If a player refunds , then the contract will revert when the selectWinner
function is called.
Suppose there are 4 players in the raffle and the entry fee is 1ETH. So now the contract will have 4ETh as balance. Now if player0 decides to refund the contract will give 1ETH to player0 and thus the contract balance is now 3ETH.And as the players.length
is 4 still now the selectWinner
function can be called.
So as per the contract the totalAmountCollected
will now be 4ETh but the balance of the SC is 3ETH. Therefore while transferring 80% of 4ETH i.e 3.2ETH the function will revert.
The selectWinner
function will revert.
NOTE : I have created a playerLen() view function in the contract to get the players array length.
VS code
Use a counter variable to calculate the length of the players.
Funds are locked to no one. If someone gets the refund issue, they also got this issue. IMPACT: High Likelihood: High
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.