Date: Mon, 1 Oct 2018 17:23:37 +0100
Subject: [PATCH 09/32] Update deprecated contracts
---
.../test/resources/solidity/arrays/Arrays.sol | 10 +--
.../solidity/arrays/build/Arrays.abi | 2 +-
.../solidity/arrays/build/Arrays.bin | 2 +-
.../solidity/contracts/HumanStandardToken.sol | 14 ++--
.../contracts/HumanStandardTokenFactory.sol | 8 +-
.../solidity/contracts/StandardToken.sol | 16 ++--
.../resources/solidity/contracts/Token.sol | 10 +--
.../contracts/build/HumanStandardToken.bin | 2 +-
.../contracts/build/StandardToken.bin | 2 +-
.../solidity/fibonacci/Fibonacci.sol | 6 +-
.../solidity/fibonacci/build/Fibonacci.bin | 2 +-
.../resources/solidity/greeter/Greeter.sol | 16 ++--
.../solidity/greeter/build/Greeter.abi | 1 +
.../solidity/greeter/build/Greeter.bin | 1 +
.../greeter/build/{mortal.abi => Mortal.abi} | 0
.../greeter/build/{mortal.bin => Mortal.bin} | 2 +-
.../solidity/greeter/build/greeter.abi | 1 -
.../solidity/greeter/build/greeter.bin | 1 -
.../solidity/simplestorage/SimpleStorage.sol | 6 +-
.../simplestorage/build/SimpleStorage.bin | 2 +-
.../resources/truffle/MetaCoin/MetaCoin.sol | 2 +-
.../test/java/org/web3j/generated/Arrays.java | 74 +++++++++++++------
.../java/org/web3j/generated/Fibonacci.java | 2 +-
.../java/org/web3j/generated/Greeter.java | 12 ++-
.../web3j/generated/HumanStandardToken.java | 2 +-
.../org/web3j/generated/SimpleStorage.java | 2 +-
26 files changed, 120 insertions(+), 78 deletions(-)
create mode 100644 codegen/src/test/resources/solidity/greeter/build/Greeter.abi
create mode 100644 codegen/src/test/resources/solidity/greeter/build/Greeter.bin
rename codegen/src/test/resources/solidity/greeter/build/{mortal.abi => Mortal.abi} (100%)
rename codegen/src/test/resources/solidity/greeter/build/{mortal.bin => Mortal.bin} (80%)
delete mode 100644 codegen/src/test/resources/solidity/greeter/build/greeter.abi
delete mode 100644 codegen/src/test/resources/solidity/greeter/build/greeter.bin
diff --git a/codegen/src/test/resources/solidity/arrays/Arrays.sol b/codegen/src/test/resources/solidity/arrays/Arrays.sol
index cca6dd47..2e011f39 100644
--- a/codegen/src/test/resources/solidity/arrays/Arrays.sol
+++ b/codegen/src/test/resources/solidity/arrays/Arrays.sol
@@ -2,7 +2,7 @@ pragma solidity ^0.4.2;
contract Arrays {
- function fixedReverse(uint[10] input) returns(uint[10] result) {
+ function fixedReverse(uint[10] input) public pure returns(uint[10] result) {
uint length = input.length;
for (uint i = 0; i < length; i++) {
result[i] = input[length - (i + 1)];
@@ -10,7 +10,7 @@ contract Arrays {
return result;
}
- function dynamicReverse(uint[] input) returns (uint[] result) {
+ function dynamicReverse(uint[] input) public pure returns (uint[] result) {
uint length = input.length;
result = new uint[](length);
@@ -20,7 +20,7 @@ contract Arrays {
return result;
}
- function multiDynamic(uint[2][] input) returns (uint[] result) {
+ function multiDynamic(uint[2][] input) public pure returns (uint[] result) {
uint length = input.length;
result = new uint[](length*2);
uint resultIndex = 0;
@@ -33,7 +33,7 @@ contract Arrays {
return result;
}
- function multiFixed(uint[2][6] input) returns (uint[] result) {
+ function multiFixed(uint[2][6] input) public pure returns (uint[] result) {
uint length = input.length;
result = new uint[](length*2);
uint resultIndex = 0;
@@ -46,7 +46,7 @@ contract Arrays {
return result;
}
- function returnArray() constant returns (address[]) {
+ function returnArray() public pure returns (address[]) {
return new address[](0);
}
}
diff --git a/codegen/src/test/resources/solidity/arrays/build/Arrays.abi b/codegen/src/test/resources/solidity/arrays/build/Arrays.abi
index 98503a38..f974c988 100644
--- a/codegen/src/test/resources/solidity/arrays/build/Arrays.abi
+++ b/codegen/src/test/resources/solidity/arrays/build/Arrays.abi
@@ -1 +1 @@
-[{"constant":false,"inputs":[{"name":"input","type":"uint256[2][]"}],"name":"multiDynamic","outputs":[{"name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"returnArray","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"input","type":"uint256[2][6]"}],"name":"multiFixed","outputs":[{"name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"input","type":"uint256[10]"}],"name":"fixedReverse","outputs":[{"name":"result","type":"uint256[10]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"input","type":"uint256[]"}],"name":"dynamicReverse","outputs":[{"name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]
\ No newline at end of file
+[{"constant":true,"inputs":[{"name":"input","type":"uint256[2][]"}],"name":"multiDynamic","outputs":[{"name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"returnArray","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"input","type":"uint256[2][6]"}],"name":"multiFixed","outputs":[{"name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"input","type":"uint256[10]"}],"name":"fixedReverse","outputs":[{"name":"result","type":"uint256[10]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"input","type":"uint256[]"}],"name":"dynamicReverse","outputs":[{"name":"result","type":"uint256[]"}],"payable":false,"stateMutability":"pure","type":"function"}]
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/arrays/build/Arrays.bin b/codegen/src/test/resources/solidity/arrays/build/Arrays.bin
index f4b9d732..fc64a58c 100644
--- a/codegen/src/test/resources/solidity/arrays/build/Arrays.bin
+++ b/codegen/src/test/resources/solidity/arrays/build/Arrays.bin
@@ -1 +1 @@
-608060405234801561001057600080fd5b50610546806100206000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633a69db9481146100715780633cac14c814610149578063a30cc5f61461015e578063b96f54d1146101d2578063beda363b14610250575b600080fd5b34801561007d57600080fd5b506040805160048035808201356020818102850181019095528084526100f9943694602493909290840191819060009085015b828210156100e95760408051808201825290808402870190600290839083908082843750505091835250506001909101906020016100b0565b509396506102a595505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390f35b34801561015557600080fd5b506100f9610371565b34801561016a57600080fd5b506040805160c081019091526100f9903690600490610184908260066000835b828210156101c357604080518082018252908084028601906002908390839080828437505050918352505060019091019060200161018a565b50929550610383945050505050565b3480156101de57600080fd5b506040805161014081810190925261021791369160049161014491908390600a9083908390808284375093965061042e95505050505050565b604051808261014080838360005b8381101561023d578181015183820152602001610225565b5050505090500191505060405180910390f35b34801561025c57600080fd5b50604080516020600480358082013583810280860185019096528085526100f99536959394602494938501929182918501908490808284375094975061047a9650505050505050565b6060600080600084519250826002026040519080825280602002602001820160405280156102dd578160200160208202803883390190505b50935060009150600090505b828110156103695784818151811015156102ff57fe5b602090810291909101015151845185908490811061031957fe5b60209081029091010152845160019092019185908290811061033757fe5b6020908102919091018101510151845185908490811061035357fe5b60209081029091010152600191820191016102e9565b505050919050565b60408051600081526020810190915290565b60408051600c8082526101a08201909252606091600691600091829190602082016101808038833901905050935060009150600090505b82811015610369578481600681106103ce57fe5b60200201515184518590849081106103e257fe5b602090810290910101526001909101908481600681106103fe57fe5b602002015160016020020151848381518110151561041857fe5b60209081029091010152600191820191016103ba565b6104366104fa565b600a60005b81811015610473578360001982840301600a811061045557fe5b60200201518382600a811061046657fe5b602002015260010161043b565b5050919050565b606060008083519150816040519080825280602002602001820160405280156104ad578160200160208202803883390190505b509250600090505b8181101561047357838160010183038151811015156104d057fe5b9060200190602002015183828151811015156104e857fe5b602090810290910101526001016104b5565b61014060405190810160405280600a9060208202803883395091929150505600a165627a7a72305820fc0f85eed8fd4527b6875523e756548fa874c98fb55ef5232fbff4131e190b990029
\ No newline at end of file
+608060405234801561001057600080fd5b50610546806100206000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633a69db9481146100715780633cac14c814610149578063a30cc5f61461015e578063b96f54d1146101d2578063beda363b14610250575b600080fd5b34801561007d57600080fd5b506040805160048035808201356020818102850181019095528084526100f9943694602493909290840191819060009085015b828210156100e95760408051808201825290808402870190600290839083908082843750505091835250506001909101906020016100b0565b509396506102a595505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390f35b34801561015557600080fd5b506100f9610371565b34801561016a57600080fd5b506040805160c081019091526100f9903690600490610184908260066000835b828210156101c357604080518082018252908084028601906002908390839080828437505050918352505060019091019060200161018a565b50929550610383945050505050565b3480156101de57600080fd5b506040805161014081810190925261021791369160049161014491908390600a9083908390808284375093965061042e95505050505050565b604051808261014080838360005b8381101561023d578181015183820152602001610225565b5050505090500191505060405180910390f35b34801561025c57600080fd5b50604080516020600480358082013583810280860185019096528085526100f99536959394602494938501929182918501908490808284375094975061047a9650505050505050565b6060600080600084519250826002026040519080825280602002602001820160405280156102dd578160200160208202803883390190505b50935060009150600090505b828110156103695784818151811015156102ff57fe5b602090810291909101015151845185908490811061031957fe5b60209081029091010152845160019092019185908290811061033757fe5b6020908102919091018101510151845185908490811061035357fe5b60209081029091010152600191820191016102e9565b505050919050565b60408051600081526020810190915290565b60408051600c8082526101a08201909252606091600691600091829190602082016101808038833901905050935060009150600090505b82811015610369578481600681106103ce57fe5b60200201515184518590849081106103e257fe5b602090810290910101526001909101908481600681106103fe57fe5b602002015160016020020151848381518110151561041857fe5b60209081029091010152600191820191016103ba565b6104366104fa565b600a60005b81811015610473578360001982840301600a811061045557fe5b60200201518382600a811061046657fe5b602002015260010161043b565b5050919050565b606060008083519150816040519080825280602002602001820160405280156104ad578160200160208202803883390190505b509250600090505b8181101561047357838160010183038151811015156104d057fe5b9060200190602002015183828151811015156104e857fe5b602090810290910101526001016104b5565b61014060405190810160405280600a9060208202803883395091929150505600a165627a7a72305820cb0cdc9f8f19935db0d46de8e33d40ebff1a1f1cdda4fa8537579264ab42d9cd0029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/contracts/HumanStandardToken.sol b/codegen/src/test/resources/solidity/contracts/HumanStandardToken.sol
index 47dc3088..f7684ae1 100644
--- a/codegen/src/test/resources/solidity/contracts/HumanStandardToken.sol
+++ b/codegen/src/test/resources/solidity/contracts/HumanStandardToken.sol
@@ -17,9 +17,9 @@ import "StandardToken.sol";
contract HumanStandardToken is StandardToken {
- function () {
+ function () public {
//if ether is sent to this address, send it back.
- throw;
+ revert();
}
/* Public variables of the token */
@@ -35,12 +35,12 @@ contract HumanStandardToken is StandardToken {
string public symbol; //An identifier: eg SBX
string public version = 'H0.1'; //human 0.1 standard. Just an arbitrary versioning scheme.
- function HumanStandardToken(
+ constructor(
uint256 _initialAmount,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol
- ) {
+ ) public {
balances[msg.sender] = _initialAmount; // Give the creator all initial tokens
totalSupply = _initialAmount; // Update total supply
name = _tokenName; // Set the name for display purposes
@@ -49,14 +49,14 @@ contract HumanStandardToken is StandardToken {
}
/* Approves and then calls the receiving contract */
- function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
+ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
- Approval(msg.sender, _spender, _value);
+ emit Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
- if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; }
+ if(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { revert(); }
return true;
}
}
diff --git a/codegen/src/test/resources/solidity/contracts/HumanStandardTokenFactory.sol b/codegen/src/test/resources/solidity/contracts/HumanStandardTokenFactory.sol
index 717b6e37..4d1f74ae 100644
--- a/codegen/src/test/resources/solidity/contracts/HumanStandardTokenFactory.sol
+++ b/codegen/src/test/resources/solidity/contracts/HumanStandardTokenFactory.sol
@@ -9,7 +9,7 @@ contract HumanStandardTokenFactory {
mapping(address => bool) public isHumanToken; //verify without having to do a bytecode check.
bytes public humanStandardByteCode;
- function HumanStandardTokenFactory() {
+ constructor() public {
//upon creation of the factory, deploy a HumanStandardToken (parameters are meaningless) and store the bytecode provably.
address verifiedToken = createHumanStandardToken(10000, "Verify Token", 3, "VTX");
humanStandardByteCode = codeAt(verifiedToken);
@@ -17,7 +17,7 @@ contract HumanStandardTokenFactory {
//verifies if a contract that has been deployed is a Human Standard Token.
//NOTE: This is a very expensive function, and should only be used in an eth_call. ~800k gas
- function verifyHumanStandardToken(address _tokenContract) returns (bool) {
+ function verifyHumanStandardToken(address _tokenContract) public returns (bool) {
bytes memory fetchedTokenByteCode = codeAt(_tokenContract);
if (fetchedTokenByteCode.length != humanStandardByteCode.length) {
@@ -36,7 +36,7 @@ contract HumanStandardTokenFactory {
//for now, keeping this internal. Ideally there should also be a live version of this that any contract can use, lib-style.
//retrieves the bytecode at a specific address.
- function codeAt(address _addr) internal returns (bytes o_code) {
+ function codeAt(address _addr) public internal returns (bytes o_code) {
assembly {
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
@@ -52,7 +52,7 @@ contract HumanStandardTokenFactory {
}
}
- function createHumanStandardToken(uint256 _initialAmount, string _name, uint8 _decimals, string _symbol) returns (address) {
+ function createHumanStandardToken(uint256 _initialAmount, string _name, uint8 _decimals, string _symbol) public returns (address) {
HumanStandardToken newToken = (new HumanStandardToken(_initialAmount, _name, _decimals, _symbol));
created[msg.sender].push(address(newToken));
diff --git a/codegen/src/test/resources/solidity/contracts/StandardToken.sol b/codegen/src/test/resources/solidity/contracts/StandardToken.sol
index e398c2b5..5824ae63 100644
--- a/codegen/src/test/resources/solidity/contracts/StandardToken.sol
+++ b/codegen/src/test/resources/solidity/contracts/StandardToken.sol
@@ -13,7 +13,7 @@ import "Token.sol";
contract StandardToken is Token {
- function transfer(address _to, uint256 _value) returns (bool success) {
+ function transfer(address _to, uint256 _value) public returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
@@ -21,34 +21,34 @@ contract StandardToken is Token {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
- Transfer(msg.sender, _to, _value);
+ emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
- function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
+ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
- Transfer(_from, _to, _value);
+ emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
- function balanceOf(address _owner) constant returns (uint256 balance) {
+ function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
- function approve(address _spender, uint256 _value) returns (bool success) {
+ function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
- Approval(msg.sender, _spender, _value);
+ emit Approval(msg.sender, _spender, _value);
return true;
}
- function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
+ function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
diff --git a/codegen/src/test/resources/solidity/contracts/Token.sol b/codegen/src/test/resources/solidity/contracts/Token.sol
index c1e10743..3b9dd3a8 100644
--- a/codegen/src/test/resources/solidity/contracts/Token.sol
+++ b/codegen/src/test/resources/solidity/contracts/Token.sol
@@ -18,31 +18,31 @@ contract Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
- function balanceOf(address _owner) constant returns (uint256 balance);
+ function balanceOf(address _owner) public constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
- function transfer(address _to, uint256 _value) returns (bool success);
+ function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
- function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
+ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
- function approve(address _spender, uint256 _value) returns (bool success);
+ function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender) constant returns (uint256 remaining);
+ function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
diff --git a/codegen/src/test/resources/solidity/contracts/build/HumanStandardToken.bin b/codegen/src/test/resources/solidity/contracts/build/HumanStandardToken.bin
index 1970d118..539b1dd3 100644
--- a/codegen/src/test/resources/solidity/contracts/build/HumanStandardToken.bin
+++ b/codegen/src/test/resources/solidity/contracts/build/HumanStandardToken.bin
@@ -1 +1 @@
-60c0604052600460808190527f48302e310000000000000000000000000000000000000000000000000000000060a090815261003e91600691906100d0565b5034801561004b57600080fd5b506040516109ab3803806109ab8339810160409081528151602080840151838501516060860151336000908152600185529586208590559484905590850180519395909491939101916100a3916003918601906100d0565b506004805460ff191660ff841617905580516100c69060059060208401906100d0565b505050505061016b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011157805160ff191683800117855561013e565b8280016001018555821561013e579182015b8281111561013e578251825591602001919060010190610123565b5061014a92915061014e565b5090565b61016891905b8082111561014a5760008155600101610154565b90565b6108318061017a6000396000f3006080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6104cc565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6104d5565b34801561020657600080fd5b5061017e600160a060020a0360043516610530565b34801561022757600080fd5b506100bc61054b565b34801561023c57600080fd5b50610155600160a060020a03600435166024356105a6565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061063f9650505050505050565b3480156102c957600080fd5b5061017e600160a060020a03600435811690602435166107da565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a038316600090815260016020526040812054821180159061042a5750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104365750600082115b156104c157600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016104c5565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526001602052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b3360009081526001602052604081205482118015906105c55750600082115b156106375733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016103d3565b5060006103d3565b336000818152600260209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b8381101561077f578181015183820152602001610767565b50505050905090810190601f1680156107ac5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156107d057600080fd5b5060019392505050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058201c19c961d60231958168e20ebab5d6476e694ee1dd7c9289cf444c6d9e38df7e0029
\ No newline at end of file
+60c0604052600460808190527f48302e310000000000000000000000000000000000000000000000000000000060a090815261003e91600691906100d0565b5034801561004b57600080fd5b506040516109ab3803806109ab8339810160409081528151602080840151838501516060860151336000908152600185529586208590559484905590850180519395909491939101916100a3916003918601906100d0565b506004805460ff191660ff841617905580516100c69060059060208401906100d0565b505050505061016b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011157805160ff191683800117855561013e565b8280016001018555821561013e579182015b8281111561013e578251825591602001919060010190610123565b5061014a92915061014e565b5090565b61016891905b8082111561014a5760008155600101610154565b90565b6108318061017a6000396000f3006080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6104cc565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6104d5565b34801561020657600080fd5b5061017e600160a060020a0360043516610530565b34801561022757600080fd5b506100bc61054b565b34801561023c57600080fd5b50610155600160a060020a03600435166024356105a6565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061063f9650505050505050565b3480156102c957600080fd5b5061017e600160a060020a03600435811690602435166107da565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a038316600090815260016020526040812054821180159061042a5750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104365750600082115b156104c157600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016104c5565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526001602052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b3360009081526001602052604081205482118015906105c55750600082115b156106375733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016103d3565b5060006103d3565b336000818152600260209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b8381101561077f578181015183820152602001610767565b50505050905090810190601f1680156107ac5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156107d057600080fd5b5060019392505050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058206e603c634e6d2ac6f989b2e2055cfbca683a30ca87aac8e0a9a6bb65e858050e0029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/contracts/build/StandardToken.bin b/codegen/src/test/resources/solidity/contracts/build/StandardToken.bin
index 2eb34393..ae4913b8 100644
--- a/codegen/src/test/resources/solidity/contracts/build/StandardToken.bin
+++ b/codegen/src/test/resources/solidity/contracts/build/StandardToken.bin
@@ -1 +1 @@
-608060405234801561001057600080fd5b506103d6806100206000396000f3006080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100b457806323b872dd146100db57806370a0823114610105578063a9059cbb14610126578063dd62ed3e1461014a575b600080fd5b34801561008857600080fd5b506100a0600160a060020a0360043516602435610171565b604080519115158252519081900360200190f35b3480156100c057600080fd5b506100c96101d8565b60408051918252519081900360200190f35b3480156100e757600080fd5b506100a0600160a060020a03600435811690602435166044356101de565b34801561011157600080fd5b506100c9600160a060020a03600435166102cb565b34801561013257600080fd5b506100a0600160a060020a03600435166024356102e6565b34801561015657600080fd5b506100c9600160a060020a036004358116906024351661037f565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a03831660009081526001602052604081205482118015906102295750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156102355750600082115b156102c057600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016102c4565b5060005b9392505050565b600160a060020a031660009081526001602052604090205490565b3360009081526001602052604081205482118015906103055750600082115b156103775733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016101d2565b5060006101d2565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058209b515d58fd0336ed30c6ff78772858cab8e1a31ed6584936bce54731542f79c80029
\ No newline at end of file
+608060405234801561001057600080fd5b506103d6806100206000396000f3006080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100b457806323b872dd146100db57806370a0823114610105578063a9059cbb14610126578063dd62ed3e1461014a575b600080fd5b34801561008857600080fd5b506100a0600160a060020a0360043516602435610171565b604080519115158252519081900360200190f35b3480156100c057600080fd5b506100c96101d8565b60408051918252519081900360200190f35b3480156100e757600080fd5b506100a0600160a060020a03600435811690602435166044356101de565b34801561011157600080fd5b506100c9600160a060020a03600435166102cb565b34801561013257600080fd5b506100a0600160a060020a03600435166024356102e6565b34801561015657600080fd5b506100c9600160a060020a036004358116906024351661037f565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a03831660009081526001602052604081205482118015906102295750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156102355750600082115b156102c057600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016102c4565b5060005b9392505050565b600160a060020a031660009081526001602052604090205490565b3360009081526001602052604081205482118015906103055750600082115b156103775733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016101d2565b5060006101d2565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a72305820c63a5e347eb028600e7edd426ec4008c97e223a93122a279c87b2053df5285010029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/fibonacci/Fibonacci.sol b/codegen/src/test/resources/solidity/fibonacci/Fibonacci.sol
index 9e1a1c8e..c3c8344b 100644
--- a/codegen/src/test/resources/solidity/fibonacci/Fibonacci.sol
+++ b/codegen/src/test/resources/solidity/fibonacci/Fibonacci.sol
@@ -4,14 +4,14 @@ contract Fibonacci {
event Notify(uint input, uint result);
- function fibonacci(uint number) constant returns(uint result) {
+ function fibonacci(uint number) public constant returns(uint result) {
if (number == 0) return 0;
else if (number == 1) return 1;
else return Fibonacci.fibonacci(number - 1) + Fibonacci.fibonacci(number - 2);
}
- function fibonacciNotify(uint number) returns(uint result) {
+ function fibonacciNotify(uint number) public returns(uint result) {
result = fibonacci(number);
- Notify(number, result);
+ emit Notify(number, result);
}
}
diff --git a/codegen/src/test/resources/solidity/fibonacci/build/Fibonacci.bin b/codegen/src/test/resources/solidity/fibonacci/build/Fibonacci.bin
index c9046bd4..920c828f 100644
--- a/codegen/src/test/resources/solidity/fibonacci/build/Fibonacci.bin
+++ b/codegen/src/test/resources/solidity/fibonacci/build/Fibonacci.bin
@@ -1 +1 @@
-608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a72305820c4ec03fb10cdd6bf64f4d1544ffb1cfbd033aaedffe67107fd541016a1ff57740029
\ No newline at end of file
+608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a723058209acf25d1bcddb7f4384fca6815063cfa89ffe456b82b5ad7135867f4b3d9d3500029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/greeter/Greeter.sol b/codegen/src/test/resources/solidity/greeter/Greeter.sol
index 77e0e095..f05415f1 100644
--- a/codegen/src/test/resources/solidity/greeter/Greeter.sol
+++ b/codegen/src/test/resources/solidity/greeter/Greeter.sol
@@ -3,28 +3,32 @@ pragma solidity ^0.4.2;
// Example taken from https://www.ethereum.org/greeter, also used in
// https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial#your-first-citizen-the-greeter
-contract mortal {
+contract Mortal {
/* Define variable owner of the type address*/
address owner;
/* this function is executed at initialization and sets the owner of the contract */
- function mortal() { owner = msg.sender; }
+ constructor() public { owner = msg.sender; }
/* Function to recover the funds on the contract */
- function kill() { if (msg.sender == owner) suicide(owner); }
+ function kill() public { if (msg.sender == owner) selfdestruct(owner); }
}
-contract greeter is mortal {
+contract Greeter is Mortal {
/* define variable greeting of the type string */
string greeting;
/* this runs when the contract is executed */
- function greeter(string _greeting) public {
+ constructor(string _greeting) public {
+ greeting = _greeting;
+ }
+
+ function newGreeting(string _greeting) public {
greeting = _greeting;
}
/* main function */
- function greet() constant returns (string) {
+ function greet() public view returns (string) {
return greeting;
}
}
diff --git a/codegen/src/test/resources/solidity/greeter/build/Greeter.abi b/codegen/src/test/resources/solidity/greeter/build/Greeter.abi
new file mode 100644
index 00000000..7d864ec6
--- /dev/null
+++ b/codegen/src/test/resources/solidity/greeter/build/Greeter.abi
@@ -0,0 +1 @@
+[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_greeting","type":"string"}],"name":"newGreeting","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/greeter/build/Greeter.bin b/codegen/src/test/resources/solidity/greeter/build/Greeter.bin
new file mode 100644
index 00000000..bf11cead
--- /dev/null
+++ b/codegen/src/test/resources/solidity/greeter/build/Greeter.bin
@@ -0,0 +1 @@
+608060405234801561001057600080fd5b5060405161040038038061040083398101604052805160008054600160a060020a0319163317905501805161004c906001906020840190610053565b50506100ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009457805160ff19168380011785556100c1565b828001600101855582156100c1579182015b828111156100c15782518255916020019190600101906100a6565b506100cd9291506100d1565b5090565b6100eb91905b808211156100cd57600081556001016100d7565b90565b610303806100fd6000396000f3006080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b5780634ac0d66e14610072578063cfae3217146100cb575b600080fd5b34801561006757600080fd5b50610070610155565b005b34801561007e57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526100709436949293602493928401919081908401838280828437509497506101929650505050505050565b3480156100d757600080fd5b506100e06101a9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011a578181015183820152602001610102565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff163314156101905760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b80516101a590600190602084019061023f565b5050565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156102345780601f1061020957610100808354040283529160200191610234565b820191906000526020600020905b81548152906001019060200180831161021757829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028057805160ff19168380011785556102ad565b828001600101855582156102ad579182015b828111156102ad578251825591602001919060010190610292565b506102b99291506102bd565b5090565b61023c91905b808211156102b957600081556001016102c35600a165627a7a723058207c7eee341550b207f947e9ace51cfc7c6132a1d7bf49efce9a6ffbfa910b7ae10029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/greeter/build/mortal.abi b/codegen/src/test/resources/solidity/greeter/build/Mortal.abi
similarity index 100%
rename from codegen/src/test/resources/solidity/greeter/build/mortal.abi
rename to codegen/src/test/resources/solidity/greeter/build/Mortal.abi
diff --git a/codegen/src/test/resources/solidity/greeter/build/mortal.bin b/codegen/src/test/resources/solidity/greeter/build/Mortal.bin
similarity index 80%
rename from codegen/src/test/resources/solidity/greeter/build/mortal.bin
rename to codegen/src/test/resources/solidity/greeter/build/Mortal.bin
index 1671353f..442247d7 100644
--- a/codegen/src/test/resources/solidity/greeter/build/mortal.bin
+++ b/codegen/src/test/resources/solidity/greeter/build/Mortal.bin
@@ -1 +1 @@
-608060405234801561001057600080fd5b5060008054600160a060020a0319163317905560bf806100316000396000f300608060405260043610603e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146043575b600080fd5b348015604e57600080fd5b5060556057565b005b60005473ffffffffffffffffffffffffffffffffffffffff1633141560915760005473ffffffffffffffffffffffffffffffffffffffff16ff5b5600a165627a7a72305820aefd7955b41b5bb5fa3e771946e6219101f3b6fd54dbfd6cf40b6c5f2f56ad370029
\ No newline at end of file
+608060405234801561001057600080fd5b5060008054600160a060020a0319163317905560bf806100316000396000f300608060405260043610603e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b581146043575b600080fd5b348015604e57600080fd5b5060556057565b005b60005473ffffffffffffffffffffffffffffffffffffffff1633141560915760005473ffffffffffffffffffffffffffffffffffffffff16ff5b5600a165627a7a723058205f4c9380976a2bc9bc290839e05144b0684717b705a34470e00b341e699657260029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/greeter/build/greeter.abi b/codegen/src/test/resources/solidity/greeter/build/greeter.abi
deleted file mode 100644
index 6cc8b9d2..00000000
--- a/codegen/src/test/resources/solidity/greeter/build/greeter.abi
+++ /dev/null
@@ -1 +0,0 @@
-[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/greeter/build/greeter.bin b/codegen/src/test/resources/solidity/greeter/build/greeter.bin
deleted file mode 100644
index ec91785e..00000000
--- a/codegen/src/test/resources/solidity/greeter/build/greeter.bin
+++ /dev/null
@@ -1 +0,0 @@
-608060405234801561001057600080fd5b506040516102ec3803806102ec83398101604052805160008054600160a060020a0319163317905501805161004c906001906020840190610053565b50506100ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009457805160ff19168380011785556100c1565b828001600101855582156100c1579182015b828111156100c15782518255916020019190600101906100a6565b506100cd9291506100d1565b5090565b6100eb91905b808211156100cd57600081556001016100d7565b90565b6101ef806100fd6000396000f30060806040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114610050578063cfae321714610067575b600080fd5b34801561005c57600080fd5b506100656100f1565b005b34801561007357600080fd5b5061007c61012e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff1633141561012c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101b95780601f1061018e576101008083540402835291602001916101b9565b820191906000526020600020905b81548152906001019060200180831161019c57829003601f168201915b50505050509050905600a165627a7a72305820e425c316c8344366d073a5ea6abfa8cf7f332c73c4473364519c6caedfe04dcf0029
\ No newline at end of file
diff --git a/codegen/src/test/resources/solidity/simplestorage/SimpleStorage.sol b/codegen/src/test/resources/solidity/simplestorage/SimpleStorage.sol
index 0c7ce22f..694d3bed 100644
--- a/codegen/src/test/resources/solidity/simplestorage/SimpleStorage.sol
+++ b/codegen/src/test/resources/solidity/simplestorage/SimpleStorage.sol
@@ -3,15 +3,15 @@ pragma solidity ^0.4.0;
contract SimpleStorage {
uint storedData;
- function SimpleStorage() {
+ constructor() public {
storedData = 5;
}
- function set(uint x) {
+ function set(uint x) public {
storedData = x;
}
- function get() constant returns (uint retVal) {
+ function get() public view returns (uint retVal) {
return storedData;
}
}
diff --git a/codegen/src/test/resources/solidity/simplestorage/build/SimpleStorage.bin b/codegen/src/test/resources/solidity/simplestorage/build/SimpleStorage.bin
index a9fccd42..6e6dd81c 100644
--- a/codegen/src/test/resources/solidity/simplestorage/build/SimpleStorage.bin
+++ b/codegen/src/test/resources/solidity/simplestorage/build/SimpleStorage.bin
@@ -1 +1 @@
-608060405234801561001057600080fd5b50600560005560bf806100246000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a7230582043daeabaa3ce46922d0af95ff9ceb18d946da5c845e6d8d7304864b377fd8d290029
\ No newline at end of file
+608060405234801561001057600080fd5b50600560005560bf806100246000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a72305820bf80fbb051cb310b6a5c5c6b0f1814770ad368bdae05716dd706b16c8c49a8da0029
\ No newline at end of file
diff --git a/codegen/src/test/resources/truffle/MetaCoin/MetaCoin.sol b/codegen/src/test/resources/truffle/MetaCoin/MetaCoin.sol
index 2658d046..fee5f560 100644
--- a/codegen/src/test/resources/truffle/MetaCoin/MetaCoin.sol
+++ b/codegen/src/test/resources/truffle/MetaCoin/MetaCoin.sol
@@ -12,7 +12,7 @@ contract MetaCoin {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
- function MetaCoin() public {
+ constructor() public {
balances[tx.origin] = 10000;
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/Arrays.java b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
index d59f3695..5ada5890 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Arrays.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
@@ -1,7 +1,6 @@
package org.web3j.generated;
import java.math.BigInteger;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.web3j.abi.TypeReference;
@@ -9,10 +8,11 @@
import org.web3j.abi.datatypes.DynamicArray;
import org.web3j.abi.datatypes.Function;
import org.web3j.abi.datatypes.Type;
+import org.web3j.abi.datatypes.generated.StaticArray10;
+import org.web3j.abi.datatypes.generated.Uint256;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.RemoteCall;
-import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
@@ -26,7 +26,7 @@
* Generated with web3j version 3.5.0.
*/
public class Arrays extends Contract {
- private static final String BINARY = "608060405234801561001057600080fd5b50610546806100206000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633a69db9481146100715780633cac14c814610149578063a30cc5f61461015e578063b96f54d1146101d2578063beda363b14610250575b600080fd5b34801561007d57600080fd5b506040805160048035808201356020818102850181019095528084526100f9943694602493909290840191819060009085015b828210156100e95760408051808201825290808402870190600290839083908082843750505091835250506001909101906020016100b0565b509396506102a595505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390f35b34801561015557600080fd5b506100f9610371565b34801561016a57600080fd5b506040805160c081019091526100f9903690600490610184908260066000835b828210156101c357604080518082018252908084028601906002908390839080828437505050918352505060019091019060200161018a565b50929550610383945050505050565b3480156101de57600080fd5b506040805161014081810190925261021791369160049161014491908390600a9083908390808284375093965061042e95505050505050565b604051808261014080838360005b8381101561023d578181015183820152602001610225565b5050505090500191505060405180910390f35b34801561025c57600080fd5b50604080516020600480358082013583810280860185019096528085526100f99536959394602494938501929182918501908490808284375094975061047a9650505050505050565b6060600080600084519250826002026040519080825280602002602001820160405280156102dd578160200160208202803883390190505b50935060009150600090505b828110156103695784818151811015156102ff57fe5b602090810291909101015151845185908490811061031957fe5b60209081029091010152845160019092019185908290811061033757fe5b6020908102919091018101510151845185908490811061035357fe5b60209081029091010152600191820191016102e9565b505050919050565b60408051600081526020810190915290565b60408051600c8082526101a08201909252606091600691600091829190602082016101808038833901905050935060009150600090505b82811015610369578481600681106103ce57fe5b60200201515184518590849081106103e257fe5b602090810290910101526001909101908481600681106103fe57fe5b602002015160016020020151848381518110151561041857fe5b60209081029091010152600191820191016103ba565b6104366104fa565b600a60005b81811015610473578360001982840301600a811061045557fe5b60200201518382600a811061046657fe5b602002015260010161043b565b5050919050565b606060008083519150816040519080825280602002602001820160405280156104ad578160200160208202803883390190505b509250600090505b8181101561047357838160010183038151811015156104d057fe5b9060200190602002015183828151811015156104e857fe5b602090810290910101526001016104b5565b61014060405190810160405280600a9060208202803883395091929150505600a165627a7a72305820fc0f85eed8fd4527b6875523e756548fa874c98fb55ef5232fbff4131e190b990029";
+ private static final String BINARY = "608060405234801561001057600080fd5b50610546806100206000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633a69db9481146100715780633cac14c814610149578063a30cc5f61461015e578063b96f54d1146101d2578063beda363b14610250575b600080fd5b34801561007d57600080fd5b506040805160048035808201356020818102850181019095528084526100f9943694602493909290840191819060009085015b828210156100e95760408051808201825290808402870190600290839083908082843750505091835250506001909101906020016100b0565b509396506102a595505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390f35b34801561015557600080fd5b506100f9610371565b34801561016a57600080fd5b506040805160c081019091526100f9903690600490610184908260066000835b828210156101c357604080518082018252908084028601906002908390839080828437505050918352505060019091019060200161018a565b50929550610383945050505050565b3480156101de57600080fd5b506040805161014081810190925261021791369160049161014491908390600a9083908390808284375093965061042e95505050505050565b604051808261014080838360005b8381101561023d578181015183820152602001610225565b5050505090500191505060405180910390f35b34801561025c57600080fd5b50604080516020600480358082013583810280860185019096528085526100f99536959394602494938501929182918501908490808284375094975061047a9650505050505050565b6060600080600084519250826002026040519080825280602002602001820160405280156102dd578160200160208202803883390190505b50935060009150600090505b828110156103695784818151811015156102ff57fe5b602090810291909101015151845185908490811061031957fe5b60209081029091010152845160019092019185908290811061033757fe5b6020908102919091018101510151845185908490811061035357fe5b60209081029091010152600191820191016102e9565b505050919050565b60408051600081526020810190915290565b60408051600c8082526101a08201909252606091600691600091829190602082016101808038833901905050935060009150600090505b82811015610369578481600681106103ce57fe5b60200201515184518590849081106103e257fe5b602090810290910101526001909101908481600681106103fe57fe5b602002015160016020020151848381518110151561041857fe5b60209081029091010152600191820191016103ba565b6104366104fa565b600a60005b81811015610473578360001982840301600a811061045557fe5b60200201518382600a811061046657fe5b602002015260010161043b565b5050919050565b606060008083519150816040519080825280602002602001820160405280156104ad578160200160208202803883390190505b509250600090505b8181101561047357838160010183038151811015156104d057fe5b9060200190602002015183828151811015156104e857fe5b602090810290910101526001016104b5565b61014060405190810160405280600a9060208202803883395091929150505600a165627a7a72305820cb0cdc9f8f19935db0d46de8e33d40ebff1a1f1cdda4fa8537579264ab42d9cd0029";
public static final String FUNC_MULTIDYNAMIC = "multiDynamic";
@@ -46,13 +46,20 @@ protected Arrays(String contractAddress, Web3j web3j, TransactionManager transac
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
- public RemoteCall multiDynamic(List> input) {
- final Function function = new Function(
- FUNC_MULTIDYNAMIC,
+ public RemoteCall multiDynamic(List> input) {
+ final Function function = new Function(FUNC_MULTIDYNAMIC,
java.util.Arrays.asList(new org.web3j.abi.datatypes.DynamicArray(
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.StaticArray2.class, org.web3j.abi.datatypes.generated.Uint256.class))),
- Collections.>emptyList());
- return executeRemoteCallTransaction(function);
+ java.util.Arrays.>asList(new TypeReference>() {}));
+ return new RemoteCall(
+ new Callable() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public List call() throws Exception {
+ List result = (List) executeCallSingleValueReturn(function, List.class);
+ return convertToNative(result);
+ }
+ });
}
public RemoteCall returnArray() {
@@ -70,31 +77,52 @@ public List call() throws Exception {
});
}
- public RemoteCall multiFixed(List> input) {
- final Function function = new Function(
- FUNC_MULTIFIXED,
+ public RemoteCall multiFixed(List> input) {
+ final Function function = new Function(FUNC_MULTIFIXED,
java.util.Arrays.asList(new org.web3j.abi.datatypes.generated.StaticArray6(
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.StaticArray2.class, org.web3j.abi.datatypes.generated.Uint256.class))),
- Collections.>emptyList());
- return executeRemoteCallTransaction(function);
+ java.util.Arrays.>asList(new TypeReference>() {}));
+ return new RemoteCall(
+ new Callable() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public List call() throws Exception {
+ List result = (List) executeCallSingleValueReturn(function, List.class);
+ return convertToNative(result);
+ }
+ });
}
- public RemoteCall fixedReverse(List input) {
- final Function function = new Function(
- FUNC_FIXEDREVERSE,
+ public RemoteCall fixedReverse(List input) {
+ final Function function = new Function(FUNC_FIXEDREVERSE,
java.util.Arrays.asList(new org.web3j.abi.datatypes.generated.StaticArray10(
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.Uint256.class))),
- Collections.>emptyList());
- return executeRemoteCallTransaction(function);
+ java.util.Arrays.>asList(new TypeReference>() {}));
+ return new RemoteCall(
+ new Callable() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public List call() throws Exception {
+ List result = (List) executeCallSingleValueReturn(function, List.class);
+ return convertToNative(result);
+ }
+ });
}
- public RemoteCall dynamicReverse(List input) {
- final Function function = new Function(
- FUNC_DYNAMICREVERSE,
+ public RemoteCall dynamicReverse(List input) {
+ final Function function = new Function(FUNC_DYNAMICREVERSE,
java.util.Arrays.asList(new org.web3j.abi.datatypes.DynamicArray(
org.web3j.abi.Utils.typeMap(input, org.web3j.abi.datatypes.generated.Uint256.class))),
- Collections.>emptyList());
- return executeRemoteCallTransaction(function);
+ java.util.Arrays.>asList(new TypeReference>() {}));
+ return new RemoteCall(
+ new Callable() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public List call() throws Exception {
+ List result = (List) executeCallSingleValueReturn(function, List.class);
+ return convertToNative(result);
+ }
+ });
}
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
diff --git a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
index fd261228..7358eb1a 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
@@ -33,7 +33,7 @@
* Generated with web3j version 3.5.0.
*/
public class Fibonacci extends Contract {
- private static final String BINARY = "608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a72305820c4ec03fb10cdd6bf64f4d1544ffb1cfbd033aaedffe67107fd541016a1ff57740029";
+ private static final String BINARY = "608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a723058209acf25d1bcddb7f4384fca6815063cfa89ffe456b82b5ad7135867f4b3d9d3500029";
public static final String FUNC_FIBONACCINOTIFY = "fibonacciNotify";
diff --git a/integration-tests/src/test/java/org/web3j/generated/Greeter.java b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
index cec7e2bb..7801eadd 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Greeter.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
@@ -25,10 +25,12 @@
*
Generated with web3j version 3.5.0.
*/
public class Greeter extends Contract {
- private static final String BINARY = "608060405234801561001057600080fd5b506040516102ec3803806102ec83398101604052805160008054600160a060020a0319163317905501805161004c906001906020840190610053565b50506100ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009457805160ff19168380011785556100c1565b828001600101855582156100c1579182015b828111156100c15782518255916020019190600101906100a6565b506100cd9291506100d1565b5090565b6100eb91905b808211156100cd57600081556001016100d7565b90565b6101ef806100fd6000396000f30060806040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b58114610050578063cfae321714610067575b600080fd5b34801561005c57600080fd5b506100656100f1565b005b34801561007357600080fd5b5061007c61012e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100b657818101518382015260200161009e565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff1633141561012c5760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156101b95780601f1061018e576101008083540402835291602001916101b9565b820191906000526020600020905b81548152906001019060200180831161019c57829003601f168201915b50505050509050905600a165627a7a72305820e425c316c8344366d073a5ea6abfa8cf7f332c73c4473364519c6caedfe04dcf0029";
+ private static final String BINARY = "608060405234801561001057600080fd5b5060405161040038038061040083398101604052805160008054600160a060020a0319163317905501805161004c906001906020840190610053565b50506100ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009457805160ff19168380011785556100c1565b828001600101855582156100c1579182015b828111156100c15782518255916020019190600101906100a6565b506100cd9291506100d1565b5090565b6100eb91905b808211156100cd57600081556001016100d7565b90565b610303806100fd6000396000f3006080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b5780634ac0d66e14610072578063cfae3217146100cb575b600080fd5b34801561006757600080fd5b50610070610155565b005b34801561007e57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526100709436949293602493928401919081908401838280828437509497506101929650505050505050565b3480156100d757600080fd5b506100e06101a9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011a578181015183820152602001610102565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff163314156101905760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b80516101a590600190602084019061023f565b5050565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156102345780601f1061020957610100808354040283529160200191610234565b820191906000526020600020905b81548152906001019060200180831161021757829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028057805160ff19168380011785556102ad565b828001600101855582156102ad579182015b828111156102ad578251825591602001919060010190610292565b506102b99291506102bd565b5090565b61023c91905b808211156102b957600081556001016102c35600a165627a7a723058207c7eee341550b207f947e9ace51cfc7c6132a1d7bf49efce9a6ffbfa910b7ae10029";
public static final String FUNC_KILL = "kill";
+ public static final String FUNC_NEWGREETING = "newGreeting";
+
public static final String FUNC_GREET = "greet";
protected Greeter(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
@@ -47,6 +49,14 @@ public RemoteCall kill() {
return executeRemoteCallTransaction(function);
}
+ public RemoteCall newGreeting(String _greeting) {
+ final Function function = new Function(
+ FUNC_NEWGREETING,
+ Arrays.asList(new org.web3j.abi.datatypes.Utf8String(_greeting)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
public RemoteCall greet() {
final Function function = new Function(FUNC_GREET,
Arrays.asList(),
diff --git a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
index cc51a111..2380db5f 100644
--- a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
+++ b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
@@ -37,7 +37,7 @@
* Generated with web3j version 3.5.0.
*/
public class HumanStandardToken extends Contract {
- private static final String BINARY = "60c0604052600460808190527f48302e310000000000000000000000000000000000000000000000000000000060a090815261003e91600691906100d0565b5034801561004b57600080fd5b506040516109ab3803806109ab8339810160409081528151602080840151838501516060860151336000908152600185529586208590559484905590850180519395909491939101916100a3916003918601906100d0565b506004805460ff191660ff841617905580516100c69060059060208401906100d0565b505050505061016b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011157805160ff191683800117855561013e565b8280016001018555821561013e579182015b8281111561013e578251825591602001919060010190610123565b5061014a92915061014e565b5090565b61016891905b8082111561014a5760008155600101610154565b90565b6108318061017a6000396000f3006080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6104cc565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6104d5565b34801561020657600080fd5b5061017e600160a060020a0360043516610530565b34801561022757600080fd5b506100bc61054b565b34801561023c57600080fd5b50610155600160a060020a03600435166024356105a6565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061063f9650505050505050565b3480156102c957600080fd5b5061017e600160a060020a03600435811690602435166107da565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a038316600090815260016020526040812054821180159061042a5750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104365750600082115b156104c157600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016104c5565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526001602052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b3360009081526001602052604081205482118015906105c55750600082115b156106375733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016103d3565b5060006103d3565b336000818152600260209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b8381101561077f578181015183820152602001610767565b50505050905090810190601f1680156107ac5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156107d057600080fd5b5060019392505050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058201c19c961d60231958168e20ebab5d6476e694ee1dd7c9289cf444c6d9e38df7e0029";
+ private static final String BINARY = "60c0604052600460808190527f48302e310000000000000000000000000000000000000000000000000000000060a090815261003e91600691906100d0565b5034801561004b57600080fd5b506040516109ab3803806109ab8339810160409081528151602080840151838501516060860151336000908152600185529586208590559484905590850180519395909491939101916100a3916003918601906100d0565b506004805460ff191660ff841617905580516100c69060059060208401906100d0565b505050505061016b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011157805160ff191683800117855561013e565b8280016001018555821561013e579182015b8281111561013e578251825591602001919060010190610123565b5061014a92915061014e565b5090565b61016891905b8082111561014a5760008155600101610154565b90565b6108318061017a6000396000f3006080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6104cc565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6104d5565b34801561020657600080fd5b5061017e600160a060020a0360043516610530565b34801561022757600080fd5b506100bc61054b565b34801561023c57600080fd5b50610155600160a060020a03600435166024356105a6565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061063f9650505050505050565b3480156102c957600080fd5b5061017e600160a060020a03600435811690602435166107da565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a038316600090815260016020526040812054821180159061042a5750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104365750600082115b156104c157600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016104c5565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526001602052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b3360009081526001602052604081205482118015906105c55750600082115b156106375733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016103d3565b5060006103d3565b336000818152600260209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b8381101561077f578181015183820152602001610767565b50505050905090810190601f1680156107ac5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156107d057600080fd5b5060019392505050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058206e603c634e6d2ac6f989b2e2055cfbca683a30ca87aac8e0a9a6bb65e858050e0029";
public static final String FUNC_NAME = "name";
diff --git a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
index 7362c60f..27ad3c2a 100644
--- a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
+++ b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
@@ -24,7 +24,7 @@
*
Generated with web3j version 3.5.0.
*/
public class SimpleStorage extends Contract {
- private static final String BINARY = "608060405234801561001057600080fd5b50600560005560bf806100246000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a7230582043daeabaa3ce46922d0af95ff9ceb18d946da5c845e6d8d7304864b377fd8d290029";
+ private static final String BINARY = "608060405234801561001057600080fd5b50600560005560bf806100246000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a72305820bf80fbb051cb310b6a5c5c6b0f1814770ad368bdae05716dd706b16c8c49a8da0029";
public static final String FUNC_SET = "set";
From 7255cee409afd494a37d6d74eafb7b97fd970297 Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Tue, 2 Oct 2018 17:21:01 +1000
Subject: [PATCH 10/32] #720: adding snapshot repo information into the readme
file
---
README.rst | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/README.rst b/README.rst
index af5d10b0..8b9a1622 100644
--- a/README.rst
+++ b/README.rst
@@ -134,6 +134,10 @@ Android:
3.3.1-android
+If you would like to use snapshots instead please add a new maven repository pointing to:
+https://oss.sonatype.org/content/repositories/snapshots
+into the relevant maven settings or POM file, please see: https://maven.apache.org/guides/mini/guide-multiple-repositories.html
+
Gradle
------
@@ -150,6 +154,15 @@ Android:
compile ('org.web3j:core:3.3.1-android')
+If you would like to use snapshots instead please add the following into your gradle script.
+
+.. code-block: groovy
+ repositories {
+ maven {
+ url "https://oss.sonatype.org/content/repositories/snapshots"
+ }
+ }
+
Start a client
--------------
From cd681b81a05b1952e7991902feb20ab87edc230b Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Tue, 2 Oct 2018 17:42:46 +1000
Subject: [PATCH 11/32] #720: adding snapshot repo information into the readme
file
---
README.rst | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/README.rst b/README.rst
index 8b9a1622..d9b7c758 100644
--- a/README.rst
+++ b/README.rst
@@ -134,9 +134,6 @@ Android:
3.3.1-android
-If you would like to use snapshots instead please add a new maven repository pointing to:
-https://oss.sonatype.org/content/repositories/snapshots
-into the relevant maven settings or POM file, please see: https://maven.apache.org/guides/mini/guide-multiple-repositories.html
Gradle
------
@@ -154,15 +151,40 @@ Android:
compile ('org.web3j:core:3.3.1-android')
-If you would like to use snapshots instead please add the following into your gradle script.
+Snapshot dependencies
+---------------------
+
+If you would like to use snapshots instead please add a new maven repository pointing to:
+
+::
+
+ https://oss.sonatype.org/content/repositories/snapshots
+
+Please refer to the `maven `_ or `gradle `_ documentation for further detail.
+
+Sample gradle configuration:
+
+.. code-block:: groovy
-.. code-block: groovy
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
+Sample maven configuration:
+
+.. code-block:: xml
+
+
+
+ sonatype-snasphots
+ Sonatype rnapshots repo
+ https://oss.sonatype.org/content/repositories/snapshot
+
+
+
+
Start a client
--------------
From 3069b30bfbbadbd9223752356d25180e6d2892fa Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Tue, 2 Oct 2018 20:45:04 +1000
Subject: [PATCH 12/32] #720: adding snapshot repo information into the readme
file - take 2
---
README.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.rst b/README.rst
index d9b7c758..94273a51 100644
--- a/README.rst
+++ b/README.rst
@@ -180,7 +180,7 @@ Sample maven configuration:
sonatype-snasphots
Sonatype rnapshots repo
- https://oss.sonatype.org/content/repositories/snapshot
+ https://oss.sonatype.org/content/repositories/snapshots
From 91057f8afb5e50764e67266b8247255ce914eb62 Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Tue, 2 Oct 2018 20:45:19 +1000
Subject: [PATCH 13/32] #720: adding snapshot repo information into the readme
file - take 2
---
README.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.rst b/README.rst
index 94273a51..3f1381ac 100644
--- a/README.rst
+++ b/README.rst
@@ -179,7 +179,7 @@ Sample maven configuration:
sonatype-snasphots
- Sonatype rnapshots repo
+ Sonatype snapshots repo
https://oss.sonatype.org/content/repositories/snapshots
From 82455674bd76f3a3097ba79bdd632e8d2cf591ce Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Tue, 2 Oct 2018 21:57:59 +1000
Subject: [PATCH 14/32] #720: addressing PR feedback on the snapshot
dependencies documentation.
---
README.rst | 77 +++++++++++++++++++++++++++++-------------------------
1 file changed, 42 insertions(+), 35 deletions(-)
diff --git a/README.rst b/README.rst
index 3f1381ac..77af2cd9 100644
--- a/README.rst
+++ b/README.rst
@@ -109,7 +109,10 @@ demonstrates a number of core features of Ethereum with web3j, including:
Getting started
---------------
-Add the relevant dependency to your project:
+Typically your application should depend on release versions of web3j, but you may also use snapshot dependencies
+for early access to features and fixes, refer to the `Snapshot Dependencies`_ section.
+
+| Add the relevant dependency to your project:
Maven
-----
@@ -151,40 +154,6 @@ Android:
compile ('org.web3j:core:3.3.1-android')
-Snapshot dependencies
----------------------
-
-If you would like to use snapshots instead please add a new maven repository pointing to:
-
-::
-
- https://oss.sonatype.org/content/repositories/snapshots
-
-Please refer to the `maven `_ or `gradle `_ documentation for further detail.
-
-Sample gradle configuration:
-
-.. code-block:: groovy
-
- repositories {
- maven {
- url "https://oss.sonatype.org/content/repositories/snapshots"
- }
- }
-
-Sample maven configuration:
-
-.. code-block:: xml
-
-
-
- sonatype-snasphots
- Sonatype snapshots repo
- https://oss.sonatype.org/content/repositories/snapshots
-
-
-
-
Start a client
--------------
@@ -603,6 +572,44 @@ To run the integration tests:
$ ./gradlew -Pintegration-tests=true :integration-tests:test
+
+.. _snapshot-dependencies:
+
+Snapshot Dependencies
+---------------------
+
+Snapshot versions of web3j follow the ``..-SNAPSHOT`` convention, for example: 3.6.0-SNAPSHOT.
+
+| If you would like to use snapshots instead please add a new maven repository pointing to:
+
+::
+
+ https://oss.sonatype.org/content/repositories/snapshots
+
+Please refer to the `maven `_ or `gradle `_ documentation for further detail.
+
+Sample gradle configuration:
+
+.. code-block:: groovy
+
+ repositories {
+ maven {
+ url "https://oss.sonatype.org/content/repositories/snapshots"
+ }
+ }
+
+Sample maven configuration:
+
+.. code-block:: xml
+
+
+
+ sonatype-snasphots
+ Sonatype snapshots repo
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+
Thanks and credits
------------------
From b6900154edd2fa9b030b4a000269e06c2dbba23f Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Tue, 2 Oct 2018 22:00:04 +1000
Subject: [PATCH 15/32] #720: addressing PR feedback on the snapshot
dependencies documentation - take 2.
---
README.rst | 2 --
1 file changed, 2 deletions(-)
diff --git a/README.rst b/README.rst
index 77af2cd9..834040f9 100644
--- a/README.rst
+++ b/README.rst
@@ -573,8 +573,6 @@ To run the integration tests:
$ ./gradlew -Pintegration-tests=true :integration-tests:test
-.. _snapshot-dependencies:
-
Snapshot Dependencies
---------------------
From ea3aa8b658910f34c06eae5b85bcc471aaa6fc87 Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Wed, 3 Oct 2018 09:57:11 +0100
Subject: [PATCH 16/32] Fixed typo
---
.../tx/response/PollingTransactionReceiptProcessorTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/test/java/org/web3j/tx/response/PollingTransactionReceiptProcessorTest.java b/core/src/test/java/org/web3j/tx/response/PollingTransactionReceiptProcessorTest.java
index 855c7268..c3cf025f 100644
--- a/core/src/test/java/org/web3j/tx/response/PollingTransactionReceiptProcessorTest.java
+++ b/core/src/test/java/org/web3j/tx/response/PollingTransactionReceiptProcessorTest.java
@@ -23,15 +23,15 @@ public class PollingTransactionReceiptProcessorTest {
private static final String TRANSACTION_HASH = "0x00";
private Web3j web3j;
private long sleepDuration;
- private int attemps;
+ private int attempts;
private PollingTransactionReceiptProcessor processor;
@Before
public void setUp() {
web3j = mock(Web3j.class);
sleepDuration = 100;
- attemps = 3;
- processor = new PollingTransactionReceiptProcessor(web3j, sleepDuration, attemps);
+ attempts = 3;
+ processor = new PollingTransactionReceiptProcessor(web3j, sleepDuration, attempts);
}
@Test
From 66d20b30d03185fa1d0002254438d1284ddf4200 Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Wed, 3 Oct 2018 09:57:43 +0100
Subject: [PATCH 17/32] Renamed greeter to Greeter to be consistent with the
other contracts
---
.../web3j/codegen/SolidityFunctionWrapperGeneratorTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperGeneratorTest.java b/codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperGeneratorTest.java
index 8e850d91..1ef26cd0 100644
--- a/codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperGeneratorTest.java
+++ b/codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperGeneratorTest.java
@@ -45,8 +45,8 @@ public void testGetFileNoExtension() {
@Test
public void testGreeterGeneration() throws Exception {
- testCodeGenerationJvmTypes("greeter", "greeter");
- testCodeGenerationSolidityTypes("greeter", "greeter");
+ testCodeGenerationJvmTypes("greeter", "Greeter");
+ testCodeGenerationSolidityTypes("greeter", "Greeter");
}
@Test
From 435eca3fbf6523e5697c1a558e00bf0ede02fe2a Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Wed, 3 Oct 2018 11:13:44 +0100
Subject: [PATCH 18/32] Regenerate smart contract wrappers with 3.6.0 tools -
PR for missing constructor is absent
---
integration-tests/src/test/java/org/web3j/generated/Arrays.java | 2 +-
.../src/test/java/org/web3j/generated/Fibonacci.java | 2 +-
.../src/test/java/org/web3j/generated/Greeter.java | 2 +-
.../src/test/java/org/web3j/generated/HumanStandardToken.java | 2 +-
integration-tests/src/test/java/org/web3j/generated/ShipIt.java | 2 +-
.../src/test/java/org/web3j/generated/SimpleStorage.java | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/integration-tests/src/test/java/org/web3j/generated/Arrays.java b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
index 5ada5890..967e900c 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Arrays.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
@@ -23,7 +23,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- * Generated with web3j version 3.5.0.
+ *
Generated with web3j version 3.6.0.
*/
public class Arrays extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b50610546806100206000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633a69db9481146100715780633cac14c814610149578063a30cc5f61461015e578063b96f54d1146101d2578063beda363b14610250575b600080fd5b34801561007d57600080fd5b506040805160048035808201356020818102850181019095528084526100f9943694602493909290840191819060009085015b828210156100e95760408051808201825290808402870190600290839083908082843750505091835250506001909101906020016100b0565b509396506102a595505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390f35b34801561015557600080fd5b506100f9610371565b34801561016a57600080fd5b506040805160c081019091526100f9903690600490610184908260066000835b828210156101c357604080518082018252908084028601906002908390839080828437505050918352505060019091019060200161018a565b50929550610383945050505050565b3480156101de57600080fd5b506040805161014081810190925261021791369160049161014491908390600a9083908390808284375093965061042e95505050505050565b604051808261014080838360005b8381101561023d578181015183820152602001610225565b5050505090500191505060405180910390f35b34801561025c57600080fd5b50604080516020600480358082013583810280860185019096528085526100f99536959394602494938501929182918501908490808284375094975061047a9650505050505050565b6060600080600084519250826002026040519080825280602002602001820160405280156102dd578160200160208202803883390190505b50935060009150600090505b828110156103695784818151811015156102ff57fe5b602090810291909101015151845185908490811061031957fe5b60209081029091010152845160019092019185908290811061033757fe5b6020908102919091018101510151845185908490811061035357fe5b60209081029091010152600191820191016102e9565b505050919050565b60408051600081526020810190915290565b60408051600c8082526101a08201909252606091600691600091829190602082016101808038833901905050935060009150600090505b82811015610369578481600681106103ce57fe5b60200201515184518590849081106103e257fe5b602090810290910101526001909101908481600681106103fe57fe5b602002015160016020020151848381518110151561041857fe5b60209081029091010152600191820191016103ba565b6104366104fa565b600a60005b81811015610473578360001982840301600a811061045557fe5b60200201518382600a811061046657fe5b602002015260010161043b565b5050919050565b606060008083519150816040519080825280602002602001820160405280156104ad578160200160208202803883390190505b509250600090505b8181101561047357838160010183038151811015156104d057fe5b9060200190602002015183828151811015156104e857fe5b602090810290910101526001016104b5565b61014060405190810160405280600a9060208202803883395091929150505600a165627a7a72305820cb0cdc9f8f19935db0d46de8e33d40ebff1a1f1cdda4fa8537579264ab42d9cd0029";
diff --git a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
index 7358eb1a..0196a790 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
@@ -30,7 +30,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.5.0.
+ *
Generated with web3j version 3.6.0.
*/
public class Fibonacci extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a723058209acf25d1bcddb7f4384fca6815063cfa89ffe456b82b5ad7135867f4b3d9d3500029";
diff --git a/integration-tests/src/test/java/org/web3j/generated/Greeter.java b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
index 7801eadd..908fe848 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Greeter.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
@@ -22,7 +22,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.5.0.
+ *
Generated with web3j version 3.6.0.
*/
public class Greeter extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b5060405161040038038061040083398101604052805160008054600160a060020a0319163317905501805161004c906001906020840190610053565b50506100ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009457805160ff19168380011785556100c1565b828001600101855582156100c1579182015b828111156100c15782518255916020019190600101906100a6565b506100cd9291506100d1565b5090565b6100eb91905b808211156100cd57600081556001016100d7565b90565b610303806100fd6000396000f3006080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b5780634ac0d66e14610072578063cfae3217146100cb575b600080fd5b34801561006757600080fd5b50610070610155565b005b34801561007e57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526100709436949293602493928401919081908401838280828437509497506101929650505050505050565b3480156100d757600080fd5b506100e06101a9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011a578181015183820152602001610102565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff163314156101905760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b80516101a590600190602084019061023f565b5050565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156102345780601f1061020957610100808354040283529160200191610234565b820191906000526020600020905b81548152906001019060200180831161021757829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028057805160ff19168380011785556102ad565b828001600101855582156102ad579182015b828111156102ad578251825591602001919060010190610292565b506102b99291506102bd565b5090565b61023c91905b808211156102b957600081556001016102c35600a165627a7a723058207c7eee341550b207f947e9ace51cfc7c6132a1d7bf49efce9a6ffbfa910b7ae10029";
diff --git a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
index 2380db5f..1dc04676 100644
--- a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
+++ b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
@@ -34,7 +34,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.5.0.
+ *
Generated with web3j version 3.6.0.
*/
public class HumanStandardToken extends Contract {
private static final String BINARY = "60c0604052600460808190527f48302e310000000000000000000000000000000000000000000000000000000060a090815261003e91600691906100d0565b5034801561004b57600080fd5b506040516109ab3803806109ab8339810160409081528151602080840151838501516060860151336000908152600185529586208590559484905590850180519395909491939101916100a3916003918601906100d0565b506004805460ff191660ff841617905580516100c69060059060208401906100d0565b505050505061016b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011157805160ff191683800117855561013e565b8280016001018555821561013e579182015b8281111561013e578251825591602001919060010190610123565b5061014a92915061014e565b5090565b61016891905b8082111561014a5760008155600101610154565b90565b6108318061017a6000396000f3006080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6104cc565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6104d5565b34801561020657600080fd5b5061017e600160a060020a0360043516610530565b34801561022757600080fd5b506100bc61054b565b34801561023c57600080fd5b50610155600160a060020a03600435166024356105a6565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061063f9650505050505050565b3480156102c957600080fd5b5061017e600160a060020a03600435811690602435166107da565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a038316600090815260016020526040812054821180159061042a5750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104365750600082115b156104c157600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016104c5565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526001602052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b3360009081526001602052604081205482118015906105c55750600082115b156106375733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016103d3565b5060006103d3565b336000818152600260209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b8381101561077f578181015183820152602001610767565b50505050905090810190601f1680156107ac5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156107d057600080fd5b5060019392505050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058206e603c634e6d2ac6f989b2e2055cfbca683a30ca87aac8e0a9a6bb65e858050e0029";
diff --git a/integration-tests/src/test/java/org/web3j/generated/ShipIt.java b/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
index dc1ddb00..ba24d252 100644
--- a/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
+++ b/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
@@ -26,7 +26,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.5.0.
+ *
Generated with web3j version 3.6.0.
*/
public class ShipIt extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b50610262806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d51cd4ac8114610045575b600080fd5b34801561005157600080fd5b5061007373ffffffffffffffffffffffffffffffffffffffff6004351661014c565b6040805173ffffffffffffffffffffffffffffffffffffffff808b1682528916602082015290810187905260608101869052608081018560008111156100b557fe5b60ff168152602001848152602001806020018360001916600019168152602001828103825284818151815260200191508051906020019080838360005b8381101561010a5781810151838201526020016100f2565b50505050905090810190601f1680156101375780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b6000602081815291815260409081902080546001808301546002808501546003860154600487015460058801546006890180548b516101009982161599909902600019011695909504601f81018c90048c0288018c01909a5289875273ffffffffffffffffffffffffffffffffffffffff9788169a97909516989297919660ff9091169591939192908301828280156102265780601f106101fb57610100808354040283529160200191610226565b820191906000526020600020905b81548152906001019060200180831161020957829003601f168201915b50505050509080600701549050885600a165627a7a723058201992563050593daf7e729a6bc33c69781340202e4a91b80b5b88c71f972c67d20029";
diff --git a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
index 27ad3c2a..abf2fec2 100644
--- a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
+++ b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
@@ -21,7 +21,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.5.0.
+ *
Generated with web3j version 3.6.0.
*/
public class SimpleStorage extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b50600560005560bf806100246000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a72305820bf80fbb051cb310b6a5c5c6b0f1814770ad368bdae05716dd706b16c8c49a8da0029";
From c537000d633fa598fc396a32c4b5e5549646a9fb Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Wed, 3 Oct 2018 20:41:05 +1000
Subject: [PATCH 19/32] #720: improve the build script to publish snapshots
---
.gitignore | 2 --
build.gradle | 30 ++++++++++++++++++------------
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2a3bb186..7b9e1989 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,8 +19,6 @@ hs_err_pid*
*/build/
*/out/
-gradle.properties
-
# Ignore Gradle GUI config
gradle-app.setting
diff --git a/build.gradle b/build.gradle
index e13b1e4b..d18fca0f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,3 @@
-
buildscript {
ext.bouncycastleVersion = '1.54'
ext.jacksonVersion = '2.8.5'
@@ -44,9 +43,6 @@ allprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
- group 'org.web3j'
- version '3.6.0'
-
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
@@ -92,11 +88,11 @@ subprojects {
dependencies {
testCompile "junit:junit:$junitVersion",
- "org.mockito:mockito-core:$mockitoVersion"
+ "org.mockito:mockito-core:$mockitoVersion"
}
}
-configure(subprojects.findAll {it.name != 'integration-tests'}) {
+configure(subprojects.findAll { it.name != 'integration-tests' }) {
// Required for Maven Nexus repository
apply plugin: 'maven'
apply plugin: 'signing'
@@ -127,6 +123,9 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
ext {
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : ''
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
+ bintrayUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
+ bintrayKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
+ isSnapshotVersion = project.version.endsWith("-SNAPSHOT")
}
publishing {
@@ -150,7 +149,12 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
- repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
+ onlyIf {
+ ossrhUsername != '' && ossrhPassword != ''
+ }
+
+ String repoUrl = isSnapshotVersion ? "http://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+ repository(url: repoUrl) {
authentication(
userName: ossrhUsername,
password: ossrhPassword
@@ -193,8 +197,8 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
}
bintray {
- user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
- key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
+ user = bintrayUser
+ key = bintrayKey
publications = ['mavenJava']
publish = true
pkg {
@@ -214,10 +218,12 @@ configure(subprojects.findAll {it.name != 'integration-tests'}) {
//TODO run clean & closeAndPromoteRepository once
dependsOn 'build'
dependsOn 'uploadArchives'
- dependsOn 'bintrayUpload'
+ if (!isSnapshotVersion && bintrayUser != '' && bintrayKey != '') {
+ dependsOn 'bintrayUpload'
+ tasks.findByName('bintrayUpload').mustRunAfter 'build'
+ }
tasks.findByName('uploadArchives').mustRunAfter 'build'
- tasks.findByName('bintrayUpload').mustRunAfter 'build'
}
}
@@ -226,7 +232,7 @@ task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
- classDirectories = files(subprojects.sourceSets.main.output)
+ classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
xml.enabled = true
From 1616748823a3851aa7a23563a24eebfbbd4ec2f9 Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Thu, 4 Oct 2018 06:19:29 +1000
Subject: [PATCH 20/32] #720: adding the missing gradle.properties file
---
gradle.properties | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 gradle.properties
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 00000000..96d6d605
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,2 @@
+group=org.web3j
+version=3.6.0-SNAPSHOT
From 5faa0b622454b6f5cff660931036f14d26cb7840 Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Thu, 4 Oct 2018 17:12:51 +1000
Subject: [PATCH 21/32] Undoing the effect of PR#711
---
.../codegen/SolidityFunctionWrapper.java | 41 ++++++++++---------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
index cb5796c1..389a4570 100644
--- a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
+++ b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
@@ -55,7 +55,6 @@
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
-import org.web3j.tx.gas.ContractGasProvider;
import org.web3j.utils.Collection;
import org.web3j.utils.Strings;
import org.web3j.utils.Version;
@@ -68,7 +67,6 @@ public class SolidityFunctionWrapper extends Generator {
private static final String BINARY = "BINARY";
private static final String WEB3J = "web3j";
private static final String CREDENTIALS = "credentials";
- private static final String CONTRACT_GAS_PROVIDER = "contractGasProvider";
private static final String TRANSACTION_MANAGER = "transactionManager";
private static final String INITIAL_VALUE = "initialWeiValue";
private static final String CONTRACT_ADDRESS = "contractAddress";
@@ -124,13 +122,16 @@ void generateJavaFiles(
TypeSpec.Builder classBuilder = createClassBuilder(className, bin);
+ classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS));
classBuilder.addMethod(buildConstructor(TransactionManager.class,
TRANSACTION_MANAGER));
classBuilder.addFields(buildFuncNameConstants(abi));
classBuilder.addMethods(
buildFunctionDefinitions(className, classBuilder, abi));
- classBuilder.addMethod(buildLoad(className));
-
+ classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS));
+ classBuilder.addMethod(buildLoad(className, TransactionManager.class,
+ TRANSACTION_MANAGER));
+
addAddressesSupport(classBuilder, addresses);
write(basePackageName, classBuilder.build(), destinationDir);
@@ -309,9 +310,10 @@ private static MethodSpec buildConstructor(Class authType, String authName) {
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
.addParameter(authType, authName)
- .addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
- .addStatement("super($N, $N, $N, $N, $N)",
- BINARY, CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER)
+ .addParameter(BigInteger.class, GAS_PRICE)
+ .addParameter(BigInteger.class, GAS_LIMIT)
+ .addStatement("super($N, $N, $N, $N, $N, $N)",
+ BINARY, CONTRACT_ADDRESS, WEB3J, authName, GAS_PRICE, GAS_LIMIT)
.build();
}
@@ -389,16 +391,17 @@ private static MethodSpec.Builder getDeployMethodSpec(
}
private static MethodSpec buildLoad(
- String className) {
+ String className, Class authType, String authName) {
return MethodSpec.methodBuilder("load")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(TypeVariableName.get(className, Type.class))
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
- .addParameter(TransactionManager.class, TRANSACTION_MANAGER)
- .addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
- .addStatement("return new $L($L, $L, $L, $L)", className,
- CONTRACT_ADDRESS, WEB3J, TRANSACTION_MANAGER, CONTRACT_GAS_PROVIDER)
+ .addParameter(authType, authName)
+ .addParameter(BigInteger.class, GAS_PRICE)
+ .addParameter(BigInteger.class, GAS_LIMIT)
+ .addStatement("return new $L($L, $L, $L, $L, $L)", className,
+ CONTRACT_ADDRESS, WEB3J, authName, GAS_PRICE, GAS_LIMIT)
.build();
}
@@ -641,7 +644,7 @@ Function.class, Function.class, funcNameToConst(functionName),
CodeBlock.Builder callCode = CodeBlock.builder();
callCode.addStatement(
"$T result = "
- + "($T) executeCallSingleValueReturn(function, $T.class)",
+ + "($T) executeCallSingleValueReturn(function, $T.class)",
listType, listType, nativeReturnTypeName);
callCode.addStatement("return convertToNative(result)");
@@ -845,7 +848,7 @@ MethodSpec buildEventTransactionReceiptFunction(
transactionMethodBuilder.addStatement("$T valueList = extractEventParametersWithLog("
+ buildEventDefinitionName(functionName) + ", "
+ "transactionReceipt)", ParameterizedTypeName.get(List.class,
- Contract.EventValuesWithLog.class))
+ Contract.EventValuesWithLog.class))
.addStatement("$1T responses = new $1T(valueList.size())",
ParameterizedTypeName.get(ClassName.get(ArrayList.class),
ClassName.get("", responseClassName)))
@@ -876,10 +879,10 @@ List buildEventFunctions(
for (AbiDefinition.NamedType namedType : inputs) {
NamedTypeName parameter = new NamedTypeName(
- namedType.getName(),
- buildTypeName(namedType.getType()),
- namedType.isIndexed()
- );
+ namedType.getName(),
+ buildTypeName(namedType.getType()),
+ namedType.isIndexed()
+ );
if (namedType.isIndexed()) {
indexedParameters.add(parameter);
} else {
@@ -1078,7 +1081,7 @@ private void buildTupleResultContainer(
}
tupleConstructor
- .add(resultString, convertTo, i);
+ .add(resultString, convertTo, i);
tupleConstructor.add(i < size - 1 ? ", " : ");\n");
}
tupleConstructor.add("$<$<");
From 97e2f4578f351f3b49c6af9a7d4b2822bf39403b Mon Sep 17 00:00:00 2001
From: Francois Le Fevre
Date: Mon, 17 Sep 2018 09:46:15 +0200
Subject: [PATCH 22/32] Code generator correction
---
.../codegen/SolidityFunctionWrapper.java | 27 +++++++++----------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
index 389a4570..c40e77dc 100644
--- a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
+++ b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
@@ -55,6 +55,7 @@
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
import org.web3j.utils.Collection;
import org.web3j.utils.Strings;
import org.web3j.utils.Version;
@@ -67,6 +68,7 @@ public class SolidityFunctionWrapper extends Generator {
private static final String BINARY = "BINARY";
private static final String WEB3J = "web3j";
private static final String CREDENTIALS = "credentials";
+ private static final String CONTRACT_GAS_PROVIDER = "contractGasProvider";
private static final String TRANSACTION_MANAGER = "transactionManager";
private static final String INITIAL_VALUE = "initialWeiValue";
private static final String CONTRACT_ADDRESS = "contractAddress";
@@ -122,16 +124,13 @@ void generateJavaFiles(
TypeSpec.Builder classBuilder = createClassBuilder(className, bin);
- classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS));
classBuilder.addMethod(buildConstructor(TransactionManager.class,
TRANSACTION_MANAGER));
classBuilder.addFields(buildFuncNameConstants(abi));
classBuilder.addMethods(
buildFunctionDefinitions(className, classBuilder, abi));
- classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS));
- classBuilder.addMethod(buildLoad(className, TransactionManager.class,
- TRANSACTION_MANAGER));
-
+ classBuilder.addMethod(buildLoad(className));
+
addAddressesSupport(classBuilder, addresses);
write(basePackageName, classBuilder.build(), destinationDir);
@@ -310,10 +309,9 @@ private static MethodSpec buildConstructor(Class authType, String authName) {
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
.addParameter(authType, authName)
- .addParameter(BigInteger.class, GAS_PRICE)
- .addParameter(BigInteger.class, GAS_LIMIT)
- .addStatement("super($N, $N, $N, $N, $N, $N)",
- BINARY, CONTRACT_ADDRESS, WEB3J, authName, GAS_PRICE, GAS_LIMIT)
+ .addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
+ .addStatement("super($N, $N, $N, $N, $N)",
+ BINARY, CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER)
.build();
}
@@ -391,17 +389,16 @@ private static MethodSpec.Builder getDeployMethodSpec(
}
private static MethodSpec buildLoad(
- String className, Class authType, String authName) {
+ String className) {
return MethodSpec.methodBuilder("load")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(TypeVariableName.get(className, Type.class))
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
- .addParameter(authType, authName)
- .addParameter(BigInteger.class, GAS_PRICE)
- .addParameter(BigInteger.class, GAS_LIMIT)
- .addStatement("return new $L($L, $L, $L, $L, $L)", className,
- CONTRACT_ADDRESS, WEB3J, authName, GAS_PRICE, GAS_LIMIT)
+ .addParameter(TransactionManager.class, TRANSACTION_MANAGER)
+ .addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
+ .addStatement("return new $L($L, $L, $L, $L)", className,
+ CONTRACT_ADDRESS, WEB3J, TRANSACTION_MANAGER, CONTRACT_GAS_PROVIDER)
.build();
}
From afaf87cea0aa51dcaf70172ee369d2c4d9a9e149 Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 10:54:09 +0100
Subject: [PATCH 23/32] Remove deprecated constructors in smart contract
wrapper
---
.../org/web3j/codegen/SolidityFunctionWrapper.java | 13 ++++++++-----
core/src/main/java/org/web3j/tx/Contract.java | 9 +++++++++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
index c40e77dc..ca3ee846 100644
--- a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
+++ b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
@@ -124,13 +124,16 @@ void generateJavaFiles(
TypeSpec.Builder classBuilder = createClassBuilder(className, bin);
+ classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS));
classBuilder.addMethod(buildConstructor(TransactionManager.class,
TRANSACTION_MANAGER));
classBuilder.addFields(buildFuncNameConstants(abi));
classBuilder.addMethods(
buildFunctionDefinitions(className, classBuilder, abi));
- classBuilder.addMethod(buildLoad(className));
-
+ classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS));
+ classBuilder.addMethod(buildLoad(className, TransactionManager.class,
+ TRANSACTION_MANAGER));
+
addAddressesSupport(classBuilder, addresses);
write(basePackageName, classBuilder.build(), destinationDir);
@@ -389,16 +392,16 @@ private static MethodSpec.Builder getDeployMethodSpec(
}
private static MethodSpec buildLoad(
- String className) {
+ String className, Class authType, String authName) {
return MethodSpec.methodBuilder("load")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(TypeVariableName.get(className, Type.class))
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
- .addParameter(TransactionManager.class, TRANSACTION_MANAGER)
+ .addParameter(authType, authName)
.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
.addStatement("return new $L($L, $L, $L, $L)", className,
- CONTRACT_ADDRESS, WEB3J, TRANSACTION_MANAGER, CONTRACT_GAS_PROVIDER)
+ CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER)
.build();
}
diff --git a/core/src/main/java/org/web3j/tx/Contract.java b/core/src/main/java/org/web3j/tx/Contract.java
index 1c5f6b2a..0afeaf63 100644
--- a/core/src/main/java/org/web3j/tx/Contract.java
+++ b/core/src/main/java/org/web3j/tx/Contract.java
@@ -70,6 +70,15 @@ protected Contract(String contractBinary, String contractAddress,
this.gasProvider = gasProvider;
}
+ protected Contract(String contractBinary, String contractAddress,
+ Web3j web3j, Credentials credentials,
+ ContractGasProvider gasProvider) {
+
+ this(contractBinary, contractAddress, web3j,
+ new RawTransactionManager(web3j, credentials),
+ gasProvider);
+ }
+
@Deprecated
protected Contract(String contractBinary, String contractAddress,
Web3j web3j, TransactionManager transactionManager,
From c744265358f2fe2fb4957303bd00225d3defe73a Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 10:55:37 +0100
Subject: [PATCH 24/32] Regenerated Contract Wrappers with the correct
constructors and load methods
---
codegen/src/test/resources/solidity/build.sh | 2 +-
.../test/java/org/web3j/generated/Arrays.java | 19 ++++++++++---------
.../java/org/web3j/generated/Fibonacci.java | 19 ++++++++++---------
.../java/org/web3j/generated/Greeter.java | 19 ++++++++++---------
.../web3j/generated/HumanStandardToken.java | 19 ++++++++++---------
.../test/java/org/web3j/generated/ShipIt.java | 19 ++++++++++---------
.../org/web3j/generated/SimpleStorage.java | 19 ++++++++++---------
7 files changed, 61 insertions(+), 55 deletions(-)
diff --git a/codegen/src/test/resources/solidity/build.sh b/codegen/src/test/resources/solidity/build.sh
index f186af68..547716eb 100755
--- a/codegen/src/test/resources/solidity/build.sh
+++ b/codegen/src/test/resources/solidity/build.sh
@@ -19,7 +19,7 @@ for target in ${targets}; do
echo "Complete"
echo "Generating web3j bindings"
- web3j solidity generate \
+ /home/ivaylo/dev/playground/web3j/console/build/distributions/web3j-3.6.0-SNAPSHOT/bin/web3j solidity generate \
build/${fileName}.bin \
build/${fileName}.abi \
-p org.web3j.generated \
diff --git a/integration-tests/src/test/java/org/web3j/generated/Arrays.java b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
index 967e900c..0cc9ed6d 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Arrays.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
@@ -15,6 +15,7 @@
import org.web3j.protocol.core.RemoteCall;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
/**
* Auto generated code.
@@ -23,7 +24,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.6.0.
+ *
Generated with web3j version 3.6.0-SNAPSHOT.
*/
public class Arrays extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b50610546806100206000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633a69db9481146100715780633cac14c814610149578063a30cc5f61461015e578063b96f54d1146101d2578063beda363b14610250575b600080fd5b34801561007d57600080fd5b506040805160048035808201356020818102850181019095528084526100f9943694602493909290840191819060009085015b828210156100e95760408051808201825290808402870190600290839083908082843750505091835250506001909101906020016100b0565b509396506102a595505050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390f35b34801561015557600080fd5b506100f9610371565b34801561016a57600080fd5b506040805160c081019091526100f9903690600490610184908260066000835b828210156101c357604080518082018252908084028601906002908390839080828437505050918352505060019091019060200161018a565b50929550610383945050505050565b3480156101de57600080fd5b506040805161014081810190925261021791369160049161014491908390600a9083908390808284375093965061042e95505050505050565b604051808261014080838360005b8381101561023d578181015183820152602001610225565b5050505090500191505060405180910390f35b34801561025c57600080fd5b50604080516020600480358082013583810280860185019096528085526100f99536959394602494938501929182918501908490808284375094975061047a9650505050505050565b6060600080600084519250826002026040519080825280602002602001820160405280156102dd578160200160208202803883390190505b50935060009150600090505b828110156103695784818151811015156102ff57fe5b602090810291909101015151845185908490811061031957fe5b60209081029091010152845160019092019185908290811061033757fe5b6020908102919091018101510151845185908490811061035357fe5b60209081029091010152600191820191016102e9565b505050919050565b60408051600081526020810190915290565b60408051600c8082526101a08201909252606091600691600091829190602082016101808038833901905050935060009150600090505b82811015610369578481600681106103ce57fe5b60200201515184518590849081106103e257fe5b602090810290910101526001909101908481600681106103fe57fe5b602002015160016020020151848381518110151561041857fe5b60209081029091010152600191820191016103ba565b6104366104fa565b600a60005b81811015610473578360001982840301600a811061045557fe5b60200201518382600a811061046657fe5b602002015260010161043b565b5050919050565b606060008083519150816040519080825280602002602001820160405280156104ad578160200160208202803883390190505b509250600090505b8181101561047357838160010183038151811015156104d057fe5b9060200190602002015183828151811015156104e857fe5b602090810290910101526001016104b5565b61014060405190810160405280600a9060208202803883395091929150505600a165627a7a72305820cb0cdc9f8f19935db0d46de8e33d40ebff1a1f1cdda4fa8537579264ab42d9cd0029";
@@ -38,12 +39,12 @@ public class Arrays extends Contract {
public static final String FUNC_DYNAMICREVERSE = "dynamicReverse";
- protected Arrays(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ protected Arrays(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
- protected Arrays(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ protected Arrays(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall multiDynamic(List> input) {
@@ -133,11 +134,11 @@ public static RemoteCall deploy(Web3j web3j, TransactionManager transact
return deployRemoteCall(Arrays.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
- public static Arrays load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- return new Arrays(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ public static Arrays load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new Arrays(contractAddress, web3j, credentials, contractGasProvider);
}
- public static Arrays load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- return new Arrays(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ public static Arrays load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new Arrays(contractAddress, web3j, transactionManager, contractGasProvider);
}
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
index 0196a790..4d475b8d 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
@@ -20,6 +20,7 @@
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
import rx.Observable;
import rx.functions.Func1;
@@ -30,7 +31,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- * Generated with web3j version 3.6.0.
+ *
Generated with web3j version 3.6.0-SNAPSHOT.
*/
public class Fibonacci extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a723058209acf25d1bcddb7f4384fca6815063cfa89ffe456b82b5ad7135867f4b3d9d3500029";
@@ -43,12 +44,12 @@ public class Fibonacci extends Contract {
Arrays.>asList(new TypeReference() {}, new TypeReference() {}));
;
- protected Fibonacci(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ protected Fibonacci(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
- protected Fibonacci(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ protected Fibonacci(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall fibonacciNotify(BigInteger number) {
@@ -107,12 +108,12 @@ public static RemoteCall deploy(Web3j web3j, TransactionManager trans
return deployRemoteCall(Fibonacci.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
- public static Fibonacci load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- return new Fibonacci(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ public static Fibonacci load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new Fibonacci(contractAddress, web3j, credentials, contractGasProvider);
}
- public static Fibonacci load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- return new Fibonacci(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ public static Fibonacci load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new Fibonacci(contractAddress, web3j, transactionManager, contractGasProvider);
}
public static class NotifyEventResponse {
diff --git a/integration-tests/src/test/java/org/web3j/generated/Greeter.java b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
index 908fe848..fc93d03d 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Greeter.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
@@ -14,6 +14,7 @@
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
/**
* Auto generated code.
@@ -22,7 +23,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.6.0.
+ *
Generated with web3j version 3.6.0-SNAPSHOT.
*/
public class Greeter extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b5060405161040038038061040083398101604052805160008054600160a060020a0319163317905501805161004c906001906020840190610053565b50506100ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061009457805160ff19168380011785556100c1565b828001600101855582156100c1579182015b828111156100c15782518255916020019190600101906100a6565b506100cd9291506100d1565b5090565b6100eb91905b808211156100cd57600081556001016100d7565b90565b610303806100fd6000396000f3006080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166341c0e1b5811461005b5780634ac0d66e14610072578063cfae3217146100cb575b600080fd5b34801561006757600080fd5b50610070610155565b005b34801561007e57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526100709436949293602493928401919081908401838280828437509497506101929650505050505050565b3480156100d757600080fd5b506100e06101a9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011a578181015183820152602001610102565b50505050905090810190601f1680156101475780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005473ffffffffffffffffffffffffffffffffffffffff163314156101905760005473ffffffffffffffffffffffffffffffffffffffff16ff5b565b80516101a590600190602084019061023f565b5050565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156102345780601f1061020957610100808354040283529160200191610234565b820191906000526020600020905b81548152906001019060200180831161021757829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061028057805160ff19168380011785556102ad565b828001600101855582156102ad579182015b828111156102ad578251825591602001919060010190610292565b506102b99291506102bd565b5090565b61023c91905b808211156102b957600081556001016102c35600a165627a7a723058207c7eee341550b207f947e9ace51cfc7c6132a1d7bf49efce9a6ffbfa910b7ae10029";
@@ -33,12 +34,12 @@ public class Greeter extends Contract {
public static final String FUNC_GREET = "greet";
- protected Greeter(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ protected Greeter(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
- protected Greeter(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ protected Greeter(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall kill() {
@@ -74,11 +75,11 @@ public static RemoteCall deploy(Web3j web3j, TransactionManager transac
return deployRemoteCall(Greeter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
- public static Greeter load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- return new Greeter(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ public static Greeter load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new Greeter(contractAddress, web3j, credentials, contractGasProvider);
}
- public static Greeter load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- return new Greeter(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ public static Greeter load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new Greeter(contractAddress, web3j, transactionManager, contractGasProvider);
}
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
index 1dc04676..95649f7c 100644
--- a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
+++ b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
@@ -24,6 +24,7 @@
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
import rx.Observable;
import rx.functions.Func1;
@@ -34,7 +35,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- * Generated with web3j version 3.6.0.
+ *
Generated with web3j version 3.6.0-SNAPSHOT.
*/
public class HumanStandardToken extends Contract {
private static final String BINARY = "60c0604052600460808190527f48302e310000000000000000000000000000000000000000000000000000000060a090815261003e91600691906100d0565b5034801561004b57600080fd5b506040516109ab3803806109ab8339810160409081528151602080840151838501516060860151336000908152600185529586208590559484905590850180519395909491939101916100a3916003918601906100d0565b506004805460ff191660ff841617905580516100c69060059060208401906100d0565b505050505061016b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061011157805160ff191683800117855561013e565b8280016001018555821561013e579182015b8281111561013e578251825591602001919060010190610123565b5061014a92915061014e565b5090565b61016891905b8082111561014a5760008155600101610154565b90565b6108318061017a6000396000f3006080604052600436106100955763ffffffff60e060020a60003504166306fdde0381146100a7578063095ea7b31461013157806318160ddd1461016957806323b872dd14610190578063313ce567146101ba57806354fd4d50146101e557806370a08231146101fa57806395d89b411461021b578063a9059cbb14610230578063cae9ca5114610254578063dd62ed3e146102bd575b3480156100a157600080fd5b50600080fd5b3480156100b357600080fd5b506100bc6102e4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f65781810151838201526020016100de565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013d57600080fd5b50610155600160a060020a0360043516602435610372565b604080519115158252519081900360200190f35b34801561017557600080fd5b5061017e6103d9565b60408051918252519081900360200190f35b34801561019c57600080fd5b50610155600160a060020a03600435811690602435166044356103df565b3480156101c657600080fd5b506101cf6104cc565b6040805160ff9092168252519081900360200190f35b3480156101f157600080fd5b506100bc6104d5565b34801561020657600080fd5b5061017e600160a060020a0360043516610530565b34801561022757600080fd5b506100bc61054b565b34801561023c57600080fd5b50610155600160a060020a03600435166024356105a6565b34801561026057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610155948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061063f9650505050505050565b3480156102c957600080fd5b5061017e600160a060020a03600435811690602435166107da565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b820191906000526020600020905b81548152906001019060200180831161034d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005481565b600160a060020a038316600090815260016020526040812054821180159061042a5750600160a060020a03841660009081526002602090815260408083203384529091529020548211155b80156104365750600082115b156104c157600160a060020a03808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060016104c5565b5060005b9392505050565b60045460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b600160a060020a031660009081526001602052604090205490565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561036a5780601f1061033f5761010080835404028352916020019161036a565b3360009081526001602052604081205482118015906105c55750600082115b156106375733600081815260016020908152604080832080548790039055600160a060020a03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060016103d3565b5060006103d3565b336000818152600260209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a383600160a060020a031660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e019050604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b8381101561077f578181015183820152602001610767565b50505050905090810190601f1680156107ac5780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015156107d057600080fd5b5060019392505050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a723058206e603c634e6d2ac6f989b2e2055cfbca683a30ca87aac8e0a9a6bb65e858050e0029";
@@ -69,12 +70,12 @@ public class HumanStandardToken extends Contract {
Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference() {}));
;
- protected HumanStandardToken(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ protected HumanStandardToken(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
- protected HumanStandardToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ protected HumanStandardToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall name() {
@@ -251,12 +252,12 @@ public Observable approvalEventObservable(DefaultBlockPar
return approvalEventObservable(filter);
}
- public static HumanStandardToken load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- return new HumanStandardToken(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ public static HumanStandardToken load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new HumanStandardToken(contractAddress, web3j, credentials, contractGasProvider);
}
- public static HumanStandardToken load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- return new HumanStandardToken(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ public static HumanStandardToken load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new HumanStandardToken(contractAddress, web3j, transactionManager, contractGasProvider);
}
public static class TransferEventResponse {
diff --git a/integration-tests/src/test/java/org/web3j/generated/ShipIt.java b/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
index ba24d252..77232203 100644
--- a/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
+++ b/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
@@ -18,6 +18,7 @@
import org.web3j.tuples.generated.Tuple8;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
/**
* Auto generated code.
@@ -26,19 +27,19 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.6.0.
+ *
Generated with web3j version 3.6.0-SNAPSHOT.
*/
public class ShipIt extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b50610262806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d51cd4ac8114610045575b600080fd5b34801561005157600080fd5b5061007373ffffffffffffffffffffffffffffffffffffffff6004351661014c565b6040805173ffffffffffffffffffffffffffffffffffffffff808b1682528916602082015290810187905260608101869052608081018560008111156100b557fe5b60ff168152602001848152602001806020018360001916600019168152602001828103825284818151815260200191508051906020019080838360005b8381101561010a5781810151838201526020016100f2565b50505050905090810190601f1680156101375780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b6000602081815291815260409081902080546001808301546002808501546003860154600487015460058801546006890180548b516101009982161599909902600019011695909504601f81018c90048c0288018c01909a5289875273ffffffffffffffffffffffffffffffffffffffff9788169a97909516989297919660ff9091169591939192908301828280156102265780601f106101fb57610100808354040283529160200191610226565b820191906000526020600020905b81548152906001019060200180831161020957829003601f168201915b50505050509080600701549050885600a165627a7a723058201992563050593daf7e729a6bc33c69781340202e4a91b80b5b88c71f972c67d20029";
public static final String FUNC_SHIPMENTS = "shipments";
- protected ShipIt(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ protected ShipIt(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
- protected ShipIt(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ protected ShipIt(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall> shipments(String param0) {
@@ -71,11 +72,11 @@ public static RemoteCall deploy(Web3j web3j, TransactionManager transact
return deployRemoteCall(ShipIt.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
- public static ShipIt load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- return new ShipIt(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ public static ShipIt load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new ShipIt(contractAddress, web3j, credentials, contractGasProvider);
}
- public static ShipIt load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- return new ShipIt(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ public static ShipIt load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new ShipIt(contractAddress, web3j, transactionManager, contractGasProvider);
}
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
index abf2fec2..dc3268c2 100644
--- a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
+++ b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
@@ -13,6 +13,7 @@
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
+import org.web3j.tx.gas.ContractGasProvider;
/**
* Auto generated code.
@@ -21,7 +22,7 @@
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* codegen module to update.
*
- *
Generated with web3j version 3.6.0.
+ *
Generated with web3j version 3.6.0-SNAPSHOT.
*/
public class SimpleStorage extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b50600560005560bf806100246000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a72305820bf80fbb051cb310b6a5c5c6b0f1814770ad368bdae05716dd706b16c8c49a8da0029";
@@ -30,12 +31,12 @@ public class SimpleStorage extends Contract {
public static final String FUNC_GET = "get";
- protected SimpleStorage(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ protected SimpleStorage(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
- protected SimpleStorage(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ protected SimpleStorage(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall set(BigInteger x) {
@@ -61,11 +62,11 @@ public static RemoteCall deploy(Web3j web3j, TransactionManager t
return deployRemoteCall(SimpleStorage.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
- public static SimpleStorage load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
- return new SimpleStorage(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ public static SimpleStorage load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new SimpleStorage(contractAddress, web3j, credentials, contractGasProvider);
}
- public static SimpleStorage load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
- return new SimpleStorage(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ public static SimpleStorage load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new SimpleStorage(contractAddress, web3j, transactionManager, contractGasProvider);
}
}
From 0f9ad96cf12deeeb34b78bb82eaa0edd49abf36a Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 11:03:48 +0100
Subject: [PATCH 25/32] Remove local web3j reference
---
codegen/src/test/resources/solidity/build.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/codegen/src/test/resources/solidity/build.sh b/codegen/src/test/resources/solidity/build.sh
index 547716eb..f186af68 100755
--- a/codegen/src/test/resources/solidity/build.sh
+++ b/codegen/src/test/resources/solidity/build.sh
@@ -19,7 +19,7 @@ for target in ${targets}; do
echo "Complete"
echo "Generating web3j bindings"
- /home/ivaylo/dev/playground/web3j/console/build/distributions/web3j-3.6.0-SNAPSHOT/bin/web3j solidity generate \
+ web3j solidity generate \
build/${fileName}.bin \
build/${fileName}.abi \
-p org.web3j.generated \
From d37295207805d01a914297752c373dea49b494bd Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 11:18:50 +0100
Subject: [PATCH 26/32] Introduced a static gas provider to Scenario to load
contracts with
---
.../java/org/web3j/protocol/scenarios/FunctionWrappersIT.java | 4 ++--
.../protocol/scenarios/HumanStandardTokenGeneratedIT.java | 2 +-
.../src/test/java/org/web3j/protocol/scenarios/Scenario.java | 4 ++++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/integration-tests/src/test/java/org/web3j/protocol/scenarios/FunctionWrappersIT.java b/integration-tests/src/test/java/org/web3j/protocol/scenarios/FunctionWrappersIT.java
index f859bf6d..a05d2d14 100644
--- a/integration-tests/src/test/java/org/web3j/protocol/scenarios/FunctionWrappersIT.java
+++ b/integration-tests/src/test/java/org/web3j/protocol/scenarios/FunctionWrappersIT.java
@@ -26,7 +26,7 @@ public class FunctionWrappersIT extends Scenario {
public void testFibonacci() throws Exception {
Fibonacci fibonacci = Fibonacci.load(
"0x3c05b2564139fb55820b18b72e94b2178eaace7d", Web3j.build(new HttpService()),
- ALICE, GAS_PRICE, GAS_LIMIT);
+ ALICE, STATIC_GAS_PROVIDER);
BigInteger result = fibonacci.fibonacci(BigInteger.valueOf(10)).send();
assertThat(result, equalTo(BigInteger.valueOf(55)));
@@ -36,7 +36,7 @@ public void testFibonacci() throws Exception {
public void testFibonacciNotify() throws Exception {
Fibonacci fibonacci = Fibonacci.load(
"0x3c05b2564139fb55820b18b72e94b2178eaace7d", Web3j.build(new HttpService()),
- ALICE, GAS_PRICE, GAS_LIMIT);
+ ALICE, STATIC_GAS_PROVIDER);
TransactionReceipt transactionReceipt = fibonacci.fibonacciNotify(
BigInteger.valueOf(15)).send();
diff --git a/integration-tests/src/test/java/org/web3j/protocol/scenarios/HumanStandardTokenGeneratedIT.java b/integration-tests/src/test/java/org/web3j/protocol/scenarios/HumanStandardTokenGeneratedIT.java
index ee35ed67..c88ad927 100644
--- a/integration-tests/src/test/java/org/web3j/protocol/scenarios/HumanStandardTokenGeneratedIT.java
+++ b/integration-tests/src/test/java/org/web3j/protocol/scenarios/HumanStandardTokenGeneratedIT.java
@@ -112,7 +112,7 @@ public void testContract() throws Exception {
// Bob requires his own contract instance
HumanStandardToken bobsContract = HumanStandardToken.load(
- contract.getContractAddress(), web3j, BOB, GAS_PRICE, GAS_LIMIT);
+ contract.getContractAddress(), web3j, BOB, STATIC_GAS_PROVIDER);
TransactionReceipt bobTransferReceipt = bobsContract.transferFrom(
aliceAddress,
diff --git a/integration-tests/src/test/java/org/web3j/protocol/scenarios/Scenario.java b/integration-tests/src/test/java/org/web3j/protocol/scenarios/Scenario.java
index 56599cc2..026297df 100644
--- a/integration-tests/src/test/java/org/web3j/protocol/scenarios/Scenario.java
+++ b/integration-tests/src/test/java/org/web3j/protocol/scenarios/Scenario.java
@@ -22,6 +22,8 @@
import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.protocol.http.HttpService;
+import org.web3j.tx.gas.ContractGasProvider;
+import org.web3j.tx.gas.StaticGasProvider;
import static junit.framework.TestCase.fail;
@@ -32,6 +34,8 @@ public class Scenario {
static final BigInteger GAS_PRICE = BigInteger.valueOf(22_000_000_000L);
static final BigInteger GAS_LIMIT = BigInteger.valueOf(4_300_000);
+ static final StaticGasProvider STATIC_GAS_PROVIDER =
+ new StaticGasProvider(GAS_PRICE, GAS_LIMIT);
// testnet
private static final String WALLET_PASSWORD = "";
From ffbbbddb175031a2b558bfce6a2066ce6a209873 Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 12:59:16 +0100
Subject: [PATCH 27/32] Support Gas Provider and Deprecated methods for
backwards compatibility
---
.../codegen/SolidityFunctionWrapper.java | 154 +++++++++++++-----
core/src/main/java/org/web3j/tx/Contract.java | 82 +++++++++-
2 files changed, 186 insertions(+), 50 deletions(-)
diff --git a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
index ca3ee846..3d9ac2eb 100644
--- a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
+++ b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
@@ -124,15 +124,21 @@ void generateJavaFiles(
TypeSpec.Builder classBuilder = createClassBuilder(className, bin);
- classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS));
+ classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS, false));
+ classBuilder.addMethod(buildConstructor(Credentials.class, CREDENTIALS, true));
classBuilder.addMethod(buildConstructor(TransactionManager.class,
- TRANSACTION_MANAGER));
+ TRANSACTION_MANAGER, false));
+ classBuilder.addMethod(buildConstructor(TransactionManager.class,
+ TRANSACTION_MANAGER, true));
classBuilder.addFields(buildFuncNameConstants(abi));
classBuilder.addMethods(
buildFunctionDefinitions(className, classBuilder, abi));
- classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS));
+ classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS, false));
+ classBuilder.addMethod(buildLoad(className, TransactionManager.class,
+ TRANSACTION_MANAGER, false));
+ classBuilder.addMethod(buildLoad(className, Credentials.class, CREDENTIALS, true));
classBuilder.addMethod(buildLoad(className, TransactionManager.class,
- TRANSACTION_MANAGER));
+ TRANSACTION_MANAGER, true));
addAddressesSupport(classBuilder, addresses);
@@ -259,25 +265,41 @@ private List buildFunctionDefinitions(
} else if (functionDefinition.getType().equals("constructor")) {
constructor = true;
methodSpecs.add(buildDeploy(
- className, functionDefinition, Credentials.class, CREDENTIALS));
+ className, functionDefinition, Credentials.class, CREDENTIALS, true));
+ methodSpecs.add(buildDeploy(
+ className, functionDefinition, TransactionManager.class,
+ TRANSACTION_MANAGER, true));
+ methodSpecs.add(buildDeploy(
+ className, functionDefinition, Credentials.class, CREDENTIALS, false));
methodSpecs.add(buildDeploy(
className, functionDefinition, TransactionManager.class,
- TRANSACTION_MANAGER));
+ TRANSACTION_MANAGER, false));
}
}
// constructor will not be specified in ABI file if its empty
if (!constructor) {
MethodSpec.Builder credentialsMethodBuilder =
- getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false);
+ getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false, true);
+ methodSpecs.add(buildDeployNoParams(
+ credentialsMethodBuilder, className, CREDENTIALS, false, true));
+
+ MethodSpec.Builder credentialsMethodBuilderNoGasProvider =
+ getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false, false);
methodSpecs.add(buildDeployNoParams(
- credentialsMethodBuilder, className, CREDENTIALS, false));
+ credentialsMethodBuilderNoGasProvider, className, CREDENTIALS, false, false));
MethodSpec.Builder transactionManagerMethodBuilder =
getDeployMethodSpec(
- className, TransactionManager.class, TRANSACTION_MANAGER, false);
+ className, TransactionManager.class, TRANSACTION_MANAGER, false, true);
+ methodSpecs.add(buildDeployNoParams(
+ transactionManagerMethodBuilder, className, TRANSACTION_MANAGER, false, true));
+
+ MethodSpec.Builder transactionManagerMethodBuilderNoGasProvider =
+ getDeployMethodSpec(
+ className, TransactionManager.class, TRANSACTION_MANAGER, false, false);
methodSpecs.add(buildDeployNoParams(
- transactionManagerMethodBuilder, className, TRANSACTION_MANAGER, false));
+ transactionManagerMethodBuilderNoGasProvider, className, TRANSACTION_MANAGER, false, false));
}
return methodSpecs;
@@ -306,53 +328,74 @@ Iterable buildFuncNameConstants(List functionDefinitio
return fields;
}
- private static MethodSpec buildConstructor(Class authType, String authName) {
- return MethodSpec.constructorBuilder()
+ private static MethodSpec buildConstructor(Class authType, String authName, boolean withGasProvider) {
+ MethodSpec.Builder toReturn = MethodSpec.constructorBuilder()
.addModifiers(Modifier.PROTECTED)
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
- .addParameter(authType, authName)
- .addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
- .addStatement("super($N, $N, $N, $N, $N)",
- BINARY, CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER)
- .build();
+ .addParameter(authType, authName);
+
+ if(withGasProvider) {
+ toReturn.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
+ .addStatement("super($N, $N, $N, $N, $N)",
+ BINARY, CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER);
+ } else {
+ toReturn.addParameter(BigInteger.class, GAS_PRICE)
+ .addParameter(BigInteger.class, GAS_LIMIT)
+ .addStatement("super($N, $N, $N, $N, $N, $N)",
+ BINARY, CONTRACT_ADDRESS, WEB3J, authName, GAS_PRICE, GAS_LIMIT)
+ .addAnnotation(Deprecated.class);
+ }
+
+ return toReturn.build();
}
private MethodSpec buildDeploy(
String className, AbiDefinition functionDefinition,
- Class authType, String authName) {
+ Class authType, String authName, boolean withGasProvider) {
boolean isPayable = functionDefinition.isPayable();
MethodSpec.Builder methodBuilder = getDeployMethodSpec(
- className, authType, authName, isPayable);
+ className, authType, authName, isPayable, withGasProvider);
String inputParams = addParameters(methodBuilder, functionDefinition.getInputs());
if (!inputParams.isEmpty()) {
return buildDeployWithParams(
- methodBuilder, className, inputParams, authName, isPayable);
+ methodBuilder, className, inputParams, authName, isPayable, withGasProvider);
} else {
- return buildDeployNoParams(methodBuilder, className, authName, isPayable);
+ return buildDeployNoParams(methodBuilder, className, authName, isPayable, withGasProvider);
}
}
private static MethodSpec buildDeployWithParams(
MethodSpec.Builder methodBuilder, String className, String inputParams,
- String authName, boolean isPayable) {
+ String authName, boolean isPayable, boolean withGasProvider) {
methodBuilder.addStatement("$T encodedConstructor = $T.encodeConstructor("
+ "$T.<$T>asList($L)"
+ ")",
String.class, FunctionEncoder.class, Arrays.class, Type.class, inputParams);
- if (isPayable) {
+ if (isPayable && !withGasProvider) {
methodBuilder.addStatement(
"return deployRemoteCall("
+ "$L.class, $L, $L, $L, $L, $L, encodedConstructor, $L)",
className, WEB3J, authName, GAS_PRICE, GAS_LIMIT, BINARY, INITIAL_VALUE);
- } else {
+ methodBuilder.addAnnotation(Deprecated.class);
+ } else if (isPayable && withGasProvider) {
+ methodBuilder.addStatement(
+ "return deployRemoteCall("
+ + "$L.class, $L, $L, $L, $L, encodedConstructor, $L)",
+ className, WEB3J, authName, CONTRACT_GAS_PROVIDER, BINARY, INITIAL_VALUE);
+ } else if (!isPayable && !withGasProvider) {
methodBuilder.addStatement(
"return deployRemoteCall($L.class, $L, $L, $L, $L, $L, encodedConstructor)",
className, WEB3J, authName, GAS_PRICE, GAS_LIMIT, BINARY);
+ methodBuilder.addAnnotation(Deprecated.class);
+ } else {
+ methodBuilder.addStatement(
+ "return deployRemoteCall($L.class, $L, $L, $L, $L, encodedConstructor)",
+ className, WEB3J, authName, CONTRACT_GAS_PROVIDER, BINARY);
}
return methodBuilder.build();
@@ -360,49 +403,76 @@ private static MethodSpec buildDeployWithParams(
private static MethodSpec buildDeployNoParams(
MethodSpec.Builder methodBuilder, String className,
- String authName, boolean isPayable) {
- if (isPayable) {
+ String authName, boolean isPayable, boolean withGasPRovider) {
+ if (isPayable && !withGasPRovider) {
methodBuilder.addStatement(
"return deployRemoteCall($L.class, $L, $L, $L, $L, $L, \"\", $L)",
className, WEB3J, authName, GAS_PRICE, GAS_LIMIT, BINARY, INITIAL_VALUE);
- } else {
+ methodBuilder.addAnnotation(Deprecated.class);
+ } else if (isPayable && withGasPRovider) {
+ methodBuilder.addStatement(
+ "return deployRemoteCall($L.class, $L, $L, $L, $L, \"\", $L)",
+ className, WEB3J, authName, CONTRACT_GAS_PROVIDER, BINARY, INITIAL_VALUE);
+ } else if (!isPayable && !withGasPRovider) {
methodBuilder.addStatement(
"return deployRemoteCall($L.class, $L, $L, $L, $L, $L, \"\")",
className, WEB3J, authName, GAS_PRICE, GAS_LIMIT, BINARY);
+ methodBuilder.addAnnotation(Deprecated.class);
+ } else {
+ methodBuilder.addStatement(
+ "return deployRemoteCall($L.class, $L, $L, $L, $L, \"\")",
+ className, WEB3J, authName, CONTRACT_GAS_PROVIDER, BINARY);
}
return methodBuilder.build();
}
private static MethodSpec.Builder getDeployMethodSpec(
- String className, Class authType, String authName, boolean isPayable) {
+ String className, Class authType, String authName, boolean isPayable, boolean withGasProvider) {
MethodSpec.Builder builder = MethodSpec.methodBuilder("deploy")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(
buildRemoteCall(TypeVariableName.get(className, Type.class)))
.addParameter(Web3j.class, WEB3J)
- .addParameter(authType, authName)
- .addParameter(BigInteger.class, GAS_PRICE)
- .addParameter(BigInteger.class, GAS_LIMIT);
- if (isPayable) {
- return builder.addParameter(BigInteger.class, INITIAL_VALUE);
- } else {
- return builder;
+ .addParameter(authType, authName);
+ if (isPayable && !withGasProvider) {
+ return builder.addParameter(BigInteger.class, GAS_PRICE)
+ .addParameter(BigInteger.class, GAS_LIMIT)
+ .addParameter(BigInteger.class, INITIAL_VALUE);
+ } else if (isPayable && withGasProvider) {
+ return builder.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
+ .addParameter(BigInteger.class, INITIAL_VALUE);
+ } else if (!isPayable && withGasProvider) {
+ return builder.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER);
+ }
+ else {
+ return builder.addParameter(BigInteger.class, GAS_PRICE)
+ .addParameter(BigInteger.class, GAS_LIMIT);
}
}
private static MethodSpec buildLoad(
- String className, Class authType, String authName) {
- return MethodSpec.methodBuilder("load")
+ String className, Class authType, String authName, boolean withGasProvider) {
+ MethodSpec.Builder toReturn = MethodSpec.methodBuilder("load")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(TypeVariableName.get(className, Type.class))
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
- .addParameter(authType, authName)
- .addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
- .addStatement("return new $L($L, $L, $L, $L)", className,
- CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER)
- .build();
+ .addParameter(authType, authName);
+
+ if(withGasProvider) {
+ toReturn.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
+ .addStatement("return new $L($L, $L, $L, $L)", className,
+ CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER);
+ } else {
+ toReturn.addParameter(BigInteger.class, GAS_PRICE)
+ .addParameter(BigInteger.class, GAS_LIMIT)
+ .addStatement("return new $L($L, $L, $L, $L, $L)", className,
+ CONTRACT_ADDRESS, WEB3J, authName, GAS_PRICE, GAS_LIMIT)
+ .addAnnotation(Deprecated.class);
+ }
+
+ return toReturn.build();
}
String addParameters(
diff --git a/core/src/main/java/org/web3j/tx/Contract.java b/core/src/main/java/org/web3j/tx/Contract.java
index 0afeaf63..748a4750 100644
--- a/core/src/main/java/org/web3j/tx/Contract.java
+++ b/core/src/main/java/org/web3j/tx/Contract.java
@@ -338,19 +338,19 @@ private static T create(
protected static T deploy(
Class type,
Web3j web3j, Credentials credentials,
- BigInteger gasPrice, BigInteger gasLimit,
- String binary, String encodedConstructor, BigInteger value) throws
- IOException, TransactionException {
+ ContractGasProvider contractGasProvider,
+ String binary, String encodedConstructor, BigInteger value)
+ throws RuntimeException, TransactionException {
try {
Constructor constructor = type.getDeclaredConstructor(
String.class,
Web3j.class, Credentials.class,
- BigInteger.class, BigInteger.class);
+ ContractGasProvider.class);
constructor.setAccessible(true);
// we want to use null here to ensure that "to" parameter on message is not populated
- T contract = constructor.newInstance(null, web3j, credentials, gasPrice, gasLimit);
+ T contract = constructor.newInstance(null, web3j, credentials, contractGasProvider);
return create(contract, binary, encodedConstructor, value);
} catch (TransactionException e) {
@@ -363,9 +363,9 @@ protected static T deploy(
protected static T deploy(
Class type,
Web3j web3j, TransactionManager transactionManager,
- BigInteger gasPrice, BigInteger gasLimit,
+ ContractGasProvider contractGasProvider,
String binary, String encodedConstructor, BigInteger value)
- throws IOException, TransactionException {
+ throws RuntimeException, TransactionException {
try {
Constructor constructor = type.getDeclaredConstructor(
@@ -376,7 +376,7 @@ protected static T deploy(
// we want to use null here to ensure that "to" parameter on message is not populated
T contract = constructor.newInstance(
- null, web3j, transactionManager, new StaticGasProvider(gasPrice, gasLimit));
+ null, web3j, transactionManager, contractGasProvider);
return create(contract, binary, encodedConstructor, value);
} catch (TransactionException e) {
throw e;
@@ -385,6 +385,19 @@ protected static T deploy(
}
}
+ @Deprecated
+ protected static T deploy(
+ Class type,
+ Web3j web3j, Credentials credentials,
+ BigInteger gasPrice, BigInteger gasLimit,
+ String binary, String encodedConstructor, BigInteger value)
+ throws RuntimeException, TransactionException {
+
+ return deploy(type, web3j, credentials,
+ new StaticGasProvider(gasPrice, gasLimit),
+ binary, encodedConstructor, value);
+ }
+
public static RemoteCall deployRemoteCall(
Class type,
Web3j web3j, Credentials credentials,
@@ -404,6 +417,39 @@ public static RemoteCall deployRemoteCall(
type, web3j, credentials, gasPrice, gasLimit,
binary, encodedConstructor, BigInteger.ZERO);
}
+ public static RemoteCall deployRemoteCall(
+ Class type,
+ Web3j web3j, Credentials credentials,
+ ContractGasProvider contractGasProvider,
+ String binary, String encodedConstructor, BigInteger value) {
+ return new RemoteCall<>(() -> deploy(
+ type, web3j, credentials, contractGasProvider, binary,
+ encodedConstructor, value));
+ }
+
+ public static RemoteCall deployRemoteCall(
+ Class type,
+ Web3j web3j, Credentials credentials,
+ ContractGasProvider contractGasProvider,
+ String binary, String encodedConstructor) {
+ return new RemoteCall<>(() -> deploy(
+ type, web3j, credentials, contractGasProvider, binary,
+ encodedConstructor, BigInteger.ZERO));
+ }
+
+ @Deprecated
+ protected static T deploy(
+ Class type,
+ Web3j web3j, TransactionManager transactionManager,
+ BigInteger gasPrice, BigInteger gasLimit,
+ String binary, String encodedConstructor, BigInteger value)
+ throws IOException, TransactionException {
+
+ return deploy(type, web3j, transactionManager,
+ new StaticGasProvider(gasPrice, gasLimit),
+ binary, encodedConstructor, value);
+ }
+
public static RemoteCall deployRemoteCall(
Class type,
@@ -425,6 +471,26 @@ public static RemoteCall deployRemoteCall(
encodedConstructor, BigInteger.ZERO);
}
+ public static RemoteCall deployRemoteCall(
+ Class type,
+ Web3j web3j, TransactionManager transactionManager,
+ ContractGasProvider contractGasProvider,
+ String binary, String encodedConstructor, BigInteger value) {
+ return new RemoteCall<>(() -> deploy(
+ type, web3j, transactionManager, contractGasProvider, binary,
+ encodedConstructor, value));
+ }
+
+ public static RemoteCall deployRemoteCall(
+ Class type,
+ Web3j web3j, TransactionManager transactionManager,
+ ContractGasProvider contractGasProvider,
+ String binary, String encodedConstructor) {
+ return new RemoteCall<>(() -> deploy(
+ type, web3j, transactionManager, contractGasProvider, binary,
+ encodedConstructor, BigInteger.ZERO));
+ }
+
public static EventValues staticExtractEventParameters(
Event event, Log log) {
From 62f1b6cf6640cd67941b4c75821677fb5c0947a5 Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 12:59:36 +0100
Subject: [PATCH 28/32] Regenerated contracts
---
.../test/java/org/web3j/generated/Arrays.java | 30 +++++++++++++++
.../java/org/web3j/generated/Fibonacci.java | 30 +++++++++++++++
.../java/org/web3j/generated/Greeter.java | 32 ++++++++++++++++
.../web3j/generated/HumanStandardToken.java | 38 +++++++++++++++++++
.../test/java/org/web3j/generated/ShipIt.java | 30 +++++++++++++++
.../org/web3j/generated/SimpleStorage.java | 30 +++++++++++++++
6 files changed, 190 insertions(+)
diff --git a/integration-tests/src/test/java/org/web3j/generated/Arrays.java b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
index 0cc9ed6d..33b12dcd 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Arrays.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Arrays.java
@@ -39,10 +39,20 @@ public class Arrays extends Contract {
public static final String FUNC_DYNAMICREVERSE = "dynamicReverse";
+ @Deprecated
+ protected Arrays(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
protected Arrays(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
+ @Deprecated
+ protected Arrays(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
protected Arrays(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
@@ -126,14 +136,34 @@ public List call() throws Exception {
});
}
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(Arrays.class, web3j, credentials, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(Arrays.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(Arrays.class, web3j, transactionManager, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(Arrays.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
+ @Deprecated
+ public static Arrays load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new Arrays(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static Arrays load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new Arrays(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
public static Arrays load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return new Arrays(contractAddress, web3j, credentials, contractGasProvider);
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
index 4d475b8d..63a2ceb3 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
@@ -44,10 +44,20 @@ public class Fibonacci extends Contract {
Arrays.>asList(new TypeReference() {}, new TypeReference() {}));
;
+ @Deprecated
+ protected Fibonacci(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
protected Fibonacci(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
+ @Deprecated
+ protected Fibonacci(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
protected Fibonacci(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
@@ -100,14 +110,34 @@ public Observable notifyEventObservable(DefaultBlockParamet
return notifyEventObservable(filter);
}
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(Fibonacci.class, web3j, credentials, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(Fibonacci.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(Fibonacci.class, web3j, transactionManager, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(Fibonacci.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
+ @Deprecated
+ public static Fibonacci load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new Fibonacci(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static Fibonacci load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new Fibonacci(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
public static Fibonacci load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return new Fibonacci(contractAddress, web3j, credentials, contractGasProvider);
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/Greeter.java b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
index fc93d03d..122a81da 100644
--- a/integration-tests/src/test/java/org/web3j/generated/Greeter.java
+++ b/integration-tests/src/test/java/org/web3j/generated/Greeter.java
@@ -34,10 +34,20 @@ public class Greeter extends Contract {
public static final String FUNC_GREET = "greet";
+ @Deprecated
+ protected Greeter(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
protected Greeter(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
+ @Deprecated
+ protected Greeter(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
protected Greeter(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
@@ -65,16 +75,38 @@ public RemoteCall greet() {
return executeRemoteCallSingleValueReturn(function, String.class);
}
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String _greeting) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Utf8String(_greeting)));
+ return deployRemoteCall(Greeter.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
+ }
+
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String _greeting) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Utf8String(_greeting)));
+ return deployRemoteCall(Greeter.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String _greeting) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Utf8String(_greeting)));
return deployRemoteCall(Greeter.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String _greeting) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Utf8String(_greeting)));
return deployRemoteCall(Greeter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
+ @Deprecated
+ public static Greeter load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new Greeter(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static Greeter load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new Greeter(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
public static Greeter load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return new Greeter(contractAddress, web3j, credentials, contractGasProvider);
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
index 95649f7c..1c957c6a 100644
--- a/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
+++ b/integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
@@ -70,10 +70,20 @@ public class HumanStandardToken extends Contract {
Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference() {}));
;
+ @Deprecated
+ protected HumanStandardToken(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
protected HumanStandardToken(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
+ @Deprecated
+ protected HumanStandardToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
protected HumanStandardToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
@@ -166,6 +176,23 @@ public RemoteCall allowance(String _owner, String _spender) {
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, BigInteger _initialAmount, String _tokenName, BigInteger _decimalUnits, String _tokenSymbol) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_initialAmount),
+ new org.web3j.abi.datatypes.Utf8String(_tokenName),
+ new org.web3j.abi.datatypes.generated.Uint8(_decimalUnits),
+ new org.web3j.abi.datatypes.Utf8String(_tokenSymbol)));
+ return deployRemoteCall(HumanStandardToken.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
+ }
+
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, BigInteger _initialAmount, String _tokenName, BigInteger _decimalUnits, String _tokenSymbol) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_initialAmount),
+ new org.web3j.abi.datatypes.Utf8String(_tokenName),
+ new org.web3j.abi.datatypes.generated.Uint8(_decimalUnits),
+ new org.web3j.abi.datatypes.Utf8String(_tokenSymbol)));
+ return deployRemoteCall(HumanStandardToken.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger _initialAmount, String _tokenName, BigInteger _decimalUnits, String _tokenSymbol) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_initialAmount),
new org.web3j.abi.datatypes.Utf8String(_tokenName),
@@ -174,6 +201,7 @@ public static RemoteCall deploy(Web3j web3j, Credentials cre
return deployRemoteCall(HumanStandardToken.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger _initialAmount, String _tokenName, BigInteger _decimalUnits, String _tokenSymbol) {
String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_initialAmount),
new org.web3j.abi.datatypes.Utf8String(_tokenName),
@@ -252,6 +280,16 @@ public Observable approvalEventObservable(DefaultBlockPar
return approvalEventObservable(filter);
}
+ @Deprecated
+ public static HumanStandardToken load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new HumanStandardToken(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static HumanStandardToken load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new HumanStandardToken(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
public static HumanStandardToken load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return new HumanStandardToken(contractAddress, web3j, credentials, contractGasProvider);
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/ShipIt.java b/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
index 77232203..60365505 100644
--- a/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
+++ b/integration-tests/src/test/java/org/web3j/generated/ShipIt.java
@@ -34,10 +34,20 @@ public class ShipIt extends Contract {
public static final String FUNC_SHIPMENTS = "shipments";
+ @Deprecated
+ protected ShipIt(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
protected ShipIt(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
+ @Deprecated
+ protected ShipIt(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
protected ShipIt(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
@@ -64,14 +74,34 @@ public Tuple8 deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(ShipIt.class, web3j, credentials, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(ShipIt.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(ShipIt.class, web3j, transactionManager, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(ShipIt.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
+ @Deprecated
+ public static ShipIt load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new ShipIt(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static ShipIt load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new ShipIt(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
public static ShipIt load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return new ShipIt(contractAddress, web3j, credentials, contractGasProvider);
}
diff --git a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
index dc3268c2..005f4153 100644
--- a/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
+++ b/integration-tests/src/test/java/org/web3j/generated/SimpleStorage.java
@@ -31,10 +31,20 @@ public class SimpleStorage extends Contract {
public static final String FUNC_GET = "get";
+ @Deprecated
+ protected SimpleStorage(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
protected SimpleStorage(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
+ @Deprecated
+ protected SimpleStorage(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
protected SimpleStorage(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
@@ -54,14 +64,34 @@ public RemoteCall get() {
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(SimpleStorage.class, web3j, credentials, contractGasProvider, BINARY, "");
+ }
+
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return deployRemoteCall(SimpleStorage.class, web3j, transactionManager, contractGasProvider, BINARY, "");
+ }
+
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(SimpleStorage.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
+ @Deprecated
public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(SimpleStorage.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
+ @Deprecated
+ public static SimpleStorage load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new SimpleStorage(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static SimpleStorage load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new SimpleStorage(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
public static SimpleStorage load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return new SimpleStorage(contractAddress, web3j, credentials, contractGasProvider);
}
From 9133df5f7484d2612141759d7d6a63f42c20daac Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 13:07:52 +0100
Subject: [PATCH 29/32] Fix checkstyle
---
.../codegen/SolidityFunctionWrapper.java | 43 ++++++++++++-------
core/src/main/java/org/web3j/tx/Contract.java | 28 ++++++------
2 files changed, 41 insertions(+), 30 deletions(-)
diff --git a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
index 3d9ac2eb..23028d33 100644
--- a/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
+++ b/codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
@@ -280,26 +280,34 @@ private List buildFunctionDefinitions(
// constructor will not be specified in ABI file if its empty
if (!constructor) {
MethodSpec.Builder credentialsMethodBuilder =
- getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false, true);
+ getDeployMethodSpec(className, Credentials.class, CREDENTIALS,
+ false, true);
methodSpecs.add(buildDeployNoParams(
- credentialsMethodBuilder, className, CREDENTIALS, false, true));
+ credentialsMethodBuilder, className, CREDENTIALS,
+ false, true));
MethodSpec.Builder credentialsMethodBuilderNoGasProvider =
- getDeployMethodSpec(className, Credentials.class, CREDENTIALS, false, false);
+ getDeployMethodSpec(className, Credentials.class, CREDENTIALS,
+ false, false);
methodSpecs.add(buildDeployNoParams(
- credentialsMethodBuilderNoGasProvider, className, CREDENTIALS, false, false));
+ credentialsMethodBuilderNoGasProvider, className, CREDENTIALS,
+ false, false));
MethodSpec.Builder transactionManagerMethodBuilder =
getDeployMethodSpec(
- className, TransactionManager.class, TRANSACTION_MANAGER, false, true);
+ className, TransactionManager.class, TRANSACTION_MANAGER,
+ false, true);
methodSpecs.add(buildDeployNoParams(
- transactionManagerMethodBuilder, className, TRANSACTION_MANAGER, false, true));
+ transactionManagerMethodBuilder, className, TRANSACTION_MANAGER,
+ false, true));
MethodSpec.Builder transactionManagerMethodBuilderNoGasProvider =
getDeployMethodSpec(
- className, TransactionManager.class, TRANSACTION_MANAGER, false, false);
+ className, TransactionManager.class, TRANSACTION_MANAGER,
+ false, false);
methodSpecs.add(buildDeployNoParams(
- transactionManagerMethodBuilderNoGasProvider, className, TRANSACTION_MANAGER, false, false));
+ transactionManagerMethodBuilderNoGasProvider, className, TRANSACTION_MANAGER,
+ false, false));
}
return methodSpecs;
@@ -328,14 +336,15 @@ Iterable buildFuncNameConstants(List functionDefinitio
return fields;
}
- private static MethodSpec buildConstructor(Class authType, String authName, boolean withGasProvider) {
+ private static MethodSpec buildConstructor(Class authType, String authName,
+ boolean withGasProvider) {
MethodSpec.Builder toReturn = MethodSpec.constructorBuilder()
.addModifiers(Modifier.PROTECTED)
.addParameter(String.class, CONTRACT_ADDRESS)
.addParameter(Web3j.class, WEB3J)
.addParameter(authType, authName);
- if(withGasProvider) {
+ if (withGasProvider) {
toReturn.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
.addStatement("super($N, $N, $N, $N, $N)",
BINARY, CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER);
@@ -362,9 +371,11 @@ private MethodSpec buildDeploy(
if (!inputParams.isEmpty()) {
return buildDeployWithParams(
- methodBuilder, className, inputParams, authName, isPayable, withGasProvider);
+ methodBuilder, className, inputParams, authName,
+ isPayable, withGasProvider);
} else {
- return buildDeployNoParams(methodBuilder, className, authName, isPayable, withGasProvider);
+ return buildDeployNoParams(methodBuilder, className, authName,
+ isPayable, withGasProvider);
}
}
@@ -428,7 +439,8 @@ private static MethodSpec buildDeployNoParams(
}
private static MethodSpec.Builder getDeployMethodSpec(
- String className, Class authType, String authName, boolean isPayable, boolean withGasProvider) {
+ String className, Class authType, String authName,
+ boolean isPayable, boolean withGasProvider) {
MethodSpec.Builder builder = MethodSpec.methodBuilder("deploy")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.returns(
@@ -444,8 +456,7 @@ private static MethodSpec.Builder getDeployMethodSpec(
.addParameter(BigInteger.class, INITIAL_VALUE);
} else if (!isPayable && withGasProvider) {
return builder.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER);
- }
- else {
+ } else {
return builder.addParameter(BigInteger.class, GAS_PRICE)
.addParameter(BigInteger.class, GAS_LIMIT);
}
@@ -460,7 +471,7 @@ private static MethodSpec buildLoad(
.addParameter(Web3j.class, WEB3J)
.addParameter(authType, authName);
- if(withGasProvider) {
+ if (withGasProvider) {
toReturn.addParameter(ContractGasProvider.class, CONTRACT_GAS_PROVIDER)
.addStatement("return new $L($L, $L, $L, $L)", className,
CONTRACT_ADDRESS, WEB3J, authName, CONTRACT_GAS_PROVIDER);
diff --git a/core/src/main/java/org/web3j/tx/Contract.java b/core/src/main/java/org/web3j/tx/Contract.java
index 748a4750..8c03e392 100644
--- a/core/src/main/java/org/web3j/tx/Contract.java
+++ b/core/src/main/java/org/web3j/tx/Contract.java
@@ -398,6 +398,19 @@ protected static T deploy(
binary, encodedConstructor, value);
}
+ @Deprecated
+ protected static T deploy(
+ Class type,
+ Web3j web3j, TransactionManager transactionManager,
+ BigInteger gasPrice, BigInteger gasLimit,
+ String binary, String encodedConstructor, BigInteger value)
+ throws IOException, TransactionException {
+
+ return deploy(type, web3j, transactionManager,
+ new StaticGasProvider(gasPrice, gasLimit),
+ binary, encodedConstructor, value);
+ }
+
public static RemoteCall deployRemoteCall(
Class type,
Web3j web3j, Credentials credentials,
@@ -417,6 +430,7 @@ public static RemoteCall deployRemoteCall(
type, web3j, credentials, gasPrice, gasLimit,
binary, encodedConstructor, BigInteger.ZERO);
}
+
public static RemoteCall deployRemoteCall(
Class type,
Web3j web3j, Credentials credentials,
@@ -437,20 +451,6 @@ public static RemoteCall deployRemoteCall(
encodedConstructor, BigInteger.ZERO));
}
- @Deprecated
- protected static T deploy(
- Class type,
- Web3j web3j, TransactionManager transactionManager,
- BigInteger gasPrice, BigInteger gasLimit,
- String binary, String encodedConstructor, BigInteger value)
- throws IOException, TransactionException {
-
- return deploy(type, web3j, transactionManager,
- new StaticGasProvider(gasPrice, gasLimit),
- binary, encodedConstructor, value);
- }
-
-
public static RemoteCall deployRemoteCall(
Class type,
Web3j web3j, TransactionManager transactionManager,
From 586d3e4dcfc846af2edda05a8f5f37459c51d513 Mon Sep 17 00:00:00 2001
From: ivaylo
Date: Thu, 4 Oct 2018 14:23:57 +0100
Subject: [PATCH 30/32] Fix function throws
---
core/src/main/java/org/web3j/tx/Contract.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/src/main/java/org/web3j/tx/Contract.java b/core/src/main/java/org/web3j/tx/Contract.java
index 8c03e392..a399d197 100644
--- a/core/src/main/java/org/web3j/tx/Contract.java
+++ b/core/src/main/java/org/web3j/tx/Contract.java
@@ -404,7 +404,7 @@ protected static T deploy(
Web3j web3j, TransactionManager transactionManager,
BigInteger gasPrice, BigInteger gasLimit,
String binary, String encodedConstructor, BigInteger value)
- throws IOException, TransactionException {
+ throws RuntimeException, TransactionException {
return deploy(type, web3j, transactionManager,
new StaticGasProvider(gasPrice, gasLimit),
From 71547c5115d9cf9a75ae7602bdf93b2d49d9b362 Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Fri, 5 Oct 2018 09:06:42 +1000
Subject: [PATCH 31/32] #720: adding support for the gradle-release-plugin to
support SCM tagging + version increment
---
build.gradle | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/build.gradle b/build.gradle
index d18fca0f..17778f42 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,6 +27,7 @@ buildscript {
plugins {
id "com.jfrog.bintray" version "1.7.3"
+ id "net.researchgate.release" version "2.7.0"
}
apply plugin: 'java'
@@ -225,6 +226,10 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
}
tasks.findByName('uploadArchives').mustRunAfter 'build'
}
+
+release {
+ tagTemplate = 'v${version}'
+ failOnCommitNeeded = true
}
From 69349ad614acb847466ec4188d5fc712b092386d Mon Sep 17 00:00:00 2001
From: Sam Nazha
Date: Fri, 5 Oct 2018 09:12:34 +1000
Subject: [PATCH 32/32] #720: adding support for the gradle-release-plugin to
support SCM tagging + version increment
---
build.gradle | 1 +
1 file changed, 1 insertion(+)
diff --git a/build.gradle b/build.gradle
index 17778f42..3d25ab1c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -226,6 +226,7 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
}
tasks.findByName('uploadArchives').mustRunAfter 'build'
}
+}
release {
tagTemplate = 'v${version}'