TwentyOne

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

No Way to Fund the Contract

Summary

There is no way to fund the contract!

Vulnerability Details

The contract cannot receive ether directly because there is no receive() or fallback() function, and there is no explicit function to allow funding. The payouts depend on the contract having sufficient ether.

Impact

The likelihood of this happening is high as the contract has no payable constructor and no 'receive() or fallback() function or any other functions to fund the contract.

Payouts will fail due to insufficient funds.
Users may lose their bet if the contract runs out of ether.

These will ruin the intended functionality, so the impact is medium.

Tools Used

Remix, Foundry, AI

Recommendations

Add a receive function or an explicit function for funding the contract:

receive() external payable {}
function fundContract() external payable {
require(msg.value > 0, "No ether sent");
}

You may add a payable constructor:

// Payable constructor
constructor() payable {
}
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.