aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--docs/common-patterns.rst8
-rw-r--r--docs/contracts.rst26
-rw-r--r--docs/control-structures.rst14
-rw-r--r--docs/introduction-to-smart-contracts.rst4
-rw-r--r--docs/layout-of-source-files.rst2
-rw-r--r--docs/security-considerations.rst8
-rw-r--r--docs/solidity-by-example.rst8
-rw-r--r--docs/structure-of-a-contract.rst12
-rw-r--r--docs/types.rst14
9 files changed, 96 insertions, 0 deletions
diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst
index 531a94ad..a92a604c 100644
--- a/docs/common-patterns.rst
+++ b/docs/common-patterns.rst
@@ -28,6 +28,8 @@ become the new richest.
::
+ pragma solidity ^0.4.0;
+
contract WithdrawalContract {
address public richest;
uint public mostSent;
@@ -68,6 +70,8 @@ This is as opposed to the more intuitive sending pattern.
::
+ pragma solidity ^0.4.0;
+
contract SendContract {
address public richest;
uint public mostSent;
@@ -131,6 +135,8 @@ restrictions highly readable.
::
+ pragma solidity ^0.4.0;
+
contract AccessRestriction {
// These will be assigned at the construction
// phase, where `msg.sender` is the account
@@ -270,6 +276,8 @@ function finishes.
::
+ pragma solidity ^0.4.0;
+
contract StateMachine {
enum Stages {
AcceptingBlindedBids,
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;
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 0e430b6b..a5ae079a 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -98,6 +98,8 @@ parameters from the function declaration, but can be in arbitrary order.
::
+ pragma solidity ^0.4.0;
+
contract C {
function f(uint key, uint value) { ... }
@@ -115,6 +117,8 @@ Those names will still be present on the stack, but they are inaccessible.
::
+ pragma solidity ^0.4.0;
+
contract C {
// omitted name for parameter
function func(uint k, uint) returns(uint) {
@@ -136,6 +140,8 @@ creation-dependencies are now possible.
::
+ pragma solidity ^0.4.0;
+
contract D {
uint x;
function D(uint a) {
@@ -343,6 +349,8 @@ idea is that assembly libraries will be used to enhance the language in such way
.. code::
+ pragma solidity ^0.4.0;
+
library GetCode {
function at(address _addr) returns (bytes o_code) {
assembly {
@@ -368,6 +376,8 @@ you really know what you are doing.
.. code::
+ pragma solidity ^0.4.0;
+
library VectorSum {
// This function is less efficient because the optimizer currently fails to
// remove the bounds checks in array access.
@@ -622,6 +632,8 @@ It is planned that the stack height changes can be specified in inline assembly.
.. code::
+ pragma solidity ^0.4.0;
+
contract C {
uint b;
function f(uint x) returns (uint r) {
@@ -696,6 +708,8 @@ be just ``0``, but it can also be a complex functional-style expression.
.. code::
+ pragma solidity ^0.4.0;
+
contract C {
function f(uint x) returns (uint b) {
assembly {
diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst
index 6fcd4854..de126a5a 100644
--- a/docs/introduction-to-smart-contracts.rst
+++ b/docs/introduction-to-smart-contracts.rst
@@ -16,6 +16,8 @@ Storage
::
+ pragma solidity ^0.4.0;
+
contract SimpleStorage {
uint storedData;
@@ -63,6 +65,8 @@ registering with username and password - all you need is an Ethereum keypair.
::
+ pragma solidity ^0.4.0;
+
contract Coin {
// The keyword "public" makes those variables
// readable from outside.
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst
index fdb7b5e8..17ac8c6f 100644
--- a/docs/layout-of-source-files.rst
+++ b/docs/layout-of-source-files.rst
@@ -192,6 +192,8 @@ for the two input parameters and two returned values.
::
+ pragma solidity ^0.4.0;
+
/** @title Shape calculator.*/
contract shapeCalculator{
/**@dev Calculates a rectangle's surface and perimeter.
diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst
index 7e846674..8800487c 100644
--- a/docs/security-considerations.rst
+++ b/docs/security-considerations.rst
@@ -51,6 +51,8 @@ complete contract):
::
+ pragma solidity ^0.4.0;
+
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract Fund {
/// Mapping of ether shares of the contract.
@@ -73,6 +75,8 @@ outlined further below:
::
+ pragma solidity ^0.4.0;
+
contract Fund {
/// Mapping of ether shares of the contract.
mapping(address => uint) shares;
@@ -149,6 +153,8 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
::
+ pragma solidity ^0.4.0;
+
contract TxUserWallet {
address owner;
@@ -166,6 +172,8 @@ Now someone tricks you into sending ether to the address of this attack wallet:
::
+ pragma solidity ^0.4.0;
+
contract TxAttackWallet {
address owner;
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index 8e23dafd..32a2e51f 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -36,6 +36,8 @@ of votes.
::
+ pragma solidity ^0.4.0;
+
/// @title Voting with delegation.
contract Ballot {
// This declares a new complex type which will
@@ -208,6 +210,8 @@ activate themselves.
::
+ pragma solidity ^0.4.0;
+
contract SimpleAuction {
// Parameters of the auction. Times are either
// absolute unix timestamps (seconds since 1970-01-01)
@@ -377,6 +381,8 @@ high or low invalid bids.
::
+ pragma solidity ^0.4.0;
+
contract BlindAuction {
struct Bid {
bytes32 blindedBid;
@@ -543,6 +549,8 @@ Safe Remote Purchase
::
+ pragma solidity ^0.4.0;
+
contract Purchase {
uint public value;
address public seller;
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
}
diff --git a/docs/types.rst b/docs/types.rst
index 737fbe7d..988a0ed0 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -241,6 +241,8 @@ to and from all integer types but implicit conversion is not allowed.
::
+ pragma solidity ^0.4.0;
+
contract test {
enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
ActionChoices choice;
@@ -300,6 +302,8 @@ memory-stored reference type does not create a copy.
::
+ pragma solidity ^0.4.0;
+
contract C {
uint[] x; // the data location of x is storage
@@ -378,6 +382,8 @@ the ``.length`` member.
::
+ pragma solidity ^0.4.0;
+
contract C {
function f(uint len) {
uint[] memory a = new uint[](7);
@@ -397,6 +403,8 @@ assigned to a variable right away.
::
+ pragma solidity ^0.4.0;
+
contract C {
function f() {
g([uint(1), 2, 3]);
@@ -416,6 +424,8 @@ possible:
::
+ pragma solidity ^0.4.0;
+
contract C {
function f() {
// The next line creates a type error because uint[3] memory
@@ -452,6 +462,8 @@ Members
::
+ pragma solidity ^0.4.0;
+
contract ArrayContract {
uint[2**20] m_aLotOfIntegers;
// Note that the following is not a pair of arrays but an array of pairs.
@@ -521,6 +533,8 @@ shown in the following example:
::
+ pragma solidity ^0.4.0;
+
contract CrowdFunding {
// Defines a new type with two fields.
struct Funder {
tle='2003-04-27 20:52:19 +0800'>2003-04-272-310/+364 * Updated Swedish translation.Christian Rose2003-04-272-30/+82 * Updated Norwegian translation. Added calendar/gui/dialogs/delete-error.cKjartan Maraas2003-04-263-5706/+864 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-04-262-342/+366 * Updated Swedish translation.Christian Rose2003-04-252-444/+473 * Dutch translation updated.Vincent van Adrighem2003-04-252-631/+438 * Updated Czech translationMiloslav Trmac2003-04-242-117/+120 * Updated italian traslation.Marco Ciampa2003-04-242-945/+1046 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-04-242-710/+687 * Dutch translation updated.Vincent van Adrighem2003-04-232-139/+155 * Update Czech translationMiloslav Trmac2003-04-232-96/+112 * Updated Italian translation.Marco Ciampa2003-04-232-863/+127 * Dutch translation updated.Vincent van Adrighem2003-04-232-2561/+653 * Updated Portuguese translation.Duarte Loreto2003-04-232-152/+168 * Update Czech translationMiloslav Trmac2003-04-222-85/+71 * Updated Portuguese translation.Duarte Loreto2003-04-182-459/+486 * Update Czech translationMiloslav Trmac2003-04-172-431/+422 * Removed erroneous line. Thanks to Christian Rose who reported that issue.Christian Neumair2003-04-173-2/+6 * Updated Swedish translation.Christian Rose2003-04-172-557/+556 * Updated German translation.Christian Neumair2003-04-171-62/+63 * Updated German translation and POTFILES.skip.Christian Neumair2003-04-163-259/+270 * Fixed an erroneous translation for "message".Wang Jian2003-04-152-2/+6 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-04-152-298/+267 * Updated Portuguese translation.Duarte Loreto2003-04-142-112/+70 * Update Czech translationMiloslav Trmac2003-04-122-67/+59 * Updated German translation, added missing files to POTFILES.*.Christian Neumair2003-04-124-309/+351 * The return of 1.3.2.Ettore Perazzoli2003-04-1239-7878/+7868 * Update Czech translationMiloslav Trmac2003-04-112-90/+94 * Update Czech translationMiloslav Trmac2003-04-112-61/+40 * Sync for 1.3.2.Ettore Perazzoli2003-04-1039-137209/+158253 * Update Czech translationMiloslav Trmac2003-04-102-334/+340 * Remove tools/evolution-addressbook-export.c, whichEttore Perazzoli2003-04-082-1/+5 * Update Czech translationMiloslav Trmac2003-04-082-357/+364 * add tools/killev.cDan Winship2003-04-082-0/+5 * Finnish translation updated by Sami Pesonen (sampeson@iki.fi)Sami Pesonen2003-04-072-2213/+2103 * Updated italian translation.Marco Ciampa2003-04-062-5024/+5724 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-04-032-349/+422 * Updated Ukrainian translationYuri Syrota2003-04-021-2/+2 * Updated Ukrainian translationYuri Syrota2003-04-021-5/+5 * Updated Ukrainian translationYuri Syrota2003-04-021-22/+22 * Updated Ukrainian translationYuri Syrota2003-04-021-7/+7 * Updated Ukrainian translationYuri Syrota2003-04-021-281/+281 * updated translationMarco Ciampa2003-04-022-33/+37 * Updated Ukrainian translationYuri Syrota2003-04-021-3/+3 * Updated Ukrainian translationYuri Syrota2003-04-021-276/+286 * Updated Hungarian translation.Andras Timar2003-04-012-4335/+4339 * Updated Hungarian translation.Andras Timar2003-04-011-2926/+3192 * Updated Ukrainian translationYuri Syrota2003-03-311-80/+80 * Updated Ukrainian translationYuri Syrota2003-03-311-22/+15 * Updated Ukrainian translationYuri Syrota2003-03-311-4/+4 * Updated Ukrainian translationYuri Syrota2003-03-312-3570/+3176 * Update Czech translationMiloslav Trmac2003-03-302-475/+476 * Updated Brazilian Portuguese translation done by Gustavo Maciel DiasGustavo Maciel Dias Vieira2003-03-302-4904/+4832 * Updated Swedish translation.Christian Rose2003-03-292-216/+230 * Finished updating Portuguese translation.Duarte Loreto2003-03-292-5549/+4766 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-03-292-1305/+1371 * Updated German translation.Christian Neumair2003-03-292-663/+638 * Non-final update to Portuguese translation.Duarte Loreto2003-03-272-2991/+1321 * Updated Swedish translation.Christian Rose2003-03-272-1264/+1327 * Update Czech translationMiloslav Trmac2003-03-242-302/+227 * Non-final update to Portuguese translation.Duarte Loreto2003-03-242-952/+954 * Update Czech translationMiloslav Trmac2003-03-242-59/+94 * Remove vanished files. Updated traditional Chinese translation fromAbel Cheung2003-03-234-12679/+10110 * Added missing files. Updated German translation.Christian Neumair2003-03-214-781/+917 * Update Czech translationMiloslav Trmac2003-03-212-385/+425 * Remove mail-search-dialogue.cRodney Dawes2003-03-202-1/+4 * Fix errors in Czech translationMiloslav Trmac2003-03-182-469/+459 * Initial Portuguese translation update.Duarte Loreto2003-03-182-7183/+7342 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-03-182-77/+83 * More date fixesKjartan Maraas2003-03-181-4/+1 * More date format fixesKjartan Maraas2003-03-171-2/+2 * Updated Norwegian translation.Kjartan Maraas2003-03-173-4878/+5443 * Updated to msg 1100.Marco Ciampa2003-03-152-97/+101 * Update Czech translationMiloslav Trmac2003-03-142-79/+81 * Updated Spanish translation by Francisco Javier FernandezPablo Gonzalo del Campo2003-03-142-1594/+1654 * Updated Slovak translation.Stanislav Visnovsky2003-03-142-5149/+5216 * Update Czech translationMiloslav Trmac2003-03-142-181/+181 * Updated German translation.Christian Neumair2003-03-122-3217/+3484 * Updated revision to string 600Marco Ciampa2003-03-112-20/+24 * Updated Swedish translation.Christian Rose2003-03-082-937/+969 * Update Czech translationMiloslav Trmac2003-03-072-237/+253 * Update Czech translationMiloslav Trmac2003-03-062-1220/+1236 * Dutch translation updated by Kees van den Broek.Vincent van Adrighem2003-03-042-817/+820 * Finnish translation updated by Sami Pesonen (sampeson@iki.fi)Sami Pesonen2003-03-032-6452/+5938 * s/server.in$/server.in.in/Rodney Dawes2003-03-032-1/+5 * Updated Swedish translation.Christian Rose2003-02-272-2605/+2864 * Update Czech translationMiloslav Trmac2003-02-262-796/+808 * updated Vietnamese filePablo Saratxaga2003-02-262-4639/+5133 * Updated Ukrainian translationYuri Syrota2003-02-251-18/+12 * Updated Ukrainian translationYuri Syrota2003-02-241-64/+38 * Updated Ukrainian translationYuri Syrota2003-02-241-102/+102 * Updated Ukrainian translationYuri Syrota2003-02-241-310/+295 * Updated Ukrainian translationYuri Syrota2003-02-231-285/+291 * Updated Ukrainian translationYuri Syrota2003-02-23