Skip to content

Commit

Permalink
Safety check that deposit amounts are positive
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Bellamy committed Jan 9, 2023
1 parent 47c382a commit 6a1a766
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions contracts/crowdfund/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl Crowdfund {
}

pub fn deposit(e: Env, user: Identifier, amount: i128) {
assert!(amount > 0, "amount must be positive");
assert!(get_state(&e) == State::Running, "sale is not running");

let recipient = get_recipient(&e);
Expand Down

0 comments on commit 6a1a766

Please sign in to comment.