aboutsummaryrefslogtreecommitdiffstats
path: root/docs/contracts.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/contracts.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/contracts.rst')
-rw-r--r--docs/contracts.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index a22a3544..8eb12688 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;