TwentyOne

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

Insufficient Initial Contract Balance Prevents First Player's Rewards in endGame Function

Summary

The TwentyOne contract does not initialize with a sufficient balance to ensure that the first player can receive the reward of 2 Ether upon winning. This can lead to a scenario where the contract lacks the required Ether to fulfill the payout, causing the transaction to revert and leaving the first player without their expected winnings.

Impact

  • The contract becomes unusable for the first player due to the lack of initial funding.

  • Player trust is undermined as winnings cannot be reliably paid out.

  • The contract's functionality is dependent on external funding, which is not guaranteed.

Tools Used

Manual Review

Recommendations

Seed the Contract with Ether on Deployment:
Add an Ether requirement during contract deployment to ensure sufficient funds are available for initial payouts.

constructor() payable {
require(msg.value >= 10 ether, "Initial funding required");
}
Updates

Lead Judging Commences

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

Contract Lacks Mechanism to Initialize or Deposit Ether

Support

FAQs

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