Skip to content

Commit

Permalink
feat: add check for zero goal and deadline
Browse files Browse the repository at this point in the history
  • Loading branch information
khayss committed Aug 24, 2024
1 parent dab9633 commit 8d6fb6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Crowdfund.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ contract Crowdfund {
error Crowdfund_CampaignNotEnded(uint256 deadline);
error Crowdfund_NoFundsRaised();
error Crowdfund_PayoutFailed();
error Crowdfund_GoalCannotBeZero();
error Crowdfund_DeadlineTooShort();

// Modifiers

Expand All @@ -52,6 +54,8 @@ contract Crowdfund {
public
returns (uint256 campaignId)
{
if (_goal == 0) revert Crowdfund_GoalCannotBeZero();
if (_deadline == 0) revert Crowdfund_DeadlineTooShort();
Campaign memory newCampaign = Campaign({
isInitialized: true,
isPaidOut: false,
Expand Down

0 comments on commit 8d6fb6c

Please sign in to comment.