18
18
Diamond ,
19
19
DiamondCutFacet ,
20
20
DiamondLoupeFacet ,
21
+ DropperFacet ,
21
22
OwnershipFacet ,
22
23
ReentrancyExploitable ,
23
24
CraftingFacet ,
27
28
FACETS : Dict [str , Any ] = {
28
29
"DiamondCutFacet" : DiamondCutFacet ,
29
30
"DiamondLoupeFacet" : DiamondLoupeFacet ,
31
+ "DropperFacet" : DropperFacet ,
30
32
"OwnershipFacet" : OwnershipFacet ,
31
33
"ReentrancyExploitable" : ReentrancyExploitable ,
32
34
"CraftingFacet" : CraftingFacet ,
33
35
"GOFPFacet" : GOFPFacet ,
34
36
}
35
37
36
38
FACET_INIT_CALLDATA : Dict [str , str ] = {
39
+ "DropperFacet" : lambda address , * args : DropperFacet .DropperFacet (
40
+ address
41
+ ).contract .init .encode_input (* args ),
37
42
"GOFPFacet" : lambda address , * args : GOFPFacet .GOFPFacet (
38
43
address
39
- ).contract .init .encode_input (* args )
44
+ ).contract .init .encode_input (* args ),
40
45
}
41
46
42
47
DIAMOND_FACET_PRECEDENCE : List [str ] = [
53
58
54
59
55
60
class EngineFeatures (Enum ):
61
+ DROPPER = "dropper"
56
62
GOFP = "GardenOfForkingPaths"
57
63
58
64
@@ -63,10 +69,14 @@ def feature_from_facet_name(facet_name: str) -> Optional[EngineFeatures]:
63
69
return None
64
70
65
71
66
- FEATURE_FACETS : Dict [EngineFeatures , List [str ]] = {EngineFeatures .GOFP : ["GOFPFacet" ]}
72
+ FEATURE_FACETS : Dict [EngineFeatures , List [str ]] = {
73
+ EngineFeatures .DROPPER : ["DropperFacet" ],
74
+ EngineFeatures .GOFP : ["GOFPFacet" ],
75
+ }
67
76
68
77
FEATURE_IGNORES : Dict [EngineFeatures , List [str ]] = {
69
- EngineFeatures .GOFP : {"methods" : ["init" ], "selectors" : []}
78
+ EngineFeatures .DROPPER : {"methods" : ["init" ], "selectors" : []},
79
+ EngineFeatures .GOFP : {"methods" : ["init" ], "selectors" : []},
70
80
}
71
81
72
82
FACET_ACTIONS : Dict [str , int ] = {"add" : 0 , "replace" : 1 , "remove" : 2 }
@@ -518,6 +528,36 @@ def lootbox_gogogo(
518
528
return contracts
519
529
520
530
531
+ def dropper_gogogo (
532
+ admin_terminus_address : str ,
533
+ admin_terminus_pool_id : int ,
534
+ transaction_config : Dict [str , Any ],
535
+ ) -> Dict [str , Any ]:
536
+ deployment_info = diamond_gogogo (
537
+ owner_address = transaction_config ["from" ].address ,
538
+ transaction_config = transaction_config ,
539
+ )
540
+
541
+ dropper_facet = DropperFacet .DropperFacet (None )
542
+ dropper_facet .deploy (transaction_config = transaction_config )
543
+ deployment_info ["contracts" ]["DropperFacet" ] = dropper_facet .address
544
+
545
+ diamond_address = deployment_info ["contracts" ]["Diamond" ]
546
+ facet_cut (
547
+ diamond_address ,
548
+ "DropperFacet" ,
549
+ dropper_facet .address ,
550
+ "add" ,
551
+ transaction_config ,
552
+ initializer_address = dropper_facet .address ,
553
+ feature = EngineFeatures .DROPPER ,
554
+ initializer_args = [admin_terminus_address , admin_terminus_pool_id ],
555
+ )
556
+ deployment_info ["attached" ].append ("DropperFacet" )
557
+
558
+ return deployment_info
559
+
560
+
521
561
def gofp_gogogo (
522
562
admin_terminus_address : str ,
523
563
admin_terminus_pool_id : int ,
@@ -588,6 +628,18 @@ def handle_lootbox_gogogo(args: argparse.Namespace) -> None:
588
628
json .dump (result , sys .stdout , indent = 4 )
589
629
590
630
631
+ def handle_dropper_gogogo (args : argparse .Namespace ) -> None :
632
+ network .connect (args .network )
633
+ transaction_config = MockTerminus .get_transaction_config (args )
634
+ result = dropper_gogogo (
635
+ args .terminus_address , args .terminus_pool_id , transaction_config
636
+ )
637
+ if args .outfile is not None :
638
+ with args .outfile :
639
+ json .dump (result , args .outfile )
640
+ json .dump (result , sys .stdout , indent = 4 )
641
+
642
+
591
643
def handle_gofp_gogogo (args : argparse .Namespace ) -> None :
592
644
network .connect (args .network )
593
645
transaction_config = MockTerminus .get_transaction_config (args )
@@ -687,6 +739,32 @@ def generate_cli():
687
739
)
688
740
facet_cut_parser .set_defaults (func = handle_facet_cut )
689
741
742
+ dropper_gogogo_parser = subcommands .add_parser (
743
+ "dropper-gogogo" ,
744
+ help = "Deploy Dropper diamond contract" ,
745
+ description = "Deploy Dropper diamond contract" ,
746
+ )
747
+ Diamond .add_default_arguments (dropper_gogogo_parser , transact = True )
748
+ dropper_gogogo_parser .add_argument (
749
+ "--terminus-address" ,
750
+ required = True ,
751
+ help = "Address of Terminus contract defining access control for this Dropper contract" ,
752
+ )
753
+ dropper_gogogo_parser .add_argument (
754
+ "--terminus-pool-id" ,
755
+ required = True ,
756
+ type = int ,
757
+ help = "Pool ID of Terminus pool for administrators of this dropper contract" ,
758
+ )
759
+ dropper_gogogo_parser .add_argument (
760
+ "-o" ,
761
+ "--outfile" ,
762
+ type = argparse .FileType ("w" ),
763
+ default = None ,
764
+ help = "(Optional) file to write deployed addresses to" ,
765
+ )
766
+ dropper_gogogo_parser .set_defaults (func = handle_dropper_gogogo )
767
+
690
768
gofp_gogogo_parser = subcommands .add_parser (
691
769
"gofp-gogogo" ,
692
770
help = "Deploy gofp diamond contract" ,
0 commit comments