The Pot::closePot()
function is in charge to distribute the rewards to those who claimed in time.
The problem is that the cut for each claimant is calculated dividing the remaing, after the manager cut, using the amount of players in the
pot, instead of the claimants.
The documentation states the remainder is distributed equally to those who claimed in time!
. This is the claimants mapping.
There is a second small issue. The remainingRewards, its not updated in this function. This value is used in Pot::getRemainingRewards(),
which in turn is called by ContestManager::getContestRemainingRewards(). Any App using this function will get a wrong value.
claimantCut
is calculated using the total number of players
instead of claimants
.
The reward distribution is incorrect, potentially locking funds in the contract permanently, as there is no function to recover stuck tokens.
Below is a test case with two players, where only one claims. A pot holds 1000 tokens, with 500 rewards allocated to each player.
We have a pot with 1000 tokens.
One player claims 500 tokens, leaving 500 remaining in the pot (1000 - 500).
The pot is closed, and the manager claims a 10% cut of the remaining 500 tokens, which is 50 tokens.
The pot contains 450.
The claimant's cut is calculated as the remainder of the pot divided by the total players: 450 / 2 = 225.
250 tokens are given to the player who claimed on time.
250 are stuck in the contract
Output
Manual review and Foundry
Calculate claimantCut
using claimants.length
instead of i_players.length
.
Update remainingRewards
to reflect no remaining rewards.
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.