mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -292,8 +292,9 @@ Consider you have the following pre-0.5.0 contract already deployed:
|
||||
|
||||
::
|
||||
|
||||
// This will not compile with the current version of the compiler
|
||||
pragma solidity ^0.4.25;
|
||||
// This will report a warning until version 0.4.25 of the compiler
|
||||
// This will not compile after 0.5.0
|
||||
contract OldContract {
|
||||
function someOldFunction(uint8 a) {
|
||||
//...
|
||||
@@ -369,8 +370,8 @@ Old version:
|
||||
|
||||
::
|
||||
|
||||
// This will not compile
|
||||
pragma solidity ^0.4.25;
|
||||
// This will not compile after 0.5.0
|
||||
|
||||
contract OtherContract {
|
||||
uint x;
|
||||
@@ -396,7 +397,7 @@ Old version:
|
||||
// Throw is fine in this version.
|
||||
if (x > 100)
|
||||
throw;
|
||||
bytes b = new bytes(x);
|
||||
bytes memory b = new bytes(x);
|
||||
y = -3 >> 1;
|
||||
// y == -1 (wrong, should be -2)
|
||||
do {
|
||||
@@ -431,14 +432,15 @@ New version:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.5.99;
|
||||
// This will not compile after 0.6.0
|
||||
|
||||
contract OtherContract {
|
||||
uint x;
|
||||
function f(uint y) external {
|
||||
x = y;
|
||||
}
|
||||
receive() payable external {}
|
||||
function() payable external {}
|
||||
}
|
||||
|
||||
contract New {
|
||||
|
||||
@@ -0,0 +1,482 @@
|
||||
// Copyright 2020 Gonçalo Sá <goncalo.sa@consensys.net>
|
||||
// Copyright 2016-2019 Federico Bond <federicobond@gmail.com>
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for details.
|
||||
|
||||
// This grammar is much less strict than what Solidity currently parses
|
||||
// to allow this to pass with older versions of Solidity.
|
||||
|
||||
grammar Solidity;
|
||||
|
||||
sourceUnit
|
||||
: (pragmaDirective | importDirective | structDefinition | enumDefinition | contractDefinition)* EOF ;
|
||||
|
||||
pragmaDirective
|
||||
: 'pragma' pragmaName pragmaValue ';' ;
|
||||
|
||||
pragmaName
|
||||
: identifier ;
|
||||
|
||||
pragmaValue
|
||||
: version | expression ;
|
||||
|
||||
version
|
||||
: versionConstraint versionConstraint? ;
|
||||
|
||||
versionConstraint
|
||||
: versionOperator? VersionLiteral ;
|
||||
|
||||
versionOperator
|
||||
: '^' | '~' | '>=' | '>' | '<' | '<=' | '=' ;
|
||||
|
||||
importDirective
|
||||
: 'import' StringLiteralFragment ('as' identifier)? ';'
|
||||
| 'import' ('*' | identifier) ('as' identifier)? 'from' StringLiteralFragment ';'
|
||||
| 'import' '{' importDeclaration ( ',' importDeclaration )* '}' 'from' StringLiteralFragment ';' ;
|
||||
|
||||
importDeclaration
|
||||
: identifier ('as' identifier)? ;
|
||||
|
||||
contractDefinition
|
||||
: 'abstract'? ( 'contract' | 'interface' | 'library' ) identifier
|
||||
( 'is' inheritanceSpecifier (',' inheritanceSpecifier )* )?
|
||||
'{' contractPart* '}' ;
|
||||
|
||||
inheritanceSpecifier
|
||||
: userDefinedTypeName ( '(' expressionList? ')' )? ;
|
||||
|
||||
contractPart
|
||||
: stateVariableDeclaration
|
||||
| usingForDeclaration
|
||||
| structDefinition
|
||||
| modifierDefinition
|
||||
| functionDefinition
|
||||
| eventDefinition
|
||||
| enumDefinition ;
|
||||
|
||||
stateVariableDeclaration
|
||||
: typeName
|
||||
( PublicKeyword | InternalKeyword | PrivateKeyword | ConstantKeyword | ImmutableKeyword | overrideSpecifier )*
|
||||
identifier ('=' expression)? ';' ;
|
||||
|
||||
overrideSpecifier : 'override' ( '(' userDefinedTypeName (',' userDefinedTypeName)* ')' )? ;
|
||||
|
||||
usingForDeclaration
|
||||
: 'using' identifier 'for' ('*' | typeName) ';' ;
|
||||
|
||||
structDefinition
|
||||
: 'struct' identifier
|
||||
'{' ( variableDeclaration ';' (variableDeclaration ';')* )? '}' ;
|
||||
|
||||
modifierDefinition
|
||||
: 'modifier' identifier parameterList? ( VirtualKeyword | overrideSpecifier )* block ;
|
||||
|
||||
functionDefinition
|
||||
: functionDescriptor parameterList modifierList returnParameters? ( ';' | block ) ;
|
||||
|
||||
functionDescriptor
|
||||
: 'function' ( identifier | ReceiveKeyword | FallbackKeyword )?
|
||||
| ConstructorKeyword
|
||||
| FallbackKeyword
|
||||
| ReceiveKeyword ;
|
||||
|
||||
returnParameters
|
||||
: 'returns' parameterList ;
|
||||
|
||||
modifierList
|
||||
: ( modifierInvocation | stateMutability | ExternalKeyword
|
||||
| PublicKeyword | InternalKeyword | PrivateKeyword | VirtualKeyword | overrideSpecifier )* ;
|
||||
|
||||
modifierInvocation
|
||||
: identifier ( '(' expressionList? ')' )? ;
|
||||
|
||||
eventDefinition
|
||||
: 'event' identifier eventParameterList AnonymousKeyword? ';' ;
|
||||
|
||||
enumDefinition
|
||||
: 'enum' identifier '{' enumValue? (',' enumValue)* '}' ;
|
||||
|
||||
enumValue
|
||||
: identifier ;
|
||||
|
||||
parameterList
|
||||
: '(' ( parameter (',' parameter)* )? ')' ;
|
||||
|
||||
parameter
|
||||
: typeName storageLocation? identifier? ;
|
||||
|
||||
eventParameterList
|
||||
: '(' ( eventParameter (',' eventParameter)* )? ')' ;
|
||||
|
||||
eventParameter
|
||||
: typeName IndexedKeyword? identifier? ;
|
||||
|
||||
variableDeclaration
|
||||
: typeName storageLocation? identifier ;
|
||||
|
||||
typeName
|
||||
: elementaryTypeName
|
||||
| userDefinedTypeName
|
||||
| mapping
|
||||
| typeName '[' expression? ']'
|
||||
| functionTypeName ;
|
||||
|
||||
userDefinedTypeName
|
||||
: identifier ( '.' identifier )* ;
|
||||
|
||||
mapping
|
||||
: 'mapping' '(' (elementaryTypeName | userDefinedTypeName) '=>' typeName ')' ;
|
||||
|
||||
functionTypeName
|
||||
: 'function' parameterList modifierList returnParameters? ;
|
||||
|
||||
storageLocation
|
||||
: 'memory' | 'storage' | 'calldata';
|
||||
|
||||
stateMutability
|
||||
: PureKeyword | ConstantKeyword | ViewKeyword | PayableKeyword ;
|
||||
|
||||
block
|
||||
: '{' statement* '}' ;
|
||||
|
||||
statement
|
||||
: ifStatement
|
||||
| tryStatement
|
||||
| whileStatement
|
||||
| forStatement
|
||||
| block
|
||||
| inlineAssemblyStatement
|
||||
| doWhileStatement
|
||||
| continueStatement
|
||||
| breakStatement
|
||||
| returnStatement
|
||||
| throwStatement
|
||||
| emitStatement
|
||||
| simpleStatement ;
|
||||
|
||||
expressionStatement
|
||||
: expression ';' ;
|
||||
|
||||
ifStatement
|
||||
: 'if' '(' expression ')' statement ( 'else' statement )? ;
|
||||
|
||||
tryStatement : 'try' expression returnParameters? block catchClause+ ;
|
||||
|
||||
// In reality catch clauses still are not processed as below
|
||||
// the identifier can only be a set string: "Error". But plans
|
||||
// of the Solidity team include possible expansion so we'll
|
||||
// leave this as is, befitting with the Solidity docs.
|
||||
catchClause : 'catch' ( identifier? parameterList )? block ;
|
||||
|
||||
whileStatement
|
||||
: 'while' '(' expression ')' statement ;
|
||||
|
||||
forStatement
|
||||
: 'for' '(' ( simpleStatement | ';' ) ( expressionStatement | ';' ) expression? ')' statement ;
|
||||
|
||||
simpleStatement
|
||||
: ( variableDeclarationStatement | expressionStatement ) ;
|
||||
|
||||
inlineAssemblyStatement
|
||||
: 'assembly' StringLiteralFragment? assemblyBlock ;
|
||||
|
||||
doWhileStatement
|
||||
: 'do' statement 'while' '(' expression ')' ';' ;
|
||||
|
||||
continueStatement
|
||||
: 'continue' ';' ;
|
||||
|
||||
breakStatement
|
||||
: 'break' ';' ;
|
||||
|
||||
returnStatement
|
||||
: 'return' expression? ';' ;
|
||||
|
||||
// throw is no longer supported by latest Solidity.
|
||||
throwStatement
|
||||
: 'throw' ';' ;
|
||||
|
||||
emitStatement
|
||||
: 'emit' functionCall ';' ;
|
||||
|
||||
// 'var' is no longer supported by latest Solidity.
|
||||
variableDeclarationStatement
|
||||
: ( 'var' identifierList | variableDeclaration | '(' variableDeclarationList ')' ) ( '=' expression )? ';';
|
||||
|
||||
variableDeclarationList
|
||||
: variableDeclaration? (',' variableDeclaration? )* ;
|
||||
|
||||
identifierList
|
||||
: '(' ( identifier? ',' )* identifier? ')' ;
|
||||
|
||||
elementaryTypeName
|
||||
: 'address' PayableKeyword? | 'bool' | 'string' | 'var' | Int | Uint | 'byte' | Byte | Fixed | Ufixed ;
|
||||
|
||||
Int
|
||||
: 'int' | 'int8' | 'int16' | 'int24' | 'int32' | 'int40' | 'int48' | 'int56' | 'int64' | 'int72' | 'int80' | 'int88' | 'int96' | 'int104' | 'int112' | 'int120' | 'int128' | 'int136' | 'int144' | 'int152' | 'int160' | 'int168' | 'int176' | 'int184' | 'int192' | 'int200' | 'int208' | 'int216' | 'int224' | 'int232' | 'int240' | 'int248' | 'int256' ;
|
||||
|
||||
Uint
|
||||
: 'uint' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint40' | 'uint48' | 'uint56' | 'uint64' | 'uint72' | 'uint80' | 'uint88' | 'uint96' | 'uint104' | 'uint112' | 'uint120' | 'uint128' | 'uint136' | 'uint144' | 'uint152' | 'uint160' | 'uint168' | 'uint176' | 'uint184' | 'uint192' | 'uint200' | 'uint208' | 'uint216' | 'uint224' | 'uint232' | 'uint240' | 'uint248' | 'uint256' ;
|
||||
|
||||
Byte
|
||||
: 'bytes' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' ;
|
||||
|
||||
Fixed
|
||||
: 'fixed' | ( 'fixed' [0-9]+ 'x' [0-9]+ ) ;
|
||||
|
||||
Ufixed
|
||||
: 'ufixed' | ( 'ufixed' [0-9]+ 'x' [0-9]+ ) ;
|
||||
|
||||
expression
|
||||
: expression ('++' | '--')
|
||||
| 'new' typeName
|
||||
| expression '[' expression? ']'
|
||||
| expression '[' expression? ':' expression? ']'
|
||||
| expression '.' identifier
|
||||
| expression '{' nameValueList '}'
|
||||
| expression '(' functionCallArguments ')'
|
||||
| PayableKeyword '(' expression ')'
|
||||
| '(' expression ')'
|
||||
| ('++' | '--') expression
|
||||
| ('+' | '-') expression
|
||||
| ('after' | 'delete') expression
|
||||
| '!' expression
|
||||
| '~' expression
|
||||
| expression '**' expression
|
||||
| expression ('*' | '/' | '%') expression
|
||||
| expression ('+' | '-') expression
|
||||
| expression ('<<' | '>>') expression
|
||||
| expression '&' expression
|
||||
| expression '^' expression
|
||||
| expression '|' expression
|
||||
| expression ('<' | '>' | '<=' | '>=') expression
|
||||
| expression ('==' | '!=') expression
|
||||
| expression '&&' expression
|
||||
| expression '||' expression
|
||||
| expression '?' expression ':' expression
|
||||
| expression ('=' | '|=' | '^=' | '&=' | '<<=' | '>>=' | '+=' | '-=' | '*=' | '/=' | '%=') expression
|
||||
| primaryExpression ;
|
||||
|
||||
primaryExpression
|
||||
: BooleanLiteral
|
||||
| numberLiteral
|
||||
| hexLiteral
|
||||
| stringLiteral
|
||||
| identifier ('[' ']')?
|
||||
| TypeKeyword
|
||||
| tupleExpression
|
||||
| typeNameExpression ('[' ']')? ;
|
||||
|
||||
expressionList
|
||||
: expression (',' expression)* ;
|
||||
|
||||
nameValueList
|
||||
: nameValue (',' nameValue)* ','? ;
|
||||
|
||||
nameValue
|
||||
: identifier ':' expression ;
|
||||
|
||||
functionCallArguments
|
||||
: '{' nameValueList? '}'
|
||||
| expressionList? ;
|
||||
|
||||
functionCall
|
||||
: expression '(' functionCallArguments ')' ;
|
||||
|
||||
tupleExpression
|
||||
: '(' ( expression? ( ',' expression? )* ) ')'
|
||||
| '[' ( expression ( ',' expression )* )? ']' ;
|
||||
|
||||
typeNameExpression
|
||||
: elementaryTypeName
|
||||
| userDefinedTypeName ;
|
||||
|
||||
assemblyItem
|
||||
: identifier
|
||||
| assemblyBlock
|
||||
| assemblyExpression
|
||||
| assemblyLocalDefinition
|
||||
| assemblyAssignment
|
||||
| assemblyStackAssignment
|
||||
| labelDefinition
|
||||
| assemblySwitch
|
||||
| assemblyFunctionDefinition
|
||||
| assemblyFor
|
||||
| assemblyIf
|
||||
| BreakKeyword
|
||||
| ContinueKeyword
|
||||
| LeaveKeyword
|
||||
| subAssembly
|
||||
| numberLiteral
|
||||
| stringLiteral
|
||||
| hexLiteral ;
|
||||
|
||||
assemblyBlock
|
||||
: '{' assemblyItem* '}' ;
|
||||
|
||||
assemblyExpression
|
||||
: assemblyCall | assemblyLiteral ;
|
||||
|
||||
assemblyCall
|
||||
: ( 'return' | 'address' | 'byte' | identifier ) ( '(' assemblyExpression? ( ',' assemblyExpression )* ')' )? ;
|
||||
|
||||
assemblyLocalDefinition
|
||||
: 'let' assemblyIdentifierList ( ':=' assemblyExpression )? ;
|
||||
|
||||
assemblyAssignment
|
||||
: assemblyIdentifierList ':=' assemblyExpression ;
|
||||
|
||||
assemblyIdentifierList
|
||||
: identifier ( ',' identifier )* ;
|
||||
|
||||
assemblyStackAssignment
|
||||
: '=:' identifier ;
|
||||
|
||||
labelDefinition
|
||||
: identifier ':' ;
|
||||
|
||||
assemblySwitch
|
||||
: 'switch' assemblyExpression assemblyCase* ;
|
||||
|
||||
assemblyCase
|
||||
: 'case' assemblyLiteral assemblyType? assemblyBlock
|
||||
| 'default' assemblyBlock ;
|
||||
|
||||
assemblyFunctionDefinition
|
||||
: 'function' identifier '(' assemblyTypedVariableList? ')'
|
||||
assemblyFunctionReturns? assemblyBlock ;
|
||||
|
||||
assemblyFunctionReturns
|
||||
: ( '-' '>' assemblyTypedVariableList ) ;
|
||||
|
||||
assemblyFor
|
||||
: 'for' assemblyBlock assemblyExpression assemblyBlock assemblyBlock ;
|
||||
|
||||
assemblyIf
|
||||
: 'if' assemblyExpression assemblyBlock ;
|
||||
|
||||
assemblyLiteral
|
||||
: ( stringLiteral | DecimalNumber | HexNumber | hexLiteral | BooleanLiteral ) assemblyType? ;
|
||||
|
||||
assemblyTypedVariableList
|
||||
: identifier assemblyType? ( ',' assemblyTypedVariableList )? ;
|
||||
|
||||
assemblyType
|
||||
: ':' identifier ;
|
||||
|
||||
subAssembly
|
||||
: 'assembly' identifier assemblyBlock ;
|
||||
|
||||
numberLiteral
|
||||
: (DecimalNumber | HexNumber) NumberUnit? ;
|
||||
|
||||
identifier
|
||||
: ('from' | 'calldata' | 'address' | Identifier) ;
|
||||
|
||||
BooleanLiteral
|
||||
: 'true' | 'false' ;
|
||||
|
||||
DecimalNumber
|
||||
: ( DecimalDigits | (DecimalDigits? '.' DecimalDigits) ) ( [eE] '-'? DecimalDigits )? ;
|
||||
|
||||
fragment
|
||||
DecimalDigits
|
||||
: [0-9] ( '_'? [0-9] )* ;
|
||||
|
||||
HexNumber
|
||||
: '0' [xX] HexDigits ;
|
||||
|
||||
fragment
|
||||
HexDigits
|
||||
: HexCharacter ( '_'? HexCharacter )* ;
|
||||
|
||||
NumberUnit
|
||||
: 'wei' | 'szabo' | 'finney' | 'ether'
|
||||
| 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' ;
|
||||
|
||||
HexLiteralFragment
|
||||
: 'hex' (('"' HexDigits? '"') | ('\'' HexDigits? '\'')) ;
|
||||
|
||||
hexLiteral : HexLiteralFragment+ ;
|
||||
|
||||
fragment
|
||||
HexPair
|
||||
: HexCharacter HexCharacter ;
|
||||
|
||||
fragment
|
||||
HexCharacter
|
||||
: [0-9A-Fa-f] ;
|
||||
|
||||
ReservedKeyword
|
||||
: 'after'
|
||||
| 'case'
|
||||
| 'default'
|
||||
| 'final'
|
||||
| 'in'
|
||||
| 'inline'
|
||||
| 'let'
|
||||
| 'match'
|
||||
| 'null'
|
||||
| 'of'
|
||||
| 'relocatable'
|
||||
| 'static'
|
||||
| 'switch'
|
||||
| 'typeof' ;
|
||||
|
||||
AnonymousKeyword : 'anonymous' ;
|
||||
BreakKeyword : 'break' ;
|
||||
ConstantKeyword : 'constant' ;
|
||||
ImmutableKeyword : 'immutable' ;
|
||||
ContinueKeyword : 'continue' ;
|
||||
LeaveKeyword : 'leave' ;
|
||||
ExternalKeyword : 'external' ;
|
||||
IndexedKeyword : 'indexed' ;
|
||||
InternalKeyword : 'internal' ;
|
||||
PayableKeyword : 'payable' ;
|
||||
PrivateKeyword : 'private' ;
|
||||
PublicKeyword : 'public' ;
|
||||
VirtualKeyword : 'virtual' ;
|
||||
PureKeyword : 'pure' ;
|
||||
TypeKeyword : 'type' ;
|
||||
ViewKeyword : 'view' ;
|
||||
|
||||
ConstructorKeyword : 'constructor' ;
|
||||
FallbackKeyword : 'fallback' ;
|
||||
ReceiveKeyword : 'receive' ;
|
||||
|
||||
Identifier
|
||||
: IdentifierStart IdentifierPart* ;
|
||||
|
||||
fragment
|
||||
IdentifierStart
|
||||
: [a-zA-Z$_] ;
|
||||
|
||||
fragment
|
||||
IdentifierPart
|
||||
: [a-zA-Z0-9$_] ;
|
||||
|
||||
stringLiteral
|
||||
: StringLiteralFragment+ ;
|
||||
|
||||
StringLiteralFragment
|
||||
: '"' DoubleQuotedStringCharacter* '"'
|
||||
| '\'' SingleQuotedStringCharacter* '\'' ;
|
||||
|
||||
fragment
|
||||
DoubleQuotedStringCharacter
|
||||
: ~["\r\n\\] | ('\\' .) ;
|
||||
|
||||
fragment
|
||||
SingleQuotedStringCharacter
|
||||
: ~['\r\n\\] | ('\\' .) ;
|
||||
|
||||
VersionLiteral
|
||||
: [0-9]+ '.' [0-9]+ ('.' [0-9]+)? ;
|
||||
|
||||
WS
|
||||
: [ \t\r\n\u000C]+ -> skip ;
|
||||
|
||||
COMMENT
|
||||
: '/*' .*? '*/' -> channel(HIDDEN) ;
|
||||
|
||||
LINE_COMMENT
|
||||
: '//' ~[\r\n]* -> channel(HIDDEN) ;
|
||||
+2
-4
@@ -234,7 +234,6 @@ Given the contract:
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
|
||||
contract Foo {
|
||||
function bar(bytes3[2] memory) public pure {}
|
||||
function baz(uint32 x, bool y) public pure returns (bool r) { r = x > 32 || y; }
|
||||
@@ -583,12 +582,11 @@ As an example, the code
|
||||
pragma solidity >=0.4.19 <0.8.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
|
||||
contract Test {
|
||||
struct S { uint a; uint[] b; T[] c; }
|
||||
struct T { uint x; uint y; }
|
||||
function f(S memory s, T memory t, uint a) public {}
|
||||
function g() public returns (S memory s, T memory t, uint a) {}
|
||||
function f(S memory, T memory, uint) public pure {}
|
||||
function g() public pure returns (S memory, T memory, uint) {}
|
||||
}
|
||||
|
||||
would result in the JSON:
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ without a compiler change.
|
||||
|
||||
.. code::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
library GetCode {
|
||||
function at(address _addr) public view returns (bytes memory o_code) {
|
||||
@@ -136,7 +136,7 @@ Local Solidity variables are available for assignments, for example:
|
||||
|
||||
.. code::
|
||||
|
||||
pragma solidity >=0.4.11 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
contract C {
|
||||
uint b;
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
"yulOptimizer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "privateCanBeOverridden",
|
||||
"summary": "Private methods can be overridden by inheriting contracts.",
|
||||
"description": "While private methods of base contracts are not visible and cannot be called directly from the derived contract, it is still possible to declare a function of the same name and type and thus change the behaviour of the base contract's function.",
|
||||
"introduced": "0.3.0",
|
||||
"fixed": "0.5.17",
|
||||
"severity": "low"
|
||||
},
|
||||
{
|
||||
"name": "YulOptimizerRedundantAssignmentBreakContinue0.5",
|
||||
"summary": "The Yul optimizer can remove essential assignments to variables declared inside for loops when Yul's continue or break statement is used. You are unlikely to be affected if you do not use inline assembly with for loops and continue and break statements.",
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
},
|
||||
"0.3.0": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -232,6 +233,7 @@
|
||||
},
|
||||
"0.3.1": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -252,6 +254,7 @@
|
||||
},
|
||||
"0.3.2": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -272,6 +275,7 @@
|
||||
},
|
||||
"0.3.3": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -291,6 +295,7 @@
|
||||
},
|
||||
"0.3.4": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -310,6 +315,7 @@
|
||||
},
|
||||
"0.3.5": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -329,6 +335,7 @@
|
||||
},
|
||||
"0.3.6": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -346,6 +353,7 @@
|
||||
},
|
||||
"0.4.0": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -363,6 +371,7 @@
|
||||
},
|
||||
"0.4.1": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -380,6 +389,7 @@
|
||||
},
|
||||
"0.4.10": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -395,6 +405,7 @@
|
||||
},
|
||||
"0.4.11": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -409,6 +420,7 @@
|
||||
},
|
||||
"0.4.12": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -422,6 +434,7 @@
|
||||
},
|
||||
"0.4.13": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -435,6 +448,7 @@
|
||||
},
|
||||
"0.4.14": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -447,6 +461,7 @@
|
||||
},
|
||||
"0.4.15": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -458,6 +473,7 @@
|
||||
},
|
||||
"0.4.16": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -471,6 +487,7 @@
|
||||
},
|
||||
"0.4.17": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -485,6 +502,7 @@
|
||||
},
|
||||
"0.4.18": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -498,6 +516,7 @@
|
||||
},
|
||||
"0.4.19": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -512,6 +531,7 @@
|
||||
},
|
||||
"0.4.2": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -528,6 +548,7 @@
|
||||
},
|
||||
"0.4.20": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -542,6 +563,7 @@
|
||||
},
|
||||
"0.4.21": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -556,6 +578,7 @@
|
||||
},
|
||||
"0.4.22": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -570,6 +593,7 @@
|
||||
},
|
||||
"0.4.23": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -583,6 +607,7 @@
|
||||
},
|
||||
"0.4.24": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -596,6 +621,7 @@
|
||||
},
|
||||
"0.4.25": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -607,6 +633,7 @@
|
||||
},
|
||||
"0.4.26": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2"
|
||||
@@ -615,6 +642,7 @@
|
||||
},
|
||||
"0.4.3": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -630,6 +658,7 @@
|
||||
},
|
||||
"0.4.4": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
"NestedArrayFunctionCallDecoder",
|
||||
@@ -644,6 +673,7 @@
|
||||
},
|
||||
"0.4.5": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
@@ -660,6 +690,7 @@
|
||||
},
|
||||
"0.4.6": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
"ExpExponentCleanup",
|
||||
@@ -675,6 +706,7 @@
|
||||
},
|
||||
"0.4.7": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -690,6 +722,7 @@
|
||||
},
|
||||
"0.4.8": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -705,6 +738,7 @@
|
||||
},
|
||||
"0.4.9": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"UninitializedFunctionPointerInConstructor_0.4.x",
|
||||
"IncorrectEventSignatureInLibraries_0.4.x",
|
||||
@@ -720,6 +754,7 @@
|
||||
},
|
||||
"0.5.0": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -731,6 +766,7 @@
|
||||
},
|
||||
"0.5.1": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -742,6 +778,7 @@
|
||||
},
|
||||
"0.5.10": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5",
|
||||
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers"
|
||||
],
|
||||
@@ -749,24 +786,28 @@
|
||||
},
|
||||
"0.5.11": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5"
|
||||
],
|
||||
"released": "2019-08-12"
|
||||
},
|
||||
"0.5.12": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5"
|
||||
],
|
||||
"released": "2019-10-01"
|
||||
},
|
||||
"0.5.13": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5"
|
||||
],
|
||||
"released": "2019-11-14"
|
||||
},
|
||||
"0.5.14": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5",
|
||||
"ABIEncoderV2LoopYulOptimizer"
|
||||
],
|
||||
@@ -774,16 +815,24 @@
|
||||
},
|
||||
"0.5.15": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5"
|
||||
],
|
||||
"released": "2019-12-17"
|
||||
},
|
||||
"0.5.16": {
|
||||
"bugs": [],
|
||||
"bugs": [
|
||||
"privateCanBeOverridden"
|
||||
],
|
||||
"released": "2020-01-02"
|
||||
},
|
||||
"0.5.17": {
|
||||
"bugs": [],
|
||||
"released": "2020-03-17"
|
||||
},
|
||||
"0.5.2": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -795,6 +844,7 @@
|
||||
},
|
||||
"0.5.3": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -806,6 +856,7 @@
|
||||
},
|
||||
"0.5.4": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -817,6 +868,7 @@
|
||||
},
|
||||
"0.5.5": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
"DynamicConstructorArgumentsClippedABIV2",
|
||||
@@ -830,6 +882,7 @@
|
||||
},
|
||||
"0.5.6": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
@@ -843,6 +896,7 @@
|
||||
},
|
||||
"0.5.7": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers",
|
||||
"SignedArrayStorageCopy",
|
||||
"ABIEncoderV2StorageArrayWithMultiSlotElement",
|
||||
@@ -854,6 +908,7 @@
|
||||
},
|
||||
"0.5.8": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5",
|
||||
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers",
|
||||
"SignedArrayStorageCopy",
|
||||
@@ -864,6 +919,7 @@
|
||||
},
|
||||
"0.5.9": {
|
||||
"bugs": [
|
||||
"privateCanBeOverridden",
|
||||
"YulOptimizerRedundantAssignmentBreakContinue0.5",
|
||||
"ABIEncoderV2CalldataStructsWithStaticallySizedAndDynamicallyEncodedMembers",
|
||||
"SignedArrayStorageCopy",
|
||||
|
||||
@@ -13,7 +13,7 @@ This can be done by using the ``abstract`` keyword as shown in the following exa
|
||||
defined as abstract, because the function ``utterance()`` was defined, but no implementation was
|
||||
provided (no implementation body ``{ }`` was given).::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
abstract contract Feline {
|
||||
function utterance() public virtual returns (bytes32);
|
||||
|
||||
@@ -335,7 +335,7 @@ operations as long as there is enough gas passed on to it.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.6.1 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
contract Test {
|
||||
// This function is called for all messages sent to
|
||||
|
||||
@@ -154,7 +154,7 @@ A call to ``Final.destroy()`` will call ``Base2.destroy`` because we specify it
|
||||
explicitly in the final override, but this function will bypass
|
||||
``Base1.destroy``. The way around this is to use ``super``::
|
||||
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract owned {
|
||||
constructor() public { owner = msg.sender; }
|
||||
@@ -204,7 +204,7 @@ use the ``override`` keyword in the function header as shown in this example:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract Base
|
||||
{
|
||||
@@ -227,7 +227,7 @@ bases, it has to explicitly override it:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract Base1
|
||||
{
|
||||
@@ -253,7 +253,7 @@ that already overrides all other functions.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract A { function f() public pure{} }
|
||||
contract B is A {}
|
||||
@@ -293,7 +293,7 @@ of the variable:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract A
|
||||
{
|
||||
@@ -324,7 +324,7 @@ and the ``override`` keyword must be used in the overriding modifier:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract Base
|
||||
{
|
||||
@@ -342,7 +342,7 @@ explicitly:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract Base1
|
||||
{
|
||||
@@ -498,7 +498,7 @@ One area where inheritance linearization is especially important and perhaps not
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
contract Base1 {
|
||||
constructor() public {}
|
||||
|
||||
@@ -22,7 +22,7 @@ Interfaces are denoted by their own keyword:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
interface Token {
|
||||
enum TokenType { Fungible, NonFungible }
|
||||
@@ -42,7 +42,7 @@ inheritance.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.6.1 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
interface ParentA {
|
||||
function test() external returns (uint256);
|
||||
|
||||
@@ -47,12 +47,14 @@ more advanced example to implement a set).
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
|
||||
// We define a new struct datatype that will be used to
|
||||
// hold its data in the calling contract.
|
||||
struct Data { mapping(uint => bool) flags; }
|
||||
struct Data {
|
||||
mapping(uint => bool) flags;
|
||||
}
|
||||
|
||||
library Set {
|
||||
// Note that the first parameter is of type "storage
|
||||
@@ -123,7 +125,7 @@ custom types without the overhead of external function calls:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
struct bigint {
|
||||
uint[] limbs;
|
||||
@@ -237,7 +239,7 @@ Its value can be obtained from Solidity using the ``.selector`` member as follow
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.5.13 <0.8.0;
|
||||
pragma solidity >=0.5.14 <0.8.0;
|
||||
|
||||
library L {
|
||||
function f(uint256) external {}
|
||||
|
||||
@@ -29,7 +29,7 @@ may only be used inside a contract, not inside any of its functions.
|
||||
Let us rewrite the set example from the
|
||||
:ref:`libraries` in this way::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
|
||||
// This is the same code as before, just without comments
|
||||
|
||||
@@ -68,7 +68,7 @@ In the following example, ``D``, can call ``c.getData()`` to retrieve the value
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
contract C {
|
||||
uint private data;
|
||||
@@ -112,7 +112,7 @@ when they are declared.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
contract C {
|
||||
uint public data = 42;
|
||||
@@ -151,7 +151,7 @@ to write a function, for example:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
contract arrayExample {
|
||||
// public state variable
|
||||
|
||||
@@ -41,7 +41,7 @@ Internal Function Calls
|
||||
Functions of the current contract can be called directly ("internally"), also recursively, as seen in
|
||||
this nonsensical example::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
contract C {
|
||||
function g(uint a) public pure returns (uint ret) { return a + f(); }
|
||||
@@ -82,7 +82,7 @@ to the total balance of that contract:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
contract InfoFeed {
|
||||
function info() public payable returns (uint ret) { return 42; }
|
||||
@@ -160,7 +160,7 @@ Those parameters will still be present on the stack, but they are inaccessible.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
contract C {
|
||||
// omitted name for parameter
|
||||
@@ -183,7 +183,7 @@ is compiled so recursive creation-dependencies are not possible.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
contract D {
|
||||
uint public x;
|
||||
@@ -238,7 +238,7 @@ which only need to be created if there is a dispute.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.6.1 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
contract D {
|
||||
uint public x;
|
||||
@@ -307,7 +307,7 @@ groupings of expressions.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >0.4.23 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
|
||||
contract C {
|
||||
uint index;
|
||||
@@ -352,7 +352,7 @@ because only a reference and not a copy is passed.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
contract C {
|
||||
uint[20] x;
|
||||
|
||||
@@ -24,7 +24,7 @@ to receive their money - contracts cannot activate themselves.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
|
||||
contract SimpleAuction {
|
||||
// Parameters of the auction. Times are either
|
||||
|
||||
@@ -338,7 +338,7 @@ The full contract
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.24 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
|
||||
contract SimplePaymentChannel {
|
||||
address payable public sender; // The account sending payments.
|
||||
|
||||
@@ -19,7 +19,7 @@ and the sum of all balances is an invariant across the lifetime of the contract.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
|
||||
library Balances {
|
||||
function move(mapping(address => uint256) storage balances, address from, address to, uint amount) internal {
|
||||
|
||||
@@ -25,7 +25,7 @@ you can use state machine-like constructs inside a contract.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
|
||||
contract Purchase {
|
||||
uint public value;
|
||||
|
||||
@@ -17,7 +17,7 @@ Storage Example
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
contract SimpleStorage {
|
||||
uint storedData;
|
||||
|
||||
@@ -284,7 +284,7 @@ for the two function parameters and two return variables.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.21 <0.8.0;
|
||||
|
||||
/** @title Shape calculator. */
|
||||
contract ShapeCalculator {
|
||||
|
||||
@@ -81,7 +81,7 @@ as it uses ``call`` which forwards all remaining gas by default:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.6.2 <0.8.0;
|
||||
|
||||
// THIS CONTRACT CONTAINS A BUG - DO NOT USE
|
||||
contract Fund {
|
||||
@@ -277,7 +277,7 @@ field of a ``struct`` that is the base type of a dynamic storage array. The
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract Map {
|
||||
mapping (uint => uint)[] array;
|
||||
|
||||
@@ -109,7 +109,7 @@ Yes::
|
||||
|
||||
No::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
abstract contract A {
|
||||
function spam() virtual pure public;
|
||||
@@ -326,7 +326,7 @@ Yes::
|
||||
|
||||
No::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract A {
|
||||
|
||||
@@ -745,7 +745,7 @@ manner as modifiers if the function declaration is long or hard to read.
|
||||
|
||||
Yes::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
// Base contracts just to make this compile
|
||||
contract B {
|
||||
@@ -777,7 +777,7 @@ Yes::
|
||||
|
||||
No::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
|
||||
// Base contracts just to make this compile
|
||||
@@ -1000,7 +1000,7 @@ As shown in the example below, if the contract name is `Congress` and the librar
|
||||
|
||||
Yes::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
|
||||
// Owned.sol
|
||||
@@ -1034,7 +1034,7 @@ and in ``Congress.sol``::
|
||||
|
||||
No::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
|
||||
// owned.sol
|
||||
@@ -1138,7 +1138,7 @@ multiline comment starting with `/**` and ending with `*/`.
|
||||
For example, the contract from `a simple smart contract <simple-smart-contract>`_ with the comments
|
||||
added looks like the one below::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
|
||||
/// @author The Solidity Team
|
||||
|
||||
@@ -66,7 +66,7 @@ The example below uses ``_allowances`` to record the amount someone else is allo
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.22 <0.8.0;
|
||||
|
||||
contract MappingExample {
|
||||
|
||||
@@ -120,7 +120,7 @@ the ``sum`` function iterates over to sum all the values.
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.5.99 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
struct IndexValue { uint keyIndex; uint value; }
|
||||
struct KeyFlag { uint key; bool deleted; }
|
||||
|
||||
@@ -57,7 +57,7 @@ Data locations are not only relevant for persistency of data, but also for the s
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.5.0 <0.8.0;
|
||||
|
||||
contract C {
|
||||
// The data location of x is storage.
|
||||
@@ -268,7 +268,7 @@ Array Members
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract ArrayContract {
|
||||
uint[2**20] m_aLotOfIntegers;
|
||||
@@ -400,7 +400,7 @@ Array slices are useful to ABI-decode secondary data passed in function paramete
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.99 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
contract Proxy {
|
||||
/// Address of the client contract managed by proxy i.e., this contract
|
||||
@@ -437,7 +437,7 @@ shown in the following example:
|
||||
|
||||
::
|
||||
|
||||
pragma solidity >=0.4.11 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
// Defines a new type with two fields.
|
||||
// Declaring a struct outside of a contract allows
|
||||
|
||||
@@ -300,6 +300,11 @@ All three functions ``call``, ``delegatecall`` and ``staticcall`` are very low-l
|
||||
The ``gas`` option is available on all three methods, while the ``value`` option is not
|
||||
supported for ``delegatecall``.
|
||||
|
||||
.. note::
|
||||
It is best to avoid relying on hardcoded gas values in your smart contract code,
|
||||
regardless of whether state is read from or written to, as this can have many pitfalls.
|
||||
Also, access to gas might change in the future.
|
||||
|
||||
.. note::
|
||||
All contracts can be converted to ``address`` type, so it is possible to query the balance of the
|
||||
current contract using ``address(this).balance``.
|
||||
@@ -645,7 +650,7 @@ External (or public) functions have the following members:
|
||||
|
||||
Example that shows how to use the members::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
// This will report a warning
|
||||
|
||||
contract Example {
|
||||
@@ -665,7 +670,6 @@ Example that shows how to use internal function types::
|
||||
|
||||
pragma solidity >=0.4.16 <0.8.0;
|
||||
|
||||
|
||||
library ArrayUtils {
|
||||
// internal functions can be used in internal library functions because
|
||||
// they will be part of the same code context
|
||||
|
||||
@@ -687,7 +687,7 @@ The command above applies all changes as shown below. Please review them careful
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
pragma solidity >0.4.23;
|
||||
pragma solidity >=0.6.0 <0.7.0;
|
||||
|
||||
abstract contract Updateable {
|
||||
function run() public view virtual returns (bool);
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ Stand-Alone Usage
|
||||
=================
|
||||
|
||||
You can use Yul in its stand-alone form in the EVM dialect using the Solidity compiler.
|
||||
This will use the `Yul object notation <yul-objects>`_ so that it is possible to refer
|
||||
This will use the :ref:`Yul object notation <yul-object>` so that it is possible to refer
|
||||
to code as data to deploy contracts. This Yul mode is available for the commandline compiler
|
||||
(use ``--strict-assembly``) and for the :ref:`standard-json interface <compiler-api>`:
|
||||
|
||||
@@ -146,7 +146,7 @@ so you can e.g. use ``//`` and ``/* */`` to denote comments.
|
||||
There is one exception: Identifiers in Yul can contain dots: ``.``.
|
||||
|
||||
Yul can specify "objects" that consist of code, data and sub-objects.
|
||||
Please see `Yul Objects <yul-objects>`_ below for details on that.
|
||||
Please see :ref:`Yul Objects <yul-object>` below for details on that.
|
||||
In this section, we are only concerned with the code part of such an object.
|
||||
This code part always consists of a curly-braces
|
||||
delimited block. Most tools support specifying just a code block
|
||||
|
||||
Reference in New Issue
Block a user