Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: assert descriptions in Crowdfund finalize() and participate() #3064

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/crowdfund.vy
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def __init__(_beneficiary: address, _goal: uint256, _timelimit: uint256):
@external
@payable
def participate():
assert block.timestamp < self.deadline, "deadline not met (yet)"
assert block.timestamp < self.deadline, "deadline has expired"

self.funders[msg.sender] += msg.value

# Enough money was raised! Send funds to the beneficiary
@external
def finalize():
assert block.timestamp >= self.deadline, "deadline has passed"
assert self.balance >= self.goal, "the goal has not been reached"
assert block.timestamp >= self.deadline, "deadline has not expired yet"
assert self.balance >= self.goal, "goal has not been reached"

selfdestruct(self.beneficiary)

Expand Down
Loading