Created
August 17, 2023 15:34
-
-
Save toidv/7f7c6c561f308f73268f23ab21c4bf4b to your computer and use it in GitHub Desktop.
Generate MutiSendSmartContractWrapper by smart contract ABI here: https://polygonscan.com/address/0x864f01c5e46b0712643b956bca607bf883e0dbc5#code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kyrd.transfer; | |
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.StaticStruct; | |
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.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 1.5.0. | |
*/ | |
@SuppressWarnings("rawtypes") | |
public class MutiSendSmartContractWrapper extends Contract { | |
public static final String BINARY = "Bin file was not provided"; | |
public static final String FUNC_MULTICALL = "multiCall"; | |
public static final String FUNC_MULTICALLTIGHTLYPACKED = "multiCallTightlyPacked"; | |
public static final String FUNC_MULTIERC20TRANSFER = "multiERC20Transfer"; | |
public static final String FUNC_MULTIERC20TRANSFERTIGHTLYPACKED = "multiERC20TransferTightlyPacked"; | |
public static final String FUNC_MULTISEND = "multiSend"; | |
public static final String FUNC_OWNER = "owner"; | |
public static final String FUNC_RENOUNCEOWNERSHIP = "renounceOwnership"; | |
public static final String FUNC_TRANSFEROWNERSHIP = "transferOwnership"; | |
public static final String FUNC_WITHDRAW = "withdraw"; | |
public static final Event CALL_EVENT = new Event("Call", | |
Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) { | |
}, new TypeReference<Address>(true) { | |
}, new TypeReference<Uint256>() { | |
})); | |
; | |
public static final Event OWNERSHIPTRANSFERRED_EVENT = new Event("OwnershipTransferred", | |
Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) { | |
}, new TypeReference<Address>(true) { | |
})); | |
; | |
@Deprecated | |
protected MutiSendSmartContractWrapper(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { | |
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); | |
} | |
protected MutiSendSmartContractWrapper(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { | |
super(BINARY, contractAddress, web3j, credentials, contractGasProvider); | |
} | |
@Deprecated | |
protected MutiSendSmartContractWrapper(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { | |
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); | |
} | |
protected MutiSendSmartContractWrapper(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { | |
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); | |
} | |
public static List<CallEventResponse> getCallEvents(TransactionReceipt transactionReceipt) { | |
List<Contract.EventValuesWithLog> valueList = staticExtractEventParametersWithLog(CALL_EVENT, transactionReceipt); | |
ArrayList<CallEventResponse> responses = new ArrayList<CallEventResponse>(valueList.size()); | |
for (Contract.EventValuesWithLog eventValues : valueList) { | |
CallEventResponse typedResponse = new CallEventResponse(); | |
typedResponse.log = eventValues.getLog(); | |
typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue(); | |
typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue(); | |
typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); | |
responses.add(typedResponse); | |
} | |
return responses; | |
} | |
public static CallEventResponse getCallEventFromLog(Log log) { | |
Contract.EventValuesWithLog eventValues = staticExtractEventParametersWithLog(CALL_EVENT, log); | |
CallEventResponse typedResponse = new CallEventResponse(); | |
typedResponse.log = log; | |
typedResponse._from = (String) eventValues.getIndexedValues().get(0).getValue(); | |
typedResponse._to = (String) eventValues.getIndexedValues().get(1).getValue(); | |
typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); | |
return typedResponse; | |
} | |
public Flowable<CallEventResponse> callEventFlowable(EthFilter filter) { | |
return web3j.ethLogFlowable(filter).map(log -> getCallEventFromLog(log)); | |
} | |
public Flowable<CallEventResponse> callEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { | |
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); | |
filter.addSingleTopic(EventEncoder.encode(CALL_EVENT)); | |
return callEventFlowable(filter); | |
} | |
public static List<OwnershipTransferredEventResponse> getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { | |
List<Contract.EventValuesWithLog> valueList = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); | |
ArrayList<OwnershipTransferredEventResponse> responses = new ArrayList<OwnershipTransferredEventResponse>(valueList.size()); | |
for (Contract.EventValuesWithLog eventValues : valueList) { | |
OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); | |
typedResponse.log = eventValues.getLog(); | |
typedResponse.previousOwner = (String) eventValues.getIndexedValues().get(0).getValue(); | |
typedResponse.newOwner = (String) eventValues.getIndexedValues().get(1).getValue(); | |
responses.add(typedResponse); | |
} | |
return responses; | |
} | |
public static OwnershipTransferredEventResponse getOwnershipTransferredEventFromLog(Log log) { | |
Contract.EventValuesWithLog eventValues = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, log); | |
OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); | |
typedResponse.log = log; | |
typedResponse.previousOwner = (String) eventValues.getIndexedValues().get(0).getValue(); | |
typedResponse.newOwner = (String) eventValues.getIndexedValues().get(1).getValue(); | |
return typedResponse; | |
} | |
public Flowable<OwnershipTransferredEventResponse> ownershipTransferredEventFlowable(EthFilter filter) { | |
return web3j.ethLogFlowable(filter).map(log -> getOwnershipTransferredEventFromLog(log)); | |
} | |
public Flowable<OwnershipTransferredEventResponse> ownershipTransferredEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { | |
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); | |
filter.addSingleTopic(EventEncoder.encode(OWNERSHIPTRANSFERRED_EVENT)); | |
return ownershipTransferredEventFlowable(filter); | |
} | |
public RemoteFunctionCall<TransactionReceipt> multiCall(List<String> _addresses, List<BigInteger> _amounts, BigInteger weiValue) { | |
final Function function = new Function( | |
FUNC_MULTICALL, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( | |
org.web3j.abi.datatypes.Address.class, | |
org.web3j.abi.Utils.typeMap(_addresses, org.web3j.abi.datatypes.Address.class)), | |
new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint256>( | |
org.web3j.abi.datatypes.generated.Uint256.class, | |
org.web3j.abi.Utils.typeMap(_amounts, org.web3j.abi.datatypes.generated.Uint256.class))), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function, weiValue); | |
} | |
public RemoteFunctionCall<TransactionReceipt> multiCallTightlyPacked(List<byte[]> _addressesAndAmounts, BigInteger weiValue) { | |
final Function function = new Function( | |
FUNC_MULTICALLTIGHTLYPACKED, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( | |
org.web3j.abi.datatypes.generated.Bytes32.class, | |
org.web3j.abi.Utils.typeMap(_addressesAndAmounts, org.web3j.abi.datatypes.generated.Bytes32.class))), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function, weiValue); | |
} | |
public RemoteFunctionCall<TransactionReceipt> multiERC20Transfer(String _token, List<String> _addresses, List<BigInteger> _amounts) { | |
final Function function = new Function( | |
FUNC_MULTIERC20TRANSFER, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _token), | |
new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>( | |
org.web3j.abi.datatypes.Address.class, | |
org.web3j.abi.Utils.typeMap(_addresses, org.web3j.abi.datatypes.Address.class)), | |
new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint256>( | |
org.web3j.abi.datatypes.generated.Uint256.class, | |
org.web3j.abi.Utils.typeMap(_amounts, org.web3j.abi.datatypes.generated.Uint256.class))), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function); | |
} | |
public RemoteFunctionCall<TransactionReceipt> multiERC20TransferTightlyPacked(String _token, List<byte[]> _addressesAndAmounts) { | |
final Function function = new Function( | |
FUNC_MULTIERC20TRANSFERTIGHTLYPACKED, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _token), | |
new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>( | |
org.web3j.abi.datatypes.generated.Bytes32.class, | |
org.web3j.abi.Utils.typeMap(_addressesAndAmounts, org.web3j.abi.datatypes.generated.Bytes32.class))), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function); | |
} | |
public RemoteFunctionCall<TransactionReceipt> multiSend(List<Send> sends, BigInteger weiValue) { | |
final Function function = new Function( | |
FUNC_MULTISEND, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<Send>(Send.class, sends)), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function, weiValue); | |
} | |
public RemoteFunctionCall<String> owner() { | |
final Function function = new Function(FUNC_OWNER, | |
Arrays.<Type>asList(), | |
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() { | |
})); | |
return executeRemoteCallSingleValueReturn(function, String.class); | |
} | |
public RemoteFunctionCall<TransactionReceipt> renounceOwnership() { | |
final Function function = new Function( | |
FUNC_RENOUNCEOWNERSHIP, | |
Arrays.<Type>asList(), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function); | |
} | |
public RemoteFunctionCall<TransactionReceipt> transferOwnership(String newOwner) { | |
final Function function = new Function( | |
FUNC_TRANSFEROWNERSHIP, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, newOwner)), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function); | |
} | |
public RemoteFunctionCall<TransactionReceipt> withdraw(String token, BigInteger amount, String to) { | |
final Function function = new Function( | |
FUNC_WITHDRAW, | |
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, token), | |
new org.web3j.abi.datatypes.generated.Uint256(amount), | |
new org.web3j.abi.datatypes.Address(160, to)), | |
Collections.<TypeReference<?>>emptyList()); | |
return executeRemoteCallTransaction(function); | |
} | |
@Deprecated | |
public static MutiSendSmartContractWrapper load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { | |
return new MutiSendSmartContractWrapper(contractAddress, web3j, credentials, gasPrice, gasLimit); | |
} | |
@Deprecated | |
public static MutiSendSmartContractWrapper load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { | |
return new MutiSendSmartContractWrapper(contractAddress, web3j, transactionManager, gasPrice, gasLimit); | |
} | |
public static MutiSendSmartContractWrapper load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { | |
return new MutiSendSmartContractWrapper(contractAddress, web3j, credentials, contractGasProvider); | |
} | |
public static MutiSendSmartContractWrapper load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { | |
return new MutiSendSmartContractWrapper(contractAddress, web3j, transactionManager, contractGasProvider); | |
} | |
public static class Send extends StaticStruct { | |
public String token; | |
public String to; | |
public BigInteger amount; | |
public Send(String token, String to, BigInteger amount) { | |
super(new org.web3j.abi.datatypes.Address(160, token), | |
new org.web3j.abi.datatypes.Address(160, to), | |
new org.web3j.abi.datatypes.generated.Uint256(amount)); | |
this.token = token; | |
this.to = to; | |
this.amount = amount; | |
} | |
public Send(Address token, Address to, Uint256 amount) { | |
super(token, to, amount); | |
this.token = token.getValue(); | |
this.to = to.getValue(); | |
this.amount = amount.getValue(); | |
} | |
} | |
public static class CallEventResponse extends BaseEventResponse { | |
public String _from; | |
public String _to; | |
public BigInteger _amount; | |
} | |
public static class OwnershipTransferredEventResponse extends BaseEventResponse { | |
public String previousOwner; | |
public String newOwner; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment