The function airdropERC20()
in theTSender
contract, designed to airdrop ERC20 tokens to multiple recipients, uses the low-level call function for token transfers. However, this approach does not handle the case where the ERC20 token might return false instead of reverting. This can cause silent failures, potentially leading to incomplete airdrops and incorrect assumptions about the success of transfers.
The contract uses call
for token transfers but does not handle the case where the ERC20 token might return false instead of reverting. This can cause silent failures if the token transfer fails, resulting in the contract incorrectly assuming the transfer succeeded.
If the transfer fails due to reasons such as insufficient balance or issues within the token contract, the contract may proceed under the incorrect assumption that the transfer succeeded. This can lead to:
Incomplete Airdrops: Some recipients may not receive their tokens, resulting in an incomplete distribution of the intended airdrop.
Silent Failures: The contract does not detect and handle the failure, leading to incorrect state assumptions and potential discrepancies in the airdrop process.
Manual Review
To address this issue, it is recommended to implement safe transfer checks in Yul to handle token transfers safely. This ensures proper handling of token transfers by checking return values and reverting if the transfer fails.
Revised Implementation in Yul
Here is the revised implementation of the airdropERC20 function using safe transfer checks in Yul:
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.