MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Leftover Tokens Might Not Be Distributed Fairly

Summary

The division of remaining tokens among claimants might result in rounding issues, leaving some tokens undistributed.

Vulnerability Details

In the closePot function, after the manager takes their cut, the remaining tokens are distributed equally among claimants. Due to Solidity's integer division, small amounts of tokens can be left behind.

Impact

Some rewards will not be distributed to users, leading to potential user dissatisfaction and fairness concerns.

Tools Used

Manual review

Recommendations

Instead of relying on integer division, implement logic to distribute all tokens or handle the remaining small amount by assigning it to the last claimant.

uint256 totalClaimantCut = remainingRewards - managerCut;
for (uint256 i = 0; i < claimants.length - 1; i++) {
_transferReward(claimants[i], totalClaimantCut / claimants.length);
}
_transferReward(claimants[claimants.length - 1], totalClaimantCut - (totalClaimantCut / claimants.length) * (claimants.length - 1));
Updates

Lead Judging Commences

equious Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Dusty Pot

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.