Description: When contest manager closes the pot by calling Pot::closePot, 10 percent of the remaining rewards are transferred to the contest manager and the rest are distributed equally among the claimants. It does this by dividing the rewards by the manager's cut percentage which is 10. Then the remaining rewards are divided by the number of players to distribute equally among claimants. Since solidity allows only integer division this will lead to precision loss which will cause a portion of funds to be left in the pot forever. Each pot follows the same method, so as number of pots grow, the loss of funds is very significant.
Impact: Reward tokens get stuck in the pot forever which causes loss of funds.
Proof of code:
Add the below test to test/TestMyCut.t.sol
Run the below test command in terminal
Which results in the below output
If you observe the output you can see the pot still has rewards despite distributing them to claimants.
Recommended Mitigations:
Fixed-Point Arithmetic: Utilize a fixed-point arithmetic library or implement a custom solution to handle fee calculations with greater precision.
Tools used: Solidity, VSCode
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.