package cc.mrbird.febs.dapp.contract.andao;
|
|
import io.reactivex.Flowable;
|
import java.math.BigInteger;
|
import java.util.ArrayList;
|
import java.util.Arrays;
|
import java.util.Collections;
|
import java.util.List;
|
import org.web3j.abi.EventEncoder;
|
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.Utf8String;
|
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.RemoteFunctionCall;
|
import org.web3j.protocol.core.methods.request.EthFilter;
|
import org.web3j.protocol.core.methods.response.BaseEventResponse;
|
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 org.web3j.tx.gas.ContractGasProvider;
|
|
/**
|
* <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 4.5.5.
|
*/
|
@SuppressWarnings("rawtypes")
|
public class Abi extends Contract {
|
private static final String BINARY = "6080604052600180546001600160a01b03199081167355d398326f99059ff775485246999027b319795517909155600380548216731562e481cef00b14693e43465444b726739e0cba17905560048054909116733614b30913f284e8868d7f6814bbcb62e3f8412717905534801561007657600080fd5b50600154600280546001600160a01b03199081166001600160a01b0390931692909217905560008054909116331790556108eb806100b56000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806310786a021461003b57806347be04b914610050575b600080fd5b61004e610049366004610736565b610063565b005b61004e61005e3660046106c3565b6103a7565b600254604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e9060440160206040518083038186803b1580156100ad57600080fd5b505afa1580156100c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e5919061071d565b9050838110156101355760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b60448201526064015b60405180910390fd5b6002546040516323b872dd60e01b8152336004820152306024820152604481018690526000916001600160a01b0316906323b872dd90606401602060405180830381600087803b15801561018857600080fd5b505af115801561019c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c091906106fb565b9050806101df5760405162461bcd60e51b815260040161012c90610807565b60006101f760646101f188600a6105c7565b9061064f565b60025460035460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb90604401602060405180830381600087803b15801561024957600080fd5b505af115801561025d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028191906106fb565b61029d5760405162461bcd60e51b815260040161012c90610807565b60006102af60646101f18960466105c7565b6002546004805460405163a9059cbb60e01b81526001600160a01b03918216928101929092526024820184905292935091169063a9059cbb90604401602060405180830381600087803b15801561030557600080fd5b505af1158015610319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033d91906106fb565b6103595760405162461bcd60e51b815260040161012c90610807565b336001600160a01b03167f4ea43b897a5f947a4940ce8fc2485d2854dcf256c52754394f1804723a091a2188888860405161039693929190610830565b60405180910390a250505050505050565b6000546001600160a01b031633146104185760405162461bcd60e51b815260206004820152602e60248201527f4f6e6c792074686520636f6e74726163742063726561746f722063616e20636160448201526d1b1b081d1a1a5cc81b595d1a1bd960921b606482015260840161012c565b6002546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561045c57600080fd5b505afa158015610470573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610494919061071d565b9050818110156104dd5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015260640161012c565b60025460405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529091169063a9059cbb90604401602060405180830381600087803b15801561052b57600080fd5b505af115801561053f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056391906106fb565b61057f5760405162461bcd60e51b815260040161012c90610807565b826001600160a01b03167f6fb24f3ad0678f9d138e80b17293be051d87911eb34e9e60f0d1b9c3805e885a836040516105ba91815260200190565b60405180910390a2505050565b6000826105d657506000610649565b60006105e28385610888565b9050826105ef8583610866565b146106465760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161012c565b90505b92915050565b600061064683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836106ad5760405162461bcd60e51b815260040161012c91906107b2565b5060006106ba8486610866565b95945050505050565b600080604083850312156106d657600080fd5b82356001600160a01b03811681146106ed57600080fd5b946020939093013593505050565b60006020828403121561070d57600080fd5b8151801515811461064657600080fd5b60006020828403121561072f57600080fd5b5051919050565b60008060006040848603121561074b57600080fd5b83359250602084013567ffffffffffffffff8082111561076a57600080fd5b818601915086601f83011261077e57600080fd5b81358181111561078d57600080fd5b87602082850101111561079f57600080fd5b6020830194508093505050509250925092565b600060208083528351808285015260005b818110156107df578581018301518582016040015282016107c3565b818111156107f1576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252600f908201526e151c985b9cd9995c8819985a5b1959608a1b604082015260600190565b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60008261088357634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156108b057634e487b7160e01b600052601160045260246000fd5b50029056fea2646970667358221220694ed63a5283d88a2b5d348c1fcde9747ff91126df19a57ff8395fcdff4d712164736f6c63430008070033";
|
|
public static final String FUNC_RECEIVEANDAO = "receiveANDAO";
|
|
public static final String FUNC_WITHDRAWANDAO = "withdrawANDAO";
|
|
public static final Event RECEIVED_EVENT = new Event("received",
|
Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}));
|
;
|
|
public static final Event WITHDRAWN_EVENT = new Event("withdrawn",
|
Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {}, new TypeReference<Uint256>() {}));
|
;
|
|
@Deprecated
|
protected Abi(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
|
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
|
}
|
|
protected Abi(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
|
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
|
}
|
|
@Deprecated
|
protected Abi(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
|
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
|
}
|
|
protected Abi(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
|
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
|
}
|
|
public RemoteFunctionCall<TransactionReceipt> receiveANDAO(BigInteger amount, String regFlow) {
|
final Function function = new Function(
|
FUNC_RECEIVEANDAO,
|
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(amount),
|
new org.web3j.abi.datatypes.Utf8String(regFlow)),
|
Collections.<TypeReference<?>>emptyList());
|
return executeRemoteCallTransaction(function);
|
}
|
|
public List<ReceivedEventResponse> getReceivedEvents(TransactionReceipt transactionReceipt) {
|
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(RECEIVED_EVENT, transactionReceipt);
|
ArrayList<ReceivedEventResponse> responses = new ArrayList<ReceivedEventResponse>(valueList.size());
|
for (Contract.EventValuesWithLog eventValues : valueList) {
|
ReceivedEventResponse typedResponse = new ReceivedEventResponse();
|
typedResponse.log = eventValues.getLog();
|
typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
|
typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
|
typedResponse.regFlow = (String) eventValues.getNonIndexedValues().get(1).getValue();
|
responses.add(typedResponse);
|
}
|
return responses;
|
}
|
|
public Flowable<ReceivedEventResponse> receivedEventFlowable(EthFilter filter) {
|
return web3j.ethLogFlowable(filter).map(new io.reactivex.functions.Function<Log, ReceivedEventResponse>() {
|
@Override
|
public ReceivedEventResponse apply(Log log) {
|
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(RECEIVED_EVENT, log);
|
ReceivedEventResponse typedResponse = new ReceivedEventResponse();
|
if(eventValues==null){
|
// 为空则直接返回空对象
|
return typedResponse;
|
}
|
typedResponse.log = log;
|
typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
|
typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
|
typedResponse.regFlow = (String) eventValues.getNonIndexedValues().get(1).getValue();
|
return typedResponse;
|
}
|
});
|
}
|
|
public Flowable<ReceivedEventResponse> receivedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
|
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
|
filter.addSingleTopic(EventEncoder.encode(RECEIVED_EVENT));
|
return receivedEventFlowable(filter);
|
}
|
|
public RemoteFunctionCall<TransactionReceipt> withdrawANDAO(String recipient, BigInteger amount) {
|
final Function function = new Function(
|
FUNC_WITHDRAWANDAO,
|
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, recipient),
|
new org.web3j.abi.datatypes.generated.Uint256(amount)),
|
Collections.<TypeReference<?>>emptyList());
|
return executeRemoteCallTransaction(function);
|
}
|
|
public List<WithdrawnEventResponse> getWithdrawnEvents(TransactionReceipt transactionReceipt) {
|
List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(WITHDRAWN_EVENT, transactionReceipt);
|
ArrayList<WithdrawnEventResponse> responses = new ArrayList<WithdrawnEventResponse>(valueList.size());
|
for (Contract.EventValuesWithLog eventValues : valueList) {
|
WithdrawnEventResponse typedResponse = new WithdrawnEventResponse();
|
typedResponse.log = eventValues.getLog();
|
typedResponse.to = (String) eventValues.getIndexedValues().get(0).getValue();
|
typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
|
responses.add(typedResponse);
|
}
|
return responses;
|
}
|
|
public Flowable<WithdrawnEventResponse> withdrawnEventFlowable(EthFilter filter) {
|
return web3j.ethLogFlowable(filter).map(new io.reactivex.functions.Function<Log, WithdrawnEventResponse>() {
|
@Override
|
public WithdrawnEventResponse apply(Log log) {
|
Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(WITHDRAWN_EVENT, log);
|
WithdrawnEventResponse typedResponse = new WithdrawnEventResponse();
|
if(eventValues==null){
|
// 为空则直接返回空对象
|
return typedResponse;
|
}
|
typedResponse.log = log;
|
typedResponse.to = (String) eventValues.getIndexedValues().get(0).getValue();
|
typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
|
return typedResponse;
|
}
|
});
|
}
|
|
public Flowable<WithdrawnEventResponse> withdrawnEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
|
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
|
filter.addSingleTopic(EventEncoder.encode(WITHDRAWN_EVENT));
|
return withdrawnEventFlowable(filter);
|
}
|
|
@Deprecated
|
public static Abi load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
|
return new Abi(contractAddress, web3j, credentials, gasPrice, gasLimit);
|
}
|
|
@Deprecated
|
public static Abi load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
|
return new Abi(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
|
}
|
|
public static Abi load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
|
return new Abi(contractAddress, web3j, credentials, contractGasProvider);
|
}
|
|
public static Abi load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
|
return new Abi(contractAddress, web3j, transactionManager, contractGasProvider);
|
}
|
|
public static RemoteCall<Abi> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
|
return deployRemoteCall(Abi.class, web3j, credentials, contractGasProvider, BINARY, "");
|
}
|
|
public static RemoteCall<Abi> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
|
return deployRemoteCall(Abi.class, web3j, transactionManager, contractGasProvider, BINARY, "");
|
}
|
|
@Deprecated
|
public static RemoteCall<Abi> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
|
return deployRemoteCall(Abi.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
|
}
|
|
@Deprecated
|
public static RemoteCall<Abi> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
|
return deployRemoteCall(Abi.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
|
}
|
|
public static class ReceivedEventResponse extends BaseEventResponse {
|
public String from;
|
|
public BigInteger amount;
|
|
public String regFlow;
|
}
|
|
public static class WithdrawnEventResponse extends BaseEventResponse {
|
public String to;
|
|
public BigInteger amount;
|
}
|
}
|