The transferFrom
calls in RockPaperScissors::createGameWithToken
and RockPaperScissors::joinGameWithToken
interact with the external WinningToken
contract without verifying the returned boolean value. This is a violation of the ERC20 standard introduced in EIP-20, where transferFrom
should return true
on success. Ignoring this return value opens the contract to logic inconsistencies, where the function continues execution even if the token transfer fails.
ERC20 transferFrom
Returns a Boolean
Per the standard, transferFrom
returns a bool
indicating success or failure. However, both functions above fail to check this return value.
Token Transfer Can Fail Silently
If transferFrom
fails—due to insufficient allowance, paused token, or transfer restrictions—the function proceeds as if the transfer succeeded. This leads to:
Invalid game state where a user appears to have paid but hasn’t
Game logic continuing with mismatched stakes
Potential denial of service in future rounds
Violates Checks-Effects-Interactions Pattern
External calls should not be trusted blindly. Not checking the return value makes the function vulnerable to subtle failures or malicious token behavior.
Logic Inconsistency: Games can be created or joined without actual token transfer, breaking fairness.
Silent Failure: Users may believe they’ve successfully entered a game when they haven’t.
Denial of Service: Malicious tokens that always return false
can disrupt the platform’s flow.
Potential Exploit Path: If any game flow depends on token stake but doesn’t confirm its presence, the system becomes exploitable.
Slither
Manual Review
Always check the return value of transferFrom
. Either use a require
statement or import SafeERC20
from OpenZeppelin.
This ensures that if the token transfer fails for any reason, the function will revert and prevent any further incorrect state changes.
ERC20 implementation typically reverts on transfer failures
ERC20 implementation typically reverts on transfer 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.