29
29
@ SuppressWarnings ("unchecked" )
30
30
public class ContractAuthPrecompiled extends Contract {
31
31
public static final String [] ABI_ARRAY = {
32
- "[{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" checkMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" bool\" ,\" name\" :\" \" ,\" type\" :\" bool\" }],\" selector\" :[3630574244,3556246924],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" closeDeployAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[1455255684,438325841],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" closeMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[3413924881,2232681703],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" _address\" ,\" type\" :\" address\" }],\" name\" :\" contractAvailable\" ,\" outputs\" :[{\" internalType\" :\" bool\" ,\" name\" :\" \" ,\" type\" :\" bool\" }],\" selector\" :[747391567,2445967236],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[],\" name\" :\" deployType\" ,\" outputs\" :[{\" internalType\" :\" uint256\" ,\" name\" :\" \" ,\" type\" :\" uint256\" }],\" selector\" :[390708905,1502262678],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" }],\" name\" :\" getAdmin\" ,\" outputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" \" ,\" type\" :\" address\" }],\" selector\" :[1693430315,3050872],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" path\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" }],\" name\" :\" getMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" uint8\" ,\" name\" :\" \" ,\" type\" :\" uint8\" },{\" internalType\" :\" string[]\" ,\" name\" :\" \" ,\" type\" :\" string[]\" },{\" internalType\" :\" string[]\" ,\" name\" :\" \" ,\" type\" :\" string[]\" }],\" selector\" :[91771290,3467007364],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" hasDeployAuth\" ,\" outputs\" :[{\" internalType\" :\" bool\" ,\" name\" :\" \" ,\" type\" :\" bool\" }],\" selector\" :[1661302757,3314574843],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" openDeployAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[1632927897,40510205],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" path\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" openMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[209893181,4148123484],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" path\" ,\" type\" :\" address\" },{\" internalType\" :\" address\" ,\" name\" :\" admin\" ,\" type\" :\" address\" }],\" name\" :\" resetAdmin\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[3308279732,45314107],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" _address\" ,\" type\" :\" address\" },{\" internalType\" :\" bool\" ,\" name\" :\" isFreeze\" ,\" type\" :\" bool\" }],\" name\" :\" setContractStatus\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[2177375452,2437471713],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" _address\" ,\" type\" :\" address\" },{\" internalType\" :\" enum Status\" ,\" name\" :\" _status\" ,\" type\" :\" uint8\" }],\" name\" :\" setContractStatus\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[4135554508,610209536],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" uint8\" ,\" name\" :\" _type\" ,\" type\" :\" uint8\" }],\" name\" :\" setDeployAuthType\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[3138036748,2966063259],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" path\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" uint8\" ,\" name\" :\" authType\" ,\" type\" :\" uint8\" }],\" name\" :\" setMethodAuthType\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" selector\" :[2630076943,1025843675],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" }]"
32
+ "[{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" checkMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" bool\" ,\" name\" :\" \" ,\" type\" :\" bool\" }],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" closeDeployAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" closeMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" address\" ,\" type\" :\" address\" }],\" name\" :\" contractAvailable\" ,\" outputs\" :[{\" internalType\" :\" bool\" ,\" name\" :\" \" ,\" type\" :\" bool\" }],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[],\" name\" :\" deployType\" ,\" outputs\" :[{\" internalType\" :\" uint256\" ,\" name\" :\" \" ,\" type\" :\" uint256\" }],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" }],\" name\" :\" getAdmin\" ,\" outputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" \" ,\" type\" :\" address\" }],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" }],\" name\" :\" getMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" uint8\" ,\" name\" :\" \" ,\" type\" :\" uint8\" },{\" internalType\" :\" string[]\" ,\" name\" :\" \" ,\" type\" :\" string[]\" },{\" internalType\" :\" string[]\" ,\" name\" :\" \" ,\" type\" :\" string[]\" }],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" hasDeployAuth\" ,\" outputs\" :[{\" internalType\" :\" bool\" ,\" name\" :\" \" ,\" type\" :\" bool\" }],\" stateMutability\" :\" view\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" string\" ,\" name\" :\" account\" ,\" type\" :\" string\" }],\" name\" :\" initAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" openDeployAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" address\" ,\" name\" :\" account\" ,\" type\" :\" address\" }],\" name\" :\" openMethodAuth\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" address\" ,\" name\" :\" admin\" ,\" type\" :\" address\" }],\" name\" :\" resetAdmin\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" address\" ,\" type\" :\" address\" },{\" internalType\" :\" bool\" ,\" name\" :\" isFreeze\" ,\" type\" :\" bool\" }],\" name\" :\" setContractStatus\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" address\" ,\" type\" :\" address\" },{\" internalType\" :\" enum Status\" ,\" name\" :\" _status\" ,\" type\" :\" uint8\" }],\" name\" :\" setContractStatus\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" uint8\" ,\" name\" :\" _type\" ,\" type\" :\" uint8\" }],\" name\" :\" setDeployAuthType\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" },{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" contractAddr\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes4\" ,\" name\" :\" func\" ,\" type\" :\" bytes4\" },{\" internalType\" :\" uint8\" ,\" name\" :\" authType\" ,\" type\" :\" uint8\" }],\" name\" :\" setMethodAuthType\" ,\" outputs\" :[{\" internalType\" :\" int256\" ,\" name\" :\" \" ,\" type\" :\" int256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" }]"
33
33
};
34
34
35
35
public static final String ABI = StringUtils .joinAll ("" , ABI_ARRAY );
@@ -50,6 +50,8 @@ public class ContractAuthPrecompiled extends Contract {
50
50
51
51
public static final String FUNC_HASDEPLOYAUTH = "hasDeployAuth" ;
52
52
53
+ public static final String FUNC_INITAUTH = "initAuth" ;
54
+
53
55
public static final String FUNC_OPENDEPLOYAUTH = "openDeployAuth" ;
54
56
55
57
public static final String FUNC_OPENMETHODAUTH = "openMethodAuth" ;
@@ -223,12 +225,12 @@ public String getAdmin(String contractAddr) throws ContractException {
223
225
return executeCallWithSingleValueReturn (function , String .class );
224
226
}
225
227
226
- public Tuple3 <BigInteger , List <String >, List <String >> getMethodAuth (String path , byte [] func )
227
- throws ContractException {
228
+ public Tuple3 <BigInteger , List <String >, List <String >> getMethodAuth (
229
+ String contractAddr , byte [] func ) throws ContractException {
228
230
final Function function =
229
231
new Function (
230
232
FUNC_GETMETHODAUTH ,
231
- Arrays .<Type >asList (new Address (path ), new Bytes4 (func )),
233
+ Arrays .<Type >asList (new Address (contractAddr ), new Bytes4 (func )),
232
234
Arrays .<TypeReference <?>>asList (
233
235
new TypeReference <Uint8 >() {},
234
236
new TypeReference <DynamicArray <Utf8String >>() {},
@@ -249,6 +251,57 @@ public Boolean hasDeployAuth(String account) throws ContractException {
249
251
return executeCallWithSingleValueReturn (function , Boolean .class );
250
252
}
251
253
254
+ public TransactionReceipt initAuth (String account ) {
255
+ final Function function =
256
+ new Function (
257
+ FUNC_INITAUTH ,
258
+ Arrays .<Type >asList (new Utf8String (account )),
259
+ Collections .<TypeReference <?>>emptyList ());
260
+ return executeTransaction (function );
261
+ }
262
+
263
+ public String initAuth (String account , TransactionCallback callback ) {
264
+ final Function function =
265
+ new Function (
266
+ FUNC_INITAUTH ,
267
+ Arrays .<Type >asList (new Utf8String (account )),
268
+ Collections .<TypeReference <?>>emptyList ());
269
+ return asyncExecuteTransaction (function , callback );
270
+ }
271
+
272
+ public String getSignedTransactionForInitAuth (String account ) {
273
+ final Function function =
274
+ new Function (
275
+ FUNC_INITAUTH ,
276
+ Arrays .<Type >asList (new Utf8String (account )),
277
+ Collections .<TypeReference <?>>emptyList ());
278
+ return createSignedTransaction (function );
279
+ }
280
+
281
+ public Tuple1 <String > getInitAuthInput (TransactionReceipt transactionReceipt ) {
282
+ String data = transactionReceipt .getInput ().substring (10 );
283
+ final Function function =
284
+ new Function (
285
+ FUNC_INITAUTH ,
286
+ Arrays .<Type >asList (),
287
+ Arrays .<TypeReference <?>>asList (new TypeReference <Utf8String >() {}));
288
+ List <Type > results =
289
+ this .functionReturnDecoder .decode (data , function .getOutputParameters ());
290
+ return new Tuple1 <String >((String ) results .get (0 ).getValue ());
291
+ }
292
+
293
+ public Tuple1 <BigInteger > getInitAuthOutput (TransactionReceipt transactionReceipt ) {
294
+ String data = transactionReceipt .getOutput ();
295
+ final Function function =
296
+ new Function (
297
+ FUNC_INITAUTH ,
298
+ Arrays .<Type >asList (),
299
+ Arrays .<TypeReference <?>>asList (new TypeReference <Int256 >() {}));
300
+ List <Type > results =
301
+ this .functionReturnDecoder .decode (data , function .getOutputParameters ());
302
+ return new Tuple1 <BigInteger >((BigInteger ) results .get (0 ).getValue ());
303
+ }
304
+
252
305
public TransactionReceipt openDeployAuth (String account ) {
253
306
final Function function =
254
307
new Function (
@@ -472,34 +525,31 @@ public Tuple1<BigInteger> getSetContractStatusAddressBoolOutput(
472
525
return new Tuple1 <BigInteger >((BigInteger ) results .get (0 ).getValue ());
473
526
}
474
527
475
- public TransactionReceipt setContractStatus (String _address , BigInteger _status ) {
528
+ public TransactionReceipt setContractStatus (String address , BigInteger _status ) {
476
529
final Function function =
477
530
new Function (
478
531
FUNC_SETCONTRACTSTATUS ,
479
- Arrays .<Type >asList (new Address (_address ), new Uint8 (_status )),
480
- Collections .<TypeReference <?>>emptyList (),
481
- 0 );
532
+ Arrays .<Type >asList (new Address (address ), new Uint8 (_status )),
533
+ Collections .<TypeReference <?>>emptyList ());
482
534
return executeTransaction (function );
483
535
}
484
536
485
537
public String setContractStatus (
486
- String _address , BigInteger _status , TransactionCallback callback ) {
538
+ String address , BigInteger _status , TransactionCallback callback ) {
487
539
final Function function =
488
540
new Function (
489
541
FUNC_SETCONTRACTSTATUS ,
490
- Arrays .<Type >asList (new Address (_address ), new Uint8 (_status )),
491
- Collections .<TypeReference <?>>emptyList (),
492
- 0 );
542
+ Arrays .<Type >asList (new Address (address ), new Uint8 (_status )),
543
+ Collections .<TypeReference <?>>emptyList ());
493
544
return asyncExecuteTransaction (function , callback );
494
545
}
495
546
496
- public String getSignedTransactionForSetContractStatus (String _address , BigInteger _status ) {
547
+ public String getSignedTransactionForSetContractStatus (String address , BigInteger _status ) {
497
548
final Function function =
498
549
new Function (
499
550
FUNC_SETCONTRACTSTATUS ,
500
- Arrays .<Type >asList (new Address (_address ), new Uint8 (_status )),
501
- Collections .<TypeReference <?>>emptyList (),
502
- 0 );
551
+ Arrays .<Type >asList (new Address (address ), new Uint8 (_status )),
552
+ Collections .<TypeReference <?>>emptyList ());
503
553
return createSignedTransaction (function );
504
554
}
505
555
0 commit comments