add "pragma solidity ^0.4.0;" to code examples

This commit is contained in:
Dimitry
2016-09-05 14:54:54 +03:00
parent 341c9436a8
commit 183cd70c47
9 changed files with 96 additions and 0 deletions
+26
View File
@@ -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;