The sellErc20
function in the TokenDivider
contract updates the user's balance and creates a sell order before transferring the tokens. If the token transfer fails (e.g., due to a non-standard ERC20 implementation returning false), the function does not revert, leaving the contract in an inconsistent state where the user's balance is reduced but the tokens were not actually transferred.
Loss of Tokens: Users can lose access to their tokens if the transfer fails, as their balance is reduced without the actual transfer taking place.
Permanent Inconsistency: The contract's state becomes permanently inconsistent, with balances not reflecting actual token ownership.
Potential for Exploitation: Malicious ERC20 tokens could be used to manipulate the contract's state.
Manual code review
Foundry for testing
Slither static analysis
Follow the Checks-Effects-Interactions pattern:
Use OpenZeppelin's SafeERC20 library to handle non-standard ERC20 implementations.
Add proper error handling for failed transfers.
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.