diff options
author | chriseth <chris@ethereum.org> | 2016-09-06 21:59:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-06 21:59:49 +0800 |
commit | 453490cb61002622fadddf5838d29a8483f364ae (patch) | |
tree | 2d5ff5cddbf8fd73afe75a516998b9890b6cf86e /docs/contracts.rst | |
parent | 462fc84e530a6e740dfc8bb92bbd5ba82862cbb2 (diff) | |
parent | 183cd70c47e27f2cec34512757860193104f674b (diff) | |
download | dexon-solidity-453490cb61002622fadddf5838d29a8483f364ae.tar.gz dexon-solidity-453490cb61002622fadddf5838d29a8483f364ae.tar.zst dexon-solidity-453490cb61002622fadddf5838d29a8483f364ae.zip |
Merge pull request #1003 from winsvega/docs
add "pragma solidity ^0.4.0;" to code examples
Diffstat (limited to 'docs/contracts.rst')
-rw-r--r-- | docs/contracts.rst | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index dfa79e79..4fe046ed 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -65,6 +65,8 @@ This means that cyclic creation dependencies are impossible. :: + pragma solidity ^0.4.0; + contract OwnedToken { // TokenCreator is a contract type that is defined below. // It is fine to reference it as long as it is not used @@ -189,6 +191,8 @@ return parameter list for functions. :: + pragma solidity ^0.4.0; + contract C { function f(uint a) private returns (uint b) { return a + 1; } function setData(uint a) internal { data = a; } @@ -201,6 +205,8 @@ In the following example, ``D``, can call ``c.getData()`` to retrieve the value :: + pragma solidity ^0.4.0; + contract C { uint private data; @@ -243,6 +249,8 @@ be done at declaration. :: + pragma solidity ^0.4.0; + contract C { uint public data = 42; } @@ -262,6 +270,8 @@ it is evaluated as a state variable and if it is accessed externally :: + pragma solidity ^0.4.0; + contract C { uint public data; function x() { @@ -274,6 +284,8 @@ The next example is a bit more complex: :: + pragma solidity ^0.4.0; + contract Complex { struct Data { uint a; @@ -307,6 +319,8 @@ inheritable properties of contracts and may be overridden by derived contracts. :: + pragma solidity ^0.4.0; + contract owned { function owned() { owner = msg.sender; } address owner; @@ -408,6 +422,8 @@ for array and struct types and not possible for mapping types). :: + pragma solidity ^0.4.0; + contract C { uint constant x = 32**22 + 8; string constant text = "abc"; @@ -455,6 +471,8 @@ Please ensure you test your fallback function thoroughly to ensure the execution :: + pragma solidity ^0.4.0; + contract Test { function() { x = 1; } uint x; @@ -523,6 +541,8 @@ All non-indexed arguments will be stored in the data part of the log. :: + pragma solidity ^0.4.0; + contract ClientReceipt { event Deposit( address indexed _from, @@ -791,6 +811,8 @@ error "Linearization of inheritance graph impossible". :: + pragma solidity ^0.4.0; + contract X {} contract A is X {} contract C is A, X {} @@ -861,6 +883,8 @@ more advanced example to implement a set). :: + pragma solidity ^0.4.0; + library Set { // We define a new struct datatype that will be used to // hold its data in the calling contract. @@ -931,6 +955,8 @@ custom types without the overhead of external function calls: :: + pragma solidity ^0.4.0; + library BigInt { struct bigint { uint[] limbs; |