The function ThePredicter.withdrawPredictionFees
incorrectly computes the value to be transferred to the organizer if it is executed while there are Players in Pending status. This can lead to Pending players not being able to cancel their registration and consequently not being refunded. It can also lead to approved players not being able to withdraw their corresponding rewards.
If the organizer executes the function ThePredicter.withdrawPredictionFees
while there are players in Pending
status, the entrance fee of those players will be transferred to the organizer.
If those pending users want to cancel their registration, the funds will not be available to refund them, so the cancellation will revert.
If those players are approved by the organizer, the entrance fees that would be used for the player's rewards will not be there, so the ThePredicter.withdraw
function will revert before having transferred all the corresponding rewards to the players.
The following PoC based on test already present in the repository show how this issue could arise and affect the withrdraw
and cancelRegistration
functions:
Incorrect computation of transferred funds.
The cancelRegistration
and withdraw
functions will not behave as expected. Those functions will revert before being able to refund and / or reward the players.
Foundry
Keep track of the prediction fees received in a state variable. Make the function ThePredicter.withdrawPredictionFees
use the value of that variable to transfer the funds and reset it to 0.
Optionally
Implement events on user registration, approval and cancellation to have better visibility of the state of each user in the system.
withdrawPredictionFees incorrectly computes the value to be transferred to the organizer, which leads to pending players not being able to cancel their registration, approved players not being able to claim their rewards and other errors.
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.