aboutsummaryrefslogtreecommitdiffstats
path: root/docs/structure-of-a-contract.rst
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-19 03:59:24 +0800
committerchriseth <c@ethdev.com>2016-05-19 03:59:24 +0800
commitec061b09a3a0093bada684d6109579b20d6775c5 (patch)
treeb96cd0d8e3dc265faa8bbfd5686a050ab0d2dacd /docs/structure-of-a-contract.rst
parent0a37072e4c0b6413aa7aa37863230f3a0d26b2a9 (diff)
parentd1529235488685846a92ba82f78c37c31ad1463d (diff)
downloaddexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.tar
dexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.tar.gz
dexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.tar.bz2
dexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.tar.lz
dexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.tar.xz
dexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.tar.zst
dexon-solidity-ec061b09a3a0093bada684d6109579b20d6775c5.zip
Merge pull request #580 from Denton-L/docs-whitespace
Corrections to Documentation Spacing
Diffstat (limited to 'docs/structure-of-a-contract.rst')
-rw-r--r--docs/structure-of-a-contract.rst70
1 files changed, 35 insertions, 35 deletions
diff --git a/docs/structure-of-a-contract.rst b/docs/structure-of-a-contract.rst
index 0968ffc8..79f78422 100644
--- a/docs/structure-of-a-contract.rst
+++ b/docs/structure-of-a-contract.rst
@@ -21,12 +21,12 @@ State variables are values which are permanently stored in contract storage.
::
contract SimpleStorage {
- uint storedData; // State variable
- // ...
+ uint storedData; // State variable
+ // ...
}
See the :ref:`types` section for valid state variable types and
-:ref:`visibility-and-accessors` for possible choices for
+:ref:`visibility-and-accessors` for possible choices for
visibility.
.. _structure-functions:
@@ -39,14 +39,14 @@ Functions are the executable units of code within a contract.
::
contract SimpleAuction {
- function bid() { // Function
- // ...
- }
+ function bid() { // Function
+ // ...
+ }
}
:ref:`function-calls` can happen internally or externally
and have different levels of visibility (:ref:`visibility-and-accessors`)
-towards other contracts.
+towards other contracts.
.. _structure-function-modifiers:
@@ -57,18 +57,18 @@ Function modifiers can be used to amend the semantics of functions in a declarat
(see :ref:`modifiers` in contracts section).
::
-
+
contract Purchase {
- address public seller;
-
- modifier onlySeller() { // Modifier
- if (msg.sender != seller) throw;
- _
- }
-
- function abort() onlySeller { // Modifier usage
- // ...
- }
+ address public seller;
+
+ modifier onlySeller() { // Modifier
+ if (msg.sender != seller) throw;
+ _
+ }
+
+ function abort() onlySeller { // Modifier usage
+ // ...
+ }
}
.. _structure-events:
@@ -81,15 +81,15 @@ Events are convenience interfaces with the EVM logging facilities.
::
contract SimpleAuction {
- event HighestBidIncreased(address bidder, uint amount); // Event
-
- function bid() {
- // ...
- HighestBidIncreased(msg.sender, msg.value); // Triggering event
- }
+ event HighestBidIncreased(address bidder, uint amount); // Event
+
+ function bid() {
+ // ...
+ HighestBidIncreased(msg.sender, msg.value); // Triggering event
+ }
}
-See :ref:`events` in contracts section for information on how events are declared
+See :ref:`events` in contracts section for information on how events are declared
and can be used from within a dapp.
.. _structure-structs-types:
@@ -97,18 +97,18 @@ and can be used from within a dapp.
Structs Types
=============
-Structs are custom defined types that can group several variables (see
+Structs are custom defined types that can group several variables (see
:ref:`structs` in types section).
::
contract Ballot {
- struct Voter { // Struct
- uint weight;
- bool voted;
- address delegate;
- uint vote;
- }
+ struct Voter { // Struct
+ uint weight;
+ bool voted;
+ address delegate;
+ uint vote;
+ }
}
.. _structure-enum-types:
@@ -116,11 +116,11 @@ Structs are custom defined types that can group several variables (see
Enum Types
==========
-Enums can be used to create custom types with a finite set of values (see
+Enums can be used to create custom types with a finite set of values (see
:ref:`enums` in types section).
::
-
+
contract Purchase {
- enum State { Created, Locked, Inactive } // Enum
+ enum State { Created, Locked, Inactive } // Enum
}