diff options
author | chriseth <chris@ethereum.org> | 2017-11-30 23:08:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-30 23:08:09 +0800 |
commit | c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40 (patch) | |
tree | 27c068f6cd96513a9023e586c209eb9f01309171 /docs/solidity-by-example.rst | |
parent | 9cf6e910bd2b90d0c9415d9c257f85fe0c518de8 (diff) | |
parent | d0af0c14841648365ad05ecc626e672a16df5b5c (diff) | |
download | dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.gz dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.bz2 dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.lz dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.xz dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.tar.zst dexon-solidity-c4cbbb054b5ed3b8ceaa21ee5b47b0704762ff40.zip |
Merge pull request #3261 from ethereum/develop
Merge develop into release for 0.4.19
Diffstat (limited to 'docs/solidity-by-example.rst')
-rw-r--r-- | docs/solidity-by-example.rst | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst index 139c8a42..9489665e 100644 --- a/docs/solidity-by-example.rst +++ b/docs/solidity-by-example.rst @@ -221,8 +221,7 @@ activate themselves. // absolute unix timestamps (seconds since 1970-01-01) // or time periods in seconds. address public beneficiary; - uint public auctionStart; - uint public biddingTime; + uint public auctionEnd; // Current state of the auction. address public highestBidder; @@ -251,8 +250,7 @@ activate themselves. address _beneficiary ) { beneficiary = _beneficiary; - auctionStart = now; - biddingTime = _biddingTime; + auctionEnd = now + _biddingTime; } /// Bid on the auction with the value sent @@ -268,7 +266,7 @@ activate themselves. // Revert the call if the bidding // period is over. - require(now <= (auctionStart + biddingTime)); + require(now <= auctionEnd); // If the bid is not higher, send the // money back. @@ -322,7 +320,7 @@ activate themselves. // external contracts. // 1. Conditions - require(now >= (auctionStart + biddingTime)); // auction did not yet end + require(now >= auctionEnd); // auction did not yet end require(!ended); // this function has already been called // 2. Effects @@ -382,7 +380,6 @@ high or low invalid bids. } address public beneficiary; - uint public auctionStart; uint public biddingEnd; uint public revealEnd; bool public ended; @@ -410,7 +407,6 @@ high or low invalid bids. address _beneficiary ) { beneficiary = _beneficiary; - auctionStart = now; biddingEnd = now + _biddingTime; revealEnd = biddingEnd + _revealTime; } @@ -496,7 +492,7 @@ high or low invalid bids. if (amount > 0) { // It is important to set this to zero because the recipient // can call this function again as part of the receiving call - // before `send` returns (see the remark above about + // before `transfer` returns (see the remark above about // conditions -> effects -> interaction). pendingReturns[msg.sender] = 0; @@ -512,12 +508,11 @@ high or low invalid bids. require(!ended); AuctionEnded(highestBidder, highestBid); ended = true; - // We send all the money we have, because some - // of the refunds might have failed. - beneficiary.transfer(this.balance); + beneficiary.transfer(highestBid); } } + .. index:: purchase, remote purchase, escrow ******************** |