@@ -21,18 +21,24 @@ import (
21
21
"github.com/rs/zerolog/log"
22
22
"github.com/spf13/cobra"
23
23
24
+ banana_committee "github.com/0xPolygon/cdk-contracts-tooling/contracts/banana/polygondatacommittee"
24
25
banana_rollup "github.com/0xPolygon/cdk-contracts-tooling/contracts/banana/polygonrollupbaseetrog"
25
26
banana_rollup_manager "github.com/0xPolygon/cdk-contracts-tooling/contracts/banana/polygonrollupmanager"
27
+ banana_validium "github.com/0xPolygon/cdk-contracts-tooling/contracts/banana/polygonvalidiumetrog"
26
28
banana_bridge "github.com/0xPolygon/cdk-contracts-tooling/contracts/banana/polygonzkevmbridgev2"
27
29
banana_ger "github.com/0xPolygon/cdk-contracts-tooling/contracts/banana/polygonzkevmglobalexitrootv2"
28
30
31
+ elderberry_committee "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygondatacommittee"
29
32
elderberry_rollup "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygonrollupbaseetrog"
30
33
elderberry_rollup_manager "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygonrollupmanager"
34
+ elderberry_validium "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygonvalidiumetrog"
31
35
elderberry_bridge "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygonzkevmbridgev2"
32
36
elderberry_ger "github.com/0xPolygon/cdk-contracts-tooling/contracts/elderberry/polygonzkevmglobalexitrootv2"
33
37
38
+ etrog_committee "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygondatacommittee"
34
39
etrog_rollup "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygonrollupbaseetrog"
35
40
etrog_rollup_manager "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygonrollupmanager"
41
+ etrog_validium "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygonvalidiumetrog"
36
42
etrog_bridge "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygonzkevmbridgev2"
37
43
etrog_ger "github.com/0xPolygon/cdk-contracts-tooling/contracts/etrog/polygonzkevmglobalexitrootv2"
38
44
)
@@ -65,7 +71,10 @@ const (
65
71
contractRequestInterval = 200 * time .Millisecond
66
72
)
67
73
68
- var ErrRollupNotFound = errors .New ("rollup not found" )
74
+ var (
75
+ ErrRollupNotFound = errors .New ("rollup not found" )
76
+ ErrMethodNotSupported = errors .New ("method not supported" )
77
+ )
69
78
70
79
var (
71
80
knownRollupManagerAddresses = map [string ]string {
@@ -285,13 +294,28 @@ func getRollup(cdkArgs parsedCDKArgs, rpcClient *ethclient.Client, addr common.A
285
294
var contract * rollup
286
295
var contractABI * abi.ABI
287
296
log .Info ().Stringer ("addr" , addr ).Msg ("Getting rollup" )
297
+
288
298
switch cdkArgs .forkID {
289
299
case etrog :
290
300
contractInstance , err := etrog_rollup .NewPolygonrollupbaseetrog (addr , rpcClient )
291
301
if err != nil {
292
302
return nil , nil , err
293
303
}
294
- contract = & rollup {contractInstance , reflect .ValueOf (contractInstance )}
304
+
305
+ validiumContractInstance , err := etrog_validium .NewPolygonvalidiumetrog (addr , rpcClient )
306
+ if err != nil {
307
+ return nil , nil , err
308
+ }
309
+ _ , err = validiumContractInstance .DataAvailabilityProtocol (nil )
310
+ if err != nil {
311
+ if err .Error () == "execution reverted" {
312
+ validiumContractInstance = nil
313
+ } else {
314
+ return nil , nil , err
315
+ }
316
+ }
317
+
318
+ contract = & rollup {contractInstance , validiumContractInstance , reflect .ValueOf (contractInstance )}
295
319
contractABI , err = etrog_rollup .PolygonrollupbaseetrogMetaData .GetAbi ()
296
320
if err != nil {
297
321
return nil , nil , err
@@ -301,7 +325,21 @@ func getRollup(cdkArgs parsedCDKArgs, rpcClient *ethclient.Client, addr common.A
301
325
if err != nil {
302
326
return nil , nil , err
303
327
}
304
- contract = & rollup {contractInstance , reflect .ValueOf (contractInstance )}
328
+
329
+ validiumContractInstance , err := elderberry_validium .NewPolygonvalidiumetrog (addr , rpcClient )
330
+ if err != nil {
331
+ return nil , nil , err
332
+ }
333
+ _ , err = validiumContractInstance .DataAvailabilityProtocol (nil )
334
+ if err != nil {
335
+ if err .Error () == "execution reverted" {
336
+ validiumContractInstance = nil
337
+ } else {
338
+ return nil , nil , err
339
+ }
340
+ }
341
+
342
+ contract = & rollup {contractInstance , validiumContractInstance , reflect .ValueOf (contractInstance )}
305
343
contractABI , err = elderberry_rollup .PolygonrollupbaseetrogMetaData .GetAbi ()
306
344
if err != nil {
307
345
return nil , nil , err
@@ -311,7 +349,21 @@ func getRollup(cdkArgs parsedCDKArgs, rpcClient *ethclient.Client, addr common.A
311
349
if err != nil {
312
350
return nil , nil , err
313
351
}
314
- contract = & rollup {contractInstance , reflect .ValueOf (contractInstance )}
352
+
353
+ validiumContractInstance , err := banana_validium .NewPolygonvalidiumetrog (addr , rpcClient )
354
+ if err != nil {
355
+ return nil , nil , err
356
+ }
357
+ _ , err = validiumContractInstance .DataAvailabilityProtocol (nil )
358
+ if err != nil {
359
+ if err .Error () == "execution reverted" {
360
+ validiumContractInstance = nil
361
+ } else {
362
+ return nil , nil , err
363
+ }
364
+ }
365
+
366
+ contract = & rollup {contractInstance , validiumContractInstance , reflect .ValueOf (contractInstance )}
315
367
contractABI , err = banana_rollup .PolygonrollupbaseetrogMetaData .GetAbi ()
316
368
if err != nil {
317
369
return nil , nil , err
@@ -322,6 +374,47 @@ func getRollup(cdkArgs parsedCDKArgs, rpcClient *ethclient.Client, addr common.A
322
374
return contract , contractABI , nil
323
375
}
324
376
377
+ func getCommittee (cdkArgs parsedCDKArgs , rpcClient * ethclient.Client , addr common.Address ) (* committee , * abi.ABI , error ) {
378
+ var contract * committee
379
+ var contractABI * abi.ABI
380
+ log .Info ().Stringer ("addr" , addr ).Msg ("Getting committee" )
381
+ switch cdkArgs .forkID {
382
+ case etrog :
383
+ contractInstance , err := etrog_committee .NewPolygondatacommittee (addr , rpcClient )
384
+ if err != nil {
385
+ return nil , nil , err
386
+ }
387
+ contract = & committee {contractInstance , reflect .ValueOf (contractInstance )}
388
+ contractABI , err = etrog_committee .PolygondatacommitteeMetaData .GetAbi ()
389
+ if err != nil {
390
+ return nil , nil , err
391
+ }
392
+ case elderberry :
393
+ contractInstance , err := elderberry_committee .NewPolygondatacommittee (addr , rpcClient )
394
+ if err != nil {
395
+ return nil , nil , err
396
+ }
397
+ contract = & committee {contractInstance , reflect .ValueOf (contractInstance )}
398
+ contractABI , err = elderberry_committee .PolygondatacommitteeMetaData .GetAbi ()
399
+ if err != nil {
400
+ return nil , nil , err
401
+ }
402
+ case banana :
403
+ contractInstance , err := banana_committee .NewPolygondatacommittee (addr , rpcClient )
404
+ if err != nil {
405
+ return nil , nil , err
406
+ }
407
+ contract = & committee {contractInstance , reflect .ValueOf (contractInstance )}
408
+ contractABI , err = banana_committee .PolygondatacommitteeMetaData .GetAbi ()
409
+ if err != nil {
410
+ return nil , nil , err
411
+ }
412
+ default :
413
+ return nil , nil , invalidForkIDErr ()
414
+ }
415
+ return contract , contractABI , nil
416
+ }
417
+
325
418
func getBridge (cdkArgs parsedCDKArgs , rpcClient * ethclient.Client , addr common.Address ) (* bridge , * abi.ABI , error ) {
326
419
var contract * bridge
327
420
var contractABI * abi.ABI
0 commit comments