From 6ab955cfa9ac02d3f786fdfebc9c79a19af4f8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Steiger?= Date: Sun, 10 Feb 2019 01:32:39 +0100 Subject: [PATCH] Fixed commenting aesthetics in example contract --- .../safe_remote_purchase.vy | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/safe_remote_purchase/safe_remote_purchase.vy b/examples/safe_remote_purchase/safe_remote_purchase.vy index de6ab373a3..6e694294ad 100644 --- a/examples/safe_remote_purchase/safe_remote_purchase.vy +++ b/examples/safe_remote_purchase/safe_remote_purchase.vy @@ -23,31 +23,32 @@ ended: public(bool) @payable def __init__(): assert (msg.value % 2) == 0 - self.value = msg.value / 2 #The seller initializes the contract by - #posting a safety deposit of 2*value of the item up for sale. + self.value = msg.value / 2 # The seller initializes the contract by + # posting a safety deposit of 2*value of the item up for sale. self.seller = msg.sender self.unlocked = True @public def abort(): assert self.unlocked #Is the contract still refundable? - assert msg.sender == self.seller #Only the seller can refund + assert msg.sender == self.seller # Only the seller can refund # his deposit before any buyer purchases the item. - selfdestruct(self.seller) #Refunds the seller and deletes the contract. + selfdestruct(self.seller) # Refunds the seller and deletes the contract. @public @payable def purchase(): - assert self.unlocked #Is the contract still open (is the item still up for sale)? - assert msg.value == (2 * self.value) #Is the deposit the correct value? + assert self.unlocked # Is the contract still open (is the item still up + # for sale)? + assert msg.value == (2 * self.value) # Is the deposit the correct value? self.buyer = msg.sender self.unlocked = False @public def received(): # 1. Conditions - assert not self.unlocked #Is the item already purchased and pending confirmation - # from the buyer? + assert not self.unlocked # Is the item already purchased and pending + # confirmation from the buyer? assert msg.sender == self.buyer assert not self.ended @@ -55,6 +56,6 @@ def received(): self.ended = True # 3. Interaction - send(self.buyer, self.value) #Return the buyer's deposit (=value) to the buyer. - selfdestruct(self.seller) #Return the seller's deposit (=2*value) - # and the purchase price (=value) to the seller. + send(self.buyer, self.value) # Return the buyer's deposit (=value) to the buyer. + selfdestruct(self.seller) # Return the seller's deposit (=2*value) and the + # purchase price (=value) to the seller.