Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

Deposit Rejected if Deadline Not Set

Summary

The deposit() function reverts with BeyondDeadline if no deadline is set, blocking legitimate deposits.

Vulnerability Details

If the owner forgets to set the deadline, users cannot deposit, making the contract unusable until the issue is resolved.

function test_DeadlineRevertBeforeSet() public {
// Deploy new contract without setting deadline
vm.startPrank(deployer);
cd = new ChristmasDinner(address(wbtc), address(weth), address(usdc));
vm.stopPrank();
// Try to deposit before deadline is set
vm.startPrank(user1);
wbtc.approve(address(cd), 1 ether);
vm.expectRevert(ChristmasDinner.BeyondDeadline.selector);
cd.deposit(address(wbtc), 0.1 ether);
vm.stopPrank();
}

Impact

-Users cannot participate in the event until the owner sets a deadline.
-Potential trust issues and user frustration.

Tools Used

Foundry for testing.

Recommendations

-Initialize a default deadline during contract deployment.
-Require the owner to set a deadline as part of the deployment process.
-Add a clear error message if users attempt to deposit before the deadline is set.

Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!