The remaining rewards in the Pot are incorrectly calculated for distribution among users.
After the 90-day reward claiming period ends, the admin can close the reward pool using the ContestManager::closeContest
function, which triggers the Pot::closePot
function. If not all users have claimed their rewards, 10% of the remaining tokens in the pool are transferred to the contract manager, and the rest are distributed among the users who have claimed their rewards.
The error in the contract is that the remaining rewards, after subtracting the portion allocated to the contract manager, are divided by number of all users participating in the contest, but distributed only to those who have claimed their rewards.
When not all eligible users claim their rewards during claim period, the incorrect distribution of the remaining rewards results in a smaller allocation for users who did claim their rewards. Additionally, part of the tokens remain in the contract, preventing their withdrawal.
Three users are eligible to claim rewards (300 tokens each)
Two of them claim their rewards during the 90-day period, the third user's reward is not claimed (300 tokens)
After the claim period ends, the admin closes the Pot:
the contract manager receives 10% of the remaining rewards (30 tokens)
the rest (270 tokens) is divided by number of all participating users
rewards are transfered to users who claimed their rewards during the designated period ((300 - 30) / 3 = 90 tokens each), and 90 tokens remain at the contract account
Add the following code to the TestMyCut.t.sol
file within the TestMyCut
contract.
Manual Review
Foundry
The remaining portion of the reward, unclaimed by users, should be reduced by the portion for the contest manager, and then divided by the number of users who have previously claimed their rewards. To do this, make the following changes to the Pot::closePot
function in the Pot.sol
file:
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.