In the Pot::closePot
function, the calculation for claimantCut
uses i_players.length
instead of claimants.length
. This results in an incorrect distribution of remaining rewards. As i_players
contains more addresses than claimants, the calculated claimantCut
will be too low, leaving some tokens unreleased in the contract. The correct approach should be to divide the remaining rewards among the actual number of claimants.
The use of i_players.length
instead of claimants.length
means that the rewards are distributed based on the total number of players, not just those who have actually claimed. This leads to:
Unclaimed Tokens: remianing token will remain stuck in the contract fprever if the number of players is greater than the number of claimants.
Inequitable Distribution: Claimants receive less than they should, as the calculation does not accurately reflect the number of individuals who are eligible to claim rewards.
Proof of Concept:
Suppose i_players contains 5 addresses and claimants contains 3 addresses.
remainingRewards is 1000 tokens, and the manager cut is calculated as 100 tokens (10%).
The current implementation calculates claimantCut as (1000 - 100) / 5, which results in 180 tokens per player.
However, there are only 3 claimants, so each should receive (1000 - 100) / 3 = 300 tokens instead.
As a result, 3 claimants receive 180 tokens each (totaling 540 tokens), leaving 460 tokens stuck in the contract.
Proof of Code (PoC):
Code
place the following in the TestMyCut.t.sol::TestMyCut
Manual Review
Use claimants.length for Distribution: Replace i_players.length with claimants.length to accurately distribute rewards only among the claimants.
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.