MyCut

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

ClosePot Function Does Not Distribute Remaining Rewards Correctly

Summary

In the declared functionality, we have the following requirement:
"... the manager takes a cut of the remaining pool, and the remainder is distributed equally to those who claimed in time."

However, in 'Pot::closePot', the distribution of the remaining rewards is not correct because claimantCut is calculated using i_players.length.

Vulnerability Details

In 'Pot::closePot', we have the following line:

uint256 claimantCut = (remainingRewards - managerCut) / i_players.length;

This distributes the remaining rewards among all registered players, not just among the claimants, as it should.

Impact

Since the division is done among all existing players and not just the claimants, the transferReward function will only send a portion of the rewards to the claimants. The rest of the funds will be locked in the pot contract forever since the owner has no mechanism to withdraw the remaining funds.

Tools Used

Manual analysis.

Recommendations

The claimantCut should be divided by claimants.length instead:

- uint256 claimantCut = (remainingRewards - managerCut) /i_players.length;
+ uint256 claimantCut = (remainingRewards - managerCut) / claimants.length;
Updates

Lead Judging Commences

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

Incorrect distribution in closePot()

Support

FAQs

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