diff options
Diffstat (limited to 'docs/structure-of-a-contract.rst')
-rw-r--r-- | docs/structure-of-a-contract.rst | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/structure-of-a-contract.rst b/docs/structure-of-a-contract.rst index 79f78422..1036289a 100644 --- a/docs/structure-of-a-contract.rst +++ b/docs/structure-of-a-contract.rst @@ -20,6 +20,8 @@ State variables are values which are permanently stored in contract storage. :: + pragma solidity ^0.4.0; + contract SimpleStorage { uint storedData; // State variable // ... @@ -38,6 +40,8 @@ Functions are the executable units of code within a contract. :: + pragma solidity ^0.4.0; + contract SimpleAuction { function bid() { // Function // ... @@ -58,6 +62,8 @@ Function modifiers can be used to amend the semantics of functions in a declarat :: + pragma solidity ^0.4.0; + contract Purchase { address public seller; @@ -80,6 +86,8 @@ Events are convenience interfaces with the EVM logging facilities. :: + pragma solidity ^0.4.0; + contract SimpleAuction { event HighestBidIncreased(address bidder, uint amount); // Event @@ -102,6 +110,8 @@ Structs are custom defined types that can group several variables (see :: + pragma solidity ^0.4.0; + contract Ballot { struct Voter { // Struct uint weight; @@ -121,6 +131,8 @@ Enums can be used to create custom types with a finite set of values (see :: + pragma solidity ^0.4.0; + contract Purchase { enum State { Created, Locked, Inactive } // Enum } |