TwentyOne

First Flight #29
Beginner FriendlyGameFiFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Lack of Balance Checks Before Payouts

Summary

The contract do not check the balance and if the contract does not have enough ether, prize transfer to the winner will be reverted

Vulnerability Details

The contract blindly transfers 2 ether to the player on a win without checking its balance.

if (playerWon) {
payable(player).transfer(2 ether); // Transfer the prize to the player
emit FeeWithdrawn(player, 2 ether); // Emit the prize withdrawal event
}

Impact: Medium

  • Players cannot claim winnings if the contract lacks sufficient balance.

  • Users lose their bets, leading to irreversible fund loss.

Liklihood: High

The likelihood of this happening is the same as the likelihood of someone to win.

Tools Used

Remix, Code Review , AI tools, Foundry

Recommendations

Check the balance before transferring funds.

if (address(this).balance >= 2 ether) {
payable(player).transfer(2 ether);
} else {
revert("Insufficient contract balance for payout");
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Insufficient balance for payouts / Lack of Contract Balance Check Before Starting Game

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.