The endGame
function does not check the contract's balance before transferring the prize to the player. This could lead to a failed transaction if the contract does not have enough funds to cover the payout.
In the current implementation of the endGame
function, the contract attempts to transfer 2 ETH to the player when they win without verifying that the contract has sufficient balance. If the contract's balance is less than 2 ETH, the transaction will fail, and the player will not receive their prize.
Without a balance check, the contract may attempt to transfer more ether than it holds, resulting in failed transactions.
Manual Review.
Before attempting to transfer the prize, the contract should check if it has enough balance to fulfill the payout. If the balance is insufficient, it should revert the transaction to prevent any failed transfers.
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.