If any player fails to claim their reward within 90 days after the contest is created, the user will close the contest using the ContestManager::closeContest
function. During this process, the unclaimed reward will be distributed such that 10% goes to the user, and the rest is evenly split among the players who have claimed their reward. The issue is that, instead of dividing the remaining amount by the number of claimants, the current implementation divides it by the total number of players. This results in claimants receiving less than they should, with the excess funds being unjustly withheld and locked in the contract.
The vulnerability is located in the Pot::closePot
function, which is called from the ContestManager::_closeContest
function, which is in turn called by the ContestManager::closeContest
function.
In the Pot::closePot
function, the claimantCut
is calculated by dividing the remaining rewards (after the manager's cut) by the total number of players (i_players.length
), instead of dividing it by the number of claimants (claimants.length
).
Place the following test in the test/TestMyCut.s.sol
file:
When closing the contest, the claimants will receive less than they deserve, and the portion that is taken from them will be locked in the contract.
Manual Code Review, Foundry Test
Instead of dividing by i_players.length
in the Pot::closePot
function, it should be divided by claimants.length
.
By making this change, the claimants will receive the correct proportion of the remaining rewards when the contest is closed.
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.