TwentyOne

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

Insufficient balance to cover the prize

Summary

The smart contract may not have a sufficient balance to cover the prizes when certain conditions are met.

Vulnerability Details

  • The contract's starting balance is 0 ETH.

  • If the first user deposits 1** ETH** to play the game and wins, the contract should transfer 2 ETH to the user, which exceeds the contract's balance.

  • This issue can persist at various points during the contract's lifetime whenever the prize exceeds the available balance.

Impact

This vulnerability could prevent the user from getting their prizes, undermining the entire game's mechanics and potentially causing dissatisfaction among users.

Tools Used

  • Manual Inspection

  • Foundry

Recommendations

  1. Fund the contract with sufficient ETH to cover the initial prizes if won.

  2. If funding the contract is not viable, create a state variable that will hold the prizes by user and implement the pull logic for the user to claim their prize when there's enough ETH in the contract.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 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.