Small amount of funds can remain stuck in the ThePredicter
contract due to precision loss.
The method ThePredicter::withdraw
is responsible for players to withdraw their prize pool. It contains the following calculation (shares * players.length * entranceFee) / totalShares
but since Solidity does not support floating point numbers it could lead to precision loss. If there was no precision loss calling the method ThePredicter::withdrawPredictionFees
by the organizer and ThePredicter::withdraw
by all players eligable for rewards, it would leave the contract with 0 balance. However, small amounds of funds can remain as shown in the proof of code due to the precision loss.
Small amount of funds remain stucked in the contract.
Manual Review, Foundry
Add the following test case ThePredicter.test.sol
:
Execute the following command: forge test --mt test_remainingFundsAreStuckedInContract -vvvvvvv
Verify from the logs that there is small amount of funds remaining: Remaining funds: 4
Implement method which allows for the organizer to withdraw the remaining funds.
Small amount of funds can remain stuck in contract due to a precision loss.
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.