From 6d7042f24c1ea0205d10038de77d79040d0f57b2 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 7 Feb 2024 16:37:03 +0400 Subject: [PATCH] Updated on 2026-08-14 --- app/build.gradle.kts | 3 + gradle/dependencies.toml | 3 +- libs/visa/.gitignore | 1 + libs/visa/build.gradle.kts | 17 + .../main/java/com/tangem/lib/visa/ERC20.java | 270 +++ .../lib/visa/TangemBridgeProcessor.java | 1371 +++++++++++++ .../tangem/lib/visa/TangemPaymentAccount.java | 1781 +++++++++++++++++ .../visa/DefaultVisaContractInfoProvider.kt | 139 ++ .../lib/visa/VisaContractInfoProvider.kt | 90 + .../lib/visa/model/BalancesAndLimits.kt | 43 + .../tangem/lib/visa/utils/BigIntegerExt.kt | 13 + .../com/tangem/lib/visa/utils/ByteArrayExt.kt | 3 + .../com/tangem/lib/visa/utils/VisaConfig.kt | 14 + settings.gradle.kts | 1 + 14 files changed, 3748 insertions(+), 1 deletion(-) create mode 100644 libs/visa/.gitignore create mode 100644 libs/visa/build.gradle.kts create mode 100644 libs/visa/src/main/java/com/tangem/lib/visa/ERC20.java create mode 100644 libs/visa/src/main/java/com/tangem/lib/visa/TangemBridgeProcessor.java create mode 100644 libs/visa/src/main/java/com/tangem/lib/visa/TangemPaymentAccount.java create mode 100644 libs/visa/src/main/kotlin/com/tangem/lib/visa/DefaultVisaContractInfoProvider.kt create mode 100644 libs/visa/src/main/kotlin/com/tangem/lib/visa/VisaContractInfoProvider.kt create mode 100644 libs/visa/src/main/kotlin/com/tangem/lib/visa/model/BalancesAndLimits.kt create mode 100644 libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/BigIntegerExt.kt create mode 100644 libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/ByteArrayExt.kt create mode 100644 libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/VisaConfig.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8c5969e599..4ff3173b40 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,6 +20,9 @@ configurations.all { substitute(module("com.facebook.react:hermes-engine")) .using(module("com.facebook.react:hermes-android:0.72.4")) + + substitute(module("org.bouncycastle:bcprov-jdk15on")) + .using(module("org.bouncycastle:bcprov-jdk18on:1.73")) } force( diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 70d41d892b..bdb562b050 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -81,6 +81,7 @@ androidXCamera = "1.3.0" listenableFuture = "1.0" swipeRefreshLayout = "1.1.0" spr-client = "3.6.2" +web3j = "4.10.1" # endregion Other libraries # region Tangem @@ -237,5 +238,5 @@ listenableFuture = { module = "com.google.guava:listenablefuture", version.ref = camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "androidXCamera" } camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "androidXCamera" } camera-view = { module = "androidx.camera:camera-view", version.ref = "androidXCamera" } - +web3j-core = { module = "org.web3j:core", version.ref = "web3j" } # endregion Other diff --git a/libs/visa/.gitignore b/libs/visa/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/libs/visa/.gitignore @@ -0,0 +1 @@ +/build diff --git a/libs/visa/build.gradle.kts b/libs/visa/build.gradle.kts new file mode 100644 index 0000000000..bc0aa12ec9 --- /dev/null +++ b/libs/visa/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + alias(deps.plugins.kotlin.jvm) + id("configuration") +} + +dependencies { + + /** Project */ + implementation(projects.core.utils) + + /** Libs - Other */ + implementation(deps.web3j.core) + implementation(deps.kotlin.coroutines) + implementation(deps.arrow.fx) + implementation(deps.jodatime) + implementation(deps.okHttp.prettyLogging) +} \ No newline at end of file diff --git a/libs/visa/src/main/java/com/tangem/lib/visa/ERC20.java b/libs/visa/src/main/java/com/tangem/lib/visa/ERC20.java new file mode 100644 index 0000000000..7b92736361 --- /dev/null +++ b/libs/visa/src/main/java/com/tangem/lib/visa/ERC20.java @@ -0,0 +1,270 @@ +package com.tangem.lib.visa; + +import org.web3j.abi.EventEncoder; +import org.web3j.abi.TypeReference; +import org.web3j.abi.datatypes.Address; +import org.web3j.abi.datatypes.Event; +import org.web3j.abi.datatypes.Function; +import org.web3j.abi.datatypes.Utf8String; +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.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; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import io.reactivex.Flowable; + +/** + *

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 1.5.0. + */ +@SuppressWarnings("rawtypes") +class ERC20 extends Contract { + public static final String BINARY = "Bin file was not provided"; + + 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_DECIMALS = "decimals"; + + public static final String FUNC_NAME = "name"; + + 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 Event APPROVAL_EVENT = new Event("Approval", + Arrays.asList(new TypeReference

(true) { + }, new TypeReference
(true) { + }, new TypeReference() { + })); + + public static final Event TRANSFER_EVENT = new Event("Transfer", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference
(true) { + }, new TypeReference() { + })); + + @Deprecated + protected ERC20(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected ERC20(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static List getApprovalEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (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 static ApprovalEventResponse getApprovalEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(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 static List getTransferEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (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; + } + + @Deprecated + public static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new ERC20(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static ERC20 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new ERC20(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static TransferEventResponse getTransferEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(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 static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new ERC20(contractAddress, web3j, credentials, contractGasProvider); + } + + public static ERC20 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new ERC20(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public Flowable transferEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getTransferEventFromLog(log)); + } + + public Flowable transferEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(TRANSFER_EVENT)); + return transferEventFlowable(filter); + } + + public Flowable approvalEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getApprovalEventFromLog(log)); + } + + public Flowable approvalEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(APPROVAL_EVENT)); + return approvalEventFlowable(filter); + } + + public RemoteFunctionCall allowance(String owner, String spender) { + final Function function = new Function(FUNC_ALLOWANCE, + Arrays.asList(new Address(160, owner), + new Address(160, spender)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall approve(String spender, BigInteger value) { + final Function function = new Function( + FUNC_APPROVE, + Arrays.asList(new Address(160, spender), + new Uint256(value)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall balanceOf(String account) { + final Function function = new Function(FUNC_BALANCEOF, + List.of(new Address(160, account)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall decimals() { + final Function function = new Function(FUNC_DECIMALS, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall name() { + final Function function = new Function(FUNC_NAME, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall symbol() { + final Function function = new Function(FUNC_SYMBOL, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall totalSupply() { + final Function function = new Function(FUNC_TOTALSUPPLY, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall transfer(String to, BigInteger value) { + final Function function = new Function( + FUNC_TRANSFER, + Arrays.asList(new Address(160, to), + new Uint256(value)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall transferFrom(String from, String to, BigInteger value) { + final Function function = new Function( + FUNC_TRANSFERFROM, + Arrays.asList(new Address(160, from), + new Address(160, to), + new Uint256(value)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public static class ApprovalEventResponse extends BaseEventResponse { + public String owner; + + public String spender; + + public BigInteger value; + } + + public static class TransferEventResponse extends BaseEventResponse { + public String from; + + public String to; + + public BigInteger value; + } +} diff --git a/libs/visa/src/main/java/com/tangem/lib/visa/TangemBridgeProcessor.java b/libs/visa/src/main/java/com/tangem/lib/visa/TangemBridgeProcessor.java new file mode 100644 index 0000000000..f712f5cb24 --- /dev/null +++ b/libs/visa/src/main/java/com/tangem/lib/visa/TangemBridgeProcessor.java @@ -0,0 +1,1371 @@ +package com.tangem.lib.visa; + +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.Function; +import org.web3j.abi.datatypes.generated.Bytes32; +import org.web3j.abi.datatypes.generated.Bytes4; +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; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import io.reactivex.Flowable; + +/** + *

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 1.5.0. + */ +@SuppressWarnings("rawtypes") +class TangemBridgeProcessor extends Contract { + public static final String BINARY = "608060405262278d0060085534801562000017575f80fd5b5060405162002457380380620024578339810160408190526200003a91620001fa565b600580546001600160a01b038088166001600160a01b031992831617909255600680548784169083161790556002805486841690831617905560038054928516929091169190911790556009819055620000955f33620000a1565b5050505050506200025d565b5f80620000af8484620000dc565b90508015620000d3575f848152600160205260409020620000d1908462000187565b505b90505b92915050565b5f828152602081815260408083206001600160a01b038516845290915281205460ff166200017f575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620001363390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001620000d6565b505f620000d6565b5f620000d3836001600160a01b0384165f8181526001830160205260408120546200017f57508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155620000d6565b80516001600160a01b0381168114620001f5575f80fd5b919050565b5f805f805f60a086880312156200020f575f80fd5b6200021a86620001de565b94506200022a60208701620001de565b93506200023a60408701620001de565b92506200024a60608701620001de565b9150608086015190509295509295909350565b6121ec806200026b5f395ff3fe608060405234801561000f575f80fd5b506004361061024a575f3560e01c806391792d5b11610140578063c904ea39116100bf578063d6d32b2a11610084578063d6d32b2a14610551578063da90f3a014610564578063e24fd1f114610577578063e452f20d1461058a578063e96ede8e1461059d578063fe2208aa146105b0575f80fd5b8063c904ea39146104fc578063ca15c8731461050f578063cb37f3b214610522578063d47ae89c14610535578063d547741f1461053e575f80fd5b8063a217fddf11610105578063a217fddf14610495578063b6878ac91461049c578063b77c6d35146104af578063be4d1851146104c2578063c6b273e4146104d5575f80fd5b806391792d5b1461041757806391d14854146104205780639353ce4c1461043357806396bc563d1461045a578063978975591461046e575f80fd5b80634413e098116101cc57806373d3467c1161019157806373d3467c146103b85780637f2fadb0146103cb5780638072a022146103de57806383af133d146103f15780639010d07c14610404575f80fd5b80634413e098146103445780635673795114610357578063601c60651461036b57806365ebf99a1461037e57806370e4306e14610391575f80fd5b80632f2ff15d116102125780632f2ff15d146102cc5780633013ce29146102df57806336568abe1461030a57806337de81061461031d5780633d409a8614610330575f80fd5b806301ffc9a71461024e5780630f1071be1461027657806311dce7711461028d578063248a9ca3146102a25780632cc32641146102c4575b5f80fd5b61026161025c366004611c84565b6105c3565b60405190151581526020015b60405180910390f35b61027f60085481565b60405190815260200161026d565b6102a061029b366004611cbf565b6105ed565b005b61027f6102b0366004611cda565b5f9081526020819052604090206001015490565b6102a061065a565b6102a06102da366004611cf1565b6106d2565b6003546102f2906001600160a01b031681565b6040516001600160a01b03909116815260200161026d565b6102a0610318366004611cf1565b6106fc565b6102a061032b366004611cda565b610734565b61027f5f8051602061216e83398151915281565b6102a0610352366004611d1f565b610780565b61027f5f805160206120f983398151915281565b6102a0610379366004611d49565b610847565b6102a061038c366004611cbf565b610a6a565b61027f7f6ac2c8b5322a929d300af17766189693ff6db6939ffe690430ad4720baf47d1c81565b6102a06103c6366004611d88565b610acf565b6102a06103d9366004611d1f565b610bdc565b6102a06103ec366004611cda565b610cb1565b6102a06103ff366004611d1f565b610d3b565b6102f2610412366004611e06565b610df5565b61027f60075481565b61026161042e366004611cf1565b610e13565b61027f7f79af5a85184b45263c1b3721b9c8eb1becd98e55ade5a61da0fed18b90b8325681565b61027f5f8051602061204983398151915281565b61027f7f581be84b4822abe392a3bcac0d4d656e4cd57faf2e321a32108215cdd4a8365681565b61027f5f81565b6102a06104aa366004611e26565b610e3b565b6002546102f2906001600160a01b031681565b6006546102f2906001600160a01b031681565b61027f7f56d36dba8e2d5c88fc1038bd95811d491e67c9a66c6848c9d4c9309b9587e06481565b6102a061050a366004611e5e565b610f3f565b61027f61051d366004611cda565b611030565b6005546102f2906001600160a01b031681565b61027f60095481565b6102a061054c366004611cf1565b611046565b6102a061055f366004611cda565b61106a565b6102a0610572366004611d1f565b6110f3565b6102a0610585366004611ea5565b611357565b6102f2610598366004611cbf565b611495565b6102a06105ab366004611d49565b6114f3565b6102a06105be366004611d49565b6115d6565b5f6001600160e01b03198216635a05180f60e01b14806105e757506105e7826116a1565b92915050565b5f80516020612049833981519152610604816116d5565b600680546001600160a01b0319166001600160a01b0384169081179091556040519081527f68c7b435e0ad7bfb2140fab0735300efbda206f62906049e0b35763cef67cc5e906020015b60405180910390a15050565b600a543390610668826116e2565b5f811160405180606001604052806029815260200161218e60299139906106ab5760405162461bcd60e51b81526004016106a29190611ef3565b60405180910390fd5b505f600a556006546003546106ce916001600160a01b0391821691168484611785565b5050565b5f828152602081905260409020600101546106ec816116d5565b6106f683836117df565b50505050565b6001600160a01b03811633146107255760405163334bd91960e11b815260040160405180910390fd5b61072f8282611812565b505050565b5f8051602061204983398151915261074b816116d5565b60078290556040518281527fb5aa183eb20407e22587bcd13d5c82a85835a4bd60e2a13d7c7efee3c2e9ed489060200161064e565b7f581be84b4822abe392a3bcac0d4d656e4cd57faf2e321a32108215cdd4a836566107aa816116d5565b60405163b9603bdf60e01b8152600481018390526001600160a01b0384169063b9603bdf906024015f604051808303815f87803b1580156107e9575f80fd5b505af11580156107fb573d5f803e3d5ffd5b50505050826001600160a01b03167fc8818db5b3e4e986e2f21e002090b1513e17c05a7a326c3737af624bf6ef78c48360405161083a91815260200190565b60405180910390a2505050565b5f805160206120f983398151915261085e816116d5565b60408051808201909152601b81527f353130307c436f6d6d6f6e3a20616d6f756e74206973207a65726f00000000006020820152826108b05760405162461bcd60e51b81526004016106a29190611ef3565b505f6108bb85611495565b6003546040516370a0823160e01b81526001600160a01b0380841660048301529293505f92909116906370a0823190602401602060405180830381865afa158015610908573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061092c9190611f25565b9050838110156040518060400160405280601f81526020017f353130317c436f6d6d6f6e3a20696e73756666696369656e742066756e647300815250906109865760405162461bcd60e51b81526004016106a29190611ef3565b50600a84905560405163f89db45760e01b8152600481018690526001600160a01b0383169063f89db457906024015f604051808303815f87803b1580156109cb575f80fd5b505af11580156109dd573d5f803e3d5ffd5b50505050600a545f146040518060600160405280602e8152602001612119602e913990610a1d5760405162461bcd60e51b81526004016106a29190611ef3565b5084866001600160a01b03167fa5411d116afcb8415f0019792cccf595f94852ba82886dacbf756d9c3ce85f3f86604051610a5a91815260200190565b60405180910390a3505050505050565b5f80516020612049833981519152610a81816116d5565b600580546001600160a01b0319166001600160a01b0384169081179091556040519081527fccbdeb71dc680b2f0fd85f93e7ef0f70eda32a12b918c9715be07bb646360e599060200161064e565b5f8051602061216e833981519152610ae6816116d5565b5f610af088611495565b90505f60075487610b019190611f50565b6040516334284dfb60e01b8152600481018a9052602481018290526001600160801b03198816604482015261ffff8716606482015285151560848201529091506001600160a01b038316906334284dfb9060a4015f604051808303815f87803b158015610b6c575f80fd5b505af1158015610b7e573d5f803e3d5ffd5b5050505087896001600160a01b03167f92c1dbadbb7b791052341ce7c185ca37861e432438355dc3e1642b7c1287609a89600754604051610bc9929190918252602082015260400190565b60405180910390a3505050505050505050565b7f79af5a85184b45263c1b3721b9c8eb1becd98e55ade5a61da0fed18b90b83256610c06816116d5565b5f610c1084611495565b604051636df6c7d560e11b8152600481018590529091506001600160a01b0382169063dbed8faa906024015f604051808303815f87803b158015610c52575f80fd5b505af1158015610c64573d5f803e3d5ffd5b50505050836001600160a01b03167f466723bb873015d5baf515fce6b0c8df2cb154adfd8badb6bc77a620a6ef676184604051610ca391815260200190565b60405180910390a250505050565b5f80516020612049833981519152610cc8816116d5565b6283d60082106040518060600160405280602a815260200161201f602a913990610d055760405162461bcd60e51b81526004016106a29190611ef3565b5060088290556040518281527fdc10143650bb79cd7a92cdf792545dcc2c3b0a719bebb3d83a8a21bb8fbfc3d69060200161064e565b7f581be84b4822abe392a3bcac0d4d656e4cd57faf2e321a32108215cdd4a83656610d65816116d5565b6040516306b2a38360e41b8152600481018390526001600160a01b03841690636b2a3830906024015f604051808303815f87803b158015610da4575f80fd5b505af1158015610db6573d5f803e3d5ffd5b50505050826001600160a01b03167fcc1685e553848099cad0e11271e780371c44b5ed92a54552fbedf9f1b6b9f2478360405161083a91815260200190565b5f828152600160205260408120610e0c908361183d565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7f6ac2c8b5322a929d300af17766189693ff6db6939ffe690430ad4720baf47d1c610e65816116d5565b5f610e6f86611495565b90505f60075484610e809190611f50565b6040516304e7595f60e21b81526004810188905260248101879052604481018290529091506001600160a01b0383169063139d657c906064015f604051808303815f87803b158015610ed0575f80fd5b505af1158015610ee2573d5f803e3d5ffd5b505050508486886001600160a01b03167fcb06dfb173e98cd60a8931644d288167e193c33d81c1019b9f9aab36b13fbc0387600754604051610f2e929190918252602082015260400190565b60405180910390a450505050505050565b5f8051602061216e833981519152610f56816116d5565b5f610f6086611495565b90505f60075485610f719190611f50565b6040516320199e7960e21b8152600481018890526024810182905285151560448201529091506001600160a01b0383169063806679e4906064015f604051808303815f87803b158015610fc2575f80fd5b505af1158015610fd4573d5f803e3d5ffd5b5050505085876001600160a01b03167f92c1dbadbb7b791052341ce7c185ca37861e432438355dc3e1642b7c1287609a8760075460405161101f929190918252602082015260400190565b60405180910390a350505050505050565b5f8181526001602052604081206105e790611848565b5f82815260208190526040902060010154611060816116d5565b6106f68383611812565b5f80516020612049833981519152611081816116d5565b610e10821060405180606001604052806027815260200161214760279139906110bd5760405162461bcd60e51b81526004016106a29190611ef3565b5060098290556040518281527f7f63f876249f25f7856e620802edd09af38a83c9c6040fcdb3717915403083119060200161064e565b5f805160206120f983398151915261110a816116d5565b5f61111484611495565b604051631902cad960e31b8152600481018590529091505f906001600160a01b0383169063c81656c890602401602060405180830381865afa15801561115c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111809190611f25565b6003546040516370a0823160e01b81526001600160a01b0385811660048301529293505f92909116906370a0823190602401602060405180830381865afa1580156111cd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111f19190611f25565b90505f82116040518060600160405280602781526020016120d2602791399061122d5760405162461bcd60e51b81526004016106a29190611ef3565b5060408051808201909152601f81527f353130317c436f6d6d6f6e3a20696e73756666696369656e742066756e6473006020820152828210156112835760405162461bcd60e51b81526004016106a29190611ef3565b50600a82905560405163e3dbffd560e01b8152600481018690526001600160a01b0384169063e3dbffd5906024015f604051808303815f87803b1580156112c8575f80fd5b505af11580156112da573d5f803e3d5ffd5b50505050600a545f146040518060600160405280602e8152602001612119602e91399061131a5760405162461bcd60e51b81526004016106a29190611ef3565b5084866001600160a01b03167fdfab01fc691e8b69fca482c65142d1bcfeafeb9eb6e9fd5220867d7196d9476e84604051610a5a91815260200190565b7f56d36dba8e2d5c88fc1038bd95811d491e67c9a66c6848c9d4c9309b9587e064611381816116d5565b61138a826116e2565b306001600160a01b0316826001600160a01b031663ce1b1d436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113f49190611f63565b6001600160a01b0316146040518060600160405280603281526020016120a060329139906114355760405162461bcd60e51b81526004016106a29190611ef3565b506001600160a01b038381165f8181526004602090815260409182902080546001600160a01b0319169487169485179055905192835290917f0c1464e8c817204497a2076f3b466fe64093e83033c83303b0cb44001cd9b6b5910161083a565b6001600160a01b038082165f90815260046020908152604080832054815160608101909252602f8083529394169283151592611ff090830139906114ec5760405162461bcd60e51b81526004016106a29190611ef3565b5092915050565b5f8051602061216e83398151915261150a816116d5565b5f61151485611495565b90505f831561152557600754611527565b5f5b90505f6115348286611f50565b60405163e4d7ddb960e01b815260048101889052602481018290529091506001600160a01b0384169063e4d7ddb9906044015f604051808303815f87803b15801561157d575f80fd5b505af115801561158f573d5f803e3d5ffd5b505060408051888152602081018690528993506001600160a01b038b1692507f8ba3ad1bd4ff5c3d75861d56df66b7942244d700f4d4cb67df693bac78e805a2910161101f565b5f805160206120f98339815191526115ed816116d5565b5f6115f785611495565b60405163456575e560e01b815260048101869052602481018590529091506001600160a01b0382169063456575e5906044015f604051808303815f87803b158015611640575f80fd5b505af1158015611652573d5f803e3d5ffd5b5050505083856001600160a01b03167f6f60b80b8dcecc3741c03485554a9a35ced96ebba66405fd324caf12a16261da8560405161169291815260200190565b60405180910390a35050505050565b5f6001600160e01b03198216637965db0b60e01b14806105e757506301ffc9a760e01b6001600160e01b03198316146105e7565b6116df8133611851565b50565b6002546040516385bb392360e01b81526001600160a01b038381166004830152909116906385bb392390602401602060405180830381865afa15801561172a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061174e9190611f7e565b60405180606001604052806037815260200161206960379139906106ce5760405162461bcd60e51b81526004016106a29190611ef3565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526106f690859061188a565b5f806117eb84846118eb565b90508015610e0c575f84815260016020526040902061180a908461197a565b509392505050565b5f8061181e848461198e565b90508015610e0c575f84815260016020526040902061180a90846119f7565b5f610e0c8383611a0b565b5f6105e7825490565b61185b8282610e13565b6106ce5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016106a2565b5f61189e6001600160a01b03841683611a31565b905080515f141580156118c25750808060200190518101906118c09190611f7e565b155b1561072f57604051635274afe760e01b81526001600160a01b03841660048201526024016106a2565b5f6118f68383610e13565b611973575f838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561192b3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016105e7565b505f6105e7565b5f610e0c836001600160a01b038416611a3e565b5f6119998383610e13565b15611973575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016105e7565b5f610e0c836001600160a01b038416611a83565b5f825f018281548110611a2057611a20611f99565b905f5260205f200154905092915050565b6060610e0c83835f611b66565b5f81815260018301602052604081205461197357508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556105e7565b5f8181526001830160205260408120548015611b5d575f611aa5600183611fad565b85549091505f90611ab890600190611fad565b9050808214611b17575f865f018281548110611ad657611ad6611f99565b905f5260205f200154905080875f018481548110611af657611af6611f99565b5f918252602080832090910192909255918252600188019052604090208390555b8554869080611b2857611b28611fc0565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506105e7565b5f9150506105e7565b606081471015611b8b5760405163cd78605960e01b81523060048201526024016106a2565b5f80856001600160a01b03168486604051611ba69190611fd4565b5f6040518083038185875af1925050503d805f8114611be0576040519150601f19603f3d011682016040523d82523d5f602084013e611be5565b606091505b5091509150611bf5868383611bff565b9695505050505050565b606082611c1457611c0f82611c5b565b610e0c565b8151158015611c2b57506001600160a01b0384163b155b15611c5457604051639996b31560e01b81526001600160a01b03851660048201526024016106a2565b5080610e0c565b805115611c6b5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f60208284031215611c94575f80fd5b81356001600160e01b031981168114610e0c575f80fd5b6001600160a01b03811681146116df575f80fd5b5f60208284031215611ccf575f80fd5b8135610e0c81611cab565b5f60208284031215611cea575f80fd5b5035919050565b5f8060408385031215611d02575f80fd5b823591506020830135611d1481611cab565b809150509250929050565b5f8060408385031215611d30575f80fd5b8235611d3b81611cab565b946020939093013593505050565b5f805f60608486031215611d5b575f80fd5b8335611d6681611cab565b95602085013595506040909401359392505050565b80151581146116df575f80fd5b5f805f805f8060c08789031215611d9d575f80fd5b8635611da881611cab565b9550602087013594506040870135935060608701356001600160801b031981168114611dd2575f80fd5b9250608087013561ffff81168114611de8575f80fd5b915060a0870135611df881611d7b565b809150509295509295509295565b5f8060408385031215611e17575f80fd5b50508035926020909101359150565b5f805f8060808587031215611e39575f80fd5b8435611e4481611cab565b966020860135965060408601359560600135945092505050565b5f805f8060808587031215611e71575f80fd5b8435611e7c81611cab565b935060208501359250604085013591506060850135611e9a81611d7b565b939692955090935050565b5f8060408385031215611eb6575f80fd5b8235611ec181611cab565b91506020830135611d1481611cab565b5f5b83811015611eeb578181015183820152602001611ed3565b50505f910152565b602081525f8251806020840152611f11816040850160208701611ed1565b601f01601f19169190910160400192915050565b5f60208284031215611f35575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156105e7576105e7611f3c565b5f60208284031215611f73575f80fd5b8151610e0c81611cab565b5f60208284031215611f8e575f80fd5b8151610e0c81611d7b565b634e487b7160e01b5f52603260045260245ffd5b818103818111156105e7576105e7611f3c565b634e487b7160e01b5f52603160045260245ffd5b5f8251611fe5818460208701611ed1565b919091019291505056fe353230327c50726f636573736f723a206e6f207061796d656e74206163636f756e7420666f72207468652063617264353231307c50726f636573736f723a20736574746c656d656e7420706572696f6420746f6f206c6f6e67fa658e47c75a6eb0e27156b2f72e1b295c98b53e8a1d238d7ca6ea6345b34880353230307c50726f636573736f723a207061796d656e74206163636f756e74206e6f74206465706c6f79656420627920666163746f7279353230317c50726f636573736f723a207061796d656e74206163636f756e742070726f636573736f72206d69736d61746368353235307c50726f636573736f723a20726566756e64207265636f7264206e6f7420666f756e64d77cc12a543481a2b3ef8fd055979569715a10db9879cd9e664395eca3a54dff353235327c50726f636573736f723a20726566756e6420746f2070726f63657373207761736e2774207265736574353231317c50726f636573736f723a2073656375726974792064656c617920746f6f206c6f6e67a567244cad934c87b7f7e15b15dd0e75f95a76afd1916f8eab4a391410d6f278353235317c50726f636573736f723a20726566756e6420746f2070726f63657373206973207a65726fa2646970667358221220abcbacdb9048a2744f99cdd5031db80dd0390bf503ccade142542ce178f0668364736f6c63430008160033"; + + public static final String FUNC_AUTHORIZATION_PROCESSOR_ROLE = "AUTHORIZATION_PROCESSOR_ROLE"; + + public static final String FUNC_BALANCE_VERIFIER_ROLE = "BALANCE_VERIFIER_ROLE"; + + public static final String FUNC_DEBT_PROCESSOR_ROLE = "DEBT_PROCESSOR_ROLE"; + + public static final String FUNC_DEFAULT_ADMIN_ROLE = "DEFAULT_ADMIN_ROLE"; + + public static final String FUNC_PAYMENT_ACCOUNT_SETTER = "PAYMENT_ACCOUNT_SETTER"; + + public static final String FUNC_PROPERTY_SETTER_ROLE = "PROPERTY_SETTER_ROLE"; + + public static final String FUNC_REFUND_PROCESSOR_ROLE = "REFUND_PROCESSOR_ROLE"; + + public static final String FUNC_SETTLEMENT_PROCESSOR_ROLE = "SETTLEMENT_PROCESSOR_ROLE"; + + public static final String FUNC_FIXEDFEE = "fixedFee"; + + public static final String FUNC_GETPAYMENTACCOUNT = "getPaymentAccount"; + + 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_INCREASEVERIFIEDBALANCEFOR = "increaseVerifiedBalanceFor"; + + public static final String FUNC_PAYMENTACCOUNTFACTORY = "paymentAccountFactory"; + + public static final String FUNC_PAYMENTRECEIVER = "paymentReceiver"; + + public static final String FUNC_PAYMENTTOKEN = "paymentToken"; + + public static final String FUNC_PROCESSAUTHORIZATION = "processAuthorization"; + + public static final String FUNC_PROCESSAUTHORIZATIONCHANGE = "processAuthorizationChange"; + + public static final String FUNC_PROCESSAUTHORIZATIONNOOTP = "processAuthorizationNoOtp"; + + public static final String FUNC_PROCESSPENDINGREFUND = "processPendingRefund"; + + public static final String FUNC_PROCESSREFUND = "processRefund"; + + public static final String FUNC_PROCESSREFUNDCALLBACK = "processRefundCallback"; + + public static final String FUNC_PROCESSSETTLEMENT = "processSettlement"; + + public static final String FUNC_REFUNDACCOUNT = "refundAccount"; + + public static final String FUNC_RENOUNCEROLE = "renounceRole"; + + public static final String FUNC_REVOKEROLE = "revokeRole"; + + public static final String FUNC_SAVEPENDINGREFUND = "savePendingRefund"; + + public static final String FUNC_SECURITYDELAY = "securityDelay"; + + public static final String FUNC_SETFIXEDFEE = "setFixedFee"; + + public static final String FUNC_SETPAYMENTACCOUNT = "setPaymentAccount"; + + public static final String FUNC_SETPAYMENTRECEIVER = "setPaymentReceiver"; + + public static final String FUNC_SETREFUNDACCOUNT = "setRefundAccount"; + + public static final String FUNC_SETSECURITYDELAY = "setSecurityDelay"; + + public static final String FUNC_SETSETTLEMENTPERIOD = "setSettlementPeriod"; + + public static final String FUNC_SETVERIFIEDBALANCEFOR = "setVerifiedBalanceFor"; + + public static final String FUNC_SETTLEMENTPERIOD = "settlementPeriod"; + + public static final String FUNC_SUPPORTSINTERFACE = "supportsInterface"; + + public static final String FUNC_WRITEOFFDEBT = "writeOffDebt"; + + public static final Event AUTHORIZATIONCHANGEPROCESSED_EVENT = new Event("AuthorizationChangeProcessed", + Arrays.asList(new TypeReference

(true) { + }, new TypeReference(true) { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event AUTHORIZATIONPROCESSED_EVENT = new Event("AuthorizationProcessed", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference(true) { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event DEBTWRITEOFFPROCESSED_EVENT = new Event("DebtWriteOffProcessed", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference() { + })); + + public static final Event FIXEDFEESET_EVENT = new Event("FixedFeeSet", + List.of(new TypeReference() { + })); + + public static final Event PAYMENTACCOUNTSET_EVENT = new Event("PaymentAccountSet", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference
() { + })); + + public static final Event PAYMENTRECEIVERSET_EVENT = new Event("PaymentReceiverSet", + List.of(new TypeReference
() { + })); + + public static final Event PENDINGREFUNDPROCESSED_EVENT = new Event("PendingRefundProcessed", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event REFUNDACCOUNTSET_EVENT = new Event("RefundAccountSet", + List.of(new TypeReference
() { + })); + + public static final Event REFUNDPROCESSED_EVENT = new Event("RefundProcessed", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference(true) { + }, 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 SAVEREFUNDPROCESSED_EVENT = new Event("SaveRefundProcessed", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event SECURITYDELAYSET_EVENT = new Event("SecurityDelaySet", + List.of(new TypeReference() { + })); + + public static final Event SETTLEMENTPERIODSET_EVENT = new Event("SettlementPeriodSet", + List.of(new TypeReference() { + })); + + public static final Event SETTLEMENTPROCESSED_EVENT = new Event("SettlementProcessed", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference(true) { + }, new TypeReference(true) { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event VERIFIEDBALANCEINCREASEDFOR_EVENT = new Event("VerifiedBalanceIncreasedFor", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference() { + })); + + public static final Event VERIFIEDBALANCESETFOR_EVENT = new Event("VerifiedBalanceSetFor", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference() { + })); + + @Deprecated + protected TangemBridgeProcessor(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected TangemBridgeProcessor(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected TangemBridgeProcessor(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected TangemBridgeProcessor(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static List getAuthorizationChangeProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(AUTHORIZATIONCHANGEPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + AuthorizationChangeProcessedEventResponse typedResponse = new AuthorizationChangeProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.fee = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static AuthorizationChangeProcessedEventResponse getAuthorizationChangeProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(AUTHORIZATIONCHANGEPROCESSED_EVENT, log); + AuthorizationChangeProcessedEventResponse typedResponse = new AuthorizationChangeProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.fee = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static List getAuthorizationProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(AUTHORIZATIONPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + AuthorizationProcessedEventResponse typedResponse = new AuthorizationProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.fee = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getDebtWriteOffProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(DEBTWRITEOFFPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + DebtWriteOffProcessedEventResponse typedResponse = new DebtWriteOffProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getFixedFeeSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(FIXEDFEESET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + FixedFeeSetEventResponse typedResponse = new FixedFeeSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.fixedFee = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static AuthorizationProcessedEventResponse getAuthorizationProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(AUTHORIZATIONPROCESSED_EVENT, log); + AuthorizationProcessedEventResponse typedResponse = new AuthorizationProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.fee = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static List getPaymentAccountSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(PAYMENTACCOUNTSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + PaymentAccountSetEventResponse typedResponse = new PaymentAccountSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.paymentAccount = (String) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getPaymentReceiverSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(PAYMENTRECEIVERSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + PaymentReceiverSetEventResponse typedResponse = new PaymentReceiverSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.paymentReceiver = (String) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getPendingRefundProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(PENDINGREFUNDPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + PendingRefundProcessedEventResponse typedResponse = new PendingRefundProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static DebtWriteOffProcessedEventResponse getDebtWriteOffProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(DEBTWRITEOFFPROCESSED_EVENT, log); + DebtWriteOffProcessedEventResponse typedResponse = new DebtWriteOffProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static PendingRefundProcessedEventResponse getPendingRefundProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(PENDINGREFUNDPROCESSED_EVENT, log); + PendingRefundProcessedEventResponse typedResponse = new PendingRefundProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static List getRefundAccountSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(REFUNDACCOUNTSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + RefundAccountSetEventResponse typedResponse = new RefundAccountSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.refundAccount = (String) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getRefundProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(REFUNDPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + RefundProcessedEventResponse typedResponse = new RefundProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static FixedFeeSetEventResponse getFixedFeeSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(FIXEDFEESET_EVENT, log); + FixedFeeSetEventResponse typedResponse = new FixedFeeSetEventResponse(); + typedResponse.log = log; + typedResponse.fixedFee = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static List getRoleAdminChangedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(ROLEADMINCHANGED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (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 static List getRoleGrantedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(ROLEGRANTED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (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 static List getRoleRevokedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(ROLEREVOKED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (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 static PaymentAccountSetEventResponse getPaymentAccountSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(PAYMENTACCOUNTSET_EVENT, log); + PaymentAccountSetEventResponse typedResponse = new PaymentAccountSetEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.paymentAccount = (String) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static List getSaveRefundProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SAVEREFUNDPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + SaveRefundProcessedEventResponse typedResponse = new SaveRefundProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getSecurityDelaySetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SECURITYDELAYSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + SecurityDelaySetEventResponse typedResponse = new SecurityDelaySetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.securityDelay = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getSettlementPeriodSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SETTLEMENTPERIODSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + SettlementPeriodSetEventResponse typedResponse = new SettlementPeriodSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.settlementPeriod = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static PaymentReceiverSetEventResponse getPaymentReceiverSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(PAYMENTRECEIVERSET_EVENT, log); + PaymentReceiverSetEventResponse typedResponse = new PaymentReceiverSetEventResponse(); + typedResponse.log = log; + typedResponse.paymentReceiver = (String) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static List getSettlementProcessedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SETTLEMENTPROCESSED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + SettlementProcessedEventResponse typedResponse = new SettlementProcessedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.settlementId = (BigInteger) eventValues.getIndexedValues().get(2).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.fee = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getVerifiedBalanceIncreasedForEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(VERIFIEDBALANCEINCREASEDFOR_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + VerifiedBalanceIncreasedForEventResponse typedResponse = new VerifiedBalanceIncreasedForEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.paymentAccount = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.increase = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getVerifiedBalanceSetForEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(VERIFIEDBALANCESETFOR_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + VerifiedBalanceSetForEventResponse typedResponse = new VerifiedBalanceSetForEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.paymentAccount = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.verifiedBalance = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + @Deprecated + public static TangemBridgeProcessor load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new TangemBridgeProcessor(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static TangemBridgeProcessor load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new TangemBridgeProcessor(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static TangemBridgeProcessor load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new TangemBridgeProcessor(contractAddress, web3j, credentials, contractGasProvider); + } + + public static TangemBridgeProcessor load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new TangemBridgeProcessor(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RefundAccountSetEventResponse getRefundAccountSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(REFUNDACCOUNTSET_EVENT, log); + RefundAccountSetEventResponse typedResponse = new RefundAccountSetEventResponse(); + typedResponse.log = log; + typedResponse.refundAccount = (String) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String paymentReceiver_, String refundAccount_, String paymentAccountFactory_, String paymentToken_, BigInteger securityDelay_) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new Address(160, paymentReceiver_), + new Address(160, refundAccount_), + new Address(160, paymentAccountFactory_), + new Address(160, paymentToken_), + new Uint256(securityDelay_))); + return deployRemoteCall(TangemBridgeProcessor.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String paymentReceiver_, String refundAccount_, String paymentAccountFactory_, String paymentToken_, BigInteger securityDelay_) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new Address(160, paymentReceiver_), + new Address(160, refundAccount_), + new Address(160, paymentAccountFactory_), + new Address(160, paymentToken_), + new Uint256(securityDelay_))); + return deployRemoteCall(TangemBridgeProcessor.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String paymentReceiver_, String refundAccount_, String paymentAccountFactory_, String paymentToken_, BigInteger securityDelay_) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new Address(160, paymentReceiver_), + new Address(160, refundAccount_), + new Address(160, paymentAccountFactory_), + new Address(160, paymentToken_), + new Uint256(securityDelay_))); + return deployRemoteCall(TangemBridgeProcessor.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + public static RefundProcessedEventResponse getRefundProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(REFUNDPROCESSED_EVENT, log); + RefundProcessedEventResponse typedResponse = new RefundProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String paymentReceiver_, String refundAccount_, String paymentAccountFactory_, String paymentToken_, BigInteger securityDelay_) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new Address(160, paymentReceiver_), + new Address(160, refundAccount_), + new Address(160, paymentAccountFactory_), + new Address(160, paymentToken_), + new Uint256(securityDelay_))); + return deployRemoteCall(TangemBridgeProcessor.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + public static RoleAdminChangedEventResponse getRoleAdminChangedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(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 static RoleGrantedEventResponse getRoleGrantedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(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 static RoleRevokedEventResponse getRoleRevokedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(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 static SaveRefundProcessedEventResponse getSaveRefundProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(SAVEREFUNDPROCESSED_EVENT, log); + SaveRefundProcessedEventResponse typedResponse = new SaveRefundProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static SecurityDelaySetEventResponse getSecurityDelaySetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(SECURITYDELAYSET_EVENT, log); + SecurityDelaySetEventResponse typedResponse = new SecurityDelaySetEventResponse(); + typedResponse.log = log; + typedResponse.securityDelay = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static SettlementPeriodSetEventResponse getSettlementPeriodSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(SETTLEMENTPERIODSET_EVENT, log); + SettlementPeriodSetEventResponse typedResponse = new SettlementPeriodSetEventResponse(); + typedResponse.log = log; + typedResponse.settlementPeriod = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static SettlementProcessedEventResponse getSettlementProcessedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(SETTLEMENTPROCESSED_EVENT, log); + SettlementProcessedEventResponse typedResponse = new SettlementProcessedEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.settlementId = (BigInteger) eventValues.getIndexedValues().get(2).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.fee = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static VerifiedBalanceIncreasedForEventResponse getVerifiedBalanceIncreasedForEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(VERIFIEDBALANCEINCREASEDFOR_EVENT, log); + VerifiedBalanceIncreasedForEventResponse typedResponse = new VerifiedBalanceIncreasedForEventResponse(); + typedResponse.log = log; + typedResponse.paymentAccount = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.increase = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static VerifiedBalanceSetForEventResponse getVerifiedBalanceSetForEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(VERIFIEDBALANCESETFOR_EVENT, log); + VerifiedBalanceSetForEventResponse typedResponse = new VerifiedBalanceSetForEventResponse(); + typedResponse.log = log; + typedResponse.paymentAccount = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.verifiedBalance = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public Flowable authorizationChangeProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getAuthorizationChangeProcessedEventFromLog(log)); + } + + public Flowable authorizationChangeProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(AUTHORIZATIONCHANGEPROCESSED_EVENT)); + return authorizationChangeProcessedEventFlowable(filter); + } + + public Flowable authorizationProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getAuthorizationProcessedEventFromLog(log)); + } + + public Flowable authorizationProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(AUTHORIZATIONPROCESSED_EVENT)); + return authorizationProcessedEventFlowable(filter); + } + + public Flowable debtWriteOffProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getDebtWriteOffProcessedEventFromLog(log)); + } + + public Flowable debtWriteOffProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(DEBTWRITEOFFPROCESSED_EVENT)); + return debtWriteOffProcessedEventFlowable(filter); + } + + public Flowable fixedFeeSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getFixedFeeSetEventFromLog(log)); + } + + public Flowable fixedFeeSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(FIXEDFEESET_EVENT)); + return fixedFeeSetEventFlowable(filter); + } + + public Flowable paymentAccountSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getPaymentAccountSetEventFromLog(log)); + } + + public Flowable paymentAccountSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(PAYMENTACCOUNTSET_EVENT)); + return paymentAccountSetEventFlowable(filter); + } + + public Flowable paymentReceiverSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getPaymentReceiverSetEventFromLog(log)); + } + + public Flowable paymentReceiverSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(PAYMENTRECEIVERSET_EVENT)); + return paymentReceiverSetEventFlowable(filter); + } + + public Flowable pendingRefundProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getPendingRefundProcessedEventFromLog(log)); + } + + public Flowable pendingRefundProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(PENDINGREFUNDPROCESSED_EVENT)); + return pendingRefundProcessedEventFlowable(filter); + } + + public Flowable refundAccountSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getRefundAccountSetEventFromLog(log)); + } + + public Flowable refundAccountSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(REFUNDACCOUNTSET_EVENT)); + return refundAccountSetEventFlowable(filter); + } + + public Flowable refundProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getRefundProcessedEventFromLog(log)); + } + + public Flowable refundProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(REFUNDPROCESSED_EVENT)); + return refundProcessedEventFlowable(filter); + } + + public Flowable roleAdminChangedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getRoleAdminChangedEventFromLog(log)); + } + + public Flowable roleAdminChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(ROLEADMINCHANGED_EVENT)); + return roleAdminChangedEventFlowable(filter); + } + + public Flowable roleGrantedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getRoleGrantedEventFromLog(log)); + } + + public Flowable roleGrantedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(ROLEGRANTED_EVENT)); + return roleGrantedEventFlowable(filter); + } + + public Flowable roleRevokedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getRoleRevokedEventFromLog(log)); + } + + public Flowable roleRevokedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(ROLEREVOKED_EVENT)); + return roleRevokedEventFlowable(filter); + } + + public Flowable saveRefundProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getSaveRefundProcessedEventFromLog(log)); + } + + public Flowable saveRefundProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(SAVEREFUNDPROCESSED_EVENT)); + return saveRefundProcessedEventFlowable(filter); + } + + public Flowable verifiedBalanceSetForEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getVerifiedBalanceSetForEventFromLog(log)); + } + + public Flowable verifiedBalanceSetForEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(VERIFIEDBALANCESETFOR_EVENT)); + return verifiedBalanceSetForEventFlowable(filter); + } + + public Flowable securityDelaySetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getSecurityDelaySetEventFromLog(log)); + } + + public Flowable securityDelaySetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(SECURITYDELAYSET_EVENT)); + return securityDelaySetEventFlowable(filter); + } + + public Flowable settlementPeriodSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getSettlementPeriodSetEventFromLog(log)); + } + + public Flowable settlementPeriodSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(SETTLEMENTPERIODSET_EVENT)); + return settlementPeriodSetEventFlowable(filter); + } + + public Flowable settlementProcessedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getSettlementProcessedEventFromLog(log)); + } + + public Flowable settlementProcessedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(SETTLEMENTPROCESSED_EVENT)); + return settlementProcessedEventFlowable(filter); + } + + public Flowable verifiedBalanceIncreasedForEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getVerifiedBalanceIncreasedForEventFromLog(log)); + } + + public Flowable verifiedBalanceIncreasedForEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(VERIFIEDBALANCEINCREASEDFOR_EVENT)); + return verifiedBalanceIncreasedForEventFlowable(filter); + } + + public RemoteFunctionCall AUTHORIZATION_PROCESSOR_ROLE() { + final Function function = new Function(FUNC_AUTHORIZATION_PROCESSOR_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall BALANCE_VERIFIER_ROLE() { + final Function function = new Function(FUNC_BALANCE_VERIFIER_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall DEBT_PROCESSOR_ROLE() { + final Function function = new Function(FUNC_DEBT_PROCESSOR_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall DEFAULT_ADMIN_ROLE() { + final Function function = new Function(FUNC_DEFAULT_ADMIN_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall PAYMENT_ACCOUNT_SETTER() { + final Function function = new Function(FUNC_PAYMENT_ACCOUNT_SETTER, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall PROPERTY_SETTER_ROLE() { + final Function function = new Function(FUNC_PROPERTY_SETTER_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall REFUND_PROCESSOR_ROLE() { + final Function function = new Function(FUNC_REFUND_PROCESSOR_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall SETTLEMENT_PROCESSOR_ROLE() { + final Function function = new Function(FUNC_SETTLEMENT_PROCESSOR_ROLE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall fixedFee() { + final Function function = new Function(FUNC_FIXEDFEE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall getPaymentAccount(String card) { + final Function function = new Function(FUNC_GETPAYMENTACCOUNT, + List.of(new Address(160, card)), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall getRoleAdmin(byte[] role) { + final Function function = new Function(FUNC_GETROLEADMIN, + List.of(new Bytes32(role)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall getRoleMember(byte[] role, BigInteger index) { + final Function function = new Function(FUNC_GETROLEMEMBER, + Arrays.asList(new Bytes32(role), + new Uint256(index)), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall getRoleMemberCount(byte[] role) { + final Function function = new Function(FUNC_GETROLEMEMBERCOUNT, + List.of(new Bytes32(role)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall grantRole(byte[] role, String account) { + final Function function = new Function( + FUNC_GRANTROLE, + Arrays.asList(new Bytes32(role), + new Address(160, account)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall hasRole(byte[] role, String account) { + final Function function = new Function(FUNC_HASROLE, + Arrays.asList(new Bytes32(role), + new Address(160, account)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteFunctionCall increaseVerifiedBalanceFor(String paymentAccount, BigInteger increase) { + final Function function = new Function( + FUNC_INCREASEVERIFIEDBALANCEFOR, + Arrays.asList(new Address(160, paymentAccount), + new Uint256(increase)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall paymentAccountFactory() { + final Function function = new Function(FUNC_PAYMENTACCOUNTFACTORY, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall paymentReceiver() { + final Function function = new Function(FUNC_PAYMENTRECEIVER, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall paymentToken() { + final Function function = new Function(FUNC_PAYMENTTOKEN, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall processAuthorization(String card, BigInteger transactionId, BigInteger amount, byte[] otp, BigInteger otpCounter, Boolean forced) { + final Function function = new Function( + FUNC_PROCESSAUTHORIZATION, + Arrays.asList(new Address(160, card), + new Uint256(transactionId), + new Uint256(amount), + new org.web3j.abi.datatypes.generated.Bytes16(otp), + new org.web3j.abi.datatypes.generated.Uint16(otpCounter), + new Bool(forced)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processAuthorizationChange(String card, BigInteger transactionId, BigInteger amount) { + final Function function = new Function( + FUNC_PROCESSAUTHORIZATIONCHANGE, + Arrays.asList(new Address(160, card), + new Uint256(transactionId), + new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processAuthorizationNoOtp(String card, BigInteger transactionId, BigInteger amount, Boolean forced) { + final Function function = new Function( + FUNC_PROCESSAUTHORIZATIONNOOTP, + Arrays.asList(new Address(160, card), + new Uint256(transactionId), + new Uint256(amount), + new Bool(forced)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processPendingRefund(String card, BigInteger transactionId) { + final Function function = new Function( + FUNC_PROCESSPENDINGREFUND, + Arrays.asList(new Address(160, card), + new Uint256(transactionId)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processRefund(String card, BigInteger transactionId, BigInteger refundAmount) { + final Function function = new Function( + FUNC_PROCESSREFUND, + Arrays.asList(new Address(160, card), + new Uint256(transactionId), + new Uint256(refundAmount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processRefundCallback() { + final Function function = new Function( + FUNC_PROCESSREFUNDCALLBACK, + List.of(), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processSettlement(String card, BigInteger transactionId, BigInteger settlementId, BigInteger amount) { + final Function function = new Function( + FUNC_PROCESSSETTLEMENT, + Arrays.asList(new Address(160, card), + new Uint256(transactionId), + new Uint256(settlementId), + new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall refundAccount() { + final Function function = new Function(FUNC_REFUNDACCOUNT, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall renounceRole(byte[] role, String callerConfirmation) { + final Function function = new Function( + FUNC_RENOUNCEROLE, + Arrays.asList(new Bytes32(role), + new Address(160, callerConfirmation)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall revokeRole(byte[] role, String account) { + final Function function = new Function( + FUNC_REVOKEROLE, + Arrays.asList(new Bytes32(role), + new Address(160, account)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall savePendingRefund(String card, BigInteger transactionId, BigInteger amount) { + final Function function = new Function( + FUNC_SAVEPENDINGREFUND, + Arrays.asList(new Address(160, card), + new Uint256(transactionId), + new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall securityDelay() { + final Function function = new Function(FUNC_SECURITYDELAY, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall setFixedFee(BigInteger fixedFee_) { + final Function function = new Function( + FUNC_SETFIXEDFEE, + List.of(new Uint256(fixedFee_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setPaymentAccount(String card, String paymentAccount) { + final Function function = new Function( + FUNC_SETPAYMENTACCOUNT, + Arrays.asList(new Address(160, card), + new Address(160, paymentAccount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setPaymentReceiver(String paymentReceiver_) { + final Function function = new Function( + FUNC_SETPAYMENTRECEIVER, + List.of(new Address(160, paymentReceiver_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setRefundAccount(String refundAccount_) { + final Function function = new Function( + FUNC_SETREFUNDACCOUNT, + List.of(new Address(160, refundAccount_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setSecurityDelay(BigInteger securityDelay_) { + final Function function = new Function( + FUNC_SETSECURITYDELAY, + List.of(new Uint256(securityDelay_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setSettlementPeriod(BigInteger settlementPeriod_) { + final Function function = new Function( + FUNC_SETSETTLEMENTPERIOD, + List.of(new Uint256(settlementPeriod_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setVerifiedBalanceFor(String paymentAccount, BigInteger verifiedBalance) { + final Function function = new Function( + FUNC_SETVERIFIEDBALANCEFOR, + Arrays.asList(new Address(160, paymentAccount), + new Uint256(verifiedBalance)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall settlementPeriod() { + final Function function = new Function(FUNC_SETTLEMENTPERIOD, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall supportsInterface(byte[] interfaceId) { + final Function function = new Function(FUNC_SUPPORTSINTERFACE, + List.of(new Bytes4(interfaceId)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteFunctionCall writeOffDebt(String card, BigInteger amount) { + final Function function = new Function( + FUNC_WRITEOFFDEBT, + Arrays.asList(new Address(160, card), + new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public static class AuthorizationChangeProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger transactionId; + + public BigInteger amount; + + public BigInteger fee; + } + + public static class AuthorizationProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger transactionId; + + public BigInteger amount; + + public BigInteger fee; + } + + public static class DebtWriteOffProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger amount; + } + + public static class FixedFeeSetEventResponse extends BaseEventResponse { + public BigInteger fixedFee; + } + + public static class PaymentAccountSetEventResponse extends BaseEventResponse { + public String card; + + public String paymentAccount; + } + + public static class PaymentReceiverSetEventResponse extends BaseEventResponse { + public String paymentReceiver; + } + + public static class PendingRefundProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class RefundAccountSetEventResponse extends BaseEventResponse { + public String refundAccount; + } + + public static class RefundProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class RoleAdminChangedEventResponse extends BaseEventResponse { + public byte[] role; + + public byte[] previousAdminRole; + + public byte[] newAdminRole; + } + + public static class RoleGrantedEventResponse extends BaseEventResponse { + public byte[] role; + + public String account; + + public String sender; + } + + public static class RoleRevokedEventResponse extends BaseEventResponse { + public byte[] role; + + public String account; + + public String sender; + } + + public static class SaveRefundProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class SecurityDelaySetEventResponse extends BaseEventResponse { + public BigInteger securityDelay; + } + + public static class SettlementPeriodSetEventResponse extends BaseEventResponse { + public BigInteger settlementPeriod; + } + + public static class SettlementProcessedEventResponse extends BaseEventResponse { + public String card; + + public BigInteger transactionId; + + public BigInteger settlementId; + + public BigInteger amount; + + public BigInteger fee; + } + + public static class VerifiedBalanceIncreasedForEventResponse extends BaseEventResponse { + public String paymentAccount; + + public BigInteger increase; + } + + public static class VerifiedBalanceSetForEventResponse extends BaseEventResponse { + public String paymentAccount; + + public BigInteger verifiedBalance; + } +} diff --git a/libs/visa/src/main/java/com/tangem/lib/visa/TangemPaymentAccount.java b/libs/visa/src/main/java/com/tangem/lib/visa/TangemPaymentAccount.java new file mode 100644 index 0000000000..943509e28e --- /dev/null +++ b/libs/visa/src/main/java/com/tangem/lib/visa/TangemPaymentAccount.java @@ -0,0 +1,1781 @@ +package com.tangem.lib.visa; + +import org.web3j.abi.EventEncoder; +import org.web3j.abi.FunctionEncoder; +import org.web3j.abi.TypeReference; +import org.web3j.abi.datatypes.*; +import org.web3j.abi.datatypes.generated.*; +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.tuples.generated.Tuple3; +import org.web3j.tx.Contract; +import org.web3j.tx.TransactionManager; +import org.web3j.tx.gas.ContractGasProvider; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.Callable; + +import io.reactivex.Flowable; + +/** + *

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 1.5.0. + */ +@SuppressWarnings("rawtypes") +class TangemPaymentAccount extends Contract { + public static final String BINARY = "60c06040523060a05234801562000014575f80fd5b5060405162004c6938038062004c69833981016040819052620000379162000109565b6001600160a01b0381166080526200004e62000055565b5062000138565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000a65760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620001065780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b5f602082840312156200011a575f80fd5b81516001600160a01b038116811462000131575f80fd5b9392505050565b60805160a051614af3620001765f395f8181612b9501528181612bbe0152612e1b01525f8181610439015281816104bb01526125500152614af35ff3fe60806040526004361061027f575f3560e01c80638c3b2a9b11610155578063ce1b1d43116100be578063e37b815411610078578063e37b8154146108c2578063e3dbffd51461092e578063e4d7ddb91461094d578063e6e268f41461096c578063f89db45714610980578063f92ad2191461099f575f80fd5b8063ce1b1d4314610831578063d47ae89c14610850578063dbed8faa14610864578063dcab7e5014610883578063df7727b4146102aa578063e1a8eafd146108a3575f80fd5b8063b4d02d0d1161010f578063b4d02d0d14610776578063b9603bdf14610795578063bb542ef0146107b4578063be69191d146107d3578063c45a0155146107e7578063c81656c814610806575f80fd5b80638c3b2a9b146106125780638cf351e7146106315780639335dcb714610650578063a075b7c71461066f578063a789457d1461068e578063ad3cb1cc14610739575f80fd5b8063456575e5116101f75780636b4943a7116101b15780636b4943a7146104985780637da0a877146104ad578063806679e4146104df578063860aefcf146104fe57806386f15d09146105df5780638bbe11af146105f3575f80fd5b8063456575e5146103c357806346236eb9146103e25780634f1ef286146103f657806352d1902d14610409578063572b6c051461041d5780636b2a383014610479575f80fd5b806322611280116102485780632261128014610308578063229865d11461031c5780633013ce291461033b57806334284dfb1461037157806335ba9af8146103905780633c1a5012146103a4575f80fd5b806274f3561461028357806301e948ff146102aa5780630f1071be146102be578063139d657c146102d257806319cdeb6f146102f3575b5f80fd5b34801561028e575f80fd5b506102976109be565b6040519081526020015b60405180910390f35b3480156102b5575f80fd5b506102976109d6565b3480156102c9575f80fd5b506102976109e5565b3480156102dd575f80fd5b506102f16102ec3660046140bc565b610a66565b005b3480156102fe575f80fd5b5061029760055481565b348015610313575f80fd5b506102f1610d5b565b348015610327575f80fd5b506102f16103363660046140e5565b610de8565b348015610346575f80fd5b505f54610359906001600160a01b031681565b6040516001600160a01b0390911681526020016102a1565b34801561037c575f80fd5b506102f161038b366004614136565b610e7f565b34801561039b575f80fd5b50610297610f45565b3480156103af575f80fd5b506102f16103be3660046141a1565b610fd4565b3480156103ce575f80fd5b506102f16103dd3660046141bc565b611060565b3480156103ed575f80fd5b50601b54610297565b6102f16104043660046141f0565b611100565b348015610414575f80fd5b5061029761111f565b348015610428575f80fd5b506104696104373660046141a1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b60405190151581526020016102a1565b348015610484575f80fd5b506102f16104933660046140e5565b61113a565b3480156104a3575f80fd5b5061029760065481565b3480156104b8575f80fd5b507f0000000000000000000000000000000000000000000000000000000000000000610359565b3480156104ea575f80fd5b506102f16104f93660046142ae565b611287565b348015610509575f80fd5b506040805160a08082018352600c54825282518084018452600d548152600e546020828101919091528084019190915283518085018552600f5481526010548183015283850152835180820185526011548152606080850191909152601254608080860191909152855193840186526013548452855180870187526014548152601554818501528484015285518087018752601654815260175481850152848701528551928301909552601854825282015260195492810192909252601a546105d0929083565b6040516102a19392919061432c565b3480156105ea575f80fd5b5061046961132a565b3480156105fe575f80fd5b506102f161060d3660046140e5565b611351565b34801561061d575f80fd5b506102f161062c366004614357565b611468565b34801561063c575f80fd5b506102f161064b366004614388565b611583565b34801561065b575f80fd5b50600354610359906001600160a01b031681565b34801561067a575f80fd5b506102f16106893660046143ca565b611710565b348015610699575f80fd5b506040805180820182526007546001600160a01b039081168252825180840184526008546001600160801b0319608082811b8216845261ffff600160801b938490048116602086810191909152808801959095528751808901895260095490961686528751808901909852600a549182901b9092168752919091041684820152810192909252600b5461072a929083565b6040516102a19392919061442a565b348015610744575f80fd5b50610769604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516102a19190614475565b348015610781575f80fd5b506102f16107903660046140e5565b611801565b3480156107a0575f80fd5b506102f16107af3660046140e5565b611901565b3480156107bf575f80fd5b506102f16107ce3660046141a1565b611a37565b3480156107de575f80fd5b50610469611b08565b3480156107f2575f80fd5b50600154610359906001600160a01b031681565b348015610811575f80fd5b506102976108203660046140e5565b5f908152601c602052604090205490565b34801561083c575f80fd5b50600254610359906001600160a01b031681565b34801561085b575f80fd5b50610297611b2d565b34801561086f575f80fd5b506102f161087e3660046140e5565b611bad565b34801561088e575f80fd5b505f8051602061479083398151915254610297565b3480156108ae575f80fd5b506102f16108bd3660046141a1565b611c0c565b3480156108cd575f80fd5b506109096108dc3660046140e5565b60046020525f9081526040902080546001909101546001600160801b03811690600160801b900460ff1683565b604080519384526001600160801b0390921660208401521515908201526060016102a1565b348015610939575f80fd5b506102f16109483660046140e5565b611da8565b348015610958575f80fd5b506102f16109673660046141bc565b611f82565b348015610977575f80fd5b5061029761212a565b34801561098b575f80fd5b506102f161099a3660046140e5565b61213f565b3480156109aa575f80fd5b506102f16109b93660046144a7565b61230d565b5f805f805160206147708339815191525b5492915050565b5f6109e05f61247c565b905090565b5f6109e060025f9054906101000a90046001600160a01b03166001600160a01b0316630f1071be6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a5d91906144e7565b6283d600612534565b6002546001600160a01b0316610a7a61254d565b6001600160a01b0316146040518060600160405280603381526020016145b96033913990610ac45760405162461bcd60e51b8152600401610abb9190614475565b60405180910390fd5b50610ace8161259e565b5f8381526004602052604081205490818311610b00575081808203828214610afa57610afa86826125f0565b50610b7f565b50805f610b0d600c612634565b80549091505f81851015610b4157610b30858303610b2b855f61264e565b612534565b9050610b3e81610b2b6109d6565b90505b8015610b67575f610b5482878903612534565b948501949050610b6584825f6126b9565b505b838603868514610b7a57610b7a816126e0565b505050505b816006541015604051806060016040528060298152602001614a186029913990610bbc5760405162461bcd60e51b8152600401610abb9190614475565b506006805483900390555f85815260046020818152604080842093845560019390930180546001600160881b0319169055600254835163659bf9d960e11b81529351610c5d946001600160a01b039092169363cb37f3b29383820193909291908290030181865afa158015610c33573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c5791906144fe565b8261273f565b6040805184815260208101839052859187917f3e565e38537fb4064a62ad5c266c37a9798b673d92066b5bbbd2269c70078fd1910160405180910390a35f546040516370a0823160e01b81523060048201527f273f30c859762d267fd40559825ed2fa0f467908c92843dfd0184b9d577dc082916001600160a01b0316906370a0823190602401602060405180830381865afa158015610cff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d2391906144e7565b600654610d2e6109be565b601b5460408051948552602085019390935291830152606082015260800160405180910390a15050505050565b6003546001600160a01b0316610d6f61254d565b6001600160a01b03161480610da65750610d89600761284a565b546001600160a01b0316610d9b61254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f913990610ddd5760405162461bcd60e51b8152600401610abb9190614475565b50610de6612864565b565b6003546001600160a01b0316610dfc61254d565b6001600160a01b03161480610e335750610e16600761284a565b546001600160a01b0316610e2861254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f913990610e6a5760405162461bcd60e51b8152600401610abb9190614475565b50610e7c81610e77611b2d565b6128b2565b50565b6002546001600160a01b0316610e9361254d565b6001600160a01b0316146040518060600160405280603381526020016145b96033913990610ed45760405162461bcd60e51b8152600401610abb9190614475565b506001610ee2848484612963565b610eee868684846129bf565b604080518681526001600160801b03198616602082015261ffff851681830152905187917faab1db26b8ce0ed14d67fd3d8eab92617f4caf4134148122ad6f2a4e20068df7919081900360600190a2505050505050565b5f80546040516370a0823160e01b815230600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa158015610f8b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610faf91906144e7565b9050600654811015610fc1575f610fce565b600654610fce908261452d565b91505090565b6003546001600160a01b0316610fe861254d565b6001600160a01b0316148061101f5750611002600761284a565b546001600160a01b031661101461254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f9139906110565760405162461bcd60e51b8152600401610abb9190614475565b50610e7c81612a24565b6002546001600160a01b031661107461254d565b6001600160a01b0316146040518060600160405280603381526020016145b960339139906110b55760405162461bcd60e51b8152600401610abb9190614475565b506110c2601b8383612b0f565b817fea92e836c1b642a333bb58b44d5f13c5a066c5b0f35b8d6da5032af605c9e031826040516110f491815260200190565b60405180910390a25050565b611108612b8a565b61111182612c2e565b61111b8282612d54565b5050565b5f611128612e10565b505f8051602061484383398151915290565b6002546001600160a01b031661114e61254d565b6001600160a01b0316146040518060600160405280603381526020016145b9603391399061118f5760405162461bcd60e51b8152600401610abb9190614475565b505f8160055461119f9190614540565b5f546040516370a0823160e01b81523060048201529192506001600160a01b0316906370a0823190602401602060405180830381865afa1580156111e5573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061120991906144e7565b81111560405180608001604052806048815260200161468d60489139906112435760405162461bcd60e51b8152600401610abb9190614475565b50600581905560408051838152602081018390527fd6004694c2f543b69302481de26731f63c1d41062795b5366d8ca20fd3e3d6d391015b60405180910390a15050565b6002546001600160a01b031661129b61254d565b6001600160a01b0316146040518060600160405280603381526020016145b960339139906112dc5760405162461bcd60e51b8152600401610abb9190614475565b505f6112ea848484846129bf565b837f5e1266400272ee17509f7d7edb190c0fa83572f90677ee6a3bbfac22bf1f679d8460405161131c91815260200190565b60405180910390a250505050565b5f80516020614790833981519152545f905f80516020614730833981519152901515610fce565b5f818152600460205260409020600181015490546001600160801b03909116906113796109e5565b6113839083614540565b42116040518060600160405280602b81526020016145ec602b9139906113bc5760405162461bcd60e51b8152600401610abb9190614475565b50806006541015604051806060016040528060298152602001614a1860299139906113fa5760405162461bcd60e51b8152600401610abb9190614475565b506006805482900390555f8381526004602052604080822091825560019190910180546001600160881b03191690555183907f056bed1bad5d90aa1df671c8d28b1bbb82ff67fd545f804e63cd261140b11f7b9061145b9084815260200190565b60405180910390a2505050565b6003546001600160a01b031661147c61254d565b6001600160a01b031614806114b35750611496600761284a565b546001600160a01b03166114a861254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f9139906114ea5760405162461bcd60e51b8152600401610abb9190614475565b506040805180820182526009546001600160a01b0316815281518083019092526001600160801b03198416825261ffff831660208381019190915281019190915261154090611537611b2d565b60079190612e59565b604080516001600160801b03198416815261ffff831660208201527fc50d2cc66f62a75104edeabfbcedb2a37ebd1cb8ce0b873ec3afa504e8bb1480910161127b565b6003546001600160a01b031661159761254d565b6001600160a01b031614806115ce57506115b1600761284a565b546001600160a01b03166115c361254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f9139906116055760405162461bcd60e51b8152600401610abb9190614475565b50600b541561165e576116596040518060400160405280856001600160a01b031681526020016040518060400160405280866001600160801b03191681526020018561ffff16815250815250611537611b2d565b6116b1565b6116b16040518060400160405280856001600160a01b031681526020016040518060400160405280866001600160801b03191681526020018561ffff16815250815250600761300090919063ffffffff16565b604080516001600160a01b03851681526001600160801b03198416602082015261ffff8316918101919091527fae81d31085749debb22edb9a09f263e50cf6047cfc57ec741c07ce62b1121b9a906060015b60405180910390a1505050565b6003546001600160a01b031661172461254d565b6001600160a01b0316148061175b575061173e600761284a565b546001600160a01b031661175061254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f9139906117925760405162461bcd60e51b8152600401610abb9190614475565b506117b36117a2858585856130a1565b6117aa611b2d565b600c9190613102565b6040805185815260208101859052908101839052606081018290527ffc3ccf3ca5a38fad8786ed39386de19cb574b06205422992c583e4753aa6268f9060800160405180910390a150505050565b6003546001600160a01b031661181561254d565b6001600160a01b0316148061184c575061182f600761284a565b546001600160a01b031661184161254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f9139906118835760405162461bcd60e51b8152600401610abb9190614475565b50610e7c8160025f9054906101000a90046001600160a01b03166001600160a01b031663cb37f3b26040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118fc91906144fe565b6131f0565b6002546001600160a01b031661191561254d565b6001600160a01b0316146040518060600160405280603381526020016145b960339139906119565760405162461bcd60e51b8152600401610abb9190614475565b505f546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561199c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119c091906144e7565b81111560405180608001604052806048815260200161468d60489139906119fa5760405162461bcd60e51b8152600401610abb9190614475565b5060058190556040518181527f321b800465e47508430424e6c089344256e17f9a5b0b43c751dffbdfd3930263906020015b60405180910390a150565b6003546001600160a01b0316611a4b61254d565b6001600160a01b03161480611a825750611a65600761284a565b546001600160a01b0316611a7761254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f913990611ab95760405162461bcd60e51b8152600401610abb9190614475565b50600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f0435c4db9db56b8cdd5d58a213f47d6fed6c2b35c81bbd6baf87547848f4c88b90602001611a2c565b5f5f80516020614730833981519152610fce5f805160206147908339815191526133a4565b5f6109e060025f9054906101000a90046001600160a01b03166001600160a01b031663d47ae89c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b81573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ba591906144e7565b610e10612534565b6002546001600160a01b0316611bc161254d565b6001600160a01b0316146040518060600160405280603381526020016145b96033913990611c025760405162461bcd60e51b8152600401610abb9190614475565b50610e7c8161340b565b6003546001600160a01b0316611c2061254d565b6001600160a01b03161480611c575750611c3a600761284a565b546001600160a01b0316611c4c61254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f913990611c8e5760405162461bcd60e51b8152600401610abb9190614475565b50600254604080516060810190915260238082526001600160a01b039092161591614641602083013990611cd55760405162461bcd60e51b8152600401610abb9190614475565b50600280546001600160a01b0319166001600160a01b03831690811790915560408051633013ce2960e01b81529051633013ce29916004808201926020929091908290030181865afa158015611d2d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d5191906144fe565b5f80546001600160a01b0319166001600160a01b0392831690811790915560408051928416835260208301919091527fb84a8bf26086331c9421c7ce6650da3b0ef748bd335c3f00ada56f481e4321939101611a2c565b6002546001600160a01b0316611dbc61254d565b6001600160a01b0316146040518060600160405280603381526020016145b96033913990611dfd5760405162461bcd60e51b8152600401610abb9190614475565b505f80546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611e44573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e6891906144e7565b905060025f9054906101000a90046001600160a01b03166001600160a01b0316632cc326416040518163ffffffff1660e01b81526004015f604051808303815f87803b158015611eb6575f80fd5b505af1158015611ec8573d5f803e3d5ffd5b50505f80546040516370a0823160e01b81523060048201529193508492506001600160a01b0316906370a0823190602401602060405180830381865afa158015611f14573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f3891906144e7565b611f42919061452d565b9050611f50601b84836134e9565b827f2c6a6ee02f179bb5f13a4b7fdc9ccd1dd37e524b48ff0957a931348cc9ad75c08260405161145b91815260200190565b6002546001600160a01b0316611f9661254d565b6001600160a01b0316146040518060600160405280603381526020016145b96033913990611fd75760405162461bcd60e51b8152600401610abb9190614475565b505f60045f8481526020019081526020015f205f015490505f811160405180606001604052806023815260200161470d60239139906120295760405162461bcd60e51b8152600401610abb9190614475565b508082106040518060600160405280603b8152602001614929603b9139906120645760405162461bcd60e51b8152600401610abb9190614475565b5081810361207284826125f0565b806006541015604051806060016040528060298152602001614a1860299139906120af5760405162461bcd60e51b8152600401610abb9190614475565b506006805482900390555f8390036120e7575f84815260046020526040812090815560010180546001600160881b03191690556120f8565b5f8481526004602052604090208390555b837f8274e5392b3ab6bba68ee0567f4ede55e361239b8d0122fa5d3b5dc36497b91d8460405161131c91815260200190565b5f805f805160206147308339815191526109cf565b6002546001600160a01b031661215361254d565b6001600160a01b0316146040518060600160405280603381526020016145b960339139906121945760405162461bcd60e51b8152600401610abb9190614475565b505f80546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156121db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121ff91906144e7565b905060025f9054906101000a90046001600160a01b03166001600160a01b0316632cc326416040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561224d575f80fd5b505af115801561225f573d5f803e3d5ffd5b50505f80546040516370a0823160e01b81523060048201529193508492506001600160a01b0316906370a0823190602401602060405180830381865afa1580156122ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122cf91906144e7565b6122d9919061452d565b9050827f2c6a6ee02f179bb5f13a4b7fdc9ccd1dd37e524b48ff0957a931348cc9ad75c08260405161145b91815260200190565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156123525750825b90505f8267ffffffffffffffff16600114801561236e5750303b155b90508115801561237c575080155b1561239a5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156123c457845460ff60401b1916600160401b1785555b6123cc6135ce565b6123d46135ce565b6123dc6135ce565b6123e461254d565b600180546001600160a01b03199081166001600160a01b039384161790915560038054909116918c1691909117905561242a6124228a8a8a8a6130a1565b600c906135d6565b831561247057845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b5f80546040516370a0823160e01b815230600482015282916124f4916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156124c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124ec91906144e7565b600554612534565b600654909150836125145761250761212a565b6125119082614540565b90505b80821015612522575f61252c565b61252c818361452d565b949350505050565b5f8183106125425781612544565b825b90505b92915050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633148015612587575060143610155b15612599575060131936013560601c90565b503390565b60408051808201909152601b81527f353130307c436f6d6d6f6e3a20616d6f756e74206973207a65726f000000000060208201528161111b5760405162461bcd60e51b8152600401610abb9190614475565b5f828152600460205260409020600101546001600160801b03811690600160801b900460ff1661262e838383612626600c612634565b929190613662565b50505050565b5f4282600e015411156126475781612547565b5060070190565b5f61265b836005016133a4565b1561268c57811561267157506001820154612547565b600183015460038401546126859190612534565b9050612547565b811561269e5761268583600101613690565b6126856126ad84600101613690565b610b2b85600301613690565b6126c2836136b0565b6126cc83836136e0565b806126db576126db83836136ed565b505050565b5f805160206147708339815191528054829082905f90612701908490614540565b909155505080546040805184815260208101929092527ff3a2c404b3362c4238317c3dad1020c2e9e984ba8df38a4a1ff18d57e92a242a910161127b565b5f80546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612785573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127a991906144e7565b905080600554146040518060600160405280603381526020016149b760339139906127e75760405162461bcd60e51b8152600401610abb9190614475565b5060408051808201909152601f81525f8051602061475083398151915260208201528282101561282a5760405162461bcd60e51b8152600401610abb9190614475565b506005805483900390555f546126db906001600160a01b031684846136fa565b5f428260040154111561285d5781612547565b5060020190565b5f5f805160206147308339815191528181555f8051602061479083398151915282905560405190917f8892a543ee6d561b73cc067b2cde5a76c251a4e0b978d92390f1301db5d125ab91a150565b6128ba610f45565b8211156040518060400160405280601f81526020015f80516020614750833981519152815250906128fe5760405162461bcd60e51b8152600401610abb9190614475565b505f805160206147308339815191528281556129275f805160206147908339815191528361374c565b60018101546040805185815260208101929092527ffa4870dc2e2f95d11863e7e765a98e12fe92c3d1d2a703b4cf983f9c4b1052e69101611703565b600b54421015806129715750805b6040518060600160405280603581526020016148cd60359139906129a85760405162461bcd60e51b8152600401610abb9190614475565b506126db83836129b8600761284a565b91906137af565b60045f8581526020019081526020015f205f01545f1460405180606001604052806029815260200161498e6029913990612a0c5760405162461bcd60e51b8152600401610abb9190614475565b50612a188383836137ca565b61262e8484848461380b565b5f805160206147308339815191528054612a3c610f45565b8111156040518060400160405280601f81526020015f8051602061475083398151915281525090612a805760405162461bcd60e51b8152600401610abb9190614475565b50612a89611b08565b6040518060600160405280603881526020016146d56038913990612ac05760405162461bcd60e51b8152600401610abb9190614475565b505f8083556001830155612ad483826139a6565b826001600160a01b03167fa578b4c05763eb039caef37b2d7b949c22914c3838384c9c73cefb78c4a8ed0a8260405161145b91815260200190565b826001015f8381526020019081526020015f20545f146040518060600160405280602a8152602001614617602a913990612b5c5760405162461bcd60e51b8152600401610abb9190614475565b505f8281526001840160205260408120829055835482918591612b80908490614540565b9091555050505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480612c1057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612c045f80516020614843833981519152546001600160a01b031690565b6001600160a01b031614155b15610de65760405163703e46dd60e11b815260040160405180910390fd5b6003546001600160a01b0316612c4261254d565b6001600160a01b03161480612c795750612c5c600761284a565b546001600160a01b0316612c6e61254d565b6001600160a01b0316145b6040518060600160405280602f8152602001614a66602f913990612cb05760405162461bcd60e51b8152600401610abb9190614475565b506001546040516316da1fb760e11b81526001600160a01b03838116600483015290911690632db43f6e90602401602060405180830381865afa158015612cf9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d1d9190614553565b604051806060016040528060298152602001614a95602991399061111b5760405162461bcd60e51b8152600401610abb9190614475565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612dae575060408051601f3d908101601f19168201909252612dab918101906144e7565b60015b612dd657604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610abb565b5f805160206148438339815191528114612e0657604051632a87526960e21b815260048101829052602401610abb565b6126db83836139dd565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610de65760405163703e46dd60e11b815260040160405180910390fd5b602082015151600384015460801b6001600160801b03199081169116141580612e9c575060208083015101516003840154600160801b900461ffff908116911614155b80612eb95750815160028401546001600160a01b03908116911614155b6040518060600160405280602781526020016149026027913990612ef05760405162461bcd60e51b8152600401610abb9190614475565b506004830154421015612f695781516002840180546001600160a01b039092166001600160a01b03199092169190911790556020808301518051600386018054929093015161ffff16600160801b026001600160901b031990921660809190911c17179055612f5f8142614540565b6004840155505050565b60028301805484546001600160a01b03199081166001600160a01b0380841691909117875560038701805460018901805461ffff600160801b808504821681026001600160901b03199384166001600160801b03871617179093558a51909516959096169490941790955560208088015180519101519092169092029290931660809390931c92909217179055612f5f8142614540565b60048201541515156040518060600160405280602f815260200161458a602f91399061303f5760405162461bcd60e51b8152600401610abb9190614475565b5080516002830180546001600160a01b039092166001600160a01b03199092169190911790556020908101518051600384018054929093015161ffff16600160801b026001600160901b031990921660809190911c1717905542600490910155565b6130a961404a565b506040805160a081018252948552805180820182529384525f6020858101829052808701959095528151808301835293845283850152848101929092528151928301909152600182526060830191909152608082015290565b600e830154421015613166578151600784015560208083015180516008860155810151600985015560408301518051600a8601550151600b840155606082015151600c8401556080820151600d84015561315c8142614540565b600e840155505050565b600783018054845560088401805460018601556009850180546002870155600a860180546003880155600b870180546004890155600c8801805460058a0155600d8901805460068b015588519096556020808901518051909655948501519093556040870151805190925592015190915560608401515190556080830151905561315c8142614540565b5f805160206147708339815191525f6132076109d6565b825460408051808201909152601b81527f353130307c436f6d6d6f6e3a20616d6f756e74206973207a65726f00000000006020820152919250908561325f5760405162461bcd60e51b8152600401610abb9190614475565b5060408051808201909152601881527f353430317c446562743a206e6f206465627420666f756e6400000000000000006020820152816132b25760405162461bcd60e51b8152600401610abb9190614475565b5060408051808201909152601d81527f353430327c446562743a206e6f2066756e647320617661696c61626c650000006020820152826133055760405162461bcd60e51b8152600401610abb9190614475565b50808511156040518060600160405280602581526020016147d560259139906133415760405162461bcd60e51b8152600401610abb9190614475565b505f61334d8387612534565b8454819003855590506133608582613a32565b83546040805183815260208101929092527f75aec94f6ad949cfd9728eb818639f1b0b882089b480409ab73245c06469eef4910160405180910390a1505050505050565b5f6133af8254151590565b6040518060400160405280601d81526020017f353534317c54696d6572733a2074696d6572206e6f7420616374697665000000815250906134035760405162461bcd60e51b8152600401610abb9190614475565b505054421190565b5f80516020614770833981519152805460408051808201909152601b81527f353130307c436f6d6d6f6e3a20616d6f756e74206973207a65726f000000000060208201528361346d5760405162461bcd60e51b8152600401610abb9190614475565b50808311156040518060600160405280602581526020016147d560259139906134a95760405162461bcd60e51b8152600401610abb9190614475565b5081548390038083556040805185815260208101929092527fb940258db5193d85cafbc591d0c29fad88d804ff8b9ab71c8f9545af2bb2c07c9101611703565b5f836001015f8481526020019081526020015f205490505f81116040518060600160405280602581526020016147b0602591399061353a5760405162461bcd60e51b8152600401610abb9190614475565b50808214604051806060016040528060258152602001614a4160259139906135755760405162461bcd60e51b8152600401610abb9190614475565b50835f01548111156040518060600160405280602a8152602001614964602a9139906135b45760405162461bcd60e51b8152600401610abb9190614475565b508354038355505f90815260019091016020526040812055565b610de6613a3c565b600e8201541515156040518060600160405280602f815260200161458a602f9139906136155760405162461bcd60e51b8152600401610abb9190614475565b508051600783015560208082015180516008850155810151600984015560408201518051600a8501550151600b830155606081015151600c83015560800151600d82015542600e90910155565b61366c8483613a85565b1561262e5761367e6001850184613ac0565b8061262e5761262e6003850184613ac0565b805460018201545f9190808210156136a8575f61252c565b900392915050565b6136bc816005016133a4565b15610e7c575f60028201555f60048201556006810154610e7c90600583019061374c565b61111b6001830182613b0f565b61111b6003830182613b0f565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526126db908490613b2b565b60408051808201909152601781527f353534307c54696d6572733a207a65726f2064656c617900000000000000000060208201528161379e5760405162461bcd60e51b8152600401610abb9190614475565b506137a98142614540565b90915550565b82546126db9060018501906001600160a01b03168484613b8c565b601a54421015806137d85750815b156137f3576126db83826137ec600c612634565b9190613d12565b6137ff600c8483613d12565b6126db60138483613d12565b6138148361259e565b5f821561387d575f613826600161247c565b905084811061383757849150613877565b809150857f83067e3478aa8b638f7e34eeecb23875cc3671e615445e892cc22dcd4c8b8df382870360405161386e91815260200190565b60405180910390a25b506138ce565b6138856109d6565b8411156040518060400160405280601f81526020015f80516020614750833981519152815250906138c95760405162461bcd60e51b8152600401610abb9190614475565b508390505b60408051808201909152601f81527f353331337c4163636f756e743a206e6f2066756e647320746f20626c6f636b006020820152816139205760405162461bcd60e51b8152600401610abb9190614475565b50604080516060810182528281526001600160801b0342811660208084019182528615158486019081525f8b815260049092529481209351845590516001909301805494511515600160801b026001600160881b03199095169390921692909217929092179091556006805483929061399a908490614540565b90915550505050505050565b8060055410156139b6575f6139c4565b806005546139c4919061452d565b6005555f5461111b906001600160a01b031683836136fa565b6139e682613d73565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a2805115613a2a576126db8282613dd6565b61111b613e48565b61111b828261273f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610de657604051631afcd79f60e31b815260040160405180910390fd5b5f60058301613a93816133a4565b15613aa1575f915050612547565b600684015481545f91613ab39161452d565b8410159250612547915050565b80826001015410156040518060600160405280602e81526020016149ea602e913990613aff5760405162461bcd60e51b8152600401610abb9190614475565b5060019091018054919091039055565b80826001015f828254613b229190614540565b90915550505050565b5f613b3f6001600160a01b03841683613e67565b905080515f14158015613b63575080806020019051810190613b619190614553565b155b156126db57604051635274afe760e01b81526001600160a01b0384166004820152602401610abb565b83546040805160608101909152602980825261ffff600160801b909304831692841683119190614664602083013990613bd85760405162461bcd60e51b8152600401610abb9190614475565b5082825b8261ffff168161ffff161015613c94576040516bffffffffffffffffffffffff19606088901b1660208201526001600160f01b031960f083901b1660348201526001600160801b03198316603682015260029060460160408051601f1981840301815290829052613c4c9161456e565b602060405180830381855afa158015613c67573d5f803e3d5ffd5b5050506040513d601f19601f82011682018060405250810190613c8a91906144e7565b9150600101613bdc565b5085546040805160608101909152602180825260809290921b6001600160801b03199081169084161491614822602083013990613ce45760405162461bcd60e51b8152600401610abb9190614475565b5050845461ffff909216600160801b026001600160901b031990921660809390931c92909217179092555050565b825f01548211156040518060600160405280603b8152602001614892603b913990613d505760405162461bcd60e51b8152600401610abb9190614475565b50613d5a836136b0565b613d648383613e74565b806126db576126db8383613ec3565b806001600160a01b03163b5f03613da857604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610abb565b5f8051602061484383398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b60605f80846001600160a01b031684604051613df2919061456e565b5f60405180830381855af49150503d805f8114613e2a576040519150601f19603f3d011682016040523d82523d5f602084013e613e2f565b606091505b5091509150613e3f858383613f15565b95945050505050565b3415610de65760405163b398979f60e01b815260040160405180910390fd5b606061254483835f613f74565b613e81600183018261400d565b6040518060600160405280602881526020016147fa6028913990613eb85760405162461bcd60e51b8152600401610abb9190614475565b5061111b82826136e0565b613ed0600383018261400d565b6040518060600160405280602f8152602001614863602f913990613f075760405162461bcd60e51b8152600401610abb9190614475565b5061111b6003830182613b0f565b606082613f2a57613f2582614021565b613f6d565b8151158015613f4157506001600160a01b0384163b155b15613f6a57604051639996b31560e01b81526001600160a01b0385166004820152602401610abb565b50805b9392505050565b606081471015613f995760405163cd78605960e01b8152306004820152602401610abb565b5f80856001600160a01b03168486604051613fb4919061456e565b5f6040518083038185875af1925050503d805f8114613fee576040519150601f19603f3d011682016040523d82523d5f602084013e613ff3565b606091505b5091509150614003868383613f15565b9695505050505050565b5f61401783613690565b9091111592915050565b8051156140315780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040518060a001604052805f815260200161407660405180604001604052805f81526020015f81525090565b815260200161409660405180604001604052805f81526020015f81525090565b81526020016140b060405180602001604052805f81525090565b81526020015f81525090565b5f805f606084860312156140ce575f80fd5b505081359360208301359350604090920135919050565b5f602082840312156140f5575f80fd5b5035919050565b80356001600160801b031981168114614113575f80fd5b919050565b803561ffff81168114614113575f80fd5b8015158114610e7c575f80fd5b5f805f805f60a0868803121561414a575f80fd5b8535945060208601359350614161604087016140fc565b925061416f60608701614118565b9150608086013561417f81614129565b809150509295509295909350565b6001600160a01b0381168114610e7c575f80fd5b5f602082840312156141b1575f80fd5b8135613f6d8161418d565b5f80604083850312156141cd575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52604160045260245ffd5b5f8060408385031215614201575f80fd5b823561420c8161418d565b9150602083013567ffffffffffffffff80821115614228575f80fd5b818501915085601f83011261423b575f80fd5b81358181111561424d5761424d6141dc565b604051601f8201601f19908116603f01168101908382118183101715614275576142756141dc565b8160405282815288602084870101111561428d575f80fd5b826020860160208301375f6020848301015280955050505050509250929050565b5f805f606084860312156142c0575f80fd5b833592506020840135915060408401356142d981614129565b809150509250925092565b8051825260208082015180518285015290810151604084015250604081015180516060840152602081015160808401525060608101515160a08301526080015160c090910152565b6101e0810161433b82866142e4565b61434860e08301856142e4565b826101c0830152949350505050565b5f8060408385031215614368575f80fd5b614371836140fc565b915061437f60208401614118565b90509250929050565b5f805f6060848603121561439a575f80fd5b83356143a58161418d565b92506143b3602085016140fc565b91506143c160408501614118565b90509250925092565b5f805f80608085870312156143dd575f80fd5b5050823594602084013594506040840135936060013592509050565b80516001600160a01b0316825260209081015180516001600160801b03191682840152015161ffff16604090910152565b60e0810161443882866143f9565b61444560608301856143f9565b8260c0830152949350505050565b5f5b8381101561446d578181015183820152602001614455565b50505f910152565b602081525f8251806020840152614493816040850160208701614453565b601f01601f19169190910160400192915050565b5f805f805f60a086880312156144bb575f80fd5b85356144c68161418d565b97602087013597506040870135966060810135965060800135945092505050565b5f602082840312156144f7575f80fd5b5051919050565b5f6020828403121561450e575f80fd5b8151613f6d8161418d565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561254757612547614519565b8082018082111561254757612547614519565b5f60208284031215614563575f80fd5b8151613f6d81614129565b5f825161457f818460208701614453565b919091019291505056fe353530307c44656c6179656453657474696e67733a2076616c756520616c726561647920696e697469616c697a6564353330327c4163636f756e743a206f6e6c792070726f636573736f722063616e2063616c6c20746869732066756e6374696f6e353334307c4163636f756e743a20736574746c656d656e7420706572696f64206973206e6f74206f766572353432307c526566756e64733a20726566756e64207265636f726420616c726561647920657869737473353336307c4163636f756e743a2070726f636573736f7220616c726561647920736574353531307c4f6e6554696d6550617373776f72643a20696e76616c6964204f545020636f756e746572353335307c4163636f756e743a20726573756c74696e672076657269666965642062616c616e6365206e6f742065717569616c20746f2062616c616e636520616e64206e6f742030353431307c44656c617965645769746864726177616c733a207769746864726177616c2074696d656c6f636b206e6f742065787072696564353332307c4163636f756e743a207472616e73616374696f6e206e6f7420666f756e6476d8021c4b979e99674b80f4e0cc10154af0e5f32df05eb51b29a464e2435500353130317c436f6d6d6f6e3a20696e73756666696369656e742066756e6473003486e95df892f06bd37fd38c44e2fee4c4efb6660a66e6eb20ed6d8a167eae0076d8021c4b979e99674b80f4e0cc10154af0e5f32df05eb51b29a464e2435501353432317c526566756e64733a20726566756e64207265636f7264206e6f7420666f756e64353430337c446562743a20616d6f756e7420697320686967686572207468616e2064656274353532317c4163636f756e744c696d6974733a207370656e64206c696d6974206578636565646564353531317c4f6e6554696d6550617373776f72643a20696e76616c6964204f5450360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc353532337c4163636f756e744c696d6974733a206e6f206f7470207370656e64206c696d6974206578636565646564353532307c4163636f756e744c696d6974733a20616d6f756e7420657863656564732073696e676c65207472616e73616374696f6e206c696d6974353331327c4163636f756e743a2063617264206f72204f5450207374617465206368616e676520697320696e2070726f6772657373353530317c44656c6179656453657474696e67733a2076616c756520616c726561647920736574353332317c4163636f756e743a206e657720616d6f756e7420697320657175616c206f7220686967686572207468616e20617574686f72697a6564353432337c526566756e64733a2070656e64696e6720616d6f756e74206578636565647320746f74616c353331307c4163636f756e743a207472616e73616374696f6e20494420616c72656164792075736564353333307c4163636f756e743a2076657269666965642062616c616e6365206e6f7420657175616c20746f2062616c616e6365353533317c5370656e644c696d6974733a20696e73756666696369656e74207370656e7420746f2063616e63656c353330347c4163636f756e743a20696e73756666696369656e7420626c6f636b656420616d6f756e74353432327c526566756e64733a20696e76616c696420616d6f756e74207265636569766564353330317c4163636f756e743a206f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e353337307c4163636f756e743a20756e617574686f72697a656420696d706c656d656e746174696f6ea264697066735822122012a8bf0b550c0636d300948851d60c701346e82b5d29b544481d654d6f3ba1f164736f6c63430008160033"; + + public static final String FUNC_UPGRADE_INTERFACE_VERSION = "UPGRADE_INTERFACE_VERSION"; + + public static final String FUNC_AUTHORIZEDTRANSACTIONS = "authorizedTransactions"; + + public static final String FUNC_AVAILABLEFORDEBTPAYMENT = "availableForDebtPayment"; + + public static final String FUNC_AVAILABLEFORPAYMENT = "availableForPayment"; + + public static final String FUNC_AVAILABLEFORWITHDRAWAL = "availableForWithdrawal"; + + public static final String FUNC_BLOCKEDAMOUNT = "blockedAmount"; + + public static final String FUNC_CANCELWITHDRAWAL = "cancelWithdrawal"; + + public static final String FUNC_CARDWITHOTP = "cardWithOtp"; + + public static final String FUNC_DEBTAMOUNT = "debtAmount"; + + public static final String FUNC_FACTORY = "factory"; + + public static final String FUNC_INCREASEVERIFIEDBALANCE = "increaseVerifiedBalance"; + + public static final String FUNC_INITWITHDRAWAL = "initWithdrawal"; + + public static final String FUNC_INITIALIZE = "initialize"; + + public static final String FUNC_ISTRUSTEDFORWARDER = "isTrustedForwarder"; + + public static final String FUNC_ISWITHDRAWALINPROGRESS = "isWithdrawalInProgress"; + + public static final String FUNC_ISWITHDRAWALREADY = "isWithdrawalReady"; + + public static final String FUNC_LIMITS = "limits"; + + public static final String FUNC_OWNERWALLET = "ownerWallet"; + + public static final String FUNC_PAYMENTTOKEN = "paymentToken"; + + public static final String FUNC_PENDINGREFUNDAMOUNT = "pendingRefundAmount"; + + public static final String FUNC_PENDINGREFUNDTOTAL = "pendingRefundTotal"; + + public static final String FUNC_PROCESSAUTHORIZATION = "processAuthorization"; + + public static final String FUNC_PROCESSAUTHORIZATIONCHANGE = "processAuthorizationChange"; + + public static final String FUNC_PROCESSAUTHORIZATIONNOOTP = "processAuthorizationNoOtp"; + + public static final String FUNC_PROCESSDEBT = "processDebt"; + + public static final String FUNC_PROCESSPENDINGREFUNDPAYMENT = "processPendingRefundPayment"; + + public static final String FUNC_PROCESSREFUNDPAYMENT = "processRefundPayment"; + + public static final String FUNC_PROCESSSETTLEMENT = "processSettlement"; + + public static final String FUNC_PROCESSWITHDRAWAL = "processWithdrawal"; + + public static final String FUNC_PROCESSOR = "processor"; + + public static final String FUNC_PROXIABLEUUID = "proxiableUUID"; + + public static final String FUNC_SAVEPENDINGREFUND = "savePendingRefund"; + + public static final String FUNC_SECURITYDELAY = "securityDelay"; + + public static final String FUNC_SETCARD = "setCard"; + + public static final String FUNC_SETLIMITS = "setLimits"; + + public static final String FUNC_SETOTPSTATE = "setOtpState"; + + public static final String FUNC_SETOWNERWALLET = "setOwnerWallet"; + + public static final String FUNC_SETPROCESSOR = "setProcessor"; + + public static final String FUNC_SETVERIFIEDBALANCE = "setVerifiedBalance"; + + public static final String FUNC_SETTLEMENTPERIOD = "settlementPeriod"; + + public static final String FUNC_TRUSTEDFORWARDER = "trustedForwarder"; + + public static final String FUNC_UNBLOCKUNSETTLEDTRANSACTION = "unblockUnsettledTransaction"; + + public static final String FUNC_UPGRADETOANDCALL = "upgradeToAndCall"; + + public static final String FUNC_VERIFIEDBALANCE = "verifiedBalance"; + + public static final String FUNC_WITHDRAWALAMOUNT = "withdrawalAmount"; + + public static final String FUNC_WITHDRAWALREADYTIMESTAMP = "withdrawalReadyTimestamp"; + + public static final String FUNC_WRITEOFFDEBT = "writeOffDebt"; + + public static final Event ACCOUNTSTATEAFTERSETTLEMENT_EVENT = new Event("AccountStateAfterSettlement", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event CARDSET_EVENT = new Event("CardSet", + Arrays.asList(new TypeReference

() { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event DEBTINCREASED_EVENT = new Event("DebtIncreased", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + })); + + public static final Event DEBTPAID_EVENT = new Event("DebtPaid", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + })); + + public static final Event DEBTWRITTENOFF_EVENT = new Event("DebtWrittenOff", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + })); + + public static final Event INITIALIZED_EVENT = new Event("Initialized", + List.of(new TypeReference() { + })); + + public static final Event INSUFFICIENTFUNDSONFORCEDAUTH_EVENT = new Event("InsufficientFundsOnForcedAuth", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event LIMITSSET_EVENT = new Event("LimitsSet", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event NOOTPTRANSACTIONAUTHORIZED_EVENT = new Event("NoOtpTransactionAuthorized", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event OTPSTATESET_EVENT = new Event("OtpStateSet", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + })); + + public static final Event OWNERWALLETSET_EVENT = new Event("OwnerWalletSet", + List.of(new TypeReference
() { + })); + + public static final Event PENDINGREFUNDSAVED_EVENT = new Event("PendingRefundSaved", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event PROCESSORSET_EVENT = new Event("ProcessorSet", + Arrays.asList(new TypeReference
() { + }, new TypeReference
() { + })); + + public static final Event REFUNDPAID_EVENT = new Event("RefundPaid", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event TRANSACTIONAMOUNTCHANGED_EVENT = new Event("TransactionAmountChanged", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event TRANSACTIONAUTHORIZED_EVENT = new Event("TransactionAuthorized", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event TRANSACTIONSETTLED_EVENT = new Event("TransactionSettled", + Arrays.asList(new TypeReference(true) { + }, new TypeReference(true) { + }, new TypeReference() { + }, new TypeReference() { + })); + + public static final Event UNSETTLEDTRANSACTIONUNBLOCKED_EVENT = new Event("UnsettledTransactionUnblocked", + Arrays.asList(new TypeReference(true) { + }, new TypeReference() { + })); + + public static final Event UPGRADED_EVENT = new Event("Upgraded", + List.of(new TypeReference
(true) { + })); + + public static final Event VERIFIEDBALANCEINCREASED_EVENT = new Event("VerifiedBalanceIncreased", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + })); + + public static final Event VERIFIEDBALANCESET_EVENT = new Event("VerifiedBalanceSet", + List.of(new TypeReference() { + })); + + public static final Event WITHDRAWALCANCELED_EVENT = new Event("WithdrawalCanceled", + List.of()); + + public static final Event WITHDRAWALCOMPLETE_EVENT = new Event("WithdrawalComplete", + Arrays.asList(new TypeReference
(true) { + }, new TypeReference() { + })); + + public static final Event WITHDRAWALINITIATED_EVENT = new Event("WithdrawalInitiated", + Arrays.asList(new TypeReference() { + }, new TypeReference() { + })); + + @Deprecated + protected TangemPaymentAccount(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected TangemPaymentAccount(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected TangemPaymentAccount(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected TangemPaymentAccount(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static List getAccountStateAfterSettlementEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(ACCOUNTSTATEAFTERSETTLEMENT_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + AccountStateAfterSettlementEventResponse typedResponse = new AccountStateAfterSettlementEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.balance = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.blockedAmount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.debtTotal = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + typedResponse.pendingRefundTotal = (BigInteger) eventValues.getNonIndexedValues().get(3).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static AccountStateAfterSettlementEventResponse getAccountStateAfterSettlementEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(ACCOUNTSTATEAFTERSETTLEMENT_EVENT, log); + AccountStateAfterSettlementEventResponse typedResponse = new AccountStateAfterSettlementEventResponse(); + typedResponse.log = log; + typedResponse.balance = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.blockedAmount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.debtTotal = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + typedResponse.pendingRefundTotal = (BigInteger) eventValues.getNonIndexedValues().get(3).getValue(); + return typedResponse; + } + + public static List getCardSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(CARDSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + CardSetEventResponse typedResponse = new CardSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.card = (String) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.otpRoot = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.otpCounter = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getDebtIncreasedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(DEBTINCREASED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + DebtIncreasedEventResponse typedResponse = new DebtIncreasedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.increase = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.debtAmount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getDebtPaidEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(DEBTPAID_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + DebtPaidEventResponse typedResponse = new DebtPaidEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.paid = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.debtLeft = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static CardSetEventResponse getCardSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(CARDSET_EVENT, log); + CardSetEventResponse typedResponse = new CardSetEventResponse(); + typedResponse.log = log; + typedResponse.card = (String) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.otpRoot = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.otpCounter = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + return typedResponse; + } + + public static List getDebtWrittenOffEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(DEBTWRITTENOFF_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + DebtWrittenOffEventResponse typedResponse = new DebtWrittenOffEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.writtenOff = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.debtLeft = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getInitializedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(INITIALIZED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + InitializedEventResponse typedResponse = new InitializedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.version = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getInsufficientFundsOnForcedAuthEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(INSUFFICIENTFUNDSONFORCEDAUTH_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + InsufficientFundsOnForcedAuthEventResponse typedResponse = new InsufficientFundsOnForcedAuthEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.insufficientAmount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static DebtIncreasedEventResponse getDebtIncreasedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(DEBTINCREASED_EVENT, log); + DebtIncreasedEventResponse typedResponse = new DebtIncreasedEventResponse(); + typedResponse.log = log; + typedResponse.increase = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.debtAmount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static List getLimitsSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(LIMITSSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + LimitsSetEventResponse typedResponse = new LimitsSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.singleTransactionLimit = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.spendLimit = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.noOtpSpendLimit = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + typedResponse.spendLimitsPeriod = (BigInteger) eventValues.getNonIndexedValues().get(3).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getNoOtpTransactionAuthorizedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(NOOTPTRANSACTIONAUTHORIZED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + NoOtpTransactionAuthorizedEventResponse typedResponse = new NoOtpTransactionAuthorizedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getOtpStateSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OTPSTATESET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + OtpStateSetEventResponse typedResponse = new OtpStateSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.otpRoot = (byte[]) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.otpCounter = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static DebtPaidEventResponse getDebtPaidEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(DEBTPAID_EVENT, log); + DebtPaidEventResponse typedResponse = new DebtPaidEventResponse(); + typedResponse.log = log; + typedResponse.paid = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.debtLeft = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static List getOwnerWalletSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OWNERWALLETSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + OwnerWalletSetEventResponse typedResponse = new OwnerWalletSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.ownerWallet = (String) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getPendingRefundSavedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(PENDINGREFUNDSAVED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + PendingRefundSavedEventResponse typedResponse = new PendingRefundSavedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getProcessorSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(PROCESSORSET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + ProcessorSetEventResponse typedResponse = new ProcessorSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.processor = (String) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.paymentToken = (String) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static DebtWrittenOffEventResponse getDebtWrittenOffEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(DEBTWRITTENOFF_EVENT, log); + DebtWrittenOffEventResponse typedResponse = new DebtWrittenOffEventResponse(); + typedResponse.log = log; + typedResponse.writtenOff = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.debtLeft = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static List getRefundPaidEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(REFUNDPAID_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + RefundPaidEventResponse typedResponse = new RefundPaidEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getTransactionAmountChangedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSACTIONAMOUNTCHANGED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + TransactionAmountChangedEventResponse typedResponse = new TransactionAmountChangedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.newAmount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getTransactionAuthorizedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSACTIONAUTHORIZED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + TransactionAuthorizedEventResponse typedResponse = new TransactionAuthorizedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.otp = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.otpCounter = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static InitializedEventResponse getInitializedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(INITIALIZED_EVENT, log); + InitializedEventResponse typedResponse = new InitializedEventResponse(); + typedResponse.log = log; + typedResponse.version = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static List getTransactionSettledEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSACTIONSETTLED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + TransactionSettledEventResponse typedResponse = new TransactionSettledEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.settlementId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.settlementAmount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.paymentAmount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getUnsettledTransactionUnblockedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(UNSETTLEDTRANSACTIONUNBLOCKED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + UnsettledTransactionUnblockedEventResponse typedResponse = new UnsettledTransactionUnblockedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getUpgradedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(UPGRADED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + UpgradedEventResponse typedResponse = new UpgradedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.implementation = (String) eventValues.getIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static InsufficientFundsOnForcedAuthEventResponse getInsufficientFundsOnForcedAuthEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(INSUFFICIENTFUNDSONFORCEDAUTH_EVENT, log); + InsufficientFundsOnForcedAuthEventResponse typedResponse = new InsufficientFundsOnForcedAuthEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.insufficientAmount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static List getVerifiedBalanceIncreasedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(VERIFIEDBALANCEINCREASED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + VerifiedBalanceIncreasedEventResponse typedResponse = new VerifiedBalanceIncreasedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.increase = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.verifiedBalance = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getVerifiedBalanceSetEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(VERIFIEDBALANCESET_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + VerifiedBalanceSetEventResponse typedResponse = new VerifiedBalanceSetEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.verifiedBalance = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getWithdrawalCanceledEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(WITHDRAWALCANCELED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + WithdrawalCanceledEventResponse typedResponse = new WithdrawalCanceledEventResponse(); + typedResponse.log = eventValues.getLog(); + responses.add(typedResponse); + } + return responses; + } + + public static LimitsSetEventResponse getLimitsSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(LIMITSSET_EVENT, log); + LimitsSetEventResponse typedResponse = new LimitsSetEventResponse(); + typedResponse.log = log; + typedResponse.singleTransactionLimit = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.spendLimit = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.noOtpSpendLimit = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + typedResponse.spendLimitsPeriod = (BigInteger) eventValues.getNonIndexedValues().get(3).getValue(); + return typedResponse; + } + + public static List getWithdrawalCompleteEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(WITHDRAWALCOMPLETE_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + WithdrawalCompleteEventResponse typedResponse = new WithdrawalCompleteEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.to = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public static List getWithdrawalInitiatedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(WITHDRAWALINITIATED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (EventValuesWithLog eventValues : valueList) { + WithdrawalInitiatedEventResponse typedResponse = new WithdrawalInitiatedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.readyToWithdrawTimestamp = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + @Deprecated + public static TangemPaymentAccount load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new TangemPaymentAccount(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + public static NoOtpTransactionAuthorizedEventResponse getNoOtpTransactionAuthorizedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(NOOTPTRANSACTIONAUTHORIZED_EVENT, log); + NoOtpTransactionAuthorizedEventResponse typedResponse = new NoOtpTransactionAuthorizedEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + @Deprecated + public static TangemPaymentAccount load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new TangemPaymentAccount(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static TangemPaymentAccount load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new TangemPaymentAccount(contractAddress, web3j, credentials, contractGasProvider); + } + + public static TangemPaymentAccount load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new TangemPaymentAccount(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static OtpStateSetEventResponse getOtpStateSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(OTPSTATESET_EVENT, log); + OtpStateSetEventResponse typedResponse = new OtpStateSetEventResponse(); + typedResponse.log = log; + typedResponse.otpRoot = (byte[]) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.otpCounter = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String trustedForwarder) { + String encodedConstructor = FunctionEncoder.encodeConstructor(List.of(new Address(160, trustedForwarder))); + return deployRemoteCall(TangemPaymentAccount.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String trustedForwarder) { + String encodedConstructor = FunctionEncoder.encodeConstructor(List.of(new Address(160, trustedForwarder))); + return deployRemoteCall(TangemPaymentAccount.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String trustedForwarder) { + String encodedConstructor = FunctionEncoder.encodeConstructor(List.of(new Address(160, trustedForwarder))); + return deployRemoteCall(TangemPaymentAccount.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + public static OwnerWalletSetEventResponse getOwnerWalletSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(OWNERWALLETSET_EVENT, log); + OwnerWalletSetEventResponse typedResponse = new OwnerWalletSetEventResponse(); + typedResponse.log = log; + typedResponse.ownerWallet = (String) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String trustedForwarder) { + String encodedConstructor = FunctionEncoder.encodeConstructor(List.of(new Address(160, trustedForwarder))); + return deployRemoteCall(TangemPaymentAccount.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + public static PendingRefundSavedEventResponse getPendingRefundSavedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(PENDINGREFUNDSAVED_EVENT, log); + PendingRefundSavedEventResponse typedResponse = new PendingRefundSavedEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static ProcessorSetEventResponse getProcessorSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(PROCESSORSET_EVENT, log); + ProcessorSetEventResponse typedResponse = new ProcessorSetEventResponse(); + typedResponse.log = log; + typedResponse.processor = (String) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.paymentToken = (String) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static RefundPaidEventResponse getRefundPaidEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(REFUNDPAID_EVENT, log); + RefundPaidEventResponse typedResponse = new RefundPaidEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static TransactionAmountChangedEventResponse getTransactionAmountChangedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(TRANSACTIONAMOUNTCHANGED_EVENT, log); + TransactionAmountChangedEventResponse typedResponse = new TransactionAmountChangedEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.newAmount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static TransactionAuthorizedEventResponse getTransactionAuthorizedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(TRANSACTIONAUTHORIZED_EVENT, log); + TransactionAuthorizedEventResponse typedResponse = new TransactionAuthorizedEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.otp = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); + typedResponse.otpCounter = (BigInteger) eventValues.getNonIndexedValues().get(2).getValue(); + return typedResponse; + } + + public static TransactionSettledEventResponse getTransactionSettledEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(TRANSACTIONSETTLED_EVENT, log); + TransactionSettledEventResponse typedResponse = new TransactionSettledEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.settlementId = (BigInteger) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.settlementAmount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.paymentAmount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static UnsettledTransactionUnblockedEventResponse getUnsettledTransactionUnblockedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(UNSETTLEDTRANSACTIONUNBLOCKED_EVENT, log); + UnsettledTransactionUnblockedEventResponse typedResponse = new UnsettledTransactionUnblockedEventResponse(); + typedResponse.log = log; + typedResponse.transactionId = (BigInteger) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static UpgradedEventResponse getUpgradedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(UPGRADED_EVENT, log); + UpgradedEventResponse typedResponse = new UpgradedEventResponse(); + typedResponse.log = log; + typedResponse.implementation = (String) eventValues.getIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static VerifiedBalanceIncreasedEventResponse getVerifiedBalanceIncreasedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(VERIFIEDBALANCEINCREASED_EVENT, log); + VerifiedBalanceIncreasedEventResponse typedResponse = new VerifiedBalanceIncreasedEventResponse(); + typedResponse.log = log; + typedResponse.increase = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.verifiedBalance = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public static VerifiedBalanceSetEventResponse getVerifiedBalanceSetEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(VERIFIEDBALANCESET_EVENT, log); + VerifiedBalanceSetEventResponse typedResponse = new VerifiedBalanceSetEventResponse(); + typedResponse.log = log; + typedResponse.verifiedBalance = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static WithdrawalCanceledEventResponse getWithdrawalCanceledEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(WITHDRAWALCANCELED_EVENT, log); + WithdrawalCanceledEventResponse typedResponse = new WithdrawalCanceledEventResponse(); + typedResponse.log = log; + return typedResponse; + } + + public static WithdrawalCompleteEventResponse getWithdrawalCompleteEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(WITHDRAWALCOMPLETE_EVENT, log); + WithdrawalCompleteEventResponse typedResponse = new WithdrawalCompleteEventResponse(); + typedResponse.log = log; + typedResponse.to = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + return typedResponse; + } + + public static WithdrawalInitiatedEventResponse getWithdrawalInitiatedEventFromLog(Log log) { + EventValuesWithLog eventValues = staticExtractEventParametersWithLog(WITHDRAWALINITIATED_EVENT, log); + WithdrawalInitiatedEventResponse typedResponse = new WithdrawalInitiatedEventResponse(); + typedResponse.log = log; + typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.readyToWithdrawTimestamp = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue(); + return typedResponse; + } + + public Flowable accountStateAfterSettlementEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getAccountStateAfterSettlementEventFromLog(log)); + } + + public Flowable accountStateAfterSettlementEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(ACCOUNTSTATEAFTERSETTLEMENT_EVENT)); + return accountStateAfterSettlementEventFlowable(filter); + } + + public Flowable cardSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getCardSetEventFromLog(log)); + } + + public Flowable cardSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(CARDSET_EVENT)); + return cardSetEventFlowable(filter); + } + + public Flowable debtIncreasedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getDebtIncreasedEventFromLog(log)); + } + + public Flowable debtIncreasedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(DEBTINCREASED_EVENT)); + return debtIncreasedEventFlowable(filter); + } + + public Flowable debtPaidEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getDebtPaidEventFromLog(log)); + } + + public Flowable debtPaidEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(DEBTPAID_EVENT)); + return debtPaidEventFlowable(filter); + } + + public Flowable debtWrittenOffEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getDebtWrittenOffEventFromLog(log)); + } + + public Flowable debtWrittenOffEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(DEBTWRITTENOFF_EVENT)); + return debtWrittenOffEventFlowable(filter); + } + + public Flowable initializedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getInitializedEventFromLog(log)); + } + + public Flowable initializedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(INITIALIZED_EVENT)); + return initializedEventFlowable(filter); + } + + public Flowable insufficientFundsOnForcedAuthEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getInsufficientFundsOnForcedAuthEventFromLog(log)); + } + + public Flowable insufficientFundsOnForcedAuthEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(INSUFFICIENTFUNDSONFORCEDAUTH_EVENT)); + return insufficientFundsOnForcedAuthEventFlowable(filter); + } + + public Flowable limitsSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getLimitsSetEventFromLog(log)); + } + + public Flowable limitsSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(LIMITSSET_EVENT)); + return limitsSetEventFlowable(filter); + } + + public Flowable noOtpTransactionAuthorizedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getNoOtpTransactionAuthorizedEventFromLog(log)); + } + + public Flowable noOtpTransactionAuthorizedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(NOOTPTRANSACTIONAUTHORIZED_EVENT)); + return noOtpTransactionAuthorizedEventFlowable(filter); + } + + public Flowable otpStateSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getOtpStateSetEventFromLog(log)); + } + + public Flowable otpStateSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(OTPSTATESET_EVENT)); + return otpStateSetEventFlowable(filter); + } + + public Flowable ownerWalletSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getOwnerWalletSetEventFromLog(log)); + } + + public Flowable ownerWalletSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(OWNERWALLETSET_EVENT)); + return ownerWalletSetEventFlowable(filter); + } + + public Flowable pendingRefundSavedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getPendingRefundSavedEventFromLog(log)); + } + + public Flowable pendingRefundSavedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(PENDINGREFUNDSAVED_EVENT)); + return pendingRefundSavedEventFlowable(filter); + } + + public Flowable processorSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getProcessorSetEventFromLog(log)); + } + + public Flowable processorSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(PROCESSORSET_EVENT)); + return processorSetEventFlowable(filter); + } + + public Flowable refundPaidEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getRefundPaidEventFromLog(log)); + } + + public Flowable refundPaidEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(REFUNDPAID_EVENT)); + return refundPaidEventFlowable(filter); + } + + public Flowable transactionAmountChangedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getTransactionAmountChangedEventFromLog(log)); + } + + public Flowable transactionAmountChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(TRANSACTIONAMOUNTCHANGED_EVENT)); + return transactionAmountChangedEventFlowable(filter); + } + + public Flowable transactionAuthorizedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getTransactionAuthorizedEventFromLog(log)); + } + + public Flowable transactionAuthorizedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(TRANSACTIONAUTHORIZED_EVENT)); + return transactionAuthorizedEventFlowable(filter); + } + + public Flowable transactionSettledEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getTransactionSettledEventFromLog(log)); + } + + public Flowable transactionSettledEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(TRANSACTIONSETTLED_EVENT)); + return transactionSettledEventFlowable(filter); + } + + public Flowable unsettledTransactionUnblockedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getUnsettledTransactionUnblockedEventFromLog(log)); + } + + public Flowable unsettledTransactionUnblockedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(UNSETTLEDTRANSACTIONUNBLOCKED_EVENT)); + return unsettledTransactionUnblockedEventFlowable(filter); + } + + public Flowable upgradedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getUpgradedEventFromLog(log)); + } + + public Flowable upgradedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(UPGRADED_EVENT)); + return upgradedEventFlowable(filter); + } + + public Flowable withdrawalInitiatedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getWithdrawalInitiatedEventFromLog(log)); + } + + public Flowable withdrawalInitiatedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(WITHDRAWALINITIATED_EVENT)); + return withdrawalInitiatedEventFlowable(filter); + } + + public Flowable verifiedBalanceIncreasedEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getVerifiedBalanceIncreasedEventFromLog(log)); + } + + public Flowable verifiedBalanceIncreasedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(VERIFIEDBALANCEINCREASED_EVENT)); + return verifiedBalanceIncreasedEventFlowable(filter); + } + + public Flowable verifiedBalanceSetEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getVerifiedBalanceSetEventFromLog(log)); + } + + public Flowable verifiedBalanceSetEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(VERIFIEDBALANCESET_EVENT)); + return verifiedBalanceSetEventFlowable(filter); + } + + public Flowable withdrawalCanceledEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getWithdrawalCanceledEventFromLog(log)); + } + + public Flowable withdrawalCanceledEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(WITHDRAWALCANCELED_EVENT)); + return withdrawalCanceledEventFlowable(filter); + } + + public Flowable withdrawalCompleteEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(log -> getWithdrawalCompleteEventFromLog(log)); + } + + public Flowable withdrawalCompleteEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(WITHDRAWALCOMPLETE_EVENT)); + return withdrawalCompleteEventFlowable(filter); + } + + public RemoteFunctionCall UPGRADE_INTERFACE_VERSION() { + final Function function = new Function(FUNC_UPGRADE_INTERFACE_VERSION, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall> authorizedTransactions(BigInteger param0) { + final Function function = new Function(FUNC_AUTHORIZEDTRANSACTIONS, + List.of(new Uint256(param0)), + Arrays.asList(new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + })); + return new RemoteFunctionCall>(function, + new Callable>() { + @Override + public Tuple3 call() throws Exception { + List results = executeCallMultipleValueReturn(function); + return new Tuple3( + (BigInteger) results.get(0).getValue(), + (BigInteger) results.get(1).getValue(), + (Boolean) results.get(2).getValue()); + } + }); + } + + public RemoteFunctionCall availableForDebtPayment() { + final Function function = new Function(FUNC_AVAILABLEFORDEBTPAYMENT, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall availableForPayment() { + final Function function = new Function(FUNC_AVAILABLEFORPAYMENT, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall availableForWithdrawal() { + final Function function = new Function(FUNC_AVAILABLEFORWITHDRAWAL, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall blockedAmount() { + final Function function = new Function(FUNC_BLOCKEDAMOUNT, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall cancelWithdrawal() { + final Function function = new Function( + FUNC_CANCELWITHDRAWAL, + List.of(), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall> cardWithOtp() { + final Function function = new Function(FUNC_CARDWITHOTP, + List.of(), + Arrays.asList(new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + })); + return new RemoteFunctionCall>(function, + new Callable>() { + @Override + public Tuple3 call() throws Exception { + List results = executeCallMultipleValueReturn(function); + return new Tuple3( + (CardWithOtp) results.get(0), + (CardWithOtp) results.get(1), + (BigInteger) results.get(2).getValue()); + } + }); + } + + public RemoteFunctionCall debtAmount() { + final Function function = new Function(FUNC_DEBTAMOUNT, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall factory() { + final Function function = new Function(FUNC_FACTORY, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall increaseVerifiedBalance(BigInteger increase) { + final Function function = new Function( + FUNC_INCREASEVERIFIEDBALANCE, + List.of(new Uint256(increase)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall initWithdrawal(BigInteger amount) { + final Function function = new Function( + FUNC_INITWITHDRAWAL, + List.of(new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall initialize(String ownerWallet_, BigInteger singleTransactionLimit, BigInteger spendLimit, BigInteger noOtpSpendLimit, BigInteger spendLimitsPeriod) { + final Function function = new Function( + FUNC_INITIALIZE, + Arrays.asList(new Address(160, ownerWallet_), + new Uint256(singleTransactionLimit), + new Uint256(spendLimit), + new Uint256(noOtpSpendLimit), + new Uint256(spendLimitsPeriod)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall isTrustedForwarder(String forwarder) { + final Function function = new Function(FUNC_ISTRUSTEDFORWARDER, + List.of(new Address(160, forwarder)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteFunctionCall isWithdrawalInProgress() { + final Function function = new Function(FUNC_ISWITHDRAWALINPROGRESS, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteFunctionCall isWithdrawalReady() { + final Function function = new Function(FUNC_ISWITHDRAWALREADY, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteFunctionCall> limits() { + final Function function = new Function(FUNC_LIMITS, + List.of(), + Arrays.asList(new TypeReference() { + }, new TypeReference() { + }, new TypeReference() { + })); + return new RemoteFunctionCall>(function, + new Callable>() { + @Override + public Tuple3 call() throws Exception { + List results = executeCallMultipleValueReturn(function); + return new Tuple3( + (Limits) results.get(0), + (Limits) results.get(1), + (BigInteger) results.get(2).getValue()); + } + }); + } + + public RemoteFunctionCall ownerWallet() { + final Function function = new Function(FUNC_OWNERWALLET, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall paymentToken() { + final Function function = new Function(FUNC_PAYMENTTOKEN, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall pendingRefundAmount(BigInteger transactionId) { + final Function function = new Function(FUNC_PENDINGREFUNDAMOUNT, + List.of(new Uint256(transactionId)), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall pendingRefundTotal() { + final Function function = new Function(FUNC_PENDINGREFUNDTOTAL, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall processAuthorization(BigInteger transactionId, BigInteger amount, byte[] otp, BigInteger otpCounter, Boolean forced) { + final Function function = new Function( + FUNC_PROCESSAUTHORIZATION, + Arrays.asList(new Uint256(transactionId), + new Uint256(amount), + new Bytes16(otp), + new Uint16(otpCounter), + new Bool(forced)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processAuthorizationChange(BigInteger transactionId, BigInteger newAmount) { + final Function function = new Function( + FUNC_PROCESSAUTHORIZATIONCHANGE, + Arrays.asList(new Uint256(transactionId), + new Uint256(newAmount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processAuthorizationNoOtp(BigInteger transactionId, BigInteger amount, Boolean forced) { + final Function function = new Function( + FUNC_PROCESSAUTHORIZATIONNOOTP, + Arrays.asList(new Uint256(transactionId), + new Uint256(amount), + new Bool(forced)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processDebt(BigInteger amount) { + final Function function = new Function( + FUNC_PROCESSDEBT, + List.of(new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processPendingRefundPayment(BigInteger transactionId) { + final Function function = new Function( + FUNC_PROCESSPENDINGREFUNDPAYMENT, + List.of(new Uint256(transactionId)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processRefundPayment(BigInteger transactionId) { + final Function function = new Function( + FUNC_PROCESSREFUNDPAYMENT, + List.of(new Uint256(transactionId)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processSettlement(BigInteger transactionId, BigInteger settlementId, BigInteger amount) { + final Function function = new Function( + FUNC_PROCESSSETTLEMENT, + Arrays.asList(new Uint256(transactionId), + new Uint256(settlementId), + new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processWithdrawal(String to) { + final Function function = new Function( + FUNC_PROCESSWITHDRAWAL, + List.of(new Address(160, to)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall processor() { + final Function function = new Function(FUNC_PROCESSOR, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall proxiableUUID() { + final Function function = new Function(FUNC_PROXIABLEUUID, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteFunctionCall savePendingRefund(BigInteger transactionId, BigInteger amount) { + final Function function = new Function( + FUNC_SAVEPENDINGREFUND, + Arrays.asList(new Uint256(transactionId), + new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall securityDelay() { + final Function function = new Function(FUNC_SECURITYDELAY, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall setCard(String card, byte[] otpRoot, BigInteger otpCounter) { + final Function function = new Function( + FUNC_SETCARD, + Arrays.asList(new Address(160, card), + new Bytes16(otpRoot), + new Uint16(otpCounter)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setLimits(BigInteger singleTransactionLimit, BigInteger spendLimit, BigInteger noOtpSpendLimit, BigInteger spendLimitsPeriod) { + final Function function = new Function( + FUNC_SETLIMITS, + Arrays.asList(new Uint256(singleTransactionLimit), + new Uint256(spendLimit), + new Uint256(noOtpSpendLimit), + new Uint256(spendLimitsPeriod)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setOtpState(byte[] otp, BigInteger counter) { + final Function function = new Function( + FUNC_SETOTPSTATE, + Arrays.asList(new Bytes16(otp), + new Uint16(counter)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setOwnerWallet(String ownerWallet_) { + final Function function = new Function( + FUNC_SETOWNERWALLET, + List.of(new Address(160, ownerWallet_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setProcessor(String processor_) { + final Function function = new Function( + FUNC_SETPROCESSOR, + List.of(new Address(160, processor_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall setVerifiedBalance(BigInteger verifiedBalance_) { + final Function function = new Function( + FUNC_SETVERIFIEDBALANCE, + List.of(new Uint256(verifiedBalance_)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall settlementPeriod() { + final Function function = new Function(FUNC_SETTLEMENTPERIOD, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall trustedForwarder() { + final Function function = new Function(FUNC_TRUSTEDFORWARDER, + List.of(), + List.of(new TypeReference
() { + })); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteFunctionCall unblockUnsettledTransaction(BigInteger transactionId) { + final Function function = new Function( + FUNC_UNBLOCKUNSETTLEDTRANSACTION, + List.of(new Uint256(transactionId)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall upgradeToAndCall(String newImplementation, byte[] data, BigInteger weiValue) { + final Function function = new Function( + FUNC_UPGRADETOANDCALL, + Arrays.asList(new Address(160, newImplementation), + new org.web3j.abi.datatypes.DynamicBytes(data)), + Collections.emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + + public RemoteFunctionCall verifiedBalance() { + final Function function = new Function(FUNC_VERIFIEDBALANCE, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall withdrawalAmount() { + final Function function = new Function(FUNC_WITHDRAWALAMOUNT, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall withdrawalReadyTimestamp() { + final Function function = new Function(FUNC_WITHDRAWALREADYTIMESTAMP, + List.of(), + List.of(new TypeReference() { + })); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall writeOffDebt(BigInteger amount) { + final Function function = new Function( + FUNC_WRITEOFFDEBT, + List.of(new Uint256(amount)), + Collections.emptyList()); + return executeRemoteCallTransaction(function); + } + + public static class OtpState extends StaticStruct { + public byte[] otp; + + public BigInteger counter; + + public OtpState(byte[] otp, BigInteger counter) { + super(new Bytes16(otp), + new Uint16(counter)); + this.otp = otp; + this.counter = counter; + } + + public OtpState(Bytes16 otp, Uint16 counter) { + super(otp, counter); + this.otp = otp.getValue(); + this.counter = counter.getValue(); + } + } + + public static class Limit extends StaticStruct { + public BigInteger _00_limit; + + public BigInteger _01_spent; + + public Limit(BigInteger limit, BigInteger spent) { + super(new Uint256(limit), + new Uint256(spent)); + this._00_limit = limit; + this._01_spent = spent; + } + + public Limit(Uint256 limit, Uint256 spent) { + super(limit, spent); + this._00_limit = limit.getValue(); + this._01_spent = spent.getValue(); + } + } + + public static class Timer extends StaticStruct { + public BigInteger expireTimestamp; + + public Timer(BigInteger expireTimestamp) { + super(new Uint256(expireTimestamp)); + this.expireTimestamp = expireTimestamp; + } + + public Timer(Uint256 expireTimestamp) { + super(expireTimestamp); + this.expireTimestamp = expireTimestamp.getValue(); + } + } + + public static class CardWithOtp extends StaticStruct { + public String card; + + public OtpState otpState; + + public CardWithOtp(String card, OtpState otpState) { + super(new Address(160, card), + otpState); + this.card = card; + this.otpState = otpState; + } + + public CardWithOtp(Address card, OtpState otpState) { + super(card, otpState); + this.card = card.getValue(); + this.otpState = otpState; + } + } + + public static class Limits extends StaticStruct { + public BigInteger _00_singleTransactionLimit; + + public Limit _01_spendLimit; + + public Limit _02_noOtpSpendLimit; + + public Timer _03_spendLimitsTimer; + + public BigInteger _04_spendLimitsPeriod; + + public Limits(BigInteger singleTransactionLimit, Limit spendLimit, Limit noOtpSpendLimit, Timer spendLimitsTimer, BigInteger spendLimitsPeriod) { + super(new Uint256(singleTransactionLimit), + spendLimit, + noOtpSpendLimit, + spendLimitsTimer, + new Uint256(spendLimitsPeriod)); + this._00_singleTransactionLimit = singleTransactionLimit; + this._01_spendLimit = spendLimit; + this._02_noOtpSpendLimit = noOtpSpendLimit; + this._03_spendLimitsTimer = spendLimitsTimer; + this._04_spendLimitsPeriod = spendLimitsPeriod; + } + + public Limits(Uint256 singleTransactionLimit, Limit spendLimit, Limit noOtpSpendLimit, Timer spendLimitsTimer, Uint256 spendLimitsPeriod) { + super(singleTransactionLimit, spendLimit, noOtpSpendLimit, spendLimitsTimer, spendLimitsPeriod); + this._00_singleTransactionLimit = singleTransactionLimit.getValue(); + this._01_spendLimit = spendLimit; + this._02_noOtpSpendLimit = noOtpSpendLimit; + this._03_spendLimitsTimer = spendLimitsTimer; + this._04_spendLimitsPeriod = spendLimitsPeriod.getValue(); + } + } + + public static class AccountStateAfterSettlementEventResponse extends BaseEventResponse { + public BigInteger balance; + + public BigInteger blockedAmount; + + public BigInteger debtTotal; + + public BigInteger pendingRefundTotal; + } + + public static class CardSetEventResponse extends BaseEventResponse { + public String card; + + public byte[] otpRoot; + + public BigInteger otpCounter; + } + + public static class DebtIncreasedEventResponse extends BaseEventResponse { + public BigInteger increase; + + public BigInteger debtAmount; + } + + public static class DebtPaidEventResponse extends BaseEventResponse { + public BigInteger paid; + + public BigInteger debtLeft; + } + + public static class DebtWrittenOffEventResponse extends BaseEventResponse { + public BigInteger writtenOff; + + public BigInteger debtLeft; + } + + public static class InitializedEventResponse extends BaseEventResponse { + public BigInteger version; + } + + public static class InsufficientFundsOnForcedAuthEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger insufficientAmount; + } + + public static class LimitsSetEventResponse extends BaseEventResponse { + public BigInteger singleTransactionLimit; + + public BigInteger spendLimit; + + public BigInteger noOtpSpendLimit; + + public BigInteger spendLimitsPeriod; + } + + public static class NoOtpTransactionAuthorizedEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class OtpStateSetEventResponse extends BaseEventResponse { + public byte[] otpRoot; + + public BigInteger otpCounter; + } + + public static class OwnerWalletSetEventResponse extends BaseEventResponse { + public String ownerWallet; + } + + public static class PendingRefundSavedEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class ProcessorSetEventResponse extends BaseEventResponse { + public String processor; + + public String paymentToken; + } + + public static class RefundPaidEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class TransactionAmountChangedEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger newAmount; + } + + public static class TransactionAuthorizedEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger amount; + + public byte[] otp; + + public BigInteger otpCounter; + } + + public static class TransactionSettledEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger settlementId; + + public BigInteger settlementAmount; + + public BigInteger paymentAmount; + } + + public static class UnsettledTransactionUnblockedEventResponse extends BaseEventResponse { + public BigInteger transactionId; + + public BigInteger amount; + } + + public static class UpgradedEventResponse extends BaseEventResponse { + public String implementation; + } + + public static class VerifiedBalanceIncreasedEventResponse extends BaseEventResponse { + public BigInteger increase; + + public BigInteger verifiedBalance; + } + + public static class VerifiedBalanceSetEventResponse extends BaseEventResponse { + public BigInteger verifiedBalance; + } + + public static class WithdrawalCanceledEventResponse extends BaseEventResponse { + } + + public static class WithdrawalCompleteEventResponse extends BaseEventResponse { + public String to; + + public BigInteger amount; + } + + public static class WithdrawalInitiatedEventResponse extends BaseEventResponse { + public BigInteger amount; + + public BigInteger readyToWithdrawTimestamp; + } +} diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/DefaultVisaContractInfoProvider.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/DefaultVisaContractInfoProvider.kt new file mode 100644 index 0000000000..1b038aa5f9 --- /dev/null +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/DefaultVisaContractInfoProvider.kt @@ -0,0 +1,139 @@ +package com.tangem.lib.visa + +import arrow.fx.coroutines.parZip +import com.tangem.lib.visa.model.BalancesAndLimits +import com.tangem.lib.visa.model.BalancesAndLimits.Balances +import com.tangem.lib.visa.model.BalancesAndLimits.Limits +import com.tangem.lib.visa.utils.toBigDecimal +import com.tangem.lib.visa.utils.toInstant +import com.tangem.utils.coroutines.CoroutineDispatcherProvider +import kotlinx.coroutines.withContext +import org.joda.time.Instant +import org.web3j.protocol.Web3j +import org.web3j.tx.TransactionManager +import org.web3j.tx.gas.ContractGasProvider + +internal class DefaultVisaContractInfoProvider( + private val web3j: Web3j, + private val transactionManager: TransactionManager, + private val gasProvider: ContractGasProvider, + private val bridgeProcessorAddress: String, + private val dispatchers: CoroutineDispatcherProvider, +) : VisaContractInfoProvider { + + override suspend fun getBalancesAndLimits(walletAddress: String): BalancesAndLimits = withContext(dispatchers.io) { + val tangemBridgeProcessor = TangemBridgeProcessor.load( + /* contractAddress = */ bridgeProcessorAddress, + /* web3j = */ web3j, + /* transactionManager = */ transactionManager, + /* contractGasProvider = */ gasProvider, + ) + + parZip( + dispatchers.io, + { loadPaymentAccount(walletAddress, tangemBridgeProcessor) }, + { loadPaymentTokenInfo(tangemBridgeProcessor) }, + { paymentAccount, paymentToken -> + fetchBalancesAndLimits(paymentAccount, paymentToken) + }, + ) + } + + private fun loadPaymentAccount( + walletAddress: String, + tangemBridgeProcessor: TangemBridgeProcessor, + ): TangemPaymentAccount { + val paymentAccountAddress = tangemBridgeProcessor.getPaymentAccount(walletAddress).send() + + return TangemPaymentAccount.load(paymentAccountAddress, web3j, transactionManager, gasProvider) + } + + private fun loadPaymentTokenInfo(tangemBridgeProcessor: TangemBridgeProcessor): PaymentTokenInfo { + val paymentTokenContractAddress = tangemBridgeProcessor.paymentToken().send() + val paymentTokenContract = ERC20.load(paymentTokenContractAddress, web3j, transactionManager, gasProvider) + val paymentTokenDecimals = paymentTokenContract.decimals().send() + + return PaymentTokenInfo( + decimals = paymentTokenDecimals.toInt(), + contract = paymentTokenContract, + ) + } + + private suspend fun fetchBalancesAndLimits( + paymentAccount: TangemPaymentAccount, + paymentToken: PaymentTokenInfo, + ): BalancesAndLimits = parZip( + dispatchers.io, + { fetchBalances(paymentAccount, paymentToken) }, + { fetchLimits(paymentAccount, paymentToken) }, + { balances, (oldLimit, newLimit, changeDate) -> + BalancesAndLimits(balances, oldLimit, newLimit, changeDate) + }, + ) + + private suspend fun fetchBalances(paymentAccount: TangemPaymentAccount, paymentToken: PaymentTokenInfo): Balances { + return parZip( + dispatchers.io, + { paymentToken.contract.balanceOf(paymentAccount.contractAddress).send() }, + { paymentAccount.verifiedBalance().send() }, + { paymentAccount.availableForPayment().send() }, + { paymentAccount.availableForWithdrawal().send() }, + { paymentAccount.availableForDebtPayment().send() }, + { paymentAccount.blockedAmount().send() }, + { paymentAccount.debtAmount().send() }, + { paymentAccount.pendingRefundTotal().send() }, + ) { total, verified, payment, withdrawal, debtPayment, blocked, debt, refund -> + val decimals = paymentToken.decimals + + Balances( + total = total.toBigDecimal(decimals), + verified = verified.toBigDecimal(decimals), + available = Balances.Available( + forPayment = payment.toBigDecimal(decimals), + forWithdrawal = withdrawal.toBigDecimal(decimals), + forDebtPayment = debtPayment.toBigDecimal(decimals), + ), + blocked = blocked.toBigDecimal(decimals), + debt = debt.toBigDecimal(decimals), + pendingRefund = refund.toBigDecimal(decimals), + ) + } + } + + private fun fetchLimits( + paymentAccount: TangemPaymentAccount, + paymentToken: PaymentTokenInfo, + ): Triple { + val ( + oldLimit, + newLimit, + changeDateSeconds, + ) = paymentAccount.limits().send() + + return Triple( + first = getLimits(oldLimit, paymentToken), + second = getLimits(newLimit, paymentToken), + third = changeDateSeconds.toInstant(), + ) + } + + private fun getLimits(limit: TangemPaymentAccount.Limits, paymentToken: PaymentTokenInfo): Limits = Limits( + spendLimit = limit._01_spendLimit.toLimit(paymentToken.decimals), + noOtpLimit = limit._02_noOtpSpendLimit.toLimit(paymentToken.decimals), + singleTransactionLimit = limit._00_singleTransactionLimit.toBigDecimal(paymentToken.decimals), + expirationDate = limit._03_spendLimitsTimer.expireTimestamp.toInstant(), + spendPeriodSeconds = limit._04_spendLimitsPeriod, + ) + + private fun TangemPaymentAccount.Limit.toLimit(decimals: Int): Limits.Limit { + return Limits.Limit( + limit = _00_limit.toBigDecimal(decimals), + spent = _01_spent.toBigDecimal(decimals), + ) + } + + private data class PaymentTokenInfo( + val decimals: Int, + val contract: ERC20, + ) +} \ No newline at end of file diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/VisaContractInfoProvider.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/VisaContractInfoProvider.kt new file mode 100644 index 0000000000..efb5ab487a --- /dev/null +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/VisaContractInfoProvider.kt @@ -0,0 +1,90 @@ +package com.tangem.lib.visa + +import com.ihsanbal.logging.Level +import com.ihsanbal.logging.LoggingInterceptor +import com.tangem.lib.visa.model.BalancesAndLimits +import com.tangem.lib.visa.utils.VisaConfig +import com.tangem.lib.visa.utils.VisaConfig.NETWORK_LOGS_TAG +import com.tangem.lib.visa.utils.toHexString +import com.tangem.utils.coroutines.CoroutineDispatcherProvider +import okhttp3.OkHttpClient +import org.web3j.crypto.Credentials +import org.web3j.protocol.Web3j +import org.web3j.protocol.http.HttpService +import org.web3j.tx.FastRawTransactionManager +import org.web3j.tx.TransactionManager +import org.web3j.tx.gas.ContractGasProvider +import org.web3j.tx.gas.StaticEIP1559GasProvider +import java.math.BigDecimal +import java.math.BigInteger +import java.util.concurrent.TimeUnit + +interface VisaContractInfoProvider { + + suspend fun getBalancesAndLimits(walletAddress: String): BalancesAndLimits + + class Builder( + private val isNetworkLoggingEnabled: Boolean, + private val dispatchers: CoroutineDispatcherProvider, + private val baseUrl: String = VisaConfig.BASE_RPC_URL, + private val bridgeProcessorAddress: String = VisaConfig.BRIDGE_PROCESSOR_CONTRACT_ADDRESS, + private val chainId: Long = VisaConfig.CHAIN_ID, + private val networkTimeoutSeconds: Long = VisaConfig.NETWORK_TIMEOUT_SECONDS, + private val decimals: Int = VisaConfig.DECIMALS, + private val gasLimit: Long = VisaConfig.GAS_LIMIT, + private val privateKey: String = ByteArray(VisaConfig.PRIVATE_KEY_LENGTH).toHexString(), + ) { + + fun build(): VisaContractInfoProvider { + val web3j = createWeb3J() + val gasProvider = createGasProvider() + val transactionManager = createTransactionManager(web3j) + + return DefaultVisaContractInfoProvider( + web3j = web3j, + transactionManager = transactionManager, + gasProvider = gasProvider, + bridgeProcessorAddress = bridgeProcessorAddress, + dispatchers = dispatchers, + ) + } + + private fun createWeb3J(): Web3j { + val httpClient = OkHttpClient.Builder().apply { + connectTimeout(networkTimeoutSeconds, TimeUnit.SECONDS) + readTimeout(networkTimeoutSeconds, TimeUnit.SECONDS) + writeTimeout(networkTimeoutSeconds, TimeUnit.SECONDS) + + if (isNetworkLoggingEnabled) { + addInterceptor( + LoggingInterceptor.Builder() + .setLevel(Level.BODY) + .tag(NETWORK_LOGS_TAG) + .build(), + ) + } + }.build() + + val web3jService = HttpService( + /* url = */ baseUrl, + /* httpClient = */ httpClient, + /* includeRawResponses = */ false, + ) + + return Web3j.build(web3jService) + } + + private fun createGasProvider(): ContractGasProvider = StaticEIP1559GasProvider( + /* chainId = */ chainId, + /* maxFeePerGas = */ BigDecimal.ONE.movePointLeft(decimals).toBigInteger(), + /* maxPriorityFeePerGas = */ BigDecimal.ONE.movePointLeft(decimals).toBigInteger(), + /* gasLimit = */ BigInteger.valueOf(gasLimit), + ) + + private fun createTransactionManager(web3j: Web3j): TransactionManager = FastRawTransactionManager( + /* web3j = */ web3j, + /* credentials = */ Credentials.create(privateKey), + /* chainId = */ chainId, + ) + } +} \ No newline at end of file diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/BalancesAndLimits.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/BalancesAndLimits.kt new file mode 100644 index 0000000000..5098ee3c43 --- /dev/null +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/BalancesAndLimits.kt @@ -0,0 +1,43 @@ +package com.tangem.lib.visa.model + +import org.joda.time.Instant +import java.math.BigDecimal +import java.math.BigInteger + +data class BalancesAndLimits( + val balances: Balances, + val oldLimits: Limits, + val newLimits: Limits, + val limitsChangeDate: Instant, +) { + + data class Balances( + val total: BigDecimal, + val verified: BigDecimal, + val available: Available, + val blocked: BigDecimal, + val debt: BigDecimal, + val pendingRefund: BigDecimal, + ) { + + data class Available( + val forPayment: BigDecimal, + val forWithdrawal: BigDecimal, + val forDebtPayment: BigDecimal, + ) + } + + data class Limits( + val spendLimit: Limit, + val noOtpLimit: Limit, + val singleTransactionLimit: BigDecimal, + val expirationDate: Instant, + val spendPeriodSeconds: BigInteger, + ) { + + data class Limit( + val limit: BigDecimal, + val spent: BigDecimal, + ) + } +} \ No newline at end of file diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/BigIntegerExt.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/BigIntegerExt.kt new file mode 100644 index 0000000000..4b129ed3c4 --- /dev/null +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/BigIntegerExt.kt @@ -0,0 +1,13 @@ +package com.tangem.lib.visa.utils + +import org.joda.time.Instant +import java.math.BigDecimal +import java.math.BigInteger + +internal fun BigInteger.toBigDecimal(decimals: Int): BigDecimal { + return BigDecimal(this).movePointLeft(decimals) +} + +internal fun BigInteger.toInstant(): Instant { + return Instant.ofEpochSecond(toLong()) +} \ No newline at end of file diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/ByteArrayExt.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/ByteArrayExt.kt new file mode 100644 index 0000000000..3efd2be245 --- /dev/null +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/ByteArrayExt.kt @@ -0,0 +1,3 @@ +package com.tangem.lib.visa.utils + +internal fun ByteArray.toHexString(): String = joinToString("") { "%02X".format(it) } \ No newline at end of file diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/VisaConfig.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/VisaConfig.kt new file mode 100644 index 0000000000..6176a369e5 --- /dev/null +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/utils/VisaConfig.kt @@ -0,0 +1,14 @@ +package com.tangem.lib.visa.utils + +internal object VisaConfig { + + const val BASE_RPC_URL = "https://rpc-mumbai.maticvigil.com/" + const val BRIDGE_PROCESSOR_CONTRACT_ADDRESS = "0x62119697e78178512bfcc456ae6d1b7dee9fbaa6" + const val CHAIN_ID = 80_001L + const val DECIMALS = 9 + const val GAS_LIMIT = 500_000_000L + const val PRIVATE_KEY_LENGTH = 32 + + const val NETWORK_TIMEOUT_SECONDS = 65L + const val NETWORK_LOGS_TAG = "VisaNetworkLogs" +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 7fc4e85cba..3df3dad60b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -77,6 +77,7 @@ include(":core:deep-links:global") // region Libs modules include(":libs:crypto") include(":libs:auth") +include(":libs:visa") // endregion Libs modules // region Feature modules