mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[DOCS] Change >=0.7.0 to ^0.7.0
This commit is contained in:
parent
9115100f2a
commit
8339765509
@ -537,7 +537,7 @@ For example,
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
|
||||||
contract Test {
|
contract Test {
|
||||||
|
@ -140,7 +140,7 @@ Local Solidity variables are available for assignments, for example:
|
|||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract C {
|
contract C {
|
||||||
uint b;
|
uint b;
|
||||||
|
@ -28,7 +28,7 @@ you receive the funds of the person who is now the richest.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract WithdrawalContract {
|
contract WithdrawalContract {
|
||||||
address public richest;
|
address public richest;
|
||||||
@ -62,7 +62,7 @@ This is as opposed to the more intuitive sending pattern:
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract SendContract {
|
contract SendContract {
|
||||||
address payable public richest;
|
address payable public richest;
|
||||||
|
@ -26,7 +26,7 @@ Not all types for constants and immutables are implemented at this time. The onl
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract C {
|
contract C {
|
||||||
uint constant X = 32**22 + 8;
|
uint constant X = 32**22 + 8;
|
||||||
|
@ -39,7 +39,7 @@ Details are given in the following example.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
|
||||||
contract Owned {
|
contract Owned {
|
||||||
@ -127,7 +127,7 @@ destruction request. The way this is done is problematic, as
|
|||||||
seen in the following example::
|
seen in the following example::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract owned {
|
contract owned {
|
||||||
constructor() { owner = msg.sender; }
|
constructor() { owner = msg.sender; }
|
||||||
@ -157,7 +157,7 @@ explicitly in the final override, but this function will bypass
|
|||||||
``Base1.destroy``. The way around this is to use ``super``::
|
``Base1.destroy``. The way around this is to use ``super``::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract owned {
|
contract owned {
|
||||||
constructor() { owner = msg.sender; }
|
constructor() { owner = msg.sender; }
|
||||||
@ -214,7 +214,7 @@ The following example demonstrates changing mutability and visibility:
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Base
|
contract Base
|
||||||
{
|
{
|
||||||
@ -405,7 +405,7 @@ equivalent to ``constructor() {}``. For example:
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
abstract contract A {
|
abstract contract A {
|
||||||
uint public a;
|
uint public a;
|
||||||
@ -442,7 +442,7 @@ 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::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Base {
|
contract Base {
|
||||||
uint x;
|
uint x;
|
||||||
@ -523,7 +523,7 @@ One area where inheritance linearization is especially important and perhaps not
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Base1 {
|
contract Base1 {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
@ -192,7 +192,7 @@ is compiled so recursive creation-dependencies are not possible.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract D {
|
contract D {
|
||||||
uint public x;
|
uint public x;
|
||||||
@ -248,7 +248,7 @@ which only need to be created if there is a dispute.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract D {
|
contract D {
|
||||||
uint public x;
|
uint public x;
|
||||||
|
@ -25,7 +25,7 @@ to receive their money - contracts cannot activate themselves.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract SimpleAuction {
|
contract SimpleAuction {
|
||||||
// Parameters of the auction. Times are either
|
// Parameters of the auction. Times are either
|
||||||
@ -186,7 +186,7 @@ invalid bids.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract BlindAuction {
|
contract BlindAuction {
|
||||||
struct Bid {
|
struct Bid {
|
||||||
|
@ -142,7 +142,7 @@ The full contract
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract ReceiverPays {
|
contract ReceiverPays {
|
||||||
address owner = msg.sender;
|
address owner = msg.sender;
|
||||||
@ -339,7 +339,7 @@ The full contract
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract SimplePaymentChannel {
|
contract SimplePaymentChannel {
|
||||||
address payable public sender; // The account sending payments.
|
address payable public sender; // The account sending payments.
|
||||||
|
@ -26,7 +26,7 @@ you can use state machine-like constructs inside a contract.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Purchase {
|
contract Purchase {
|
||||||
uint public value;
|
uint public value;
|
||||||
|
@ -33,7 +33,7 @@ of votes.
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
/// @title Voting with delegation.
|
/// @title Voting with delegation.
|
||||||
contract Ballot {
|
contract Ballot {
|
||||||
|
@ -201,7 +201,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
||||||
contract TxUserWallet {
|
contract TxUserWallet {
|
||||||
@ -222,7 +222,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet:
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
interface TxUserWallet {
|
interface TxUserWallet {
|
||||||
function transferTo(address payable dest, uint amount) external;
|
function transferTo(address payable dest, uint amount) external;
|
||||||
|
@ -300,7 +300,7 @@ Within a grouping, place the ``view`` and ``pure`` functions last.
|
|||||||
Yes::
|
Yes::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract A {
|
contract A {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -337,7 +337,7 @@ Yes::
|
|||||||
No::
|
No::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract A {
|
contract A {
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ manner as modifiers if the function declaration is long or hard to read.
|
|||||||
Yes::
|
Yes::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
// Base contracts just to make this compile
|
// Base contracts just to make this compile
|
||||||
contract B {
|
contract B {
|
||||||
@ -790,7 +790,7 @@ Yes::
|
|||||||
No::
|
No::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
|
||||||
// Base contracts just to make this compile
|
// Base contracts just to make this compile
|
||||||
@ -1012,7 +1012,7 @@ As shown in the example below, if the contract name is ``Congress`` and the libr
|
|||||||
Yes::
|
Yes::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
|
||||||
// Owned.sol
|
// Owned.sol
|
||||||
@ -1048,7 +1048,7 @@ and in ``Congress.sol``::
|
|||||||
No::
|
No::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
|
||||||
// owned.sol
|
// owned.sol
|
||||||
|
@ -434,7 +434,7 @@ Array slices are useful to ABI-decode secondary data passed in function paramete
|
|||||||
::
|
::
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
contract Proxy {
|
contract Proxy {
|
||||||
/// @dev Address of the client contract managed by proxy i.e., this contract
|
/// @dev Address of the client contract managed by proxy i.e., this contract
|
||||||
|
@ -693,7 +693,7 @@ have to be updated manually.)
|
|||||||
|
|
||||||
.. code-block:: Solidity
|
.. code-block:: Solidity
|
||||||
|
|
||||||
pragma solidity >=0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
// SPDX-License-Identifier: GPL-3.0
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
abstract contract C {
|
abstract contract C {
|
||||||
// FIXME: remove constructor visibility and make the contract abstract
|
// FIXME: remove constructor visibility and make the contract abstract
|
||||||
|
Loading…
Reference in New Issue
Block a user