From 9f07175b6a210aea168b1b31676d6aef925e1fd7 Mon Sep 17 00:00:00 2001 From: kyonRay Date: Tue, 4 Jun 2024 19:12:18 +0800 Subject: [PATCH] (V2,V3): fix call get struct value bug. --- build.gradle | 12 +-- .../org/fisco/bcos/codegen/CodeGenMain.java | 1 + .../v2/wrapper/SolidityContractWrapper.java | 83 +++++++------------ .../codegen/v3/wrapper/ContractWrapper.java | 74 ++--------------- .../bcos/codegen/v2/test/CodeGenV2Test.java | 7 ++ .../bcos/codegen/v3/test/CodeGenV3Test.java | 7 ++ src/test/resources/IRechargeV2.abi | 1 + 7 files changed, 61 insertions(+), 124 deletions(-) create mode 100644 src/test/resources/IRechargeV2.abi diff --git a/build.gradle b/build.gradle index 85e5e15..aa4e777 100644 --- a/build.gradle +++ b/build.gradle @@ -24,15 +24,15 @@ ext { ossrhPassword = "xxx" } // jackson version - jacksonVersion = '2.14.1' + jacksonVersion = '2.17.0' javapoetVersion = '1.13.0' - picocliVersion = '4.6.1' + picocliVersion = '4.7.6' junitVersion = '4.13.2' - commonsLang3Version = '3.12.0' + commonsLang3Version = '3.14.0' javaSDKVersion3 = "3.7.0" javaSDKVersion2 = "2.10.0" - slf4jVersion = "1.7.32" + slf4jVersion = "1.7.36" } sourceSets { @@ -54,7 +54,7 @@ configurations.all { // integrationTest.mustRunAfter test allprojects { group = 'org.fisco-bcos.code-generator' - version = '1.5.0' + version = '1.6.0-SNAPSHOT' apply plugin: 'maven-publish' apply plugin: 'idea' apply plugin: 'eclipse' @@ -86,7 +86,7 @@ allprojects { api("org.slf4j:slf4j-api:${slf4jVersion}") api("org.apache.commons:commons-lang3:${commonsLang3Version}") testImplementation("junit:junit:${junitVersion}") - testImplementation("org.mockito:mockito-core:4.6.0") + testImplementation('org.mockito:mockito-core:5.11.0') } clean.doLast { diff --git a/src/main/java/org/fisco/bcos/codegen/CodeGenMain.java b/src/main/java/org/fisco/bcos/codegen/CodeGenMain.java index 3bd71a1..0c7e6b7 100644 --- a/src/main/java/org/fisco/bcos/codegen/CodeGenMain.java +++ b/src/main/java/org/fisco/bcos/codegen/CodeGenMain.java @@ -147,6 +147,7 @@ public void run() { packageName) .generateJavaFiles(); } catch (Exception e) { + e.printStackTrace(); org.fisco.bcos.codegen.v2.utils.CodeGenUtils.exitError(e); } } else if (version.equals(Version.V3)) { diff --git a/src/main/java/org/fisco/bcos/codegen/v2/wrapper/SolidityContractWrapper.java b/src/main/java/org/fisco/bcos/codegen/v2/wrapper/SolidityContractWrapper.java index 29af75d..b2e6637 100644 --- a/src/main/java/org/fisco/bcos/codegen/v2/wrapper/SolidityContractWrapper.java +++ b/src/main/java/org/fisco/bcos/codegen/v2/wrapper/SolidityContractWrapper.java @@ -910,9 +910,10 @@ private MethodSpec buildFunctionWithInputDecoder( List.class, FunctionReturnDecoder.class); - buildTupleResultContainer0( + buildTupleResultContainer( methodBuilder, parameterizedTupleType, + inputTypes, buildTypeNames(functionDefinition.getInputs())); return methodBuilder.build(); @@ -963,9 +964,10 @@ private MethodSpec buildFunctionWithOutputDecoder( List.class, FunctionReturnDecoder.class); - buildTupleResultContainer0( + buildTupleResultContainer( methodBuilder, parameterizedTupleType, + outputTypes, buildTypeNames(functionDefinition.getOutputs())); return methodBuilder.build(); @@ -1070,7 +1072,15 @@ private void buildConstantFunction( buildVariableLengthReturnFunctionConstructor( methodBuilder, functionName, inputParams, outputParameterTypes); - buildTupleResultContainer(methodBuilder, parameterizedTupleType, outputParameterTypes); + methodBuilder.addStatement( + "$T results = executeCallWithMultipleValueReturn(function)", + ParameterizedTypeName.get( + List.class, org.fisco.bcos.sdk.abi.datatypes.Type.class)); + buildTupleResultContainer( + methodBuilder, + parameterizedTupleType, + functionDefinition.getOutputs(), + outputParameterTypes); } } @@ -1497,31 +1507,33 @@ private static void buildVariableLengthReturnFunctionConstructor( private void buildTupleResultContainer( MethodSpec.Builder methodBuilder, ParameterizedTypeName tupleType, + List namedTypes, List outputParameterTypes) { List typeArguments = tupleType.typeArguments; - CodeBlock.Builder tupleConstructor = CodeBlock.builder(); - tupleConstructor - .addStatement( - "$T results = executeCallWithMultipleValueReturn(function)", - ParameterizedTypeName.get(List.class, Type.class)) - .add("return new $T(", tupleType) - .add("$>$>"); + CodeBlock.Builder codeBuilder = CodeBlock.builder(); String resultStringSimple = "\n($T) results.get($L)"; - resultStringSimple += ".getValue()"; + String getValueString = ".getValue()"; String resultStringNativeList = "\nconvertToNative(($T) results.get($L).getValue())"; + String dynamicResultStringList = + "\nnew DynamicArray<>($T.class,($T) results.get($L).getValue())"; int size = typeArguments.size(); ClassName classList = ClassName.get(List.class); + ClassName dynamicArray = ClassName.get(org.fisco.bcos.sdk.abi.datatypes.DynamicArray.class); + ClassName staticArray = ClassName.get(org.fisco.bcos.sdk.abi.datatypes.StaticArray.class); for (int i = 0; i < size; i++) { TypeName param = outputParameterTypes.get(i); TypeName convertTo = typeArguments.get(i); - + ABIDefinition.NamedType namedType = namedTypes.get(i); String resultString = resultStringSimple; + if (!namedType.getType().contains("tuple")) { + resultString += getValueString; + } // If we use native java types we need to convert // elements of arrays to native java types too @@ -1534,50 +1546,15 @@ private void buildTupleResultContainer( ParameterizedTypeName.get(classList, oldContainer.typeArguments.get(0)); resultString = resultStringNativeList; } - } - - tupleConstructor.add(resultString, convertTo, i); - tupleConstructor.add(i < size - 1 ? ", " : ");\n"); - } - tupleConstructor.add("$<$<"); - methodBuilder.returns(tupleType).addCode(tupleConstructor.build()); - } - - private void buildTupleResultContainer0( - MethodSpec.Builder methodBuilder, - ParameterizedTypeName tupleType, - List outputParameterTypes) { - - List typeArguments = tupleType.typeArguments; - - CodeBlock.Builder codeBuilder = CodeBlock.builder(); - - String resultStringSimple = "\n($T) results.get($L)"; - String resultGetValue = ".getValue()"; - - String resultStringNativeList = "\nconvertToNative(($T) results.get($L).getValue())"; - - int size = typeArguments.size(); - ClassName classList = ClassName.get(List.class); - - for (int i = 0; i < size; i++) { - TypeName param = outputParameterTypes.get(i); - TypeName convertTo = typeArguments.get(i); - - String resultString = resultStringSimple + resultGetValue; - - // If we use native java types we need to convert - // elements of arrays to native java types too - if (param.equals(convertTo)) { - resultString = resultStringSimple; - } else if (param instanceof ParameterizedTypeName) { - ParameterizedTypeName oldContainer = (ParameterizedTypeName) param; - ParameterizedTypeName newContainer = (ParameterizedTypeName) convertTo; - if (newContainer.rawType.compareTo(classList) == 0 + if ((newContainer.rawType.compareTo(dynamicArray) == 0 + || newContainer.rawType.compareTo(staticArray) == 0) && newContainer.typeArguments.size() == 1) { + resultString = dynamicResultStringList; convertTo = ParameterizedTypeName.get(classList, oldContainer.typeArguments.get(0)); - resultString = resultStringNativeList; + codeBuilder.add(resultString, oldContainer.typeArguments.get(0), convertTo, i); + codeBuilder.add(i < size - 1 ? ", " : "\n"); + continue; } } diff --git a/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java b/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java index 1a86739..8a31ecb 100644 --- a/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java +++ b/src/main/java/org/fisco/bcos/codegen/v3/wrapper/ContractWrapper.java @@ -1399,7 +1399,7 @@ private MethodSpec buildFunctionWithInputDecoder( "$T results = this.functionReturnDecoder.decode(data, function.getOutputParameters())", List.class); - this.buildTupleResultContainer0( + this.buildTupleResultContainer( methodBuilder, parameterizedTupleType, inputTypes, @@ -1450,7 +1450,7 @@ private MethodSpec buildFunctionWithOutputDecoder( "$T results = this.functionReturnDecoder.decode(data, function.getOutputParameters())", List.class); - this.buildTupleResultContainer0( + this.buildTupleResultContainer( methodBuilder, parameterizedTupleType, outputTypes, @@ -1769,8 +1769,14 @@ private void buildConstantFunction( buildVariableLengthReturnFunctionConstructor( methodBuilder, functionName, inputParams, outputParameterTypes); + methodBuilder.addStatement( + "$T results = executeCallWithMultipleValueReturn(function)", + ParameterizedTypeName.get(List.class, Type.class)); this.buildTupleResultContainer( - methodBuilder, parameterizedTupleType, outputParameterTypes); + methodBuilder, + parameterizedTupleType, + functionDefinition.getOutputs(), + outputParameterTypes); } } @@ -2230,68 +2236,6 @@ private static void buildVariableLengthReturnFunctionConstructor( } private void buildTupleResultContainer( - MethodSpec.Builder methodBuilder, - ParameterizedTypeName tupleType, - List outputParameterTypes) { - - List typeArguments = tupleType.typeArguments; - - CodeBlock.Builder tupleConstructor = CodeBlock.builder(); - tupleConstructor - .addStatement( - "$T results = executeCallWithMultipleValueReturn(function)", - ParameterizedTypeName.get(List.class, Type.class)) - .add("return new $T(", tupleType) - .add("$>$>"); - - String resultStringSimple = "\n($T) results.get($L)"; - resultStringSimple += ".getValue()"; - - String resultStringNativeList = "\nconvertToNative(($T) results.get($L).getValue())"; - String dynamicResultStringList = - "\nnew DynamicArray<>($T.class,($T) results.get($L).getValue())"; - - int size = typeArguments.size(); - ClassName classList = ClassName.get(List.class); - ClassName dynamicArray = ClassName.get(DynamicArray.class); - - for (int i = 0; i < size; i++) { - TypeName param = outputParameterTypes.get(i); - TypeName convertTo = typeArguments.get(i); - - String resultString = resultStringSimple; - - // If we use native java types we need to convert - // elements of arrays to native java types too - if (param instanceof ParameterizedTypeName) { - ParameterizedTypeName oldContainer = (ParameterizedTypeName) param; - ParameterizedTypeName newContainer = (ParameterizedTypeName) convertTo; - if (newContainer.rawType.compareTo(classList) == 0 - && newContainer.typeArguments.size() == 1) { - convertTo = - ParameterizedTypeName.get(classList, oldContainer.typeArguments.get(0)); - resultString = resultStringNativeList; - } - if (newContainer.rawType.compareTo(dynamicArray) == 0 - && newContainer.typeArguments.size() == 1) { - resultString = dynamicResultStringList; - convertTo = - ParameterizedTypeName.get(classList, oldContainer.typeArguments.get(0)); - tupleConstructor.add( - resultString, oldContainer.typeArguments.get(0), convertTo, i); - tupleConstructor.add(i < size - 1 ? ", " : ");\n"); - continue; - } - } - - tupleConstructor.add(resultString, convertTo, i); - tupleConstructor.add(i < size - 1 ? ", " : ");\n"); - } - tupleConstructor.add("$<$<"); - methodBuilder.returns(tupleType).addCode(tupleConstructor.build()); - } - - private void buildTupleResultContainer0( MethodSpec.Builder methodBuilder, ParameterizedTypeName tupleType, List namedTypes, diff --git a/src/test/java/org/fisco/bcos/codegen/v2/test/CodeGenV2Test.java b/src/test/java/org/fisco/bcos/codegen/v2/test/CodeGenV2Test.java index fa36f70..b399ead 100644 --- a/src/test/java/org/fisco/bcos/codegen/v2/test/CodeGenV2Test.java +++ b/src/test/java/org/fisco/bcos/codegen/v2/test/CodeGenV2Test.java @@ -100,6 +100,13 @@ public void codecTestABICodeGen() throws IOException { codeGenTest(ABI_FILE, CONTRACT_NAME); } + @Test + public void RechargeTestCodeGen() throws IOException { + final String ABI_FILE = "IRechargeV2.abi"; + final String CONTRACT_NAME = "IRechargeV2"; + codeGenTest(ABI_FILE, CONTRACT_NAME); + } + @Test public void weidABICodeGen() throws IOException { final String ABI_FILE = "Weid.abi"; diff --git a/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java b/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java index 884e587..07ebaea 100644 --- a/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java +++ b/src/test/java/org/fisco/bcos/codegen/v3/test/CodeGenV3Test.java @@ -166,6 +166,13 @@ public void payableTestCodeGen() throws IOException { codeGenTest(ABI_FILE, CONTRACT_NAME); } + @Test + public void RechargeTestCodeGen() throws IOException { + final String ABI_FILE = "IRechargeV2.abi"; + final String CONTRACT_NAME = "IRechargeV2"; + codeGenTest(ABI_FILE, CONTRACT_NAME); + } + @Test public void docTestCodeGen() throws IOException { final String CONTRACT_NAME = "ERC721"; diff --git a/src/test/resources/IRechargeV2.abi b/src/test/resources/IRechargeV2.abi new file mode 100644 index 0000000..b0c61ea --- /dev/null +++ b/src/test/resources/IRechargeV2.abi @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"orderID","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"string[]","name":"cards","type":"string[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"BindCardsWithValues","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"orderID","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"string[]","name":"physicalCards","type":"string[]"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"BindPhysicalCards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"orderID","type":"string"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"CancelHistoryRechargeOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawID","type":"uint256"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"CancelWithdrawOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"orderID","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"CreateRechargeOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"txHash","type":"string"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"CreateWithdrawOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawID","type":"uint256"},{"indexed":false,"internalType":"string[]","name":"physicalCards","type":"string[]"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"WithdrawPhysicalCards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawOrderIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"txHash","type":"string"},{"indexed":false,"internalType":"string[]","name":"vCards","type":"string[]"},{"indexed":false,"internalType":"string","name":"extraData","type":"string"}],"name":"WithdrawVCards","type":"event"},{"inputs":[],"name":"_contractType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"admins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bac20Address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string[]","name":"_physicalCards","type":"string[]"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"bindHistoryPhysicalCards","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"}],"internalType":"struct IRechargeV2.RechargeOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"string[]","name":"_physicalCards","type":"string[]"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"bindPhysicalCards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"cancelHistoryRechargeOrderByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_withdrawID","type":"uint256"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"cancelWithdrawOrderByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cardLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"createHistoryRechargeOrder","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"}],"internalType":"struct IRechargeV2.RechargeOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"createRechargeOrder","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"}],"internalType":"struct IRechargeV2.RechargeOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"createWithdrawOrder","outputs":[{"internalType":"uint256","name":"withdrawOrderIndex","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"},{"internalType":"bool","name":"canceled","type":"bool"}],"internalType":"struct IRechargeV2.WithdrawOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_txHash","type":"string"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"createWithdrawOrderByAdmin","outputs":[{"internalType":"uint256","name":"withdrawOrderIndex","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"},{"internalType":"bool","name":"canceled","type":"bool"}],"internalType":"struct IRechargeV2.WithdrawOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getFailedWithdrawOrderIndex","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_physicalCardID","type":"string"}],"name":"getPhysicalCard","outputs":[{"components":[{"internalType":"string","name":"rechargeOrderID","type":"string"},{"internalType":"address","name":"withdrawUser","type":"address"},{"internalType":"uint256","name":"withdrawIndex","type":"uint256"},{"internalType":"bool","name":"withdrawState","type":"bool"},{"internalType":"uint256","name":"inBlockHeight","type":"uint256"},{"internalType":"uint256","name":"outBlockHeight","type":"uint256"}],"internalType":"struct IRechargeV2.PhysicalCard","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"}],"name":"getRechargeOrder","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"}],"internalType":"struct IRechargeV2.RechargeOrder","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalRecharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_values","type":"uint256[]"}],"name":"getVCardNum","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVCardTotalRecharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"getVCards","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_txHash","type":"string"}],"name":"getWithdrawIndexAndOrderByTxHash","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"},{"internalType":"bool","name":"canceled","type":"bool"}],"internalType":"struct IRechargeV2.WithdrawOrder","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getWithdrawOrder","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"},{"internalType":"bool","name":"canceled","type":"bool"}],"internalType":"struct IRechargeV2.WithdrawOrder","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_txHash","type":"string"}],"name":"getWithdrawOrderByTxHash","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"},{"internalType":"bool","name":"canceled","type":"bool"}],"internalType":"struct IRechargeV2.WithdrawOrder","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_bac20Address","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"string[]","name":"_vCards","type":"string[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"rechargeHistoryVCard","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"}],"internalType":"struct IRechargeV2.RechargeOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"}],"name":"rechargeOrderCanceled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"orderId","type":"string"}],"name":"rechargeOrderExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_orderID","type":"string"},{"internalType":"string[]","name":"_vCards","type":"string[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"rechargeVCard","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"blockHeight","type":"uint256"},{"internalType":"string[]","name":"physicalCardSerials","type":"string[]"},{"internalType":"bool","name":"physicalCardBound","type":"bool"}],"internalType":"struct IRechargeV2.RechargeOrder","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cardLimit","type":"uint256"}],"name":"setCardLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"value","type":"string"}],"name":"setContractType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalCashRecharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalOutbound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSettledRecharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTransit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVCardRecharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVCardSettledRecharge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"txHash","type":"string"}],"name":"txHashExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"}],"name":"userWithdrawIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawID","type":"uint256"},{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"string[]","name":"_physicalCards","type":"string[]"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"withdrawPhysicalCards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"string","name":"_txHash","type":"string"},{"internalType":"string","name":"_extraData","type":"string"}],"name":"withdrawVCard","outputs":[{"internalType":"uint256","name":"withdrawOrderIndex","type":"uint256"},{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file