https://github.com/Cyfrin/2024-08-MyCut/blob/main/src/Pot.sol#L54
uint256 managerCut = remainingRewards / managerCutPercent
could possibly return 0 when remainingRewards > managerCutPercent
. The reason for this is that solidity does not return values in decimals, so if remainingRewards
is say 4 and since managerCutPercent
is 10, the result of managerCut
will be zero. The implication fo this is that nothing will be transfered as intended when the pot is closed.
finalBalance
and userBalanceBeforeClosingPot
is the same from the test above to prove that the balance of the owner does not change after pot is closed.
Manual Review
There are different ways to go about this. Protocol can add a require check that makes sure that remainingRewards is greater than managerCutPercent or that remainingRewards is a multiple of managerCutPercent which would mean that it introduce a variable to the mix just for the calculation but which does not influence the reward system. There are also many other solutions to this aside the aforementioned but the protocol decision should be based on its goal.
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.