include generated contract interfaces in git

This commit is contained in:
Martin Klepsch 2018-03-12 23:49:28 +07:00 committed by Tetiana Churikova
parent 32c4d3ccee
commit c599021a40
5 changed files with 1269 additions and 1 deletions

1
.gitignore vendored
View File

@ -26,4 +26,3 @@ node_modules
/config-prod.edn
/config-dev.edn
/config-test.edn
/src/java

View File

@ -0,0 +1,183 @@
package commiteth.eth.contracts;
import java.math.BigInteger;
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;
import org.web3j.abi.datatypes.Function;
import org.web3j.abi.datatypes.Type;
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.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.Log;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
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>Generated with web3j version 2.3.0.
*/
public final class ERC20 extends Contract {
private static final String BINARY = "";
private 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) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public List<TransferEventResponse> getTransferEvents(TransactionReceipt transactionReceipt) {
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);
ArrayList<TransferEventResponse> responses = new ArrayList<TransferEventResponse>(valueList.size());
for (EventValues 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);
responses.add(typedResponse);
}
return responses;
}
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("Transfer",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
@Override
public TransferEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(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);
return typedResponse;
}
});
}
public List<ApprovalEventResponse> getApprovalEvents(TransactionReceipt transactionReceipt) {
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);
ArrayList<ApprovalEventResponse> responses = new ArrayList<ApprovalEventResponse>(valueList.size());
for (EventValues 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);
responses.add(typedResponse);
}
return responses;
}
public Observable<ApprovalEventResponse> approvalEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("Approval",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, ApprovalEventResponse>() {
@Override
public ApprovalEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(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);
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 Future<Uint256> totalSupply() {
Function function = new Function("totalSupply",
Arrays.<Type>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeCallSingleValueReturnAsync(function);
}
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 Future<Uint256> balanceOf(Address who) {
Function function = new Function("balanceOf",
Arrays.<Type>asList(who),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeCallSingleValueReturnAsync(function);
}
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 Future<Uint256> allowance(Address owner, Address spender) {
Function function = new Function("allowance",
Arrays.<Type>asList(owner, spender),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeCallSingleValueReturnAsync(function);
}
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 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 ERC20 load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return new ERC20(contractAddress, web3j, credentials, gasPrice, gasLimit);
}
public static ERC20 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return new ERC20(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public static class TransferEventResponse {
public Address from;
public Address to;
public Uint256 value;
}
public static class ApprovalEventResponse {
public Address owner;
public Address spender;
public Uint256 value;
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,111 @@
package commiteth.eth.contracts;
import java.math.BigInteger;
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;
import org.web3j.abi.datatypes.Function;
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.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.Log;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
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>Generated with web3j version 2.3.0.
*/
public final class Owned extends Contract {
private static final String BINARY = "606060405260008054600160a060020a03191633600160a060020a0316179055341561002a57600080fd5b5b6101578061003a6000396000f300606060405263ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166313af403581146100485780638da5cb5b14610069575b600080fd5b341561005357600080fd5b610067600160a060020a0360043516610098565b005b341561007457600080fd5b61007c61011c565b604051600160a060020a03909116815260200160405180910390f35b60005433600160a060020a039081169116146100b357610118565b600054600160a060020a0380831691167f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236460405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600054600160a060020a0316815600a165627a7a723058206bbc12c5f2dde30ed4acaaf0df4c0bc44e5909ce3b8ab82da7f226137465b3fd0029";
private 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) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public List<NewOwnerEventResponse> getNewOwnerEvents(TransactionReceipt transactionReceipt) {
final Event event = new Event("NewOwner",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList());
List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
ArrayList<NewOwnerEventResponse> responses = new ArrayList<NewOwnerEventResponse>(valueList.size());
for (EventValues eventValues : valueList) {
NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
typedResponse.old = (Address) eventValues.getIndexedValues().get(0);
typedResponse.current = (Address) eventValues.getIndexedValues().get(1);
responses.add(typedResponse);
}
return responses;
}
public Observable<NewOwnerEventResponse> newOwnerEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("NewOwner",
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}),
Arrays.<TypeReference<?>>asList());
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(new Func1<Log, NewOwnerEventResponse>() {
@Override
public NewOwnerEventResponse call(Log log) {
EventValues eventValues = extractEventParameters(event, log);
NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
typedResponse.old = (Address) eventValues.getIndexedValues().get(0);
typedResponse.current = (Address) eventValues.getIndexedValues().get(1);
return typedResponse;
}
});
}
public Future<TransactionReceipt> setOwner(Address _new) {
Function function = new Function("setOwner", Arrays.<Type>asList(_new), Collections.<TypeReference<?>>emptyList());
return executeTransactionAsync(function);
}
public Future<Address> owner() {
Function function = new Function("owner",
Arrays.<Type>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
return executeCallSingleValueReturnAsync(function);
}
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 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 Owned load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return new Owned(contractAddress, web3j, credentials, gasPrice, gasLimit);
}
public static Owned load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
return new Owned(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public static class NewOwnerEventResponse {
public Address old;
public Address current;
}
}

File diff suppressed because one or more lines are too long