Compiled with web3j 3.3.1

This commit is contained in:
Vitaliy Vlasov 2018-03-27 17:28:46 +03:00
parent e549725648
commit 1d3dd6fbee
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
4 changed files with 693 additions and 406 deletions

View File

@ -5,9 +5,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Future;
import org.web3j.abi.EventEncoder;
import org.web3j.abi.EventValues;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.Event;
@ -17,6 +15,7 @@ import org.web3j.abi.datatypes.generated.Uint256;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.DefaultBlockParameter;
import org.web3j.protocol.core.RemoteCall;
import org.web3j.protocol.core.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.Log;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
@ -26,20 +25,22 @@ import rx.Observable;
import rx.functions.Func1;
/**
* Auto generated code.<br>
* <strong>Do not modify!</strong><br>
* Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>, or {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update.
* <p>Auto generated code.
* <p><strong>Do not modify!</strong>
* <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 2.3.0.
* <p>Generated with web3j version 3.3.1.
*/
public final class ERC20 extends Contract {
public class ERC20 extends Contract {
private static final String BINARY = "";
private ERC20(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
protected ERC20(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}
private ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
@ -47,13 +48,14 @@ public final class ERC20 extends Contract {
final Event event = new Event("Transfer",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(event, transactionReceipt);
ArrayList<TransferEventResponse> responses = new ArrayList<TransferEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
for (Contract.EventValuesWithLog eventValues : valueList) {
TransferEventResponse typedResponse = new TransferEventResponse();
typedResponse.from = (Address) eventValues.getIndexedValues().get(0);
typedResponse.to = (Address) eventValues.getIndexedValues().get(1);
typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.log = eventValues.getLog();
typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse.to = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
responses.add(typedResponse);
}
return responses;
@ -68,11 +70,12 @@ public final class ERC20 extends Contract {
return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
@Override
public TransferEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(event, log);
TransferEventResponse typedResponse = new TransferEventResponse();
typedResponse.from = (Address) eventValues.getIndexedValues().get(0);
typedResponse.to = (Address) eventValues.getIndexedValues().get(1);
typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.log = log;
typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse.to = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
return typedResponse;
}
});
@ -82,13 +85,14 @@ public final class ERC20 extends Contract {
final Event event = new Event("Approval",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(event, transactionReceipt);
ArrayList<ApprovalEventResponse> responses = new ArrayList<ApprovalEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
for (Contract.EventValuesWithLog eventValues : valueList) {
ApprovalEventResponse typedResponse = new ApprovalEventResponse();
typedResponse.owner = (Address) eventValues.getIndexedValues().get(0);
typedResponse.spender = (Address) eventValues.getIndexedValues().get(1);
typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.log = eventValues.getLog();
typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse.spender = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
responses.add(typedResponse);
}
return responses;
@ -103,58 +107,73 @@ public final class ERC20 extends Contract {
return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
@Override
public ApprovalEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(event, log);
ApprovalEventResponse typedResponse = new ApprovalEventResponse();
typedResponse.owner = (Address) eventValues.getIndexedValues().get(0);
typedResponse.spender = (Address) eventValues.getIndexedValues().get(1);
typedResponse.value = (Uint256) eventValues.getNonIndexedValues().get(0);
typedResponse.log = log;
typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse.spender = (String) eventValues.getIndexedValues().get(1).getValue();
typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
return typedResponse;
}
});
}
public Future<TransactionReceipt> approve(Address spender, Uint256 value) {
Function function = new Function("approve", Arrays.<Type>asList(spender, value), Collections.<TypeReference<?>>emptyList());
return executeTransactionAsync(function);
public RemoteCall<TransactionReceipt> approve(String spender, BigInteger value) {
final Function function = new Function(
"approve",
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(spender),
new org.web3j.abi.datatypes.generated.Uint256(value)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
public Future<Uint256> totalSupply() {
Function function = new Function("totalSupply",
public RemoteCall<BigInteger> totalSupply() {
final Function function = new Function("totalSupply",
Arrays.<Type>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeCallSingleValueReturnAsync(function);
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
public Future<TransactionReceipt> transferFrom(Address from, Address to, Uint256 value) {
Function function = new Function("transferFrom", Arrays.<Type>asList(from, to, value), Collections.<TypeReference<?>>emptyList());
return executeTransactionAsync(function);
public RemoteCall<TransactionReceipt> transferFrom(String from, String to, BigInteger value) {
final Function function = new Function(
"transferFrom",
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(from),
new org.web3j.abi.datatypes.Address(to),
new org.web3j.abi.datatypes.generated.Uint256(value)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
public Future<Uint256> balanceOf(Address who) {
Function function = new Function("balanceOf",
Arrays.<Type>asList(who),
public RemoteCall<BigInteger> balanceOf(String who) {
final Function function = new Function("balanceOf",
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(who)),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeCallSingleValueReturnAsync(function);
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
public Future<TransactionReceipt> transfer(Address to, Uint256 value) {
Function function = new Function("transfer", Arrays.<Type>asList(to, value), Collections.<TypeReference<?>>emptyList());
return executeTransactionAsync(function);
public RemoteCall<TransactionReceipt> transfer(String to, BigInteger value) {
final Function function = new Function(
"transfer",
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(to),
new org.web3j.abi.datatypes.generated.Uint256(value)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
public Future<Uint256> allowance(Address owner, Address spender) {
Function function = new Function("allowance",
Arrays.<Type>asList(owner, spender),
public RemoteCall<BigInteger> allowance(String owner, String spender) {
final Function function = new Function("allowance",
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(owner),
new org.web3j.abi.datatypes.Address(spender)),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeCallSingleValueReturnAsync(function);
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
public static Future<ERC20> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(ERC20.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialWeiValue);
public static RemoteCall<ERC20> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(ERC20.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
public static Future<ERC20> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(ERC20.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialWeiValue);
public static RemoteCall<ERC20> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(ERC20.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
public static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
@ -166,18 +185,22 @@ public final class ERC20 extends Contract {
}
public static class TransferEventResponse {
public Address from;
public Log log;
public Address to;
public String from;
public Uint256 value;
public String to;
public BigInteger value;
}
public static class ApprovalEventResponse {
public Address owner;
public Log log;
public Address spender;
public String owner;
public Uint256 value;
public String spender;
public BigInteger value;
}
}

File diff suppressed because one or more lines are too long

View File

@ -5,9 +5,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Future;
import org.web3j.abi.EventEncoder;
import org.web3j.abi.EventValues;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.Event;
@ -16,6 +14,7 @@ import org.web3j.abi.datatypes.Type;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.DefaultBlockParameter;
import org.web3j.protocol.core.RemoteCall;
import org.web3j.protocol.core.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.Log;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
@ -25,20 +24,22 @@ import rx.Observable;
import rx.functions.Func1;
/**
* Auto generated code.<br>
* <strong>Do not modify!</strong><br>
* Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>, or {@link org.web3j.codegen.SolidityFunctionWrapperGenerator} to update.
* <p>Auto generated code.
* <p><strong>Do not modify!</strong>
* <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 2.3.0.
* <p>Generated with web3j version 3.3.1.
*/
public final class Owned extends Contract {
private static final String BINARY = "606060405260008054600160a060020a03191633600160a060020a0316179055341561002a57600080fd5b5b6101578061003a6000396000f300606060405263ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313af403581146100485780638da5cb5b14610069575b600080fd5b341561005357600080fd5b610067600160a060020a0360043516610098565b005b341561007457600080fd5b61007c61011c565b604051600160a060020a03909116815260200160405180910390f35b60005433600160a060020a039081169116146100b357610118565b600054600160a060020a0380831691167f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236460405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600054600160a060020a0316815600a165627a7a723058206bbc12c5f2dde30ed4acaaf0df4c0bc44e5909ce3b8ab82da7f226137465b3fd0029";
public class Owned extends Contract {
private static final String BINARY = "606060405260008054600160a060020a03191633600160a060020a0316179055341561002a57600080fd5b6101ac806100396000396000f30060606040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313af403581146100505780638da5cb5b1461007e575b600080fd5b341561005b57600080fd5b61007c73ffffffffffffffffffffffffffffffffffffffff600435166100ba565b005b341561008957600080fd5b610091610164565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116146100e257610161565b60005473ffffffffffffffffffffffffffffffffffffffff80831691167f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236460405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff191673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60005473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a723058206f92b115e641d63f5ea85daf79224b120587e075f9a8eee88ef952eb8c83efc40029";
private Owned(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
protected Owned(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}
private Owned(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
protected Owned(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
@ -46,12 +47,13 @@ public final class Owned extends Contract {
final Event event = new Event("NewOwner",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList());
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(event, transactionReceipt);
ArrayList<NewOwnerEventResponse> responses = new ArrayList<NewOwnerEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
for (Contract.EventValuesWithLog eventValues : valueList) {
NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
typedResponse.old = (Address) eventValues.getIndexedValues().get(0);
typedResponse.current = (Address) eventValues.getIndexedValues().get(1);
typedResponse.log = eventValues.getLog();
typedResponse.old = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse.current = (String) eventValues.getIndexedValues().get(1).getValue();
responses.add(typedResponse);
}
return responses;
@ -66,33 +68,37 @@ public final class Owned extends Contract {
return web3j.ethLogObservable(filter).map(new Func1<Log, NewOwnerEventResponse>() {
@Override
public NewOwnerEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(event, log);
NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
typedResponse.old = (Address) eventValues.getIndexedValues().get(0);
typedResponse.current = (Address) eventValues.getIndexedValues().get(1);
typedResponse.log = log;
typedResponse.old = (String) eventValues.getIndexedValues().get(0).getValue();
typedResponse.current = (String) eventValues.getIndexedValues().get(1).getValue();
return typedResponse;
}
});
}
public Future<TransactionReceipt> setOwner(Address _new) {
Function function = new Function("setOwner", Arrays.<Type>asList(_new), Collections.<TypeReference<?>>emptyList());
return executeTransactionAsync(function);
public RemoteCall<TransactionReceipt> setOwner(String _new) {
final Function function = new Function(
"setOwner",
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_new)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
public Future<Address> owner() {
Function function = new Function("owner",
public RemoteCall<String> owner() {
final Function function = new Function("owner",
Arrays.<Type>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
return executeCallSingleValueReturnAsync(function);
return executeRemoteCallSingleValueReturn(function, String.class);
}
public static Future<Owned> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(Owned.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialWeiValue);
public static RemoteCall<Owned> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(Owned.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
public static Future<Owned> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
return deployAsync(Owned.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialWeiValue);
public static RemoteCall<Owned> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(Owned.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
public static Owned load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
@ -104,8 +110,10 @@ public final class Owned extends Contract {
}
public static class NewOwnerEventResponse {
public Address old;
public Log log;
public Address current;
public String old;
public String current;
}
}

File diff suppressed because one or more lines are too long