@ -15,7 +15,7 @@ tape('ContractParameters - (TxFormat.buildData) - format input parameters', func
output = JSON . parse ( output )
output = JSON . parse ( output )
var contract = output . contracts [ 'test.sol' ] [ 'uintContractTest' ]
var contract = output . contracts [ 'test.sol' ] [ 'uintContractTest' ]
context = { output , contract }
context = { output , contract }
var bytecode = '608060405234801561001057600080fd5b50610111806100206000396000f300 608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b348015604f57600080fd5b5060966004803603 8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506098 565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505600a165627a7a7230582028c4b7d4bd450fb198ccfdf15510df1721e4f8abda2487d4b452c533bed8880b 0029'
var bytecode = '608060405234801561001057600080fd5b5061011e806100206000396000f3fe 608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b348015604f57600080fd5b5060a360048036036060811015606457600080fd5b 8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505060a5 565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505056fea165627a7a7230582053a6bee96a62b9079722b2a0004a405aa29803abc12ed6dd0322007ebb44a5f6 0029'
t . test ( '(TxFormat.buildData)' , function ( st ) {
t . test ( '(TxFormat.buildData)' , function ( st ) {
st . plan ( 3 )
st . plan ( 3 )
testWithInput ( st , '123123, "0xf7a10e525d4b168f45f74db1b61f63d3e7619ea8", "34"' , bytecode + '000000000000000000000000000000000000000000000000000000000001e0f3000000000000000000000000f7a10e525d4b168f45f74db1b61f63d3e7619ea80000000000000000000000000000000000000000000000000000000000000022' )
testWithInput ( st , '123123, "0xf7a10e525d4b168f45f74db1b61f63d3e7619ea8", "34"' , bytecode + '000000000000000000000000000000000000000000000000000000000001e0f3000000000000000000000000f7a10e525d4b168f45f74db1b61f63d3e7619ea80000000000000000000000000000000000000000000000000000000000000022' )
@ -29,7 +29,7 @@ function testWithInput (st, params, expected) {
txFormat . buildData ( 'uintContractTest' , context . contract , context . output . contracts , true , context . contract . abi [ 0 ] , params , ( error , data ) => {
txFormat . buildData ( 'uintContractTest' , context . contract , context . output . contracts , true , context . contract . abi [ 0 ] , params , ( error , data ) => {
if ( error ) { return st . fails ( error ) }
if ( error ) { return st . fails ( error ) }
console . log ( data )
console . log ( data )
st . equal ( data . dataHex , expected )
st . equal ( expected , data . dataHex )
} , ( ) => { } , ( ) => { } )
} , ( ) => { } , ( ) => { } )
}
}
@ -96,7 +96,8 @@ function testLinkLibrary2 (st, callbackDeployLibraries) {
'lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2' : '0xf7a10e525d4b168f45f74db1b61f63d3e7619e33'
'lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2' : '0xf7a10e525d4b168f45f74db1b61f63d3e7619e33'
}
}
}
}
var data = '608060405234801561001057600080fd5b5061026b806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14610046575b600080fd5b34801561005257600080fd5b5061005b61005d565b005b73f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156100bd57600080fd5b505af41580156100d1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561013557600080fd5b505af4158015610149573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156101ad57600080fd5b505af41580156101c1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561022557600080fd5b505af4158015610239573d6000803e3d6000fd5b505050505600a165627a7a7230582007a22a440570c53944d704e68b3fd4ba3ba4a0fba71c4abd66b195d87f065bcd0029'
var data = '608060405234801561001057600080fd5b5061026b806100206000396000f3fe608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14610046575b600080fd5b34801561005257600080fd5b5061005b61005d565b005b73f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156100bd57600080fd5b505af41580156100d1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561013557600080fd5b505af4158015610149573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156101ad57600080fd5b505af41580156101c1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561022557600080fd5b505af4158015610239573d6000803e3d6000fd5b5050505056fea165627a7a72305820d2fdcf2968ba13c89dd82748af1cac609a670e333fce635bc2212c2a50508be70029'
var deployMsg = [ 'creation of library test.sol:lib1 pending...' ,
var deployMsg = [ 'creation of library test.sol:lib1 pending...' ,
'creation of library test.sol:lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2 pending...' ]
'creation of library test.sol:lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2 pending...' ]
@ -216,26 +217,26 @@ tape('test abiEncoderV2 array of tuple', function (t) {
var uintContract = ` contract uintContractTest {
var uintContract = ` contract uintContractTest {
uint _tp ;
uint _tp ;
address _ap ;
address _ap ;
function test ( uint _t , address _a , uint _i ) {
function test ( uint _t , address _a , uint _i ) public {
_tp = _t ;
_tp = _t ;
_ap = _a ;
_ap = _a ;
}
}
} `
} `
var deploySimpleLib = ` pragma solidity ^0.4.4 ;
var deploySimpleLib = ` pragma solidity ^0.5.0 ;
library lib1 {
library lib1 {
function getEmpty ( ) {
function getEmpty ( ) public {
}
}
}
}
library lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 {
library lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 {
function getEmpty ( ) {
function getEmpty ( ) public {
}
}
}
}
contract testContractLinkLibrary {
contract testContractLinkLibrary {
function get ( ) {
function get ( ) public {
lib1 . getEmpty ( ) ;
lib1 . getEmpty ( ) ;
lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 . getEmpty ( ) ;
lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 . getEmpty ( ) ;
lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 . getEmpty ( ) ;
lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 _lib2 . getEmpty ( ) ;
@ -243,22 +244,20 @@ contract testContractLinkLibrary {
}
}
} `
} `
var encodeFunctionCall = ` pragma solidity ^0.4.4 ;
var encodeFunctionCall = ` pragma solidity ^0.5.0 ;
contract testContractLinkLibrary {
contract testContractLinkLibrary {
function get ( uint _p , string _o ) {
function get ( uint _p , string memory _o ) public {
}
}
} `
} `
var fallbackFunction = ` pragma solidity ^0.4.4 ;
var fallbackFunction = ` pragma solidity ^0.5.0 ;
contract fallbackFunctionContract {
contract fallbackFunctionContract {
function get ( uint _p , string _o ) {
function get ( uint _p , string memory _o ) public {
}
}
function ( ) { }
function ( ) external { }
} `
} `
var abiEncoderV2 = ` pragma experimental ABIEncoderV2;
var abiEncoderV2 = ` pragma experimental ABIEncoderV2;
@ -269,12 +268,12 @@ contract test {
uint b ;
uint b ;
string s ;
string s ;
}
}
function t ( p _p , uint _i ) returns ( p ) {
function t ( p memory _p , uint _i ) public returns ( p memory ) {
return _p ;
return _p ;
}
}
function t ( ) returns ( p ) {
function t ( ) public returns ( p memory ) {
p mm ;
p memory m m ;
mm . a = 123 ;
mm . a = 123 ;
mm . b = 133 ;
mm . b = 133 ;
return mm ;
return mm ;
@ -284,17 +283,17 @@ contract test {
var abiEncoderV2ArrayOfTuple = ` pragma experimental ABIEncoderV2;
var abiEncoderV2ArrayOfTuple = ` pragma experimental ABIEncoderV2;
contract test {
contract test {
struct MyStruct { uint256 num ; string _string ; }
struct MyStruct { uint256 num ; string _string ; }
constructor ( MyStruct [ ] _structs , string _str ) {
constructor ( MyStruct [ ] memory _structs , string memory _str ) public {
}
}
function addStructs ( MyStruct [ ] _structs ) public returns ( MyStruct [ ] strucmts ) {
function addStructs ( MyStruct [ ] memory _structs ) public returns ( MyStruct [ ] memory strucmts ) {
strucmts = _structs ;
strucmts = _structs ;
}
}
function addStructs ( MyStruct _structs ) public returns ( MyStruct _strucmts ) {
function addStructs ( MyStruct memory _structs ) public returns ( MyStruct memory _strucmts ) {
_strucmts = _structs ;
_strucmts = _structs ;
}
}
} `
} `