aboutsummaryrefslogtreecommitdiffstats
path: root/docs/structure-of-a-contract.rst
diff options
context:
space:
mode:
authorDimitry <winsvega@mail.ru>2016-09-05 19:54:54 +0800
committerDimitry <winsvega@mail.ru>2016-09-05 19:54:54 +0800
commit183cd70c47e27f2cec34512757860193104f674b (patch)
tree403ba1d0099bce0377c11d334156bc670a047d40 /docs/structure-of-a-contract.rst
parent341c9436a8b6f5ae49265a482519e165a7f40395 (diff)
downloaddexon-solidity-183cd70c47e27f2cec34512757860193104f674b.tar.gz
dexon-solidity-183cd70c47e27f2cec34512757860193104f674b.tar.zst
dexon-solidity-183cd70c47e27f2cec34512757860193104f674b.zip
add "pragma solidity ^0.4.0;" to code examples
Diffstat (limited to 'docs/structure-of-a-contract.rst')
-rw-r--r--docs/structure-of-a-contract.rst12
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
}