The Treasury.sol contract documentation states that it supports multi-token deposits. Given this claim, the contract is expected to work seamlessly with various ERC-20 tokens, including stablecoins like USDC and USDT. However, the contract uses transferFrom instead of safeTransferFrom in the deposit() function, which can lead to failed transfers and funds getting stuck.
transferFrom May Not Work Reliably for Certain TokensThe contract uses IERC20(token).transferFrom(msg.sender, address(this), amount); to transfer tokens. This is problematic for tokens that do not fully comply with the ERC-20 standard, such as USDT (Tether), which does not return a boolean value upon transfer.
Silent Transaction Failures: Some tokens, like USDT, do not return true/false on transferFrom(), and the transaction might succeed without proper validation, leading to unexpected behavior.
Funds Getting Stuck: If the transfer fails and the function does not revert, the _balances mapping may be updated incorrectly, creating a discrepancy between the stored balance and actual token holdings.
Inconsistent Multi-Token Support: While the contract documentation claims to support multiple tokens, its implementation does not account for variations in token behavior, potentially breaking compatibility with major stablecoins.
Potential Loss of Funds: Users may believe their deposit succeeded while the actual token transfer failed.
Incompatibility with Stablecoins: Popular stablecoins like USDT may not function properly, limiting the usability of the treasury.
Risk of Incorrect Balance Accounting: The contract might reflect a deposit that never actually occurred, leading to misreported treasury holdings.
Manual Code Review
Use safeTransferFrom from OpenZeppelin’s SafeERC20 Library
LightChaser Low-60
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.