Merge pull request #4193 from ethereum/050-version

Set version to 0.5.0-develop
This commit is contained in:
Alex Beregszaszi 2018-09-25 20:04:13 +01:00 committed by GitHub
commit 56eb9dd47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 116 additions and 113 deletions

View File

@ -8,7 +8,7 @@ include(EthPolicy)
eth_policy() eth_policy()
# project name and version should be set after cmake_policy CMP0048 # project name and version should be set after cmake_policy CMP0048
set(PROJECT_VERSION "0.4.26") set(PROJECT_VERSION "0.5.0")
project(solidity VERSION ${PROJECT_VERSION}) project(solidity VERSION ${PROJECT_VERSION})
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF) option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)

View File

@ -327,7 +327,7 @@ New version:
:: ::
pragma solidity >0.4.25; pragma solidity >0.4.99 <0.6.0;
contract OtherContract { contract OtherContract {
uint x; uint x;

View File

@ -211,7 +211,7 @@ Given the contract:
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract Foo { contract Foo {
function bar(bytes3[2] memory) public pure {} function bar(bytes3[2] memory) public pure {}
@ -468,7 +468,7 @@ For example,
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract Test { contract Test {
constructor() public { b = hex"12345678901234567890123456789012"; } constructor() public { b = hex"12345678901234567890123456789012"; }
@ -515,7 +515,7 @@ As an example, the code
:: ::
pragma solidity ^0.4.19; pragma solidity >=0.4.19 <0.6.0;
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
contract Test { contract Test {

View File

@ -67,7 +67,7 @@ idea is that assembly libraries will be used to enhance the Solidity language.
.. code:: .. code::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
library GetCode { library GetCode {
function at(address _addr) public view returns (bytes memory o_code) { function at(address _addr) public view returns (bytes memory o_code) {
@ -92,7 +92,7 @@ efficient code, for example:
.. code:: .. code::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
library VectorSum { library VectorSum {
// This function is less efficient because the optimizer currently fails to // This function is less efficient because the optimizer currently fails to
@ -381,7 +381,7 @@ Local Solidity variables are available for assignments, for example:
.. code:: .. code::
pragma solidity ^0.4.11; pragma solidity >=0.4.11 <0.6.0;
contract C { contract C {
uint b; uint b;
@ -420,7 +420,7 @@ be just ``0``, but it can also be a complex functional-style expression.
.. code:: .. code::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function f(uint x) public view returns (uint b) { function f(uint x) public view returns (uint b) {
@ -685,7 +685,7 @@ Example:
We will follow an example compilation from Solidity to assembly. We will follow an example compilation from Solidity to assembly.
We consider the runtime bytecode of the following Solidity program:: We consider the runtime bytecode of the following Solidity program::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function f(uint x) public pure returns (uint y) { function f(uint x) public pure returns (uint y) {

View File

@ -28,7 +28,7 @@ become the new richest.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract WithdrawalContract { contract WithdrawalContract {
address public richest; address public richest;
@ -65,7 +65,7 @@ This is as opposed to the more intuitive sending pattern:
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract SendContract { contract SendContract {
address payable public richest; address payable public richest;
@ -130,7 +130,7 @@ restrictions highly readable.
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract AccessRestriction { contract AccessRestriction {
// These will be assigned at the construction // These will be assigned at the construction
@ -282,7 +282,7 @@ function finishes.
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract StateMachine { contract StateMachine {
enum Stages { enum Stages {

View File

@ -42,7 +42,7 @@ This means that cyclic creation dependencies are impossible.
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract OwnedToken { contract OwnedToken {
// TokenCreator is a contract type that is defined below. // TokenCreator is a contract type that is defined below.
@ -173,7 +173,7 @@ return parameter list for functions.
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function f(uint a) private pure returns (uint b) { return a + 1; } function f(uint a) private pure returns (uint b) { return a + 1; }
@ -187,7 +187,7 @@ In the following example, ``D``, can call ``c.getData()`` to retrieve the value
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
uint private data; uint private data;
@ -231,7 +231,7 @@ when they are declared.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
uint public data = 42; uint public data = 42;
@ -251,7 +251,7 @@ it evaluates to a state variable. If it is accessed externally
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
uint public data; uint public data;
@ -270,7 +270,8 @@ to write a function, for example:
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract arrayExample { contract arrayExample {
// public state variable // public state variable
uint[] public myArray; uint[] public myArray;
@ -295,7 +296,7 @@ The next example is more complex:
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Complex { contract Complex {
struct Data { struct Data {
@ -330,7 +331,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract owned { contract owned {
constructor() public { owner = msg.sender; } constructor() public { owner = msg.sender; }
@ -456,7 +457,7 @@ value types and strings.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
uint constant x = 32**22 + 8; uint constant x = 32**22 + 8;
@ -499,7 +500,7 @@ The following statements are considered modifying the state:
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract C { contract C {
function f(uint a, uint b) public view returns (uint) { function f(uint a, uint b) public view returns (uint) {
@ -544,7 +545,7 @@ In addition to the list of state modifying statements explained above, the follo
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract C { contract C {
function f(uint a, uint b) public pure returns (uint) { function f(uint a, uint b) public pure returns (uint) {
@ -632,7 +633,7 @@ Like any function, the fallback function can execute complex operations as long
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract Test { contract Test {
// This function is called for all messages sent to // This function is called for all messages sent to
@ -683,7 +684,7 @@ The following example shows overloading of the function
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract A { contract A {
function f(uint _in) public pure returns (uint out) { function f(uint _in) public pure returns (uint out) {
@ -701,7 +702,7 @@ externally visible functions differ by their Solidity types but not by their ext
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
// This will not compile // This will not compile
contract A { contract A {
@ -734,7 +735,7 @@ candidate, resolution fails.
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract A { contract A {
function f(uint8 _in) public pure returns (uint8 out) { function f(uint8 _in) public pure returns (uint8 out) {
@ -794,7 +795,7 @@ All non-indexed arguments will be :ref:`ABI-encoded <ABI>` into the data part of
:: ::
pragma solidity ^0.4.21; pragma solidity >=0.4.21 <0.6.0;
contract ClientReceipt { contract ClientReceipt {
event Deposit( event Deposit(
@ -851,7 +852,7 @@ as topics. The event call above can be performed in the same way as
:: ::
pragma solidity ^0.4.10; pragma solidity >=0.4.10 <0.6.0;
contract C { contract C {
function f() public payable { function f() public payable {
@ -899,7 +900,7 @@ Details are given in the following example.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract owned { contract owned {
constructor() public { owner = msg.sender; } constructor() public { owner = msg.sender; }
@ -971,7 +972,7 @@ Note that above, we call ``mortal.kill()`` to "forward" the
destruction request. The way this is done is problematic, as destruction request. The way this is done is problematic, as
seen in the following example:: seen in the following example::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract owned { contract owned {
constructor() public { owner = msg.sender; } constructor() public { owner = msg.sender; }
@ -1000,7 +1001,7 @@ derived override, but this function will bypass
``Base1.kill``, basically because it does not even know about ``Base1.kill``, basically because it does not even know about
``Base1``. The way around this is to use ``super``:: ``Base1``. The way around this is to use ``super``::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract owned { contract owned {
constructor() public { owner = msg.sender; } constructor() public { owner = msg.sender; }
@ -1059,7 +1060,7 @@ equivalent to ``constructor() public {}``. For example:
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract A { contract A {
uint public a; uint public a;
@ -1089,7 +1090,7 @@ The constructors of all the base contracts will be called following the
linearization rules explained below. If the base constructors have arguments, linearization rules explained below. If the base constructors have arguments,
derived contracts need to specify all of them. This can be done in two ways:: derived contracts need to specify all of them. This can be done in two ways::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract Base { contract Base {
uint x; uint x;
@ -1148,7 +1149,7 @@ error "Linearization of inheritance graph impossible".
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract X {} contract X {}
contract A is X {} contract A is X {}
@ -1179,7 +1180,7 @@ Abstract Contracts
Contracts are marked as abstract when at least one of their functions lacks an implementation as in the following example (note that the function declaration header is terminated by ``;``):: Contracts are marked as abstract when at least one of their functions lacks an implementation as in the following example (note that the function declaration header is terminated by ``;``)::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Feline { contract Feline {
function utterance() public returns (bytes32); function utterance() public returns (bytes32);
@ -1187,7 +1188,7 @@ Contracts are marked as abstract when at least one of their functions lacks an i
Such contracts cannot be compiled (even if they contain implemented functions alongside non-implemented functions), but they can be used as base contracts:: Such contracts cannot be compiled (even if they contain implemented functions alongside non-implemented functions), but they can be used as base contracts::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Feline { contract Feline {
function utterance() public returns (bytes32); function utterance() public returns (bytes32);
@ -1238,7 +1239,7 @@ Interfaces are denoted by their own keyword:
:: ::
pragma solidity ^0.4.11; pragma solidity >=0.4.11 <0.6.0;
interface Token { interface Token {
enum TokenType { Fungible, NonFungible } enum TokenType { Fungible, NonFungible }
@ -1300,7 +1301,7 @@ more advanced example to implement a set).
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
library Set { library Set {
// We define a new struct datatype that will be used to // We define a new struct datatype that will be used to
@ -1374,7 +1375,7 @@ custom types without the overhead of external function calls:
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
library BigInt { library BigInt {
struct bigint { struct bigint {
@ -1515,7 +1516,7 @@ available without having to add further code.
Let us rewrite the set example from the Let us rewrite the set example from the
:ref:`libraries` in this way:: :ref:`libraries` in this way::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
// This is the same code as before, just without comments // This is the same code as before, just without comments
library Set { library Set {
@ -1565,7 +1566,7 @@ Let us rewrite the set example from the
It is also possible to extend elementary types in that way:: It is also possible to extend elementary types in that way::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
library Search { library Search {
function indexOf(uint[] storage self, uint value) function indexOf(uint[] storage self, uint value)

View File

@ -20,7 +20,7 @@ For example, suppose we want our contract to
accept one kind of external calls with two integers, we would write accept one kind of external calls with two integers, we would write
something like:: something like::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract Simple { contract Simple {
uint sum; uint sum;
@ -40,7 +40,7 @@ The output parameters can be declared with the same syntax after the
the sum and the product of the two given integers, then we would the sum and the product of the two given integers, then we would
write:: write::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract Simple { contract Simple {
function arithmetic(uint _a, uint _b) function arithmetic(uint _a, uint _b)
@ -99,7 +99,7 @@ Internal Function Calls
Functions of the current contract can be called directly ("internally"), also recursively, as seen in Functions of the current contract can be called directly ("internally"), also recursively, as seen in
this nonsensical example:: this nonsensical example::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function g(uint a) public pure returns (uint ret) { return a + f(); } function g(uint a) public pure returns (uint ret) { return a + f(); }
@ -129,7 +129,7 @@ all function arguments have to be copied to memory.
When calling functions of other contracts, the amount of Wei sent with the call and When calling functions of other contracts, the amount of Wei sent with the call and
the gas can be specified with special options ``.value()`` and ``.gas()``, respectively:: the gas can be specified with special options ``.value()`` and ``.gas()``, respectively::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract InfoFeed { contract InfoFeed {
function info() public payable returns (uint ret) { return 42; } function info() public payable returns (uint ret) { return 42; }
@ -176,7 +176,7 @@ parameters from the function declaration, but can be in arbitrary order.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
mapping(uint => uint) data; mapping(uint => uint) data;
@ -199,7 +199,7 @@ Those parameters will still be present on the stack, but they are inaccessible.
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
// omitted name for parameter // omitted name for parameter
@ -222,7 +222,7 @@ is compiled so recursive creation-dependencies are not possible.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract D { contract D {
uint public x; uint public x;
@ -345,7 +345,7 @@ the two variables have the same name but disjoint scopes.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract C { contract C {
function minimalScoping() pure public { function minimalScoping() pure public {
{ {
@ -366,7 +366,7 @@ In any case, you will get a warning about the outer variable being shadowed.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
// This will report a warning // This will report a warning
contract C { contract C {
function f() pure public returns (uint) { function f() pure public returns (uint) {
@ -386,7 +386,7 @@ In any case, you will get a warning about the outer variable being shadowed.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
// This will not compile // This will not compile
contract C { contract C {
function f() pure public returns (uint) { function f() pure public returns (uint) {
@ -433,7 +433,7 @@ a message string for ``require``, but not for ``assert``.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract Sharer { contract Sharer {
function sendHalf(address payable addr) public payable returns (uint balance) { function sendHalf(address payable addr) public payable returns (uint balance) {
@ -479,7 +479,7 @@ The following example shows how an error string can be used together with revert
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract VendingMachine { contract VendingMachine {
function buy(uint amount) public payable { function buy(uint amount) public payable {

View File

@ -57,7 +57,7 @@ array in the return statement. Pretty cool, huh?
Example:: Example::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function f() public pure returns (uint8[5] memory) { function f() public pure returns (uint8[5] memory) {
@ -87,7 +87,7 @@ should be noted that you must declare them as static memory arrays.
Examples:: Examples::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
struct S { struct S {
@ -127,7 +127,7 @@ which will be extended in the future. In addition, Arachnid has written `solidit
For now, if you want to modify a string (even when you only want to know its length), For now, if you want to modify a string (even when you only want to know its length),
you should always convert it to a ``bytes`` first:: you should always convert it to a ``bytes`` first::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
string s; string s;
@ -282,7 +282,7 @@ In the case of a ``contract A`` calling a new instance of ``contract B``, parent
You will need to make sure that you have both contracts aware of each other's presence and that ``contract B`` has a ``payable`` constructor. You will need to make sure that you have both contracts aware of each other's presence and that ``contract B`` has a ``payable`` constructor.
In this example:: In this example::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract B { contract B {
constructor() public payable {} constructor() public payable {}
@ -330,7 +330,7 @@ Can a contract pass an array (static size) or string or ``bytes`` (dynamic size)
Sure. Take care that if you cross the memory / storage boundary, Sure. Take care that if you cross the memory / storage boundary,
independent copies will be created:: independent copies will be created::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
uint[20] x; uint[20] x;
@ -367,7 +367,7 @@ contract level) with ``arrayname.length = <some new length>;``. If you get the
:: ::
pragma solidity ^0.4.18; pragma solidity >=0.4.18 <0.6.0;
// This will not compile // This will not compile
contract C { contract C {

View File

@ -16,7 +16,7 @@ Storage
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract SimpleStorage { contract SimpleStorage {
uint storedData; uint storedData;
@ -80,7 +80,7 @@ registering with username and password — all you need is an Ethereum keypair.
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
contract Coin { contract Coin {
// The keyword "public" makes those variables // The keyword "public" makes those variables

View File

@ -261,7 +261,7 @@ for the two input parameters and two returned values.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
/** @title Shape calculator. */ /** @title Shape calculator. */
contract ShapeCalculator { contract ShapeCalculator {

View File

@ -48,7 +48,7 @@ non-elementary type, the positions are found by adding an offset of ``keccak256(
So for the following contract snippet:: So for the following contract snippet::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
struct s { uint a; uint b; } struct s { uint a; uint b; }

View File

@ -55,7 +55,7 @@ complete contract):
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// THIS CONTRACT CONTAINS A BUG - DO NOT USE // THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract Fund { contract Fund {
@ -78,7 +78,7 @@ as it uses ``call`` which forwards all remaining gas by default:
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// THIS CONTRACT CONTAINS A BUG - DO NOT USE // THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract Fund { contract Fund {
@ -97,7 +97,7 @@ outlined further below:
:: ::
pragma solidity ^0.4.11; pragma solidity >=0.4.11 <0.6.0;
contract Fund { contract Fund {
/// Mapping of ether shares of the contract. /// Mapping of ether shares of the contract.
@ -182,7 +182,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
// THIS CONTRACT CONTAINS A BUG - DO NOT USE // THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract TxUserWallet { contract TxUserWallet {
@ -202,7 +202,7 @@ Now someone tricks you into sending ether to the address of this attack wallet:
:: ::
pragma solidity >0.4.24; pragma solidity >0.4.99 <0.6.0;
interface TxUserWallet { interface TxUserWallet {
function transferTo(address payable dest, uint amount) external; function transferTo(address payable dest, uint amount) external;

View File

@ -36,7 +36,7 @@ of votes.
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
/// @title Voting with delegation. /// @title Voting with delegation.
contract Ballot { contract Ballot {
@ -225,7 +225,7 @@ activate themselves.
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract SimpleAuction { contract SimpleAuction {
// Parameters of the auction. Times are either // Parameters of the auction. Times are either
@ -542,7 +542,7 @@ Safe Remote Purchase
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract Purchase { contract Purchase {
uint public value; uint public value;
@ -793,7 +793,7 @@ The full contract
:: ::
pragma solidity ^0.4.24; pragma solidity >=0.4.24 <0.6.0;
contract ReceiverPays { contract ReceiverPays {
address owner = msg.sender; address owner = msg.sender;
@ -988,7 +988,7 @@ The full contract
:: ::
pragma solidity ^0.4.24; pragma solidity >=0.4.24 <0.6.0;
contract SimplePaymentChannel { contract SimplePaymentChannel {
address payable public sender; // The account sending payments. address payable public sender; // The account sending payments.

View File

@ -26,7 +26,7 @@ storage.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract SimpleStorage { contract SimpleStorage {
uint storedData; // State variable uint storedData; // State variable
@ -46,7 +46,7 @@ Functions are the executable units of code within a contract.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract SimpleAuction { contract SimpleAuction {
function bid() public payable { // Function function bid() public payable { // Function
@ -68,7 +68,7 @@ Function modifiers can be used to amend the semantics of functions in a declarat
:: ::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract Purchase { contract Purchase {
address public seller; address public seller;
@ -95,7 +95,7 @@ Events are convenience interfaces with the EVM logging facilities.
:: ::
pragma solidity ^0.4.21; pragma solidity >=0.4.21 <0.6.0;
contract SimpleAuction { contract SimpleAuction {
event HighestBidIncreased(address bidder, uint amount); // Event event HighestBidIncreased(address bidder, uint amount); // Event
@ -119,7 +119,7 @@ Structs are custom defined types that can group several variables (see
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Ballot { contract Ballot {
struct Voter { // Struct struct Voter { // Struct
@ -140,7 +140,7 @@ Enums can be used to create custom types with a finite set of 'constant values'
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Purchase { contract Purchase {
enum State { Created, Locked, Inactive } // Enum enum State { Created, Locked, Inactive } // Enum

View File

@ -52,7 +52,7 @@ Surround top level declarations in solidity source with two blank lines.
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
// ... // ...
@ -70,7 +70,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
// ... // ...
@ -89,7 +89,7 @@ Blank lines may be omitted between groups of related one-liners (such as stub fu
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
function spam() public pure; function spam() public pure;
@ -109,7 +109,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
function spam() public pure { function spam() public pure {
@ -237,7 +237,7 @@ Import statements should always be placed at the top of the file.
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
import "./Owned.sol"; import "./Owned.sol";
@ -251,7 +251,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
// ... // ...
@ -283,7 +283,7 @@ Within a grouping, place the ``view`` and ``pure`` functions last.
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
constructor() public { constructor() public {
@ -315,7 +315,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract A { contract A {
@ -411,7 +411,7 @@ should:
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Coin { contract Coin {
struct Bank { struct Bank {
@ -422,7 +422,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Coin contract Coin
{ {
@ -723,7 +723,7 @@ manner as modifiers if the function declaration is long or hard to read.
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// Base contracts just to make this compile // Base contracts just to make this compile
contract B { contract B {
@ -755,7 +755,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// Base contracts just to make this compile // Base contracts just to make this compile
contract B { contract B {
@ -955,7 +955,7 @@ As shown in the example below, if the contract name is `Congress` and the librar
Yes:: Yes::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// Owned.sol // Owned.sol
contract Owned { contract Owned {
@ -984,7 +984,7 @@ Yes::
No:: No::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// owned.sol // owned.sol
contract owned { contract owned {

View File

@ -484,7 +484,7 @@ subsequent unsigned integer values starting from ``0``.
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract test { contract test {
enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
@ -583,7 +583,7 @@ Members:
Public (or external) functions also have a special member called ``selector``, Public (or external) functions also have a special member called ``selector``,
which returns the :ref:`ABI function selector <abi_function_selector>`:: which returns the :ref:`ABI function selector <abi_function_selector>`::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract Selector { contract Selector {
function f() public pure returns (bytes4) { function f() public pure returns (bytes4) {
@ -593,7 +593,7 @@ which returns the :ref:`ABI function selector <abi_function_selector>`::
Example that shows how to use internal function types:: Example that shows how to use internal function types::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
library ArrayUtils { library ArrayUtils {
// internal functions can be used in internal library functions because // internal functions can be used in internal library functions because
@ -644,7 +644,7 @@ Example that shows how to use internal function types::
Another example that uses external function types:: Another example that uses external function types::
pragma solidity ^0.4.22; pragma solidity >=0.4.22 <0.6.0;
contract Oracle { contract Oracle {
struct Request { struct Request {
@ -727,7 +727,7 @@ memory-stored reference type do not create a copy.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract C { contract C {
uint[] x; // the data location of x is storage uint[] x; // the data location of x is storage
@ -809,7 +809,7 @@ or create a new memory array and copy every element.
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function f(uint len) public pure { function f(uint len) public pure {
@ -831,7 +831,7 @@ assigned to a variable right away.
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract C { contract C {
function f() public pure { function f() public pure {
@ -852,7 +852,7 @@ possible:
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
// This will not compile. // This will not compile.
contract C { contract C {
@ -890,7 +890,7 @@ Members
:: ::
pragma solidity ^0.4.16; pragma solidity >=0.4.16 <0.6.0;
contract ArrayContract { contract ArrayContract {
uint[2**20] m_aLotOfIntegers; uint[2**20] m_aLotOfIntegers;
@ -970,7 +970,7 @@ shown in the following example:
:: ::
pragma solidity ^0.4.11; pragma solidity >=0.4.11 <0.6.0;
contract CrowdFunding { contract CrowdFunding {
// Defines a new type with two fields. // Defines a new type with two fields.
@ -1066,7 +1066,7 @@ each ``_KeyType``, recursively. For example with a mapping:
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract MappingExample { contract MappingExample {
mapping(address => uint) public balances; mapping(address => uint) public balances;
@ -1111,7 +1111,7 @@ value it referred to previously.
:: ::
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract DeleteExample { contract DeleteExample {
uint data; uint data;

View File

@ -177,6 +177,8 @@ do
then then
echo " - $dir" echo " - $dir"
cd "$dir" cd "$dir"
# Replace version pragmas
find . -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity [\^0-9\.]*/pragma solidity >=0.0/'
compileFull -w *.sol */*.sol compileFull -w *.sol */*.sol
cd .. cd ..
fi fi

View File

@ -40,7 +40,7 @@ namespace
{ {
static char const* registrarCode = R"DELIMITER( static char const* registrarCode = R"DELIMITER(
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract NameRegister { contract NameRegister {
function addr(string memory _name) public view returns (address o_owner); function addr(string memory _name) public view returns (address o_owner);

View File

@ -53,7 +53,7 @@ static char const* registrarCode = R"DELIMITER(
// @authors: // @authors:
// Gav Wood <g@ethdev.com> // Gav Wood <g@ethdev.com>
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract Registrar { contract Registrar {
event Changed(string indexed name); event Changed(string indexed name);

View File

@ -56,7 +56,7 @@ static char const* walletCode = R"DELIMITER(
// some number (specified in constructor) of the set of owners (specified in the constructor, modifiable) before the // some number (specified in constructor) of the set of owners (specified in the constructor, modifiable) before the
// interior is executed. // interior is executed.
pragma solidity ^0.4.0; pragma solidity >=0.4.0 <0.6.0;
contract multiowned { contract multiowned {

View File

@ -56,10 +56,10 @@ function test_truffle
echo "Current commit hash: `git rev-parse HEAD`" echo "Current commit hash: `git rev-parse HEAD`"
npm install npm install
find . -name soljson.js -exec cp "$SOLJSON" {} \; find . -name soljson.js -exec cp "$SOLJSON" {} \;
if [ "$name" == "Gnosis" ]; then if [ "$name" == "Zeppelin" -o "$name" == "Gnosis" ]; then
echo "Replaced fixed-version pragmas..." echo "Replaced fixed-version pragmas..."
# Replace fixed-version pragmas in Gnosis (part of Consensys best practice) # Replace fixed-version pragmas in Gnosis (part of Consensys best practice)
find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity 0/pragma solidity ^0/' find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity [\^0-9\.]*/pragma solidity >=0.0/'
fi fi
assertsol="node_modules/truffle/build/Assert.sol" assertsol="node_modules/truffle/build/Assert.sol"
if [ -f "$assertsol" ] if [ -f "$assertsol" ]