From 29b2c34f33d92ca4c50c950aefb92956a173efb8 Mon Sep 17 00:00:00 2001 From: nfwsncked Date: Thu, 11 Aug 2022 19:15:26 +0200 Subject: [PATCH 1/2] improvement: assert descriptions in Crowdfund.finalize() and Crowdfund.participate() --- examples/crowdfund.vy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/crowdfund.vy b/examples/crowdfund.vy index 3891ad0b74..ff928892cf 100644 --- a/examples/crowdfund.vy +++ b/examples/crowdfund.vy @@ -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 is already overdue" 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 is already overdue" + assert self.balance >= self.goal, "goal has not been reached" selfdestruct(self.beneficiary) From d6854b3ebe2aacb6ceb7e7f4b3b6a7082180bc8e Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Tue, 7 Nov 2023 14:50:09 -0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com> --- examples/crowdfund.vy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/crowdfund.vy b/examples/crowdfund.vy index ff928892cf..56b34308f1 100644 --- a/examples/crowdfund.vy +++ b/examples/crowdfund.vy @@ -18,14 +18,14 @@ def __init__(_beneficiary: address, _goal: uint256, _timelimit: uint256): @external @payable def participate(): - assert block.timestamp < self.deadline, "deadline is already overdue" + 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 is already overdue" + assert block.timestamp >= self.deadline, "deadline has not expired yet" assert self.balance >= self.goal, "goal has not been reached" selfdestruct(self.beneficiary)