diff options
author | chriseth <chris@ethereum.org> | 2018-02-17 00:32:30 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-22 22:17:42 +0800 |
commit | f58024b9744f557dbc77d5f7bfbc4319bde2e0c7 (patch) | |
tree | abde5538e7cedcf41cafb9fe0681ad505380c496 /docs/solidity-by-example.rst | |
parent | 04c922e5ed038fd5f6d43a364e11b8c459898a93 (diff) | |
download | dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.tar dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.tar.gz dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.tar.bz2 dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.tar.lz dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.tar.xz dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.tar.zst dexon-solidity-f58024b9744f557dbc77d5f7bfbc4319bde2e0c7.zip |
Documentation about emitting events.
Diffstat (limited to 'docs/solidity-by-example.rst')
-rw-r--r-- | docs/solidity-by-example.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst index b8e158ac..e5b44c98 100644 --- a/docs/solidity-by-example.rst +++ b/docs/solidity-by-example.rst @@ -214,7 +214,7 @@ activate themselves. :: - pragma solidity ^0.4.11; + pragma solidity ^0.4.20; // should actually be 0.4.21 contract SimpleAuction { // Parameters of the auction. Times are either @@ -282,7 +282,7 @@ activate themselves. } highestBidder = msg.sender; highestBid = msg.value; - HighestBidIncreased(msg.sender, msg.value); + emit HighestBidIncreased(msg.sender, msg.value); } /// Withdraw a bid that was overbid. @@ -325,7 +325,7 @@ activate themselves. // 2. Effects ended = true; - AuctionEnded(highestBidder, highestBid); + emit AuctionEnded(highestBidder, highestBid); // 3. Interaction beneficiary.transfer(highestBid); @@ -371,7 +371,7 @@ high or low invalid bids. :: - pragma solidity ^0.4.11; + pragma solidity ^0.4.20; // should actually be 0.4.21 contract BlindAuction { struct Bid { @@ -509,7 +509,7 @@ high or low invalid bids. onlyAfter(revealEnd) { require(!ended); - AuctionEnded(highestBidder, highestBid); + emit AuctionEnded(highestBidder, highestBid); ended = true; beneficiary.transfer(highestBid); } @@ -524,7 +524,7 @@ Safe Remote Purchase :: - pragma solidity ^0.4.11; + pragma solidity ^0.4.20; // should actually be 0.4.21 contract Purchase { uint public value; @@ -574,7 +574,7 @@ Safe Remote Purchase onlySeller inState(State.Created) { - Aborted(); + emit Aborted(); state = State.Inactive; seller.transfer(this.balance); } @@ -589,7 +589,7 @@ Safe Remote Purchase condition(msg.value == (2 * value)) payable { - PurchaseConfirmed(); + emit PurchaseConfirmed(); buyer = msg.sender; state = State.Locked; } @@ -601,7 +601,7 @@ Safe Remote Purchase onlyBuyer inState(State.Locked) { - ItemReceived(); + emit ItemReceived(); // It is important to change the state first because // otherwise, the contracts called using `send` below // can call in again here. |