mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Documentation.
This commit is contained in:
parent
9743390a53
commit
479d7a059f
@ -18,3 +18,5 @@ This section gives detailed instructions on how to update prior code for every b
|
||||
* Change ``now`` to ``block.timestamp``.
|
||||
* Change types of right operand in shift operators to unsigned types. For example change ``x >> (256 - y)`` to
|
||||
``x >> uint(256 - y)``.
|
||||
* Remove the ``public`` keyword from every constructor.
|
||||
* Remove the ``internal`` keyword from every constructor and add ``abstract`` to the contract (if not already present).
|
||||
|
@ -537,11 +537,11 @@ For example,
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
|
||||
contract Test {
|
||||
constructor() public { b = hex"12345678901234567890123456789012"; }
|
||||
constructor() { b = hex"12345678901234567890123456789012"; }
|
||||
event Event(uint indexed a, bytes32 b);
|
||||
event Event2(uint indexed a, bytes32 b);
|
||||
function foo(uint a) public { emit Event(a, b); }
|
||||
|
@ -28,7 +28,7 @@ you receive the funds of the person who is now the richest.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract WithdrawalContract {
|
||||
address public richest;
|
||||
@ -36,7 +36,7 @@ you receive the funds of the person who is now the richest.
|
||||
|
||||
mapping (address => uint) pendingWithdrawals;
|
||||
|
||||
constructor() public payable {
|
||||
constructor() payable {
|
||||
richest = msg.sender;
|
||||
mostSent = msg.value;
|
||||
}
|
||||
@ -62,13 +62,13 @@ This is as opposed to the more intuitive sending pattern:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract SendContract {
|
||||
address payable public richest;
|
||||
uint public mostSent;
|
||||
|
||||
constructor() public payable {
|
||||
constructor() payable {
|
||||
richest = msg.sender;
|
||||
mostSent = msg.value;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ Not all types for constants and immutables are implemented at this time. The onl
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.4 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract C {
|
||||
uint constant X = 32**22 + 8;
|
||||
@ -28,7 +28,7 @@ Not all types for constants and immutables are implemented at this time. The onl
|
||||
uint immutable maxBalance;
|
||||
address immutable owner = msg.sender;
|
||||
|
||||
constructor(uint _decimals, address _reference) public {
|
||||
constructor(uint _decimals, address _reference) {
|
||||
decimals = _decimals;
|
||||
// Assignments to immutables can even access the environment.
|
||||
maxBalance = _reference.balance;
|
||||
|
@ -48,7 +48,7 @@ This means that cyclic creation dependencies are impossible.
|
||||
|
||||
// This is the constructor which registers the
|
||||
// creator and the assigned name.
|
||||
constructor(bytes32 _name) public {
|
||||
constructor(bytes32 _name) {
|
||||
// State variables are accessed via their name
|
||||
// and not via e.g. `this.owner`. Functions can
|
||||
// be accessed directly or through `this.f`,
|
||||
|
@ -18,10 +18,10 @@ if they are marked ``virtual``. For details, please see
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
constructor() { owner = msg.sender; }
|
||||
address payable owner;
|
||||
|
||||
// This contract only defines a modifier but does not use
|
||||
@ -63,7 +63,7 @@ if they are marked ``virtual``. For details, please see
|
||||
mapping (address => bool) registeredAddresses;
|
||||
uint price;
|
||||
|
||||
constructor(uint initialPrice) public { price = initialPrice; }
|
||||
constructor(uint initialPrice) { price = initialPrice; }
|
||||
|
||||
// It is important to also provide the
|
||||
// `payable` keyword here, otherwise the function will
|
||||
|
@ -39,11 +39,11 @@ Details are given in the following example.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
|
||||
contract Owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
constructor() { owner = msg.sender; }
|
||||
address payable owner;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ Details are given in the following example.
|
||||
// also a base class of `Destructible`, yet there is only a single
|
||||
// instance of `owned` (as for virtual inheritance in C++).
|
||||
contract Named is Owned, Destructible {
|
||||
constructor(bytes32 name) public {
|
||||
constructor(bytes32 name) {
|
||||
Config config = Config(0xD5f9D8D94886E70b06E474c3fB14Fd43E2f23970);
|
||||
NameReg(config.lookup(1)).register(name);
|
||||
}
|
||||
@ -106,8 +106,8 @@ Details are given in the following example.
|
||||
|
||||
|
||||
// If a constructor takes an argument, it needs to be
|
||||
// provided in the header (or modifier-invocation-style at
|
||||
// the constructor of the derived contract (see below)).
|
||||
// provided in the header or modifier-invocation-style at
|
||||
// the constructor of the derived contract (see below).
|
||||
contract PriceFeed is Owned, Destructible, Named("GoldFeed") {
|
||||
function updateInfo(uint newInfo) public {
|
||||
if (msg.sender == owner) info = newInfo;
|
||||
@ -127,10 +127,10 @@ destruction request. The way this is done is problematic, as
|
||||
seen in the following example::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
constructor() { owner = msg.sender; }
|
||||
address payable owner;
|
||||
}
|
||||
|
||||
@ -157,10 +157,10 @@ explicitly in the final override, but this function will bypass
|
||||
``Base1.destroy``. The way around this is to use ``super``::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
constructor() { owner = msg.sender; }
|
||||
address payable owner;
|
||||
}
|
||||
|
||||
@ -392,33 +392,39 @@ and all functions that are reachable from there through function calls.
|
||||
It does not include the constructor code or internal functions that are
|
||||
only called from the constructor.
|
||||
|
||||
Constructor functions can be either ``public`` or ``internal``. If there is no
|
||||
If there is no
|
||||
constructor, the contract will assume the default constructor, which is
|
||||
equivalent to ``constructor() public {}``. For example:
|
||||
equivalent to ``constructor() {}``. For example:
|
||||
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract A {
|
||||
abstract contract A {
|
||||
uint public a;
|
||||
|
||||
constructor(uint _a) internal {
|
||||
constructor(uint _a) {
|
||||
a = _a;
|
||||
}
|
||||
}
|
||||
|
||||
contract B is A(1) {
|
||||
constructor() public {}
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
A constructor set as ``internal`` causes the contract to be marked as :ref:`abstract <abstract-contract>`.
|
||||
You can use internal parameters in a constructor (for example storage pointers). In this case,
|
||||
the contract has to be marked :ref:`abstract <abstract-contract>`, because these parameters
|
||||
cannot be assigned valid values from outside but only through the constructors of derived contracts.
|
||||
|
||||
.. warning ::
|
||||
Prior to version 0.4.22, constructors were defined as functions with the same name as the contract.
|
||||
This syntax was deprecated and is not allowed anymore in version 0.5.0.
|
||||
|
||||
.. warning ::
|
||||
Prior to version 0.7.0, you had to specify the visibility of constructors as either
|
||||
``internal`` or ``public``.
|
||||
|
||||
|
||||
.. index:: ! base;constructor
|
||||
|
||||
@ -430,21 +436,21 @@ 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::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract Base {
|
||||
uint x;
|
||||
constructor(uint _x) public { x = _x; }
|
||||
constructor(uint _x) { x = _x; }
|
||||
}
|
||||
|
||||
// Either directly specify in the inheritance list...
|
||||
contract Derived1 is Base(7) {
|
||||
constructor() public {}
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
// or through a "modifier" of the derived constructor.
|
||||
contract Derived2 is Base {
|
||||
constructor(uint _y) Base(_y * _y) public {}
|
||||
constructor(uint _y) Base(_y * _y) {}
|
||||
}
|
||||
|
||||
One way is directly in the inheritance list (``is Base(7)``). The other is in
|
||||
@ -511,14 +517,14 @@ One area where inheritance linearization is especially important and perhaps not
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract Base1 {
|
||||
constructor() public {}
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
contract Base2 {
|
||||
constructor() public {}
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
// Constructors are executed in the following order:
|
||||
@ -526,7 +532,7 @@ One area where inheritance linearization is especially important and perhaps not
|
||||
// 2 - Base2
|
||||
// 3 - Derived1
|
||||
contract Derived1 is Base1, Base2 {
|
||||
constructor() public Base1() Base2() {}
|
||||
constructor() Base1() Base2() {}
|
||||
}
|
||||
|
||||
// Constructors are executed in the following order:
|
||||
@ -534,7 +540,7 @@ One area where inheritance linearization is especially important and perhaps not
|
||||
// 2 - Base1
|
||||
// 3 - Derived2
|
||||
contract Derived2 is Base2, Base1 {
|
||||
constructor() public Base2() Base1() {}
|
||||
constructor() Base2() Base1() {}
|
||||
}
|
||||
|
||||
// Constructors are still executed in the following order:
|
||||
@ -542,7 +548,7 @@ One area where inheritance linearization is especially important and perhaps not
|
||||
// 2 - Base1
|
||||
// 3 - Derived3
|
||||
contract Derived3 is Base2, Base1 {
|
||||
constructor() public Base1() Base2() {}
|
||||
constructor() Base1() Base2() {}
|
||||
}
|
||||
|
||||
|
||||
|
@ -188,11 +188,11 @@ is compiled so recursive creation-dependencies are not possible.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract D {
|
||||
uint public x;
|
||||
constructor(uint a) public payable {
|
||||
constructor(uint a) payable {
|
||||
x = a;
|
||||
}
|
||||
}
|
||||
@ -244,11 +244,11 @@ which only need to be created if there is a dispute.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract D {
|
||||
uint public x;
|
||||
constructor(uint a) public {
|
||||
constructor(uint a) {
|
||||
x = a;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ to receive their money - contracts cannot activate themselves.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract SimpleAuction {
|
||||
// Parameters of the auction. Times are either
|
||||
@ -60,7 +60,7 @@ to receive their money - contracts cannot activate themselves.
|
||||
constructor(
|
||||
uint _biddingTime,
|
||||
address payable _beneficiary
|
||||
) public {
|
||||
) {
|
||||
beneficiary = _beneficiary;
|
||||
auctionEndTime = block.timestamp + _biddingTime;
|
||||
}
|
||||
@ -186,7 +186,7 @@ invalid bids.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract BlindAuction {
|
||||
struct Bid {
|
||||
@ -220,7 +220,7 @@ invalid bids.
|
||||
uint _biddingTime,
|
||||
uint _revealTime,
|
||||
address payable _beneficiary
|
||||
) public {
|
||||
) {
|
||||
beneficiary = _beneficiary;
|
||||
biddingEnd = block.timestamp + _biddingTime;
|
||||
revealEnd = biddingEnd + _revealTime;
|
||||
|
@ -143,14 +143,14 @@ The full contract
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.24 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract ReceiverPays {
|
||||
address owner = msg.sender;
|
||||
|
||||
mapping(uint256 => bool) usedNonces;
|
||||
|
||||
constructor() public payable {}
|
||||
constructor() payable {}
|
||||
|
||||
function claimPayment(uint256 amount, uint256 nonce, bytes memory signature) public {
|
||||
require(!usedNonces[nonce]);
|
||||
@ -340,7 +340,7 @@ The full contract
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract SimplePaymentChannel {
|
||||
address payable public sender; // The account sending payments.
|
||||
@ -348,7 +348,6 @@ The full contract
|
||||
uint256 public expiration; // Timeout in case the recipient never closes.
|
||||
|
||||
constructor (address payable _recipient, uint256 duration)
|
||||
public
|
||||
payable
|
||||
{
|
||||
sender = msg.sender;
|
||||
|
@ -26,7 +26,7 @@ you can use state machine-like constructs inside a contract.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract Purchase {
|
||||
uint public value;
|
||||
@ -74,7 +74,7 @@ you can use state machine-like constructs inside a contract.
|
||||
// Ensure that `msg.value` is an even number.
|
||||
// Division will truncate if it is an odd number.
|
||||
// Check via multiplication that it wasn't an odd number.
|
||||
constructor() public payable {
|
||||
constructor() payable {
|
||||
seller = msg.sender;
|
||||
value = msg.value / 2;
|
||||
require((2 * value) == msg.value, "Value has to be even.");
|
||||
|
@ -33,7 +33,7 @@ of votes.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
/// @title Voting with delegation.
|
||||
contract Ballot {
|
||||
@ -63,7 +63,7 @@ of votes.
|
||||
Proposal[] public proposals;
|
||||
|
||||
/// Create a new ballot to choose one of `proposalNames`.
|
||||
constructor(bytes32[] memory proposalNames) public {
|
||||
constructor(bytes32[] memory proposalNames) {
|
||||
chairperson = msg.sender;
|
||||
voters[chairperson].weight = 1;
|
||||
|
||||
|
@ -83,7 +83,7 @@ registering with a username and password, all you need is an Ethereum keypair.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.5.99 <0.8.0;
|
||||
|
||||
contract Coin {
|
||||
// The keyword "public" makes variables
|
||||
@ -97,7 +97,7 @@ registering with a username and password, all you need is an Ethereum keypair.
|
||||
|
||||
// Constructor code is only run when the contract
|
||||
// is created
|
||||
constructor() public {
|
||||
constructor() {
|
||||
minter = msg.sender;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ and any user interface calls the automatically generated ``balances`` function f
|
||||
|
||||
.. index:: coin
|
||||
|
||||
The :ref:`constructor<constructor>` is a special function run during the creation of the contract and
|
||||
The :ref:`constructor<constructor>` is a special function that is executed during the creation of the contract and
|
||||
cannot be called afterwards. In this case, it permanently stores the address of the person creating the
|
||||
contract. The ``msg`` variable (together with ``tx`` and ``block``) is a
|
||||
:ref:`special global variable <special-variables-functions>` that
|
||||
|
@ -201,13 +201,13 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
||||
contract TxUserWallet {
|
||||
address owner;
|
||||
|
||||
constructor() public {
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
interface TxUserWallet {
|
||||
function transferTo(address payable dest, uint amount) external;
|
||||
@ -231,7 +231,7 @@ Now someone tricks you into sending Ether to the address of this attack wallet:
|
||||
contract TxAttackWallet {
|
||||
address payable owner;
|
||||
|
||||
constructor() public {
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
|
@ -300,10 +300,10 @@ Within a grouping, place the ``view`` and ``pure`` functions last.
|
||||
Yes::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract A {
|
||||
constructor() public {
|
||||
constructor() {
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ Yes::
|
||||
No::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract A {
|
||||
|
||||
@ -357,7 +357,7 @@ No::
|
||||
// Public functions
|
||||
// ...
|
||||
|
||||
constructor() public {
|
||||
constructor() {
|
||||
// ...
|
||||
}
|
||||
|
||||
@ -758,19 +758,19 @@ manner as modifiers if the function declaration is long or hard to read.
|
||||
Yes::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
// Base contracts just to make this compile
|
||||
contract B {
|
||||
constructor(uint) public {
|
||||
constructor(uint) {
|
||||
}
|
||||
}
|
||||
contract C {
|
||||
constructor(uint, uint) public {
|
||||
constructor(uint, uint) {
|
||||
}
|
||||
}
|
||||
contract D {
|
||||
constructor(uint) public {
|
||||
constructor(uint) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,7 +781,6 @@ Yes::
|
||||
B(param1)
|
||||
C(param2, param3)
|
||||
D(param4)
|
||||
public
|
||||
{
|
||||
// do something with param5
|
||||
x = param5;
|
||||
@ -791,24 +790,24 @@ Yes::
|
||||
No::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
|
||||
// Base contracts just to make this compile
|
||||
contract B {
|
||||
constructor(uint) public {
|
||||
constructor(uint) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract C {
|
||||
constructor(uint, uint) public {
|
||||
constructor(uint, uint) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract D {
|
||||
constructor(uint) public {
|
||||
constructor(uint) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -819,8 +818,7 @@ No::
|
||||
constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
|
||||
B(param1)
|
||||
C(param2, param3)
|
||||
D(param4)
|
||||
public {
|
||||
D(param4) {
|
||||
x = param5;
|
||||
}
|
||||
}
|
||||
@ -832,8 +830,7 @@ No::
|
||||
constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
|
||||
B(param1)
|
||||
C(param2, param3)
|
||||
D(param4)
|
||||
public {
|
||||
D(param4) {
|
||||
x = param5;
|
||||
}
|
||||
}
|
||||
@ -1015,14 +1012,14 @@ As shown in the example below, if the contract name is ``Congress`` and the libr
|
||||
Yes::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
|
||||
// Owned.sol
|
||||
contract Owned {
|
||||
address public owner;
|
||||
|
||||
constructor() public {
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
@ -1051,14 +1048,14 @@ and in ``Congress.sol``::
|
||||
No::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
|
||||
// owned.sol
|
||||
contract owned {
|
||||
address public owner;
|
||||
|
||||
constructor() public {
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
@ -1096,7 +1093,7 @@ Events should be named using the CapWords style. Examples: ``Deposit``, ``Transf
|
||||
Function Names
|
||||
==============
|
||||
|
||||
Functions other than constructors should use mixedCase. Examples: ``getBalance``, ``transfer``, ``verifyOwner``, ``addMember``, ``changeOwner``.
|
||||
Functions should use mixedCase. Examples: ``getBalance``, ``transfer``, ``verifyOwner``, ``addMember``, ``changeOwner``.
|
||||
|
||||
|
||||
Function Argument Names
|
||||
|
@ -417,13 +417,13 @@ Array slices are useful to ABI-decode secondary data passed in function paramete
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
contract Proxy {
|
||||
/// @dev Address of the client contract managed by proxy i.e., this contract
|
||||
address client;
|
||||
|
||||
constructor(address _client) public {
|
||||
constructor(address _client) {
|
||||
client = _client;
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,7 @@ The command above applies all changes as shown below. Please review them careful
|
||||
.. code-block:: solidity
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
|
||||
abstract contract Updateable {
|
||||
function run() public view virtual returns (bool);
|
||||
@ -734,7 +734,7 @@ The command above applies all changes as shown below. Please review them careful
|
||||
}
|
||||
|
||||
contract Source is Updateable, Upgradable {
|
||||
constructor() public {}
|
||||
constructor() {}
|
||||
|
||||
function run()
|
||||
public
|
||||
|
Loading…
Reference in New Issue
Block a user