The closePot
function incorrectly calculates and distributes the remaining rewards when the pot is closed. Specifically, the calculation of claimantCut
is performed by dividing the remaining rewards (after deducting the manager's cut) by the total number of players (i_players.length
) instead of the number of actual claimants. This results in an incorrect and insufficient distribution of rewards to claimants.
This flaw can cause under-distribution of rewards, leaving some tokens trapped within the contract. Since these remaining tokens are not accounted for or redistributed, they become inaccessible, potentially causing a loss of funds for the intended recipients (claimants). Furthermore, the manager's cut and the claimants' rewards are both incorrectly calculated, reducing the expected rewards for the claimants.
Deploy the contract with a set of players and their corresponding rewards.
Simulate a scenario where only a subset of players claims their rewards.
Call the closePot
function after 90 days.
Observe that the claimants receive a lower amount than expected because the remaining rewards are divided by the total number of players instead of the actual number of claimants.
Check the contract balance afterward to confirm that leftover tokens remain trapped within the contract.
Update the closePot
function to calculate claimantCut
based on the number of actual claimants instead of the total number of players. Additionally, ensure that any remainder from integer division is distributed appropriately, either by allocating it to the manager or the final claimant to prevent tokens from being trapped in the contract.
This solution ensures that the rewards are correctly distributed among the claimants, with no leftover tokens remaining in the contract.
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.