transferOwnership(String newOwner) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_TRANSFEROWNERSHIP,
diff --git a/application/sfc-examples/tokenbridge/src/main/java/net/consensys/gpact/sfc/examples/tokenbridge/soliditywrappers/SfcErc20MintingBurningBridge.java b/application/sfc-examples/tokenbridge/src/main/java/net/consensys/gpact/sfc/examples/tokenbridge/soliditywrappers/SfcErc20MintingBurningBridge.java
new file mode 100644
index 00000000..66f3896e
--- /dev/null
+++ b/application/sfc-examples/tokenbridge/src/main/java/net/consensys/gpact/sfc/examples/tokenbridge/soliditywrappers/SfcErc20MintingBurningBridge.java
@@ -0,0 +1,557 @@
+package net.consensys.gpact.sfc.examples.tokenbridge.soliditywrappers;
+
+import io.reactivex.Flowable;
+import io.reactivex.functions.Function;
+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.FunctionEncoder;
+import org.web3j.abi.TypeReference;
+import org.web3j.abi.datatypes.Address;
+import org.web3j.abi.datatypes.Bool;
+import org.web3j.abi.datatypes.Event;
+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.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;
+
+/**
+ * Auto generated code.
+ *
Do not modify!
+ *
Please use the web3j command line tools,
+ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
+ * codegen module to update.
+ *
+ *
Generated with web3j version 4.8.5-SNAPSHOT.
+ */
+@SuppressWarnings("rawtypes")
+public class SfcErc20MintingBurningBridge extends Contract {
+ public static final String BINARY = "608060405234801561001057600080fd5b50604051610dcd380380610dcd83398101604081905261002f9161009c565b600080546001600160a81b031916336101008102919091178255604051839282917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b0319166001600160a01b0392909216919091179055506100cc565b6000602082840312156100ae57600080fd5b81516001600160a01b03811681146100c557600080fd5b9392505050565b610cf2806100db6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80638278ef6d116100715780638278ef6d146101ab57806384aea633146101be5780638da5cb5b146101d1578063da72c1e8146101e7578063e787282a146101fa578063f2fde38b1461020d57600080fd5b806306b47e9e146100b95780630dd4b783146100ce5780632e44a5b5146101145780635c975abb1461015f578063715018a61461016a57806380ccbde414610172575b600080fd5b6100cc6100c7366004610af8565b610220565b005b6100f76100dc366004610b34565b6000908152600360205260409020546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b61014f610122366004610b4d565b6001600160a01b039081166000908152600260209081526040808320948352939052919091205416151590565b604051901515815260200161010b565b60005460ff1661014f565b6100cc6102d5565b6100f7610180366004610b4d565b6001600160a01b03908116600090815260026020908152604080832094835293905291909120541690565b6100cc6101b9366004610b79565b610354565b6100cc6101cc366004610bb5565b6105e8565b60005461010090046001600160a01b03166100f7565b6100cc6101f5366004610b79565b61083b565b6100cc610208366004610b4d565b6108be565b6100cc61021b366004610bf9565b61091c565b6000546001600160a01b036101009091041633146102595760405162461bcd60e51b815260040161025090610c1b565b60405180910390fd5b6001600160a01b03838116600081815260026020908152604080832087845282529182902080546001600160a01b0319169486169485179055815192835282018590528101919091527f3887b7740ba2f669b578cfaf7b54c097711335413cf96f681d36dbf97b98a830906060015b60405180910390a1505050565b6000546001600160a01b036101009091041633146103055760405162461bcd60e51b815260040161025090610c1b565b600080546040516101009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360008054610100600160a81b0319169055565b60005460ff161561039a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610250565b6001546001600160a01b0316331461042a5760405162461bcd60e51b815260206004820152604760248201527f43616e206e6f742070726f63657373207472616e73666572732066726f6d206360448201527f6f6e747261637473206f74686572207468616e207468652062726964676520636064820152661bdb9d1c9858dd60ca1b608482015260a401610250565b600080610435610a17565b9092509050806001600160a01b03811661049d5760405162461bcd60e51b8152602060048201526024808201527f45524320323020427269646765202863616c6c65722920636f6e7472616374206044820152630697320360e41b6064820152608401610250565b6000838152600360205260409020546001600160a01b03168061051b5760405162461bcd60e51b815260206004820152603060248201527f4e6f204552432032302042726964676520737570706f7274656420666f72207360448201526f37bab931b290313637b1b5b1b430b4b760811b6064820152608401610250565b806001600160a01b0316826001600160a01b03161461057c5760405162461bcd60e51b815260206004820152601e60248201527f496e636f727265637420736f75726365204552432032302042726964676500006044820152606401610250565b610587878787610a3f565b604080518581526001600160a01b03848116602083015289811682840152881660608201526080810187905290517f3008be2f38f2c92605e65a39c193c4b67868ea0dd742f5b9d6f228c9e258ece19181900360a00190a150505050505050565b60005460ff161561062e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610250565b6000848152600360205260409020546001600160a01b0316806106935760405162461bcd60e51b815260206004820152601860248201527f426c6f636b636861696e206e6f7420737570706f7274656400000000000000006044820152606401610250565b6001600160a01b038085166000908152600260209081526040808320898452909152902054168061071d5760405162461bcd60e51b815260206004820152602e60248201527f546f6b656e206e6f74207472616e7366657261626c6520746f2072657175657360448201526d3a32b210313637b1b5b1b430b4b760911b6064820152608401610250565b610728853385610aa7565b600154604080516001600160a01b0384811660248301528781166044830152606480830188905283518084039091018152608490920183526020820180516001600160e01b0316638278ef6d60e01b17905291516392b2c33560e01b815291909216916392b2c335916107a2918a91879190600401610c50565b600060405180830381600087803b1580156107bc57600080fd5b505af11580156107d0573d6000803e3d6000fd5b5050604080518981526001600160a01b038981166020830152858116828401523360608301528816608082015260a0810187905290517f752a2bfed77c22e59eeaf9351f545a08f5ee0110b8d6de0e7bcaf32a5dfa661b93509081900360c0019150a1505050505050565b6000546001600160a01b0361010090910416331461086b5760405162461bcd60e51b815260040161025090610c1b565b610876838383610a3f565b604080516001600160a01b038086168252841660208201529081018290527f728fe8c3e9dd087cac70e8ff44565c920a2bb77c726ed3191394fefb4aabc358906060016102c8565b6000546001600160a01b036101009091041633146108ee5760405162461bcd60e51b815260040161025090610c1b565b60009182526003602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b0361010090910416331461094c5760405162461bcd60e51b815260040161025090610c1b565b6001600160a01b0381166109b15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610250565b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000808036806020603f19820184376000519450602080820360003760005193505050509091565b6040516340c10f1960e01b81526001600160a01b038381166004830152602482018390528416906340c10f19906044015b600060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b50505050505050565b60405163079cc67960e41b81526001600160a01b038381166004830152602482018390528416906379cc679090604401610a70565b80356001600160a01b0381168114610af357600080fd5b919050565b600080600060608486031215610b0d57600080fd5b610b1684610adc565b925060208401359150610b2b60408501610adc565b90509250925092565b600060208284031215610b4657600080fd5b5035919050565b60008060408385031215610b6057600080fd5b82359150610b7060208401610adc565b90509250929050565b600080600060608486031215610b8e57600080fd5b610b9784610adc565b9250610ba560208501610adc565b9150604084013590509250925092565b60008060008060808587031215610bcb57600080fd5b84359350610bdb60208601610adc565b9250610be960408601610adc565b9396929550929360600135925050565b600060208284031215610c0b57600080fd5b610c1482610adc565b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b8381526000602060018060a01b0385168184015260606040840152835180606085015260005b81811015610c9257858101830151858201608001528201610c76565b81811115610ca4576000608083870101525b50601f01601f1916929092016080019594505050505056fea2646970667358221220423b3716f1d30703c4ed8ed6a14aee8e85be6382b34a2781b5c43f712d4025ce64736f6c63430008090033";
+
+ public static final String FUNC_ADMINTRANSFER = "adminTransfer";
+
+ public static final String FUNC_CHANGEBLOCKCHAINMAPPING = "changeBlockchainMapping";
+
+ public static final String FUNC_CHANGECONTRACTMAPPING = "changeContractMapping";
+
+ public static final String FUNC_GETBCIDTOKENMAPING = "getBcIdTokenMaping";
+
+ public static final String FUNC_GETREMOTEERC20BRIDGECONTRACT = "getRemoteErc20BridgeContract";
+
+ public static final String FUNC_ISBCIDTOKENALLOWED = "isBcIdTokenAllowed";
+
+ public static final String FUNC_OWNER = "owner";
+
+ public static final String FUNC_PAUSED = "paused";
+
+ public static final String FUNC_RECEIVEFROMOTHERBLOCKCHAIN = "receiveFromOtherBlockchain";
+
+ public static final String FUNC_RENOUNCEOWNERSHIP = "renounceOwnership";
+
+ public static final String FUNC_TRANSFEROWNERSHIP = "transferOwnership";
+
+ public static final String FUNC_TRANSFERTOOTHERBLOCKCHAIN = "transferToOtherBlockchain";
+
+ public static final Event ADMINTRANSFER_EVENT = new Event("AdminTransfer",
+ Arrays.>asList(new TypeReference() {}, new TypeReference() {}, new TypeReference() {}));
+ ;
+
+ public static final Event OWNERSHIPTRANSFERRED_EVENT = new Event("OwnershipTransferred",
+ Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}));
+ ;
+
+ public static final Event PAUSED_EVENT = new Event("Paused",
+ Arrays.>asList(new TypeReference() {}));
+ ;
+
+ public static final Event RECEIVEDFROM_EVENT = new Event("ReceivedFrom",
+ Arrays.>asList(new TypeReference() {}, new TypeReference() {}, new TypeReference() {}, new TypeReference() {}, new TypeReference() {}));
+ ;
+
+ public static final Event TOKENCONTRACTADDRESSMAPPINGCHANGED_EVENT = new Event("TokenContractAddressMappingChanged",
+ Arrays.>asList(new TypeReference() {}, new TypeReference() {}, new TypeReference() {}));
+ ;
+
+ public static final Event TRANSFERTO_EVENT = new Event("TransferTo",
+ Arrays.>asList(new TypeReference() {}, new TypeReference() {}, new TypeReference() {}, new TypeReference() {}, new TypeReference() {}, new TypeReference() {}));
+ ;
+
+ public static final Event UNPAUSED_EVENT = new Event("Unpaused",
+ Arrays.>asList(new TypeReference() {}));
+ ;
+
+ @Deprecated
+ protected SfcErc20MintingBurningBridge(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ protected SfcErc20MintingBurningBridge(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
+ }
+
+ @Deprecated
+ protected SfcErc20MintingBurningBridge(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
+ protected SfcErc20MintingBurningBridge(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
+ }
+
+ public List getAdminTransferEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(ADMINTRANSFER_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ AdminTransferEventResponse typedResponse = new AdminTransferEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse._erc20Contract = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._recipient = (String) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable adminTransferEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public AdminTransferEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(ADMINTRANSFER_EVENT, log);
+ AdminTransferEventResponse typedResponse = new AdminTransferEventResponse();
+ typedResponse.log = log;
+ typedResponse._erc20Contract = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._recipient = (String) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable adminTransferEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(ADMINTRANSFER_EVENT));
+ return adminTransferEventFlowable(filter);
+ }
+
+ public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(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 Flowable ownershipTransferredEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public OwnershipTransferredEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(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 ownershipTransferredEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(OWNERSHIPTRANSFERRED_EVENT));
+ return ownershipTransferredEventFlowable(filter);
+ }
+
+ public List getPausedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(PAUSED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ PausedEventResponse typedResponse = new PausedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable pausedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public PausedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(PAUSED_EVENT, log);
+ PausedEventResponse typedResponse = new PausedEventResponse();
+ typedResponse.log = log;
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable pausedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(PAUSED_EVENT));
+ return pausedEventFlowable(filter);
+ }
+
+ public List getReceivedFromEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(RECEIVEDFROM_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ ReceivedFromEventResponse typedResponse = new ReceivedFromEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse._srcBcId = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._srcTokenContract = (String) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._destTokenContract = (String) eventValues.getNonIndexedValues().get(2).getValue();
+ typedResponse._recipient = (String) eventValues.getNonIndexedValues().get(3).getValue();
+ typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(4).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable receivedFromEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public ReceivedFromEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(RECEIVEDFROM_EVENT, log);
+ ReceivedFromEventResponse typedResponse = new ReceivedFromEventResponse();
+ typedResponse.log = log;
+ typedResponse._srcBcId = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._srcTokenContract = (String) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._destTokenContract = (String) eventValues.getNonIndexedValues().get(2).getValue();
+ typedResponse._recipient = (String) eventValues.getNonIndexedValues().get(3).getValue();
+ typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(4).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable receivedFromEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(RECEIVEDFROM_EVENT));
+ return receivedFromEventFlowable(filter);
+ }
+
+ public List getTokenContractAddressMappingChangedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(TOKENCONTRACTADDRESSMAPPINGCHANGED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ TokenContractAddressMappingChangedEventResponse typedResponse = new TokenContractAddressMappingChangedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse._thisBcTokenContract = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._otherBcId = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._othercTokenContract = (String) eventValues.getNonIndexedValues().get(2).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable tokenContractAddressMappingChangedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public TokenContractAddressMappingChangedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(TOKENCONTRACTADDRESSMAPPINGCHANGED_EVENT, log);
+ TokenContractAddressMappingChangedEventResponse typedResponse = new TokenContractAddressMappingChangedEventResponse();
+ typedResponse.log = log;
+ typedResponse._thisBcTokenContract = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._otherBcId = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._othercTokenContract = (String) eventValues.getNonIndexedValues().get(2).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable tokenContractAddressMappingChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(TOKENCONTRACTADDRESSMAPPINGCHANGED_EVENT));
+ return tokenContractAddressMappingChangedEventFlowable(filter);
+ }
+
+ public List getTransferToEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(TRANSFERTO_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ TransferToEventResponse typedResponse = new TransferToEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse._destBcId = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._srcTokenContract = (String) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._destTokenContract = (String) eventValues.getNonIndexedValues().get(2).getValue();
+ typedResponse._sender = (String) eventValues.getNonIndexedValues().get(3).getValue();
+ typedResponse._recipient = (String) eventValues.getNonIndexedValues().get(4).getValue();
+ typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(5).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable transferToEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public TransferToEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(TRANSFERTO_EVENT, log);
+ TransferToEventResponse typedResponse = new TransferToEventResponse();
+ typedResponse.log = log;
+ typedResponse._destBcId = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
+ typedResponse._srcTokenContract = (String) eventValues.getNonIndexedValues().get(1).getValue();
+ typedResponse._destTokenContract = (String) eventValues.getNonIndexedValues().get(2).getValue();
+ typedResponse._sender = (String) eventValues.getNonIndexedValues().get(3).getValue();
+ typedResponse._recipient = (String) eventValues.getNonIndexedValues().get(4).getValue();
+ typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(5).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable transferToEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(TRANSFERTO_EVENT));
+ return transferToEventFlowable(filter);
+ }
+
+ public List getUnpausedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(UNPAUSED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ UnpausedEventResponse typedResponse = new UnpausedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable unpausedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public UnpausedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(UNPAUSED_EVENT, log);
+ UnpausedEventResponse typedResponse = new UnpausedEventResponse();
+ typedResponse.log = log;
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable unpausedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(UNPAUSED_EVENT));
+ return unpausedEventFlowable(filter);
+ }
+
+ public RemoteFunctionCall adminTransfer(String _erc20Contract, String _recipient, BigInteger _amount) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_ADMINTRANSFER,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, _erc20Contract),
+ new org.web3j.abi.datatypes.Address(160, _recipient),
+ new org.web3j.abi.datatypes.generated.Uint256(_amount)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall changeBlockchainMapping(BigInteger _otherBcId, String _otherErc20Bridge) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_CHANGEBLOCKCHAINMAPPING,
+ Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_otherBcId),
+ new org.web3j.abi.datatypes.Address(160, _otherErc20Bridge)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall changeContractMapping(String _thisBcTokenContract, BigInteger _otherBcId, String _othercTokenContract) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_CHANGECONTRACTMAPPING,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, _thisBcTokenContract),
+ new org.web3j.abi.datatypes.generated.Uint256(_otherBcId),
+ new org.web3j.abi.datatypes.Address(160, _othercTokenContract)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall getBcIdTokenMaping(BigInteger _bcId, String _tokenContract) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETBCIDTOKENMAPING,
+ Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId),
+ new org.web3j.abi.datatypes.Address(160, _tokenContract)),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, String.class);
+ }
+
+ public RemoteFunctionCall getRemoteErc20BridgeContract(BigInteger _bcId) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_GETREMOTEERC20BRIDGECONTRACT,
+ Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId)),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, String.class);
+ }
+
+ public RemoteFunctionCall isBcIdTokenAllowed(BigInteger _bcId, String _tokenContract) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ISBCIDTOKENALLOWED,
+ Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId),
+ new org.web3j.abi.datatypes.Address(160, _tokenContract)),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, Boolean.class);
+ }
+
+ public RemoteFunctionCall owner() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_OWNER,
+ Arrays.asList(),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, String.class);
+ }
+
+ public RemoteFunctionCall paused() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_PAUSED,
+ Arrays.asList(),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, Boolean.class);
+ }
+
+ public RemoteFunctionCall receiveFromOtherBlockchain(String _destTokenContract, String _recipient, BigInteger _amount) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_RECEIVEFROMOTHERBLOCKCHAIN,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, _destTokenContract),
+ new org.web3j.abi.datatypes.Address(160, _recipient),
+ new org.web3j.abi.datatypes.generated.Uint256(_amount)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall renounceOwnership() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_RENOUNCEOWNERSHIP,
+ Arrays.asList(),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall transferOwnership(String newOwner) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_TRANSFEROWNERSHIP,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, newOwner)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall transferToOtherBlockchain(BigInteger _destBcId, String _srcTokenContract, String _recipient, BigInteger _amount) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_TRANSFERTOOTHERBLOCKCHAIN,
+ Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_destBcId),
+ new org.web3j.abi.datatypes.Address(160, _srcTokenContract),
+ new org.web3j.abi.datatypes.Address(160, _recipient),
+ new org.web3j.abi.datatypes.generated.Uint256(_amount)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ @Deprecated
+ public static SfcErc20MintingBurningBridge load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ return new SfcErc20MintingBurningBridge(contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ @Deprecated
+ public static SfcErc20MintingBurningBridge load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ return new SfcErc20MintingBurningBridge(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
+ public static SfcErc20MintingBurningBridge load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ return new SfcErc20MintingBurningBridge(contractAddress, web3j, credentials, contractGasProvider);
+ }
+
+ public static SfcErc20MintingBurningBridge load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ return new SfcErc20MintingBurningBridge(contractAddress, web3j, transactionManager, contractGasProvider);
+ }
+
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String _sfcCbcContract) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Address(160, _sfcCbcContract)));
+ return deployRemoteCall(SfcErc20MintingBurningBridge.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
+ }
+
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String _sfcCbcContract) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Address(160, _sfcCbcContract)));
+ return deployRemoteCall(SfcErc20MintingBurningBridge.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
+ }
+
+ @Deprecated
+ public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String _sfcCbcContract) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Address(160, _sfcCbcContract)));
+ return deployRemoteCall(SfcErc20MintingBurningBridge.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
+ }
+
+ @Deprecated
+ public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String _sfcCbcContract) {
+ String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.web3j.abi.datatypes.Address(160, _sfcCbcContract)));
+ return deployRemoteCall(SfcErc20MintingBurningBridge.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
+ }
+
+ public static class AdminTransferEventResponse extends BaseEventResponse {
+ public String _erc20Contract;
+
+ public String _recipient;
+
+ public BigInteger _amount;
+ }
+
+ public static class OwnershipTransferredEventResponse extends BaseEventResponse {
+ public String previousOwner;
+
+ public String newOwner;
+ }
+
+ public static class PausedEventResponse extends BaseEventResponse {
+ public String account;
+ }
+
+ public static class ReceivedFromEventResponse extends BaseEventResponse {
+ public BigInteger _srcBcId;
+
+ public String _srcTokenContract;
+
+ public String _destTokenContract;
+
+ public String _recipient;
+
+ public BigInteger _amount;
+ }
+
+ public static class TokenContractAddressMappingChangedEventResponse extends BaseEventResponse {
+ public String _thisBcTokenContract;
+
+ public BigInteger _otherBcId;
+
+ public String _othercTokenContract;
+ }
+
+ public static class TransferToEventResponse extends BaseEventResponse {
+ public BigInteger _destBcId;
+
+ public String _srcTokenContract;
+
+ public String _destTokenContract;
+
+ public String _sender;
+
+ public String _recipient;
+
+ public BigInteger _amount;
+ }
+
+ public static class UnpausedEventResponse extends BaseEventResponse {
+ public String account;
+ }
+}
diff --git a/application/sfc-examples/tokenbridge/src/main/resources/log4j2.xml b/application/sfc-examples/tokenbridge/src/main/resources/log4j2.xml
new file mode 100644
index 00000000..88a65fc8
--- /dev/null
+++ b/application/sfc-examples/tokenbridge/src/main/resources/log4j2.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ INFO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/sfc-examples/tokenbridge/src/main/solidity/AbstractSfcErc20Bridge.sol b/application/sfc-examples/tokenbridge/src/main/solidity/AbstractSfcErc20Bridge.sol
index eede2dfa..bdbaa156 100644
--- a/application/sfc-examples/tokenbridge/src/main/solidity/AbstractSfcErc20Bridge.sol
+++ b/application/sfc-examples/tokenbridge/src/main/solidity/AbstractSfcErc20Bridge.sol
@@ -27,14 +27,19 @@ import "./SfcErc20BridgeInterface.sol";
*/
abstract contract AbstractSfcErc20Bridge is HiddenParameters, Pausable, Ownable, SfcErc20BridgeInterface {
// Simple Function Call bridge.
- CrosschainFunctionCallInterface crosschainBridge;
+ CrosschainFunctionCallInterface private crosschainBridge;
// Mapping of ERC 20 contracts on this blockchain to ERC 20 contracts
// of the same type on different blockchains.
//
// Map (token contract address on this blockchain =>
// Map (destination blockchain Id => address on remote contract)
- mapping (address => mapping (uint256 => address)) public tokenContractAddressMapping;
+ mapping (address => mapping (uint256 => address)) private tokenContractAddressMapping;
+
+
+ // Addresses of ERC 20 bridges on other blockchains.
+ mapping (uint256 => address) private remoteErc20Bridges;
+
/**
* @param _sfcCbcContract Simple Function Call protocol implementation.
@@ -44,19 +49,15 @@ abstract contract AbstractSfcErc20Bridge is HiddenParameters, Pausable, Ownable,
}
- /**
- * Update the mapping between an ERC 20 contract on this blockchain and an ERC 20
- * contract on another blockchain.
- *
- * @param _thisBcTokenContract Address of ERC 20 contract on this blockchain.
- * @param _otherBcId Blockchain ID where the corresponding ERC 20 contract resides.
- * @param _othercTokenContract Address of ERC 20 contract on the other blockchain.
- */
function changeContractMapping(address _thisBcTokenContract, uint256 _otherBcId, address _othercTokenContract) onlyOwner override external {
tokenContractAddressMapping[_thisBcTokenContract][_otherBcId] = _othercTokenContract;
emit TokenContractAddressMappingChanged(_thisBcTokenContract, _otherBcId, _othercTokenContract);
}
+ function changeBlockchainMapping(uint256 _otherBcId, address _otherErc20Bridge) onlyOwner override external {
+ remoteErc20Bridges[_otherBcId] = _otherErc20Bridge;
+ }
+
/**
* Transfer tokens from msg.sender to this contract on this blockchain,
* and request tokens on the remote blockchain be given to the requested
@@ -69,19 +70,19 @@ abstract contract AbstractSfcErc20Bridge is HiddenParameters, Pausable, Ownable,
* @param _amount The number of tokens to transfer.
*/
function transferToOtherBlockchain(uint256 _destBcId, address _srcTokenContract, address _recipient, uint256 _amount) whenNotPaused override public {
- address destTokenContract = tokenContractAddressMapping[_srcTokenContract][_destBcId];
+ address destErc20BridgeContract = remoteErc20Bridges[_destBcId];
+ require(destErc20BridgeContract != address(0), "Blockchain not supported");
// The token must be able to be transferred to the target blockchain.
- require(destTokenContract != address(0), "Token not transferable");
+ address destTokenContract = tokenContractAddressMapping[_srcTokenContract][_destBcId];
+ require(destTokenContract != address(0), "Token not transferable to requested blockchain");
// Transfer tokens from the user to this contract.
// The transfer will revert if the account has inadequate balance or if adequate
// allowance hasn't been set-up.
- if (!IERC20(_srcTokenContract).transferFrom(msg.sender, address(this), _amount)) {
- revert("transferFrom failed");
- }
+ transferOrBurn(_srcTokenContract, msg.sender, _amount);
- crosschainBridge.crossBlockchainCall(_destBcId, destTokenContract,
+ crosschainBridge.crossBlockchainCall(_destBcId, destErc20BridgeContract,
abi.encodeWithSelector(this.receiveFromOtherBlockchain.selector, destTokenContract, _recipient, _amount));
emit TransferTo(_destBcId, _srcTokenContract, destTokenContract, msg.sender, _recipient, _amount);
@@ -102,28 +103,22 @@ abstract contract AbstractSfcErc20Bridge is HiddenParameters, Pausable, Ownable,
(uint256 sourceBcId, uint256 sourceContract1) = extractTwoHiddenParams();
address sourceContract = address(uint160(sourceContract1));
// The source blockchain id is validated at the function call layer. No need to check
- // that is isn't zero.
- // The sourceContract could be manipulated by malicious validators. A value of zero
- // would be deemed valid in the code that follows. Hence, check for zero here.
- require(sourceContract != address(0), "Source is not correct ERC20");
-
- // Determine the ERC contract address that corresponds to the address on this blockchain.
- address expectedSourceContract = tokenContractAddressMapping[_destTokenContract][sourceBcId];
+ // that it isn't zero.
- require(sourceContract == expectedSourceContract, "Source is not correct ERC20");
+ require(sourceContract != address(0), "ERC 20 Bridge (caller) contract is 0");
+ address remoteErc20Bridge = remoteErc20Bridges[sourceBcId];
+ require(remoteErc20Bridge != address(0), "No ERC 20 Bridge supported for source blockchain");
+ require(sourceContract == remoteErc20Bridge, "Incorrect source ERC 20 Bridge");
- if (!transferOrMint(_destTokenContract, _recipient, _amount)) {
- revert("transferFrom failed");
- }
+ transferOrMint(_destTokenContract, _recipient, _amount);
emit ReceivedFrom(sourceBcId, sourceContract, _destTokenContract, _recipient, _amount);
}
+
function adminTransfer(address _erc20Contract, address _recipient, uint256 _amount) onlyOwner override external {
- if (!IERC20(_erc20Contract).transfer(_recipient, _amount)) {
- revert("transferFrom failed");
- }
+ transferOrMint(_erc20Contract, _recipient, _amount);
emit AdminTransfer(_erc20Contract, _recipient, _amount);
}
@@ -136,11 +131,32 @@ abstract contract AbstractSfcErc20Bridge is HiddenParameters, Pausable, Ownable,
return tokenContractAddressMapping[_tokenContract][_bcId];
}
+ function getRemoteErc20BridgeContract(uint256 _bcId) external override view returns(address) {
+ return remoteErc20Bridges[_bcId];
+ }
// ***************************************************************************
// ******* Internal below here ***********************************************
// ***************************************************************************
- function transferOrMint(address _tokenContract, address _recipient, uint256 _amount) virtual internal returns (bool);
-
+ /**
+ * Mass Conservation: Transfer tokens that are owned by this contract to a recipient.
+ * OR
+ * Minting Burning: Mint token and assign them to a recipient.
+ *
+ * @param _tokenContract ERC 20 contract of the token being transferred or minted.
+ * @param _recipient Account to transfer ownership of the tokens to.
+ * @param _amount The number of tokens to be transferred.
+ */
+ function transferOrMint(address _tokenContract, address _recipient, uint256 _amount) virtual internal;
+ /**
+ * Mass Conservation: TransferFrom tokens from a spender to this contract.
+ * OR
+ * Minting Burning: BurnFrom a spender's tokens.
+ *
+ * @param _tokenContract ERC 20 contract of the token being transferred or burned.
+ * @param _spender Account to transfer ownership of the tokens from.
+ * @param _amount The number of tokens to be transferred.
+ */
+ function transferOrBurn(address _tokenContract, address _spender, uint256 _amount) virtual internal;
}
\ No newline at end of file
diff --git a/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20BridgeInterface.sol b/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20BridgeInterface.sol
index 0443228c..ce16e196 100644
--- a/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20BridgeInterface.sol
+++ b/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20BridgeInterface.sol
@@ -81,6 +81,12 @@ interface SfcErc20BridgeInterface {
*/
function changeContractMapping(address _thisBcTokenContract, uint256 _otherBcId, address _othercTokenContract) external;
+ /**
+ * Connect this ERC20 Bridge contract to an ERC20 Bridge contract on another blockchain.
+ */
+ function changeBlockchainMapping(uint256 _otherBcId, address _otherErc20Bridge) external;
+
+
/**
* Transfer tokens from msg.sender to this contract on this blockchain,
* and request tokens on the remote blockchain be given to the requested
@@ -141,4 +147,6 @@ interface SfcErc20BridgeInterface {
*/
function getBcIdTokenMaping(uint256 _bcId, address _tokenContract) external view returns(address);
+
+ function getRemoteErc20BridgeContract(uint256 _bcId) external view returns(address);
}
\ No newline at end of file
diff --git a/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MassConservationBridge.sol b/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MassConservationBridge.sol
index d6d28304..bb616efd 100644
--- a/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MassConservationBridge.sol
+++ b/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MassConservationBridge.sol
@@ -19,8 +19,12 @@ import "./SfcErc20BridgeInterface.sol";
import "./AbstractSfcErc20Bridge.sol";
/**
- * ERC 20 bridge using the Simple Function Call protocol.
- *
+ * ERC 20 bridge using the Simple Function Call protocol. This bridge is the owner
+ * of tokens that are transferred to other blockchains. When tokens are
+ * transferred to another blockchain, the user approves the contract using some
+ * of their tokens. The contract is then able to execute a transferFrom() for the
+ * tokens to be transferred. When tokens are transferred back to this chain,
+ * the contract transfers tokens to the recipient.
*/
contract SfcErc20MassConservationBridge is SfcErc20BridgeInterface, AbstractSfcErc20Bridge {
@@ -31,15 +35,17 @@ contract SfcErc20MassConservationBridge is SfcErc20BridgeInterface, AbstractSfcE
}
- /**
- * Transfer tokens that are owned by this contract to a recipient.
- *
- * @param _tokenContract ERC 20 contract of the token being transferred.
- * @param _recipient Account to transfer ownership of the tokens to.
- * @param _amount The number of tokens to be transferred.
- */
- function transferOrMint(address _tokenContract, address _recipient, uint256 _amount) internal override returns (bool) {
- return IERC20(_tokenContract).transfer(_recipient, _amount);
+ function transferOrMint(address _tokenContract, address _recipient, uint256 _amount) internal override {
+ if (!IERC20(_tokenContract).transfer(_recipient, _amount)) {
+ revert("transfer failed");
+ }
}
+ function transferOrBurn(address _tokenContract, address _spender, uint256 _amount) internal override {
+ if (!IERC20(_tokenContract).transferFrom(_spender, address(this), _amount)) {
+ revert("transferFrom failed");
+ }
+ }
+
+
}
\ No newline at end of file
diff --git a/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MintingBurningBridge.sol b/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MintingBurningBridge.sol
new file mode 100644
index 00000000..52f10751
--- /dev/null
+++ b/application/sfc-examples/tokenbridge/src/main/solidity/SfcErc20MintingBurningBridge.sol
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2021 ConsenSys Software Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+pragma solidity >=0.8.0;
+
+import "../../../../../../common/openzeppelin/src/main/solidity/token/ERC20/presets/ERC20PresetMinterPauser.sol";
+import "./SfcErc20BridgeInterface.sol";
+import "./AbstractSfcErc20Bridge.sol";
+
+/**
+ * ERC 20 bridge using the Simple Function Call protocol. This bridge mints new tokens
+ * when they are transferred to this chain and burns tokens when they are transferred
+ * from this chain.
+ */
+contract SfcErc20MintingBurningBridge is SfcErc20BridgeInterface, AbstractSfcErc20Bridge {
+
+ /**
+ * @param _sfcCbcContract Simple Function Call protocol implementation.
+ */
+ constructor (address _sfcCbcContract) AbstractSfcErc20Bridge (_sfcCbcContract){
+ }
+
+
+ function transferOrMint(address _tokenContract, address _recipient, uint256 _amount) internal override {
+ ERC20PresetMinterPauser(_tokenContract).mint(_recipient, _amount);
+ }
+
+ function transferOrBurn(address _tokenContract, address _spender, uint256 _amount) internal override {
+ ERC20PresetMinterPauser(_tokenContract).burnFrom(_spender, _amount);
+ }
+
+}
\ No newline at end of file
diff --git a/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/SfcCrosschainWrite.java b/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/SfcCrosschainWrite.java
index fba624d6..3d1b4674 100644
--- a/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/SfcCrosschainWrite.java
+++ b/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/SfcCrosschainWrite.java
@@ -70,12 +70,22 @@ public static void main(String[] args) throws Exception {
RemoteCall functionCall = bc1ContractABlockchain.doCrosschainWrite(val);
SimpleCrosschainExecutor executor = new SimpleCrosschainExecutor(crossControlManagerGroup);
- TransactionReceipt[] receipts = executor.execute(rootBcId, functionCall);
-
- success = (receipts.length == 2) && receipts[0].isStatusOK() && receipts[1].isStatusOK();
+ Tuple results = executor.execute(rootBcId, functionCall);
+ success = results.getThird();
LOG.info("Success: {}", success);
-
- bc2ContractBBlockchain.showEvents(receipts[1]);
+ if (!success) {
+ LOG.error("Crosschain Execution failed. See log for details");
+ String errorMsg = results.getSecond();
+ if (errorMsg != null) {
+ LOG.error("Error information: {}", errorMsg);
+ }
+ for (TransactionReceipt txr: results.getFirst()) {
+ LOG.error("Transaction Receipt: {}", txr.toString());
+ }
+ throw new Exception("Crosschain Execution failed. See log for details");
+ }
+
+ bc2ContractBBlockchain.showEvents(results.getFirst()[1]);
bc2ContractBBlockchain.checkValueWritten(val);
}
diff --git a/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractA.java b/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractA.java
index c95716c5..b463f67f 100644
--- a/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractA.java
+++ b/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractA.java
@@ -27,7 +27,7 @@
*/
@SuppressWarnings("rawtypes")
public class ContractA extends Contract {
- public static final String BINARY = "608060405234801561001057600080fd5b5060405161027138038061027183398101604081905261002f91610082565b600280546001600160a01b039485166001600160a01b031991821617909155600092909255600180549190931691161790556100be565b80516001600160a01b038116811461007d57600080fd5b919050565b60008060006060848603121561009757600080fd5b6100a084610066565b9250602084015191506100b560408501610066565b90509250925092565b6101a4806100cd6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063209a5a9b14610030575b600080fd5b61004361003e3660046100e9565b610045565b005b60025460005460015460408051602480820187905282518083039091018152604490910182526020810180516001600160e01b03166360fe47b160e01b17905290516392b2c33560e01b81526001600160a01b03948516946392b2c335946100b4949093911691600401610102565b600060405180830381600087803b1580156100ce57600080fd5b505af11580156100e2573d6000803e3d6000fd5b5050505050565b6000602082840312156100fb57600080fd5b5035919050565b8381526000602060018060a01b0385168184015260606040840152835180606085015260005b8181101561014457858101830151858201608001528201610128565b81811115610156576000608083870101525b50601f01601f1916929092016080019594505050505056fea26469706673582212208b4d1277ad31126306d132039ff97dbac8f0422d899536276b02b54f44b17e0c64736f6c63430008050033";
+ public static final String BINARY = "608060405234801561001057600080fd5b5060405161027138038061027183398101604081905261002f91610082565b600280546001600160a01b039485166001600160a01b031991821617909155600092909255600180549190931691161790556100be565b80516001600160a01b038116811461007d57600080fd5b919050565b60008060006060848603121561009757600080fd5b6100a084610066565b9250602084015191506100b560408501610066565b90509250925092565b6101a4806100cd6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063209a5a9b14610030575b600080fd5b61004361003e3660046100e9565b610045565b005b60025460005460015460408051602480820187905282518083039091018152604490910182526020810180516001600160e01b03166360fe47b160e01b17905290516392b2c33560e01b81526001600160a01b03948516946392b2c335946100b4949093911691600401610102565b600060405180830381600087803b1580156100ce57600080fd5b505af11580156100e2573d6000803e3d6000fd5b5050505050565b6000602082840312156100fb57600080fd5b5035919050565b8381526000602060018060a01b0385168184015260606040840152835180606085015260005b8181101561014457858101830151858201608001528201610128565b81811115610156576000608083870101525b50601f01601f1916929092016080019594505050505056fea2646970667358221220999aa16ed47916778e136f2ef0d3ed83035374b1a55bdf1419fa880561e116db64736f6c63430008090033";
public static final String FUNC_DOCROSSCHAINWRITE = "doCrosschainWrite";
diff --git a/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractB.java b/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractB.java
index fc80cb35..5ea5421a 100644
--- a/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractB.java
+++ b/application/sfc-examples/write/src/main/java/net/consensys/gpact/sfc/examples/write/soliditywrappers/ContractB.java
@@ -36,7 +36,7 @@
*/
@SuppressWarnings("rawtypes")
public class ContractB extends Contract {
- public static final String BINARY = "608060405234801561001057600080fd5b5060e68061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806360fe47b1146037578063e1cb0e52146048575b600080fd5b604660423660046098565b605d565b005b60005460405190815260200160405180910390f35b60008190556040518181527fbc9e8ea3b0777e6b9815f4c534668e08ddcaa8595a383ac46aebb40336ce81d79060200160405180910390a150565b60006020828403121560a957600080fd5b503591905056fea26469706673582212201919e8532a3b46aa155b08bbca3c06351bb96645e06404588fa9334c7803485164736f6c63430008050033";
+ public static final String BINARY = "608060405234801561001057600080fd5b5060e68061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806360fe47b1146037578063e1cb0e52146048575b600080fd5b604660423660046098565b605d565b005b60005460405190815260200160405180910390f35b60008190556040518181527fbc9e8ea3b0777e6b9815f4c534668e08ddcaa8595a383ac46aebb40336ce81d79060200160405180910390a150565b60006020828403121560a957600080fd5b503591905056fea2646970667358221220d1c263c8a8d37f93dbbb8baaddf50bbf949a38703292975ccabe71d74d5db24a64736f6c63430008090033";
public static final String FUNC_GETVAL = "getVal";
diff --git a/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/BlsSignatureTest.java b/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/BlsSignatureTest.java
index e26bd309..fb1ceffa 100644
--- a/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/BlsSignatureTest.java
+++ b/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/BlsSignatureTest.java
@@ -27,7 +27,7 @@
*/
@SuppressWarnings("rawtypes")
public class BlsSignatureTest extends Contract {
- public static final String BINARY = "608060405234801561001057600080fd5b50610d50806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063bbb82d891461003b578063f6e548e91461005c575b600080fd5b6000546100489060ff1681565b604051901515815260200160405180910390f35b61006f61006a366004610b93565b610071565b005b60006100b287878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061015492505050565b905060006100f584848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061027292505050565b90506101398287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610344915050565b6000805460ff19169115159190911790555050505050505050565b61015c610acb565b60408051600480825260a082019092526000916020820160808036833701905050905060205b815161018f906020610c45565b81116101af5783810151828201526101a8602082610c2d565b9050610182565b50806000815181106101c3576101c3610cee565b60209081029190910101518251528051819060019081106101e6576101e6610cee565b602090810291909101015182516001602002015280518190600290811061020f5761020f610cee565b6020026020010151826020015160006002811061022e5761022e610cee565b602002015280518190600390811061024857610248610cee565b6020026020010151826020015160016002811061026757610267610cee565b602002015250919050565b6040805180820182526000808252602082018190528251600280825260608201909452919290919081602001602082028036833701905050905060205b81516102bc906020610c45565b81116102dc5783810151828201526102d5602082610c2d565b90506102af565b50604051806040016040528060008152602001600081525091508060008151811061030957610309610cee565b60200260200101518260000181815250508060018151811061032d5761032d610cee565b602002602001015182602001818152505050919050565b60408051600280825260608201909252600091829190816020015b604080518082019091526000808252602082015281526020019060019003908161035f5750506040805160028082526060820190925291925060009190602082015b6103a9610acb565b8152602001906001900390816103a15790505090506103c784610465565b826000815181106103da576103da610cee565b60200260200101819052506103ee856104fb565b8260018151811061040157610401610cee565b60200260200101819052506104146105f2565b8160008151811061042757610427610cee565b6020026020010181905250858160018151811061044657610446610cee565b602002602001018190525061045b82826106b2565b9695505050505050565b60408051808201909152600080825260208201527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd476104a383610a08565b156104c35750506040805180820190915260008082526020820152919050565b6040518060400160405280846000015181526020018285602001516104e89190610cb6565b6104f29084610c64565b90529392505050565b60408051808201825260008082526020808301829052845185820120845180860190955282855290840182905291925b600061053a60ff841685610c2d565b905061057161056b604080518082018252600080825260209182015281518083019092526001825260029082015290565b82610a22565b915061057c82610a08565b61058657506105ea565b8261059081610c96565b935050600a60ff8416106105e45760405162461bcd60e51b815260206004820152601660248201527511985a5b1959081d1bc81b585c081d1bc81c1bda5b9d60521b60448201526064015b60405180910390fd5b5061052b565b949350505050565b6105fa610acb565b50604080516080810182527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28183019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6060830152815281518083019092527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b82527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa60208381019190915281019190915290565b600081518351146106fd5760405162461bcd60e51b81526020600482015260156024820152742837b4b73a1031b7bab73a1036b4b9b6b0ba31b41760591b60448201526064016105db565b8251600061070c826006610c45565b905060008167ffffffffffffffff81111561072957610729610d04565b604051908082528060200260200182016040528015610752578160200160208202803683370190505b50905060005b8381101561098d5786818151811061077257610772610cee565b6020026020010151600001518282600661078c9190610c45565b610797906000610c2d565b815181106107a7576107a7610cee565b6020026020010181815250508681815181106107c5576107c5610cee565b602002602001015160200151828260066107df9190610c45565b6107ea906001610c2d565b815181106107fa576107fa610cee565b60200260200101818152505085818151811061081857610818610cee565b6020908102919091010151515182610831836006610c45565b61083c906002610c2d565b8151811061084c5761084c610cee565b60200260200101818152505085818151811061086a5761086a610cee565b60209081029190910181015151015182610885836006610c45565b610890906003610c2d565b815181106108a0576108a0610cee565b6020026020010181815250508581815181106108be576108be610cee565b6020026020010151602001516000600281106108dc576108dc610cee565b6020020151826108ed836006610c45565b6108f8906004610c2d565b8151811061090857610908610cee565b60200260200101818152505085818151811061092657610926610cee565b60200260200101516020015160016002811061094457610944610cee565b602002015182610955836006610c45565b610960906005610c2d565b8151811061097057610970610cee565b60209081029190910101528061098581610c7b565b915050610758565b50610996610af0565b6000602082602086026020860160086107d05a03fa9050806109fa5760405162461bcd60e51b815260206004820152601960248201527f50616972696e67206f7065726174696f6e206661696c65642e0000000000000060448201526064016105db565b505115159695505050505050565b8051600090158015610a1c57506020820151155b92915050565b6040805180820190915260008082526020820152610a3e610b0e565b83518152602080850151818301526040808301859052805180820182526000808252928101839052908160608560076107d05a03fa915081610ac25760405162461bcd60e51b815260206004820152601c60248201527f506f696e74206d756c7469706c69636174696f6e206661696c65642e0000000060448201526064016105db565b95945050505050565b6040518060400160405280610ade610b2c565b8152602001610aeb610b2c565b905290565b60405180602001604052806001906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180604001604052806002906020820280368337509192915050565b60008083601f840112610b5c57600080fd5b50813567ffffffffffffffff811115610b7457600080fd5b602083019150836020828501011115610b8c57600080fd5b9250929050565b60008060008060008060608789031215610bac57600080fd5b863567ffffffffffffffff80821115610bc457600080fd5b610bd08a838b01610b4a565b90985096506020890135915080821115610be957600080fd5b610bf58a838b01610b4a565b90965094506040890135915080821115610c0e57600080fd5b50610c1b89828a01610b4a565b979a9699509497509295939492505050565b60008219821115610c4057610c40610cd8565b500190565b6000816000190483118215151615610c5f57610c5f610cd8565b500290565b600082821015610c7657610c76610cd8565b500390565b6000600019821415610c8f57610c8f610cd8565b5060010190565b600060ff821660ff811415610cad57610cad610cd8565b60010192915050565b600082610cd357634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212205e9192a1b998b80f9d752fa1480bb5d8d1b7dca01e772970862989d3bb56cf2764736f6c63430008050033";
+ public static final String BINARY = "608060405234801561001057600080fd5b50610d50806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063bbb82d891461003b578063f6e548e91461005c575b600080fd5b6000546100489060ff1681565b604051901515815260200160405180910390f35b61006f61006a366004610b93565b610071565b005b60006100b287878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061015492505050565b905060006100f584848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061027292505050565b90506101398287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869250610344915050565b6000805460ff19169115159190911790555050505050505050565b61015c610acb565b60408051600480825260a082019092526000916020820160808036833701905050905060205b815161018f906020610c59565b81116101af5783810151828201526101a8602082610c78565b9050610182565b50806000815181106101c3576101c3610c90565b60209081029190910101518251528051819060019081106101e6576101e6610c90565b602090810291909101015182516001602002015280518190600290811061020f5761020f610c90565b6020026020010151826020015160006002811061022e5761022e610c90565b602002015280518190600390811061024857610248610c90565b6020026020010151826020015160016002811061026757610267610c90565b602002015250919050565b6040805180820182526000808252602082018190528251600280825260608201909452919290919081602001602082028036833701905050905060205b81516102bc906020610c59565b81116102dc5783810151828201526102d5602082610c78565b90506102af565b50604051806040016040528060008152602001600081525091508060008151811061030957610309610c90565b60200260200101518260000181815250508060018151811061032d5761032d610c90565b602002602001015182602001818152505050919050565b60408051600280825260608201909252600091829190816020015b604080518082019091526000808252602082015281526020019060019003908161035f5750506040805160028082526060820190925291925060009190602082015b6103a9610acb565b8152602001906001900390816103a15790505090506103c784610465565b826000815181106103da576103da610c90565b60200260200101819052506103ee856104fb565b8260018151811061040157610401610c90565b60200260200101819052506104146105f2565b8160008151811061042757610427610c90565b6020026020010181905250858160018151811061044657610446610c90565b602002602001018190525061045b82826106b2565b9695505050505050565b60408051808201909152600080825260208201527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd476104a383610a08565b156104c35750506040805180820190915260008082526020820152919050565b6040518060400160405280846000015181526020018285602001516104e89190610ca6565b6104f29084610cc8565b90529392505050565b60408051808201825260008082526020808301829052845185820120845180860190955282855290840182905291925b600061053a60ff841685610c78565b905061057161056b604080518082018252600080825260209182015281518083019092526001825260029082015290565b82610a22565b915061057c82610a08565b61058657506105ea565b8261059081610cdf565b935050600a60ff8416106105e45760405162461bcd60e51b815260206004820152601660248201527511985a5b1959081d1bc81b585c081d1bc81c1bda5b9d60521b60448201526064015b60405180910390fd5b5061052b565b949350505050565b6105fa610acb565b50604080516080810182527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28183019081527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6060830152815281518083019092527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b82527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa60208381019190915281019190915290565b600081518351146106fd5760405162461bcd60e51b81526020600482015260156024820152742837b4b73a1031b7bab73a1036b4b9b6b0ba31b41760591b60448201526064016105db565b8251600061070c826006610c59565b905060008167ffffffffffffffff81111561072957610729610c2d565b604051908082528060200260200182016040528015610752578160200160208202803683370190505b50905060005b8381101561098d5786818151811061077257610772610c90565b6020026020010151600001518282600661078c9190610c59565b610797906000610c78565b815181106107a7576107a7610c90565b6020026020010181815250508681815181106107c5576107c5610c90565b602002602001015160200151828260066107df9190610c59565b6107ea906001610c78565b815181106107fa576107fa610c90565b60200260200101818152505085818151811061081857610818610c90565b6020908102919091010151515182610831836006610c59565b61083c906002610c78565b8151811061084c5761084c610c90565b60200260200101818152505085818151811061086a5761086a610c90565b60209081029190910181015151015182610885836006610c59565b610890906003610c78565b815181106108a0576108a0610c90565b6020026020010181815250508581815181106108be576108be610c90565b6020026020010151602001516000600281106108dc576108dc610c90565b6020020151826108ed836006610c59565b6108f8906004610c78565b8151811061090857610908610c90565b60200260200101818152505085818151811061092657610926610c90565b60200260200101516020015160016002811061094457610944610c90565b602002015182610955836006610c59565b610960906005610c78565b8151811061097057610970610c90565b60209081029190910101528061098581610cff565b915050610758565b50610996610af0565b6000602082602086026020860160086107d05a03fa9050806109fa5760405162461bcd60e51b815260206004820152601960248201527f50616972696e67206f7065726174696f6e206661696c65642e0000000000000060448201526064016105db565b505115159695505050505050565b8051600090158015610a1c57506020820151155b92915050565b6040805180820190915260008082526020820152610a3e610b0e565b83518152602080850151818301526040808301859052805180820182526000808252928101839052908160608560076107d05a03fa915081610ac25760405162461bcd60e51b815260206004820152601c60248201527f506f696e74206d756c7469706c69636174696f6e206661696c65642e0000000060448201526064016105db565b95945050505050565b6040518060400160405280610ade610b2c565b8152602001610aeb610b2c565b905290565b60405180602001604052806001906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180604001604052806002906020820280368337509192915050565b60008083601f840112610b5c57600080fd5b50813567ffffffffffffffff811115610b7457600080fd5b602083019150836020828501011115610b8c57600080fd5b9250929050565b60008060008060008060608789031215610bac57600080fd5b863567ffffffffffffffff80821115610bc457600080fd5b610bd08a838b01610b4a565b90985096506020890135915080821115610be957600080fd5b610bf58a838b01610b4a565b90965094506040890135915080821115610c0e57600080fd5b50610c1b89828a01610b4a565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615610c7357610c73610c43565b500290565b60008219821115610c8b57610c8b610c43565b500190565b634e487b7160e01b600052603260045260246000fd5b600082610cc357634e487b7160e01b600052601260045260246000fd5b500690565b600082821015610cda57610cda610c43565b500390565b600060ff821660ff811415610cf657610cf6610c43565b60010192915050565b6000600019821415610d1357610d13610c43565b506001019056fea26469706673582212204b76186c7d93a190cb10a97c62e1a0d099ebc49b5cddccbbff951c23b061d68364736f6c63430008090033";
public static final String FUNC_VERIFIED = "verified";
diff --git a/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/EcdsaSignatureTest.java b/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/EcdsaSignatureTest.java
index 166dcbc9..d7641612 100644
--- a/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/EcdsaSignatureTest.java
+++ b/common/common/src/test/java/net/consensys/gpact/test/soliditywrappers/EcdsaSignatureTest.java
@@ -25,7 +25,7 @@
*/
@SuppressWarnings("rawtypes")
public class EcdsaSignatureTest extends Contract {
- public static final String BINARY = "608060405234801561001057600080fd5b50610395806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063c976588c1461003b578063f3a2281d14610062575b600080fd5b61004e6100493660046102ce565b610075565b604051901515815260200160405180910390f35b61004e61007036600461024e565b610090565b600061008486868686866100ad565b90505b95945050505050565b60006100a087878787878761012c565b90505b9695505050505050565b6000604182146100bf57506000610087565b600083838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506020850151604086015160608701519697509095909450901a915061011e90508a8a8a86868661012c565b9a9950505050505050505050565b600080868660405161013f92919061034f565b604051809103902090508260ff16601b1415801561016157508260ff16601c14155b156101705760009150506100a3565b60408051600081526020810180835283905260ff851691810191909152606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156101c3573d6000803e3d6000fd5b505050602060405103516001600160a01b0316886001600160a01b0316149150506100a3565b80356001600160a01b038116811461020057600080fd5b919050565b60008083601f84011261021757600080fd5b50813567ffffffffffffffff81111561022f57600080fd5b60208301915083602082850101111561024757600080fd5b9250929050565b60008060008060008060a0878903121561026757600080fd5b610270876101e9565b9550602087013567ffffffffffffffff81111561028c57600080fd5b61029889828a01610205565b9096509450506040870135925060608701359150608087013560ff811681146102c057600080fd5b809150509295509295509295565b6000806000806000606086880312156102e657600080fd5b6102ef866101e9565b9450602086013567ffffffffffffffff8082111561030c57600080fd5b61031889838a01610205565b9096509450604088013591508082111561033157600080fd5b5061033e88828901610205565b969995985093965092949392505050565b818382376000910190815291905056fea2646970667358221220ae1cf7717f1f55d9c1f78c9750de81242106c472a2674a2660229747694d6c6064736f6c63430008050033";
+ public static final String BINARY = "608060405234801561001057600080fd5b50610395806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063c976588c1461003b578063f3a2281d14610062575b600080fd5b61004e61004936600461024e565b610075565b604051901515815260200160405180910390f35b61004e6100703660046102cf565b610090565b600061008486868686866100ad565b90505b95945050505050565b60006100a087878787878761012c565b90505b9695505050505050565b6000604182146100bf57506000610087565b600083838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506020850151604086015160608701519697509095909450901a915061011e90508a8a8a86868661012c565b9a9950505050505050505050565b600080868660405161013f92919061034f565b604051809103902090508260ff16601b1415801561016157508260ff16601c14155b156101705760009150506100a3565b60408051600081526020810180835283905260ff851691810191909152606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156101c3573d6000803e3d6000fd5b505050602060405103516001600160a01b0316886001600160a01b0316149150506100a3565b80356001600160a01b038116811461020057600080fd5b919050565b60008083601f84011261021757600080fd5b50813567ffffffffffffffff81111561022f57600080fd5b60208301915083602082850101111561024757600080fd5b9250929050565b60008060008060006060868803121561026657600080fd5b61026f866101e9565b9450602086013567ffffffffffffffff8082111561028c57600080fd5b61029889838a01610205565b909650945060408801359150808211156102b157600080fd5b506102be88828901610205565b969995985093965092949392505050565b60008060008060008060a087890312156102e857600080fd5b6102f1876101e9565b9550602087013567ffffffffffffffff81111561030d57600080fd5b61031989828a01610205565b9096509450506040870135925060608701359150608087013560ff8116811461034157600080fd5b809150509295509295509295565b818382376000910190815291905056fea2646970667358221220e55fb33aa47de053727dc86665d5f66759e235904f6aadfe3887e725f496035464736f6c63430008090033";
public static final String FUNC_VERIFY2 = "verify2";
diff --git a/common/openzeppelin/gen.sh b/common/openzeppelin/gen.sh
index 8d1555fe..d3994354 100755
--- a/common/openzeppelin/gen.sh
+++ b/common/openzeppelin/gen.sh
@@ -14,10 +14,12 @@ WEB3J=../web3j-rlp/codegen/build/install/codegen/bin/codegen
solc $CONTRACTSDIR/token/ERC20/presets/ERC20PresetFixedSupply.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
-# solc $CONTRACTSDIR/proxy/transparent/ProxyAdmin.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
+solc $CONTRACTSDIR/token/ERC20/presets/ERC20PresetMinterPauser.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
+#solc $CONTRACTSDIR/proxy/transparent/ProxyAdmin.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
# solc $CONTRACTSDIR/proxy/transparent/TransparentUpgradeableProxy.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
$WEB3J solidity generate -a=$BUILDDIR/ERC20PresetFixedSupply.abi -b=$BUILDDIR/ERC20PresetFixedSupply.bin -o=$OUTPUTDIR -p=$PACKAGE
+$WEB3J solidity generate -a=$BUILDDIR/ERC20PresetMinterPauser.abi -b=$BUILDDIR/ERC20PresetMinterPauser.bin -o=$OUTPUTDIR -p=$PACKAGE
# $WEB3J solidity generate -a=$BUILDDIR/ProxyAdmin.abi -b=$BUILDDIR/ProxyAdmin.bin -o=$OUTPUTDIR -p=$PACKAGE
# $WEB3J solidity generate -a=$BUILDDIR/TransparentUpgradeableProxy.abi -b=$BUILDDIR/TransparentUpgradeableProxy.bin -o=$OUTPUTDIR -p=$PACKAGE
diff --git a/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetFixedSupply.java b/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetFixedSupply.java
index 552a5252..43f8f977 100644
--- a/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetFixedSupply.java
+++ b/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetFixedSupply.java
@@ -40,7 +40,7 @@
*/
@SuppressWarnings("rawtypes")
public class ERC20PresetFixedSupply extends Contract {
- public static final String BINARY = "60806040523480156200001157600080fd5b5060405162000f2238038062000f228339810160408190526200003491620002c7565b8351849084906200004d9060039060208501906200016a565b508051620000639060049060208401906200016a565b5050506200007881836200008260201b60201c565b50505050620003d6565b6001600160a01b038216620000dd5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620000f191906200035c565b90915550506001600160a01b03821660009081526020819052604081208054839290620001209084906200035c565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b828054620001789062000383565b90600052602060002090601f0160209004810192826200019c5760008555620001e7565b82601f10620001b757805160ff1916838001178555620001e7565b82800160010185558215620001e7579182015b82811115620001e7578251825591602001919060010190620001ca565b50620001f5929150620001f9565b5090565b5b80821115620001f55760008155600101620001fa565b600082601f8301126200022257600080fd5b81516001600160401b03808211156200023f576200023f620003c0565b604051601f8301601f19908116603f011681019082821181831017156200026a576200026a620003c0565b816040528381526020925086838588010111156200028757600080fd5b600091505b83821015620002ab57858201830151818301840152908201906200028c565b83821115620002bd5760008385830101525b9695505050505050565b60008060008060808587031215620002de57600080fd5b84516001600160401b0380821115620002f657600080fd5b620003048883890162000210565b955060208701519150808211156200031b57600080fd5b506200032a8782880162000210565b60408701516060880151919550935090506001600160a01b03811681146200035157600080fd5b939692955090935050565b600082198211156200037e57634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200039857607f821691505b60208210811415620003ba57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b610b3c80620003e66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806342966c681161008c57806395d89b411161006657806395d89b41146101ad578063a457c2d7146101b5578063a9059cbb146101c8578063dd62ed3e146101db57600080fd5b806342966c681461015c57806370a082311461017157806379cc67901461019a57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a5780633950935114610149575b600080fd5b6100dc610214565b6040516100e99190610a31565b60405180910390f35b6101056101003660046109ee565b6102a6565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046109b2565b6102bc565b604051601281526020016100e9565b6101056101573660046109ee565b610372565b61016f61016a366004610a18565b6103a9565b005b61011961017f36600461095d565b6001600160a01b031660009081526020819052604090205490565b61016f6101a83660046109ee565b6103b6565b6100dc61043e565b6101056101c33660046109ee565b61044d565b6101056101d63660046109ee565b6104e8565b6101196101e936600461097f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461022390610ab5565b80601f016020809104026020016040519081016040528092919081815260200182805461024f90610ab5565b801561029c5780601f106102715761010080835404028352916020019161029c565b820191906000526020600020905b81548152906001019060200180831161027f57829003601f168201915b5050505050905090565b60006102b33384846104f5565b50600192915050565b60006102c984848461061a565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103535760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61036785336103628685610a9e565b6104f5565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916102b3918590610362908690610a86565b6103b333826107f2565b50565b60006103c283336101e9565b9050818110156104205760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b606482015260840161034a565b61042f83336103628585610a9e565b61043983836107f2565b505050565b60606004805461022390610ab5565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156104cf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161034a565b6104de33856103628685610a9e565b5060019392505050565b60006102b333848461061a565b6001600160a01b0383166105575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161034a565b6001600160a01b0382166105b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161034a565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661067e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161034a565b6001600160a01b0382166106e05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161034a565b6001600160a01b038316600090815260208190526040902054818110156107585760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161034a565b6107628282610a9e565b6001600160a01b038086166000908152602081905260408082209390935590851681529081208054849290610798908490610a86565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107e491815260200190565b60405180910390a350505050565b6001600160a01b0382166108525760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161034a565b6001600160a01b038216600090815260208190526040902054818110156108c65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161034a565b6108d08282610a9e565b6001600160a01b038416600090815260208190526040812091909155600280548492906108fe908490610a9e565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161060d565b80356001600160a01b038116811461095857600080fd5b919050565b60006020828403121561096f57600080fd5b61097882610941565b9392505050565b6000806040838503121561099257600080fd5b61099b83610941565b91506109a960208401610941565b90509250929050565b6000806000606084860312156109c757600080fd5b6109d084610941565b92506109de60208501610941565b9150604084013590509250925092565b60008060408385031215610a0157600080fd5b610a0a83610941565b946020939093013593505050565b600060208284031215610a2a57600080fd5b5035919050565b600060208083528351808285015260005b81811015610a5e57858101830151858201604001528201610a42565b81811115610a70576000604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610a9957610a99610af0565b500190565b600082821015610ab057610ab0610af0565b500390565b600181811c90821680610ac957607f821691505b60208210811415610aea57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220302a7528bcd8e6183dcd91121fde835101ff7cd25df164a195cfb36711d5a69864736f6c63430008050033";
+ public static final String BINARY = "60806040523480156200001157600080fd5b5060405162000f2238038062000f228339810160408190526200003491620002dd565b8351849084906200004d9060039060208501906200016a565b508051620000639060049060208401906200016a565b5050506200007881836200008260201b60201c565b50505050620003d6565b6001600160a01b038216620000dd5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620000f1919062000372565b90915550506001600160a01b038216600090815260208190526040812080548392906200012090849062000372565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b828054620001789062000399565b90600052602060002090601f0160209004810192826200019c5760008555620001e7565b82601f10620001b757805160ff1916838001178555620001e7565b82800160010185558215620001e7579182015b82811115620001e7578251825591602001919060010190620001ca565b50620001f5929150620001f9565b5090565b5b80821115620001f55760008155600101620001fa565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023857600080fd5b81516001600160401b038082111562000255576200025562000210565b604051601f8301601f19908116603f0116810190828211818310171562000280576200028062000210565b816040528381526020925086838588010111156200029d57600080fd5b600091505b83821015620002c15785820183015181830184015290820190620002a2565b83821115620002d35760008385830101525b9695505050505050565b60008060008060808587031215620002f457600080fd5b84516001600160401b03808211156200030c57600080fd5b6200031a8883890162000226565b955060208701519150808211156200033157600080fd5b50620003408782880162000226565b60408701516060880151919550935090506001600160a01b03811681146200036757600080fd5b939692955090935050565b600082198211156200039457634e487b7160e01b600052601160045260246000fd5b500190565b600181811c90821680620003ae57607f821691505b60208210811415620003d057634e487b7160e01b600052602260045260246000fd5b50919050565b610b3c80620003e66000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806342966c681161008c57806395d89b411161006657806395d89b41146101ad578063a457c2d7146101b5578063a9059cbb146101c8578063dd62ed3e146101db57600080fd5b806342966c681461015c57806370a082311461017157806379cc67901461019a57600080fd5b806306fdde03146100d4578063095ea7b3146100f257806318160ddd1461011557806323b872dd14610127578063313ce5671461013a5780633950935114610149575b600080fd5b6100dc610214565b6040516100e99190610941565b60405180910390f35b6101056101003660046109b2565b6102a6565b60405190151581526020016100e9565b6002545b6040519081526020016100e9565b6101056101353660046109dc565b6102bc565b604051601281526020016100e9565b6101056101573660046109b2565b610372565b61016f61016a366004610a18565b6103a9565b005b61011961017f366004610a31565b6001600160a01b031660009081526020819052604090205490565b61016f6101a83660046109b2565b6103b6565b6100dc61043e565b6101056101c33660046109b2565b61044d565b6101056101d63660046109b2565b6104e8565b6101196101e9366004610a53565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60606003805461022390610a86565b80601f016020809104026020016040519081016040528092919081815260200182805461024f90610a86565b801561029c5780601f106102715761010080835404028352916020019161029c565b820191906000526020600020905b81548152906001019060200180831161027f57829003601f168201915b5050505050905090565b60006102b33384846104f5565b50600192915050565b60006102c984848461061a565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103535760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61036785336103628685610ad7565b6104f5565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916102b3918590610362908690610aee565b6103b333826107f2565b50565b60006103c283336101e9565b9050818110156104205760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b606482015260840161034a565b61042f83336103628585610ad7565b61043983836107f2565b505050565b60606004805461022390610a86565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156104cf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161034a565b6104de33856103628685610ad7565b5060019392505050565b60006102b333848461061a565b6001600160a01b0383166105575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161034a565b6001600160a01b0382166105b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161034a565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661067e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161034a565b6001600160a01b0382166106e05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161034a565b6001600160a01b038316600090815260208190526040902054818110156107585760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161034a565b6107628282610ad7565b6001600160a01b038086166000908152602081905260408082209390935590851681529081208054849290610798908490610aee565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107e491815260200190565b60405180910390a350505050565b6001600160a01b0382166108525760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161034a565b6001600160a01b038216600090815260208190526040902054818110156108c65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161034a565b6108d08282610ad7565b6001600160a01b038416600090815260208190526040812091909155600280548492906108fe908490610ad7565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161060d565b600060208083528351808285015260005b8181101561096e57858101830151858201604001528201610952565b81811115610980576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146109ad57600080fd5b919050565b600080604083850312156109c557600080fd5b6109ce83610996565b946020939093013593505050565b6000806000606084860312156109f157600080fd5b6109fa84610996565b9250610a0860208501610996565b9150604084013590509250925092565b600060208284031215610a2a57600080fd5b5035919050565b600060208284031215610a4357600080fd5b610a4c82610996565b9392505050565b60008060408385031215610a6657600080fd5b610a6f83610996565b9150610a7d60208401610996565b90509250929050565b600181811c90821680610a9a57607f821691505b60208210811415610abb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610ae957610ae9610ac1565b500390565b60008219821115610b0157610b01610ac1565b50019056fea26469706673582212202e241dbb092171169068fcb551f0acb126fdaf9452653b7c960b8774a650b2ea64736f6c63430008090033";
public static final String FUNC_ALLOWANCE = "allowance";
diff --git a/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetMinterPauser.java b/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetMinterPauser.java
new file mode 100644
index 00000000..37bed4a9
--- /dev/null
+++ b/common/openzeppelin/src/main/java/net/consensys/gpact/openzeppelin/soliditywrappers/ERC20PresetMinterPauser.java
@@ -0,0 +1,700 @@
+package net.consensys.gpact.openzeppelin.soliditywrappers;
+
+import io.reactivex.Flowable;
+import io.reactivex.functions.Function;
+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.FunctionEncoder;
+import org.web3j.abi.TypeReference;
+import org.web3j.abi.datatypes.Address;
+import org.web3j.abi.datatypes.Bool;
+import org.web3j.abi.datatypes.Event;
+import org.web3j.abi.datatypes.Type;
+import org.web3j.abi.datatypes.Utf8String;
+import org.web3j.abi.datatypes.generated.Bytes32;
+import org.web3j.abi.datatypes.generated.Uint256;
+import org.web3j.abi.datatypes.generated.Uint8;
+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;
+
+/**
+ * Auto generated code.
+ *
Do not modify!
+ *
Please use the web3j command line tools,
+ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
+ * codegen module to update.
+ *
+ *
Generated with web3j version 4.8.5-SNAPSHOT.
+ */
+@SuppressWarnings("rawtypes")
+public class ERC20PresetMinterPauser extends Contract {
+ public static final String BINARY = "60806040523480156200001157600080fd5b5060405162001c5c38038062001c5c8339810160408190526200003491620003b5565b8151829082906200004d90600590602085019062000242565b5080516200006390600690602084019062000242565b50506007805460ff19169055506200007d600033620000dd565b620000a97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000dd565b620000d57f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620000dd565b50506200045c565b620000f482826200012060201b620009ef1760201c565b60008281526001602090815260409091206200011b918390620009f962000130821b17901c565b505050565b6200012c828262000150565b5050565b600062000147836001600160a01b038416620001f0565b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200012c576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001ac3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600081815260018301602052604081205462000239575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200014a565b5060006200014a565b82805462000250906200041f565b90600052602060002090601f016020900481019282620002745760008555620002bf565b82601f106200028f57805160ff1916838001178555620002bf565b82800160010185558215620002bf579182015b82811115620002bf578251825591602001919060010190620002a2565b50620002cd929150620002d1565b5090565b5b80821115620002cd5760008155600101620002d2565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200031057600080fd5b81516001600160401b03808211156200032d576200032d620002e8565b604051601f8301601f19908116603f01168101908282118183101715620003585762000358620002e8565b816040528381526020925086838588010111156200037557600080fd5b600091505b838210156200039957858201830151818301840152908201906200037a565b83821115620003ab5760008385830101525b9695505050505050565b60008060408385031215620003c957600080fd5b82516001600160401b0380821115620003e157600080fd5b620003ef86838701620002fe565b935060208501519150808211156200040657600080fd5b506200041585828601620002fe565b9150509250929050565b600181811c908216806200043457607f821691505b602082108114156200045657634e487b7160e01b600052602260045260246000fd5b50919050565b6117f0806200046c6000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063a457c2d711610097578063d539139311610071578063d5391393146103af578063d547741f146103d6578063dd62ed3e146103e9578063e63ab1e91461042257600080fd5b8063a457c2d714610376578063a9059cbb14610389578063ca15c8731461039c57600080fd5b80639010d07c116100d35780639010d07c1461032857806391d148541461035357806395d89b4114610366578063a217fddf1461036e57600080fd5b806370a08231146102e457806379cc67901461030d5780638456cb591461032057600080fd5b8063313ce567116101665780633f4ba83a116101405780633f4ba83a146102ab57806340c10f19146102b357806342966c68146102c65780635c975abb146102d957600080fd5b8063313ce5671461027657806336568abe14610285578063395093511461029857600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022b578063248a9ca31461023e5780632f2ff15d1461026157600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d7366004611561565b610449565b60405190151581526020015b60405180910390f35b6101f9610474565b6040516101e8919061158b565b6101dc6102143660046115fc565b610506565b6004545b6040519081526020016101e8565b6101dc610239366004611626565b61051c565b61021d61024c366004611662565b60009081526020819052604090206001015490565b61027461026f36600461167b565b6105d2565b005b604051601281526020016101e8565b61027461029336600461167b565b6105f9565b6101dc6102a63660046115fc565b61061b565b610274610652565b6102746102c13660046115fc565b6106f8565b6102746102d4366004611662565b61079b565b60075460ff166101dc565b61021d6102f23660046116a7565b6001600160a01b031660009081526002602052604090205490565b61027461031b3660046115fc565b6107a8565b61027461082b565b61033b6103363660046116c2565b6108cf565b6040516001600160a01b0390911681526020016101e8565b6101dc61036136600461167b565b6108ee565b6101f9610917565b61021d600081565b6101dc6103843660046115fc565b610926565b6101dc6103973660046115fc565b6109c1565b61021d6103aa366004611662565b6109ce565b61021d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102746103e436600461167b565b6109e5565b61021d6103f73660046116e4565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b61021d7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006001600160e01b03198216635a05180f60e01b148061046e575061046e82610a0e565b92915050565b6060600580546104839061170e565b80601f01602080910402602001604051908101604052809291908181526020018280546104af9061170e565b80156104fc5780601f106104d1576101008083540402835291602001916104fc565b820191906000526020600020905b8154815290600101906020018083116104df57829003601f168201915b5050505050905090565b6000610513338484610a43565b50600192915050565b6000610529848484610b68565b6001600160a01b0384166000908152600360209081526040808320338452909152902054828110156105b35760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6105c785336105c2868561175f565b610a43565b506001949350505050565b6105dc8282610d4b565b60008281526001602052604090206105f490826109f9565b505050565b6106038282610dcc565b60008281526001602052604090206105f49082610e46565b3360008181526003602090815260408083206001600160a01b038716845290915281205490916105139185906105c2908690611776565b61067c7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a336108ee565b6106ee5760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105aa565b6106f6610e5b565b565b6107227f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6336108ee565b61078d5760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105aa565b6107978282610eee565b5050565b6107a53382610fd9565b50565b60006107b483336103f7565b9050818110156108125760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016105aa565b61082183336105c2858561175f565b6105f48383610fd9565b6108557f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a336108ee565b6108c75760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105aa565b6106f6611134565b60008281526001602052604081206108e790836111af565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600680546104839061170e565b3360009081526003602090815260408083206001600160a01b0386168452909152812054828110156109a85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105aa565b6109b733856105c2868561175f565b5060019392505050565b6000610513338484610b68565b600081815260016020526040812061046e906111bb565b61060382826111c5565b6107978282611245565b60006108e7836001600160a01b0384166112c9565b60006001600160e01b03198216637965db0b60e01b148061046e57506301ffc9a760e01b6001600160e01b031983161461046e565b6001600160a01b038316610aa55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105aa565b6001600160a01b038216610b065760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105aa565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610bcc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105aa565b6001600160a01b038216610c2e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105aa565b610c39838383611318565b6001600160a01b03831660009081526002602052604090205481811015610cb15760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105aa565b610cbb828261175f565b6001600160a01b038086166000908152600260205260408082209390935590851681529081208054849290610cf1908490611776565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610d3d91815260200190565b60405180910390a350505050565b600082815260208190526040902060010154610d68905b336108ee565b6109ef5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b60648201526084016105aa565b6001600160a01b0381163314610e3c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105aa565b6107978282611323565b60006108e7836001600160a01b038416611388565b60075460ff16610ea45760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105aa565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610f445760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105aa565b610f5060008383611318565b8060046000828254610f629190611776565b90915550506001600160a01b03821660009081526002602052604081208054839290610f8f908490611776565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0382166110395760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105aa565b61104582600083611318565b6001600160a01b038216600090815260026020526040902054818110156110b95760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105aa565b6110c3828261175f565b6001600160a01b038416600090815260026020526040812091909155600480548492906110f190849061175f565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610b5b565b60075460ff161561117a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105aa565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610ed13390565b60006108e78383611475565b600061046e825490565b6000828152602081905260409020600101546111e090610d62565b610e3c5760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b60648201526084016105aa565b61124f82826108ee565b610797576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556112853390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008181526001830160205260408120546113105750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561046e565b50600061046e565b6105f48383836114fb565b61132d82826108ee565b15610797576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000818152600183016020526040812054801561146b5760006113ac60018361175f565b85549091506000906113c09060019061175f565b905060008660000182815481106113d9576113d961178e565b90600052602060002001549050808760000184815481106113fc576113fc61178e565b60009182526020808320909101929092558281526001890190915260409020849055865487908061142f5761142f6117a4565b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061046e565b600091505061046e565b815460009082106114d35760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016105aa565b8260000182815481106114e8576114e861178e565b9060005260206000200154905092915050565b60075460ff16156105f45760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105aa565b60006020828403121561157357600080fd5b81356001600160e01b0319811681146108e757600080fd5b600060208083528351808285015260005b818110156115b85785810183015185820160400152820161159c565b818111156115ca576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146115f757600080fd5b919050565b6000806040838503121561160f57600080fd5b611618836115e0565b946020939093013593505050565b60008060006060848603121561163b57600080fd5b611644846115e0565b9250611652602085016115e0565b9150604084013590509250925092565b60006020828403121561167457600080fd5b5035919050565b6000806040838503121561168e57600080fd5b8235915061169e602084016115e0565b90509250929050565b6000602082840312156116b957600080fd5b6108e7826115e0565b600080604083850312156116d557600080fd5b50508035926020909101359150565b600080604083850312156116f757600080fd5b611700836115e0565b915061169e602084016115e0565b600181811c9082168061172257607f821691505b6020821081141561174357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561177157611771611749565b500390565b6000821982111561178957611789611749565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fdfea26469706673582212209d9442eaa5836b28c3447bc5808b064d427aa35fe6605aae6d07b276262529f364736f6c63430008090033";
+
+ public static final String FUNC_DEFAULT_ADMIN_ROLE = "DEFAULT_ADMIN_ROLE";
+
+ public static final String FUNC_MINTER_ROLE = "MINTER_ROLE";
+
+ public static final String FUNC_PAUSER_ROLE = "PAUSER_ROLE";
+
+ public static final String FUNC_ALLOWANCE = "allowance";
+
+ public static final String FUNC_APPROVE = "approve";
+
+ public static final String FUNC_BALANCEOF = "balanceOf";
+
+ public static final String FUNC_BURN = "burn";
+
+ public static final String FUNC_BURNFROM = "burnFrom";
+
+ public static final String FUNC_DECIMALS = "decimals";
+
+ public static final String FUNC_DECREASEALLOWANCE = "decreaseAllowance";
+
+ public static final String FUNC_GETROLEADMIN = "getRoleAdmin";
+
+ public static final String FUNC_GETROLEMEMBER = "getRoleMember";
+
+ public static final String FUNC_GETROLEMEMBERCOUNT = "getRoleMemberCount";
+
+ public static final String FUNC_GRANTROLE = "grantRole";
+
+ public static final String FUNC_HASROLE = "hasRole";
+
+ public static final String FUNC_INCREASEALLOWANCE = "increaseAllowance";
+
+ public static final String FUNC_MINT = "mint";
+
+ public static final String FUNC_NAME = "name";
+
+ public static final String FUNC_PAUSE = "pause";
+
+ public static final String FUNC_PAUSED = "paused";
+
+ public static final String FUNC_RENOUNCEROLE = "renounceRole";
+
+ public static final String FUNC_REVOKEROLE = "revokeRole";
+
+ public static final String FUNC_SUPPORTSINTERFACE = "supportsInterface";
+
+ public static final String FUNC_SYMBOL = "symbol";
+
+ public static final String FUNC_TOTALSUPPLY = "totalSupply";
+
+ public static final String FUNC_TRANSFER = "transfer";
+
+ public static final String FUNC_TRANSFERFROM = "transferFrom";
+
+ public static final String FUNC_UNPAUSE = "unpause";
+
+ public static final Event APPROVAL_EVENT = new Event("Approval",
+ Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference() {}));
+ ;
+
+ public static final Event PAUSED_EVENT = new Event("Paused",
+ Arrays.>asList(new TypeReference() {}));
+ ;
+
+ public static final Event ROLEADMINCHANGED_EVENT = new Event("RoleAdminChanged",
+ Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference(true) {}));
+ ;
+
+ public static final Event ROLEGRANTED_EVENT = new Event("RoleGranted",
+ Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference(true) {}));
+ ;
+
+ public static final Event ROLEREVOKED_EVENT = new Event("RoleRevoked",
+ Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference(true) {}));
+ ;
+
+ public static final Event TRANSFER_EVENT = new Event("Transfer",
+ Arrays.>asList(new TypeReference(true) {}, new TypeReference(true) {}, new TypeReference() {}));
+ ;
+
+ public static final Event UNPAUSED_EVENT = new Event("Unpaused",
+ Arrays.>asList(new TypeReference() {}));
+ ;
+
+ @Deprecated
+ protected ERC20PresetMinterPauser(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
+ }
+
+ protected ERC20PresetMinterPauser(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
+ }
+
+ @Deprecated
+ protected ERC20PresetMinterPauser(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
+ super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
+ }
+
+ protected ERC20PresetMinterPauser(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
+ super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
+ }
+
+ public List getApprovalEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ ApprovalEventResponse typedResponse = new ApprovalEventResponse();
+ 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;
+ }
+
+ public Flowable approvalEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public ApprovalEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(APPROVAL_EVENT, log);
+ ApprovalEventResponse typedResponse = new ApprovalEventResponse();
+ 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 Flowable approvalEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(APPROVAL_EVENT));
+ return approvalEventFlowable(filter);
+ }
+
+ public List getPausedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(PAUSED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ PausedEventResponse typedResponse = new PausedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable pausedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public PausedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(PAUSED_EVENT, log);
+ PausedEventResponse typedResponse = new PausedEventResponse();
+ typedResponse.log = log;
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable pausedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(PAUSED_EVENT));
+ return pausedEventFlowable(filter);
+ }
+
+ public List getRoleAdminChangedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(ROLEADMINCHANGED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ RoleAdminChangedEventResponse typedResponse = new RoleAdminChangedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.role = (byte[]) eventValues.getIndexedValues().get(0).getValue();
+ typedResponse.previousAdminRole = (byte[]) eventValues.getIndexedValues().get(1).getValue();
+ typedResponse.newAdminRole = (byte[]) eventValues.getIndexedValues().get(2).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable roleAdminChangedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public RoleAdminChangedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(ROLEADMINCHANGED_EVENT, log);
+ RoleAdminChangedEventResponse typedResponse = new RoleAdminChangedEventResponse();
+ typedResponse.log = log;
+ typedResponse.role = (byte[]) eventValues.getIndexedValues().get(0).getValue();
+ typedResponse.previousAdminRole = (byte[]) eventValues.getIndexedValues().get(1).getValue();
+ typedResponse.newAdminRole = (byte[]) eventValues.getIndexedValues().get(2).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable roleAdminChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(ROLEADMINCHANGED_EVENT));
+ return roleAdminChangedEventFlowable(filter);
+ }
+
+ public List getRoleGrantedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(ROLEGRANTED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ RoleGrantedEventResponse typedResponse = new RoleGrantedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.role = (byte[]) eventValues.getIndexedValues().get(0).getValue();
+ typedResponse.account = (String) eventValues.getIndexedValues().get(1).getValue();
+ typedResponse.sender = (String) eventValues.getIndexedValues().get(2).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable roleGrantedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public RoleGrantedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(ROLEGRANTED_EVENT, log);
+ RoleGrantedEventResponse typedResponse = new RoleGrantedEventResponse();
+ typedResponse.log = log;
+ typedResponse.role = (byte[]) eventValues.getIndexedValues().get(0).getValue();
+ typedResponse.account = (String) eventValues.getIndexedValues().get(1).getValue();
+ typedResponse.sender = (String) eventValues.getIndexedValues().get(2).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable roleGrantedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(ROLEGRANTED_EVENT));
+ return roleGrantedEventFlowable(filter);
+ }
+
+ public List getRoleRevokedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(ROLEREVOKED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ RoleRevokedEventResponse typedResponse = new RoleRevokedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.role = (byte[]) eventValues.getIndexedValues().get(0).getValue();
+ typedResponse.account = (String) eventValues.getIndexedValues().get(1).getValue();
+ typedResponse.sender = (String) eventValues.getIndexedValues().get(2).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable roleRevokedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public RoleRevokedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(ROLEREVOKED_EVENT, log);
+ RoleRevokedEventResponse typedResponse = new RoleRevokedEventResponse();
+ typedResponse.log = log;
+ typedResponse.role = (byte[]) eventValues.getIndexedValues().get(0).getValue();
+ typedResponse.account = (String) eventValues.getIndexedValues().get(1).getValue();
+ typedResponse.sender = (String) eventValues.getIndexedValues().get(2).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable roleRevokedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(ROLEREVOKED_EVENT));
+ return roleRevokedEventFlowable(filter);
+ }
+
+ public List getTransferEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ TransferEventResponse typedResponse = new TransferEventResponse();
+ 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;
+ }
+
+ public Flowable transferEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public TransferEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(TRANSFER_EVENT, log);
+ TransferEventResponse typedResponse = new TransferEventResponse();
+ 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;
+ }
+ });
+ }
+
+ public Flowable transferEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(TRANSFER_EVENT));
+ return transferEventFlowable(filter);
+ }
+
+ public List getUnpausedEvents(TransactionReceipt transactionReceipt) {
+ List valueList = extractEventParametersWithLog(UNPAUSED_EVENT, transactionReceipt);
+ ArrayList responses = new ArrayList(valueList.size());
+ for (Contract.EventValuesWithLog eventValues : valueList) {
+ UnpausedEventResponse typedResponse = new UnpausedEventResponse();
+ typedResponse.log = eventValues.getLog();
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ responses.add(typedResponse);
+ }
+ return responses;
+ }
+
+ public Flowable unpausedEventFlowable(EthFilter filter) {
+ return web3j.ethLogFlowable(filter).map(new Function() {
+ @Override
+ public UnpausedEventResponse apply(Log log) {
+ Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(UNPAUSED_EVENT, log);
+ UnpausedEventResponse typedResponse = new UnpausedEventResponse();
+ typedResponse.log = log;
+ typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue();
+ return typedResponse;
+ }
+ });
+ }
+
+ public Flowable unpausedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
+ EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
+ filter.addSingleTopic(EventEncoder.encode(UNPAUSED_EVENT));
+ return unpausedEventFlowable(filter);
+ }
+
+ public RemoteFunctionCall DEFAULT_ADMIN_ROLE() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_DEFAULT_ADMIN_ROLE,
+ Arrays.asList(),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, byte[].class);
+ }
+
+ public RemoteFunctionCall MINTER_ROLE() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_MINTER_ROLE,
+ Arrays.asList(),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, byte[].class);
+ }
+
+ public RemoteFunctionCall PAUSER_ROLE() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_PAUSER_ROLE,
+ Arrays.asList(),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, byte[].class);
+ }
+
+ public RemoteFunctionCall allowance(String owner, String spender) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ALLOWANCE,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, owner),
+ new org.web3j.abi.datatypes.Address(160, spender)),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, BigInteger.class);
+ }
+
+ public RemoteFunctionCall approve(String spender, BigInteger amount) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_APPROVE,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, spender),
+ new org.web3j.abi.datatypes.generated.Uint256(amount)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall balanceOf(String account) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_BALANCEOF,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, account)),
+ Arrays.>asList(new TypeReference() {}));
+ return executeRemoteCallSingleValueReturn(function, BigInteger.class);
+ }
+
+ public RemoteFunctionCall burn(BigInteger amount) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_BURN,
+ Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(amount)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall burnFrom(String account, BigInteger amount) {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
+ FUNC_BURNFROM,
+ Arrays.asList(new org.web3j.abi.datatypes.Address(160, account),
+ new org.web3j.abi.datatypes.generated.Uint256(amount)),
+ Collections.>emptyList());
+ return executeRemoteCallTransaction(function);
+ }
+
+ public RemoteFunctionCall decimals() {
+ final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_DECIMALS,
+ Arrays.asList(),
+ Arrays.>asList(new TypeReference