The Treasury contract fails to properly handle tokens with transfer deductions (both fee-on-transfer and tax-on-transfer tokens), leading to accounting discrepancies between recorded balances and actual token holdings.
The Treasury contract's deposit and withdrawal functions assume that the amount of tokens specified in the transfer is equal to the amount actually received. However, for fee-on-transfer tokens, the received amount is less than the transferred amount due to fees being deducted during transfer.
The issue occurs in these functions:
When a fee-on-transfer token is deposited:
User deposits 1000 tokens
Contract receives 950 tokens (assuming 5% fee)
Contract incorrectly records 1000 tokens in _balances
Creates a 50 token discrepancy between recorded and actual balance
Balance Inflation: The contract records higher balances than actually held
Fund Locking: Withdrawals may fail when attempting to withdraw recorded balance amount that exceeds actual holdings
Incorrect Total Value: _totalValue
becomes inflated as it records pre-fee amounts
Compounding Issues: The discrepancy grows with each deposit transaction
The severity is HIGH because:
Direct loss of funds through locked tokens
Core accounting functionality is compromised
Affects protocol's financial accuracy
Requires protocol changes to fix
Manual Review
Implement balance tracking to record actual received amounts:
This ensures:
Accurate balance tracking based on actual received amounts
Proper handling of fee-on-transfer tokens
Correct total value calculations
Prevention of withdrawal failures
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.