The Treasury::deposit
function uses IERC20(token).transferFrom(...)
to transfer tokens from the user to the contract. However, this method does not handle transfer failures safely for non-standard ERC-20 tokens that do not return a boolean value. Using safeTransferFrom
from OpenZeppelin’s SafeERC20
library would mitigate this risk.
The issue arises because some ERC-20 tokens (e.g., USDT) do not return a boolean value, which can cause silent failures or unexpected behavior. If the token transfer fails and the return value is not checked, the function may proceed without actually transferring the tokens.
Deposits might not be completed as expected, leading to incorrect balances.
Manual code review
Replace the direct transferFrom
call with OpenZeppelin’s SafeERC20.safeTransferFrom
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.