diff options
author | Matt Wisniewski <contact.mattdylan@gmail.com> | 2017-04-20 02:12:45 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-05-03 18:03:02 +0800 |
commit | 2b4b86aa7f72d8f7c2c4e250953d8f9018f4fd53 (patch) | |
tree | 34b54c98a4e9f359479bbc5b73945b3c74884c98 /docs/types.rst | |
parent | 00933b99cc64a5af1e00ed4b119fc725ddbb3513 (diff) | |
download | dexon-solidity-2b4b86aa7f72d8f7c2c4e250953d8f9018f4fd53.tar.gz dexon-solidity-2b4b86aa7f72d8f7c2c4e250953d8f9018f4fd53.tar.zst dexon-solidity-2b4b86aa7f72d8f7c2c4e250953d8f9018f4fd53.zip |
Update common-patterns.rst
Diffstat (limited to 'docs/types.rst')
-rw-r--r-- | docs/types.rst | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/types.rst b/docs/types.rst index c868adc6..c400aecb 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -420,7 +420,7 @@ Example that shows how to use internal function types:: Another example that uses external function types:: - pragma solidity ^0.4.5; + pragma solidity ^0.4.11; contract Oracle { struct Request { @@ -445,7 +445,7 @@ Another example that uses external function types:: oracle.query("USD", this.oracleResponse); } function oracleResponse(bytes response) { - if (msg.sender != address(oracle)) throw; + require(msg.sender == address(oracle)); // Use the data } } @@ -722,7 +722,7 @@ shown in the following example: :: - pragma solidity ^0.4.0; + pragma solidity ^0.4.11; contract CrowdFunding { // Defines a new type with two fields. @@ -763,8 +763,7 @@ shown in the following example: return false; uint amount = c.amount; c.amount = 0; - if (!c.beneficiary.send(amount)) - throw; + c.beneficiary.transfer(amount); return true; } } |