The Pot contract allows authorized claimants 90 days to claim before the manager takes a cut of the remaining pool and the remainder is distributed equally to those who claimed in time. However, due to incorrect implementation of the Pot::closePot function, funds could remain locked in the contract whenever the contest is closed and there is at least one player who didn't claim. Additionally, the distribution of remaining funds is unfair to those who did claim.
The root cause of the problem is the line marked bellow:
According to the documentation, the remaining rewards (if any) should be distributed as follows:
10% to the manager
Remainder equally among claimants
However, this implementation is dividing claimantCut by i_players.length instead of claimants.length. This leads to an unfair distribution where:
If some players don't claim, their share is effectively lost.
The total amount distributed to claimants is less than it should be.
Funds may remain locked in the contract.
Proof of Concept:
Place the following test in test/TestMyCut.t.sol:
Due to incorrect implementation of this function:
Funds will remain locked in the Pot contract in any scenario where there is at least one player that didn't claim. (There is no ability to withdraw the locked funds.)
Claimants receive less than their fair share of the remaining funds.
Manual code review / Foundry tests
Consider the scenario when there are 0 claimants, and divide with claimants.length instead of i_players.length:
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.