mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5732 from ethereum/pragma-update
[DOCS] Update non-existent pragma 0.4.99 to 0.5.0
This commit is contained in:
commit
d9910f2a12
@ -308,7 +308,7 @@ This will no longer compile with Solidity v0.5.0. However, you can define a comp
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
interface OldContract {
|
||||
function someOldFunction(uint8 a) external;
|
||||
function anotherOldFunction() external returns (bool);
|
||||
@ -325,7 +325,7 @@ Given the interface defined above, you can now easily use the already deployed p
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
interface OldContract {
|
||||
function someOldFunction(uint8 a) external;
|
||||
@ -345,7 +345,7 @@ commandline compiler for linking):
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
library OldLibrary {
|
||||
function someFunction(uint8 a) public returns(bool);
|
||||
@ -430,7 +430,7 @@ New version:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract OtherContract {
|
||||
uint x;
|
||||
|
@ -471,7 +471,7 @@ For example,
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract Test {
|
||||
constructor() public { b = hex"12345678901234567890123456789012"; }
|
||||
|
@ -28,7 +28,7 @@ become the new richest.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract WithdrawalContract {
|
||||
address public richest;
|
||||
@ -65,7 +65,7 @@ This is as opposed to the more intuitive sending pattern:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract SendContract {
|
||||
address payable public richest;
|
||||
|
@ -343,7 +343,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
@ -585,7 +585,7 @@ The following statements are considered modifying the state:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract C {
|
||||
function f(uint a, uint b) public view returns (uint) {
|
||||
@ -630,7 +630,7 @@ In addition to the list of state modifying statements explained above, the follo
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract C {
|
||||
function f(uint a, uint b) public pure returns (uint) {
|
||||
@ -724,7 +724,7 @@ Like any function, the fallback function can execute complex operations as long
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract Test {
|
||||
// This function is called for all messages sent to
|
||||
@ -1029,7 +1029,7 @@ Details are given in the following example.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
@ -1194,7 +1194,7 @@ equivalent to ``constructor() public {}``. For example:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract A {
|
||||
uint public a;
|
||||
@ -1373,7 +1373,7 @@ Interfaces are denoted by their own keyword:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
interface Token {
|
||||
enum TokenType { Fungible, NonFungible }
|
||||
|
@ -168,7 +168,7 @@ is compiled so recursive creation-dependencies are not possible.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract D {
|
||||
uint public x;
|
||||
@ -291,7 +291,7 @@ the two variables have the same name but disjoint scopes.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
contract C {
|
||||
function minimalScoping() pure public {
|
||||
{
|
||||
@ -312,7 +312,7 @@ In any case, you will get a warning about the outer variable being shadowed.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
// This will report a warning
|
||||
contract C {
|
||||
function f() pure public returns (uint) {
|
||||
@ -332,7 +332,7 @@ In any case, you will get a warning about the outer variable being shadowed.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
// This will not compile
|
||||
contract C {
|
||||
function f() pure public returns (uint) {
|
||||
@ -379,7 +379,7 @@ a message string for ``require``, but not for ``assert``.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract Sharer {
|
||||
function sendHalf(address payable addr) public payable returns (uint balance) {
|
||||
@ -425,7 +425,7 @@ The following example shows how an error string can be used together with revert
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract VendingMachine {
|
||||
function buy(uint amount) public payable {
|
||||
|
@ -120,7 +120,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.
|
||||
In this example::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract B {
|
||||
constructor() public payable {}
|
||||
|
@ -81,7 +81,7 @@ registering with username and password — all you need is an Ethereum keypair.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract Coin {
|
||||
// The keyword "public" makes those variables
|
||||
|
@ -183,7 +183,7 @@ Never use tx.origin for authorization. Let's say you have a wallet contract like
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
||||
contract TxUserWallet {
|
||||
@ -203,7 +203,7 @@ Now someone tricks you into sending ether to the address of this attack wallet:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.99 <0.6.0;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
interface TxUserWallet {
|
||||
function transferTo(address payable dest, uint amount) external;
|
||||
|
Loading…
Reference in New Issue
Block a user