6
6
import org .fisco .bcos .sdk .v3 .client .Client ;
7
7
import org .fisco .bcos .sdk .v3 .contract .precompiled .callback .PrecompiledCallback ;
8
8
import org .fisco .bcos .sdk .v3 .contract .precompiled .model .PrecompiledAddress ;
9
- import org .fisco .bcos .sdk .v3 .contract .precompiled .model .PrecompiledVersionCheck ;
10
9
import org .fisco .bcos .sdk .v3 .crypto .keypair .CryptoKeyPair ;
11
10
import org .fisco .bcos .sdk .v3 .model .EnumNodeVersion ;
12
11
import org .fisco .bcos .sdk .v3 .model .PrecompiledRetCode ;
@@ -43,15 +42,15 @@ public BalancePrecompiled getBalancePrecompiled() {
43
42
}
44
43
45
44
public BigInteger getBalance (String address ) throws ContractException {
46
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
45
+
47
46
BigInteger balance = balancePrecompiled .getBalance (address );
48
47
return balance ;
49
48
}
50
49
51
50
public RetCode addBalance (String address , String amount , Convert .Unit unit )
52
51
throws ContractException {
53
52
BigDecimal weiValue = Convert .toWei (amount , unit );
54
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
53
+
55
54
TransactionReceipt transactionReceipt =
56
55
balancePrecompiled .addBalance (address , weiValue .toBigIntegerExact ());
57
56
if (transactionReceipt .isStatusOK ()) {
@@ -67,15 +66,15 @@ public void addBalanceAsync(
67
66
String address , String amount , Convert .Unit unit , PrecompiledCallback callback )
68
67
throws ContractException {
69
68
BigDecimal weiValue = Convert .toWei (amount , unit );
70
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
69
+
71
70
this .balancePrecompiled .addBalance (
72
71
address , weiValue .toBigIntegerExact (), createTransactionCallback (callback ));
73
72
}
74
73
75
74
public RetCode subBalance (String address , String amount , Convert .Unit unit )
76
75
throws ContractException {
77
76
BigDecimal weiValue = Convert .toWei (amount , unit );
78
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
77
+
79
78
TransactionReceipt transactionReceipt =
80
79
balancePrecompiled .subBalance (address , weiValue .toBigIntegerExact ());
81
80
if (transactionReceipt .isStatusOK ()) {
@@ -91,15 +90,15 @@ public void subBalanceAsync(
91
90
String address , String amount , Convert .Unit unit , PrecompiledCallback callback )
92
91
throws ContractException {
93
92
BigDecimal weiValue = Convert .toWei (amount , unit );
94
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
93
+
95
94
this .balancePrecompiled .subBalance (
96
95
address , weiValue .toBigIntegerExact (), createTransactionCallback (callback ));
97
96
}
98
97
99
98
public RetCode transfer (String from , String to , String amount , Convert .Unit unit )
100
99
throws ContractException {
101
100
BigDecimal weiValue = Convert .toWei (amount , unit );
102
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
101
+
103
102
TransactionReceipt transactionReceipt =
104
103
balancePrecompiled .transfer (from , to , weiValue .toBigIntegerExact ());
105
104
if (transactionReceipt .isStatusOK ()) {
@@ -115,13 +114,13 @@ public void transferAsync(
115
114
String from , String to , String amount , Convert .Unit unit , PrecompiledCallback callback )
116
115
throws ContractException {
117
116
BigDecimal weiValue = Convert .toWei (amount , unit );
118
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
117
+
119
118
this .balancePrecompiled .transfer (
120
119
from , to , weiValue .toBigIntegerExact (), createTransactionCallback (callback ));
121
120
}
122
121
123
122
public RetCode registerCaller (String address ) throws ContractException {
124
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
123
+
125
124
TransactionReceipt receipt = balancePrecompiled .registerCaller (address );
126
125
if (receipt .isStatusOK ()) {
127
126
RetCode codeSuccess = PrecompiledRetCode .CODE_SUCCESS ;
@@ -134,12 +133,12 @@ public RetCode registerCaller(String address) throws ContractException {
134
133
135
134
public void registerCallerAsync (String address , PrecompiledCallback callback )
136
135
throws ContractException {
137
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
136
+
138
137
this .balancePrecompiled .registerCaller (address , createTransactionCallback (callback ));
139
138
}
140
139
141
140
public RetCode unregisterCaller (String address ) throws ContractException {
142
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
141
+
143
142
TransactionReceipt receipt = balancePrecompiled .unregisterCaller (address );
144
143
if (receipt .isStatusOK ()) {
145
144
RetCode codeSuccess = PrecompiledRetCode .CODE_SUCCESS ;
@@ -152,12 +151,12 @@ public RetCode unregisterCaller(String address) throws ContractException {
152
151
153
152
public void unregisterCallerAsync (String address , PrecompiledCallback callback )
154
153
throws ContractException {
155
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
154
+
156
155
this .balancePrecompiled .unregisterCaller (address , createTransactionCallback (callback ));
157
156
}
158
157
159
158
public List <String > listCaller () throws ContractException {
160
- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
159
+
161
160
List <String > result = balancePrecompiled .listCaller ();
162
161
return result ;
163
162
}
0 commit comments