MyCut

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

Logic Flaw

Summary

incorrect logic of closing the pot, there still will be tokens left , it must be (remainingRewards - managerCut) / claimants.length

Vulnerability Details

in Pot.sol , line 57

function closePot() external onlyOwner {
if (block.timestamp - i_deployedAt < 90 days) {
revert Pot__StillOpenForClaim();
}
if (remainingRewards > 0) {
uint256 managerCut = remainingRewards / managerCutPercent;
i_token.transfer(msg.sender, managerCut);
// @audit incorrect logic of closing the pot, there still will be tokens left , it must be (remainingRewards - managerCut) / claimants.length
uint256 claimantCut = (remainingRewards - managerCut) / i_players.length;
for (uint256 i = 0; i < claimants.length; i++) {
_transferReward(claimants[i], claimantCut);
}
}
}

Impact

not all tokens in pot will be distributed

Tools Used

eyes

Recommendations

do

(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.