The ERC20 token function ERC20::transfer
returns a boolean value (true if the transfer was successful). However, the idea of this return values is to revert if the transaction fails. In this protocol the return values are ignored. This problem is anywhere in the protocol where transfer
is used. This includes Pot::_transferReward
and the ERC20::transferFrom
call in ContestManager.sol
. This can lead to loss of funds for the user. The ERC20 implementation only reverts on 0-addresses.
transfer()
will return true
if the transfer was successful and false
if the transfer failed.
A user calls for example Pot::claimCut
.
The reward of this user is > 0 → The function will be executed.
The states of playersToRewards[player]
, remainingRewards
and claimants[]
are set
_transferReward
is called, transfer
fails and returns false
which is not checked
The user has no longer access to his rewards by calling claimCut
again.
Those rewards will be stuck in the contest due to the updated storage variable remainingRewards
.
If a transaction fails somehow, the states are already set. This can lead to loss of funds or unexpected behavior. Since the states are already set, calling this function again cannot undo this problem.
Manual Review
Checking the return values of transfer
. Here is an example:
Another popular way to accomplish checked transfer values is by using the SafeERC20 library.
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.