The Treasury contract allows for the management of multiple ERC20 tokens. However, the current implementation does not adequately differentiate between tokens during allocation and withdrawal processes. This can lead to significant risks, including mismanagement of funds and confusion regarding which tokens are allocated to which recipients.
Lack of Token-Specific Tracking:
The contract does not maintain separate records for allocations based on the token type. This means that allocators can allocate funds without regard to the specific token being used, leading to potential confusion and mismanagement.
Withdrawals Not Token-Specific:
Managers can withdraw any token from the treasury without considering the allocations made for that specific token. This can result in situations where funds are withdrawn that were promised to recipients in a different token.
Potential for Financial Mismanagement:
If multiple tokens are managed without clear tracking, it can lead to scenarios where the treasury may not have enough of a specific token to fulfill its obligations, even if the total balance across all tokens appears sufficient.
Initial Setup:
The treasury holds 1,000 DAI (a stablecoin) and 1,000 USDC (another stablecoin).
Allocator A allocates 500 DAI to Recipient 1.
Allocator B allocates 500 USDC to Recipient 2.
Withdrawals Made:
The manager decides to withdraw 1,000 USDC from the treasury.
Problem Arises:
The treasury has enough total funds (1,000 DAI + 1,000 USDC), but the withdrawal of 1,000 USDC does not consider the allocations made for DAI.
If the treasury had promised 500 DAI to Recipient 1, the withdrawal could lead to a situation where the treasury cannot fulfill its obligations to Recipient 1.
Unmet Obligations: Recipients may not receive the funds they were promised, leading to frustration and loss of trust in the protocol.
Financial Instability: The treasury may face financial instability if it cannot meet its obligations, potentially leading to legal issues or the need for emergency measures.
Reputation Damage: The protocol's reputation may suffer if users perceive it as unreliable or poorly managed.
forge test --match-test testMultipleTokenDepositsAndWithdrawal -vv
Implement Token-Specific Tracking:
Maintain separate records for allocations based on the token type to ensure clarity and prevent mismanagement.
Token-Specific Withdrawals:
Modify the withdrawal function to ensure that withdrawals are only allowed for tokens that have been allocated and that the total amount withdrawn does not exceed the available balance for that specific token.
Enhanced Documentation:
Clearly document the handling of multiple tokens in the contract to prevent misunderstandings among users and developers.Multiple Token Management Lets Withdraw a Token Different than Deposited Token
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.