@@ -152,6 +152,42 @@ def deployer(rpc_endpoint: Optional[str]) -> None:
152152protocol_group .add_command (deployer )
153153
154154
155+ @command ()
156+ @rpc_endpoint_option
157+ def get_epoch_period (rpc_endpoint : Optional [str ]) -> None :
158+ """Epoch period in blocks"""
159+ from aut .utils import autonity_from_endpoint_arg
160+
161+ print (autonity_from_endpoint_arg (rpc_endpoint ).get_epoch_period ())
162+
163+
164+ protocol_group .add_command (get_epoch_period )
165+
166+
167+ @command ()
168+ @rpc_endpoint_option
169+ def get_block_period (rpc_endpoint : Optional [str ]) -> None :
170+ """Block period in seconds"""
171+ from aut .utils import autonity_from_endpoint_arg
172+
173+ print (autonity_from_endpoint_arg (rpc_endpoint ).get_block_period ())
174+
175+
176+ protocol_group .add_command (get_block_period )
177+
178+
179+ @command ()
180+ @rpc_endpoint_option
181+ def get_unbonding_period (rpc_endpoint : Optional [str ]) -> None :
182+ """Unbonding period in blocks"""
183+ from aut .utils import autonity_from_endpoint_arg
184+
185+ print (autonity_from_endpoint_arg (rpc_endpoint ).get_unbonding_period ())
186+
187+
188+ protocol_group .add_command (get_unbonding_period )
189+
190+
155191@command ()
156192@rpc_endpoint_option
157193def get_last_epoch_block (rpc_endpoint : Optional [str ]) -> None :
@@ -204,6 +240,30 @@ def get_validators(rpc_endpoint: Optional[str]) -> None:
204240protocol_group .add_command (get_validators )
205241
206242
243+ @command ()
244+ @rpc_endpoint_option
245+ def get_treasury_account (rpc_endpoint : Optional [str ]) -> None :
246+ """Treasury account address"""
247+ from aut .utils import autonity_from_endpoint_arg
248+
249+ print (autonity_from_endpoint_arg (rpc_endpoint ).get_treasury_account ())
250+
251+
252+ protocol_group .add_command (get_treasury_account )
253+
254+
255+ @command ()
256+ @rpc_endpoint_option
257+ def get_treasury_fee (rpc_endpoint : Optional [str ]) -> None :
258+ """Treasury fee"""
259+ from aut .utils import autonity_from_endpoint_arg
260+
261+ print (autonity_from_endpoint_arg (rpc_endpoint ).get_treasury_fee ())
262+
263+
264+ protocol_group .add_command (get_treasury_fee )
265+
266+
207267@command ()
208268@rpc_endpoint_option
209269def get_max_committee_size (rpc_endpoint : Optional [str ]) -> None :
@@ -271,6 +331,22 @@ def get_proposer(rpc_endpoint: Optional[str], height: int, round_: int) -> None:
271331protocol_group .add_command (get_proposer )
272332
273333
334+ @command ()
335+ @rpc_endpoint_option
336+ @argument ("block" , type = int , nargs = 1 )
337+ def get_epoch_from_block (rpc_endpoint : Optional [str ], block : int ) -> None :
338+ """Get the epoch of the given block"""
339+ from autonity import Autonity
340+
341+ from aut .utils import web3_from_endpoint_arg
342+
343+ aut = Autonity (web3_from_endpoint_arg (None , rpc_endpoint ))
344+ print (aut .get_epoch_from_block (block ))
345+
346+
347+ protocol_group .add_command (get_epoch_from_block )
348+
349+
274350@command ()
275351@rpc_endpoint_option
276352@keyfile_option ()
@@ -631,6 +707,271 @@ def set_treasury_fee(
631707protocol_group .add_command (set_treasury_fee )
632708
633709
710+ @command ()
711+ @rpc_endpoint_option
712+ @keyfile_option ()
713+ @from_option
714+ @tx_aux_options
715+ @argument ("contract-address-str" , metavar = "CONTRACT-ADDRESS" , nargs = 1 )
716+ def set_accountability_contract (
717+ rpc_endpoint : Optional [str ],
718+ keyfile : Optional [str ],
719+ from_str : Optional [str ],
720+ gas : Optional [str ],
721+ gas_price : Optional [str ],
722+ max_priority_fee_per_gas : Optional [str ],
723+ max_fee_per_gas : Optional [str ],
724+ fee_factor : Optional [float ],
725+ nonce : Optional [int ],
726+ chain_id : Optional [int ],
727+ contract_address_str : str ,
728+ ) -> None :
729+ """
730+ Set the Accountability Contract address. Restricted to the Operator account. See
731+ `setAccountabilityContract` on Autonity contract.
732+ """
733+ from eth_utils import to_checksum_address
734+
735+ from aut .utils import (
736+ autonity_from_endpoint_arg ,
737+ create_contract_tx_from_args ,
738+ from_address_from_argument ,
739+ to_json ,
740+ )
741+
742+ contract_address = to_checksum_address (contract_address_str )
743+ from_addr = from_address_from_argument (from_str , keyfile )
744+ aut = autonity_from_endpoint_arg (rpc_endpoint )
745+
746+ tx = create_contract_tx_from_args (
747+ function = aut .set_accountability_contract (contract_address ),
748+ from_addr = from_addr ,
749+ gas = gas ,
750+ gas_price = gas_price ,
751+ max_fee_per_gas = max_fee_per_gas ,
752+ max_priority_fee_per_gas = max_priority_fee_per_gas ,
753+ fee_factor = fee_factor ,
754+ nonce = nonce ,
755+ chain_id = chain_id ,
756+ )
757+ print (to_json (tx ))
758+
759+
760+ protocol_group .add_command (set_accountability_contract )
761+
762+
763+ @command ()
764+ @rpc_endpoint_option
765+ @keyfile_option ()
766+ @from_option
767+ @tx_aux_options
768+ @argument ("contract-address-str" , metavar = "CONTRACT-ADDRESS" , nargs = 1 )
769+ def set_oracle_contract (
770+ rpc_endpoint : Optional [str ],
771+ keyfile : Optional [str ],
772+ from_str : Optional [str ],
773+ gas : Optional [str ],
774+ gas_price : Optional [str ],
775+ max_priority_fee_per_gas : Optional [str ],
776+ max_fee_per_gas : Optional [str ],
777+ fee_factor : Optional [float ],
778+ nonce : Optional [int ],
779+ chain_id : Optional [int ],
780+ contract_address_str : str ,
781+ ) -> None :
782+ """
783+ Set the Oracle Contract address. Restricted to the Operator account. See
784+ `setOracleContract` on Autonity contract.
785+ """
786+ from eth_utils import to_checksum_address
787+
788+ from aut .utils import (
789+ autonity_from_endpoint_arg ,
790+ create_contract_tx_from_args ,
791+ from_address_from_argument ,
792+ to_json ,
793+ )
794+
795+ contract_address = to_checksum_address (contract_address_str )
796+ from_addr = from_address_from_argument (from_str , keyfile )
797+ aut = autonity_from_endpoint_arg (rpc_endpoint )
798+
799+ tx = create_contract_tx_from_args (
800+ function = aut .set_oracle_contract (contract_address ),
801+ from_addr = from_addr ,
802+ gas = gas ,
803+ gas_price = gas_price ,
804+ max_fee_per_gas = max_fee_per_gas ,
805+ max_priority_fee_per_gas = max_priority_fee_per_gas ,
806+ fee_factor = fee_factor ,
807+ nonce = nonce ,
808+ chain_id = chain_id ,
809+ )
810+ print (to_json (tx ))
811+
812+
813+ protocol_group .add_command (set_oracle_contract )
814+
815+
816+ @command ()
817+ @rpc_endpoint_option
818+ @keyfile_option ()
819+ @from_option
820+ @tx_aux_options
821+ @argument ("contract-address-str" , metavar = "CONTRACT-ADDRESS" , nargs = 1 )
822+ def set_acu_contract (
823+ rpc_endpoint : Optional [str ],
824+ keyfile : Optional [str ],
825+ from_str : Optional [str ],
826+ gas : Optional [str ],
827+ gas_price : Optional [str ],
828+ max_priority_fee_per_gas : Optional [str ],
829+ max_fee_per_gas : Optional [str ],
830+ fee_factor : Optional [float ],
831+ nonce : Optional [int ],
832+ chain_id : Optional [int ],
833+ contract_address_str : str ,
834+ ) -> None :
835+ """
836+ Set the ACU Contract address. Restricted to the Operator account. See
837+ `setAcuContract` on Autonity contract.
838+ """
839+ from eth_utils import to_checksum_address
840+
841+ from aut .utils import (
842+ autonity_from_endpoint_arg ,
843+ create_contract_tx_from_args ,
844+ from_address_from_argument ,
845+ to_json ,
846+ )
847+
848+ contract_address = to_checksum_address (contract_address_str )
849+ from_addr = from_address_from_argument (from_str , keyfile )
850+ aut = autonity_from_endpoint_arg (rpc_endpoint )
851+
852+ tx = create_contract_tx_from_args (
853+ function = aut .set_acu_contract (contract_address ),
854+ from_addr = from_addr ,
855+ gas = gas ,
856+ gas_price = gas_price ,
857+ max_fee_per_gas = max_fee_per_gas ,
858+ max_priority_fee_per_gas = max_priority_fee_per_gas ,
859+ fee_factor = fee_factor ,
860+ nonce = nonce ,
861+ chain_id = chain_id ,
862+ )
863+ print (to_json (tx ))
864+
865+
866+ protocol_group .add_command (set_acu_contract )
867+
868+
869+ @command ()
870+ @rpc_endpoint_option
871+ @keyfile_option ()
872+ @from_option
873+ @tx_aux_options
874+ @argument ("contract-address-str" , metavar = "CONTRACT-ADDRESS" , nargs = 1 )
875+ def set_supply_control_contract (
876+ rpc_endpoint : Optional [str ],
877+ keyfile : Optional [str ],
878+ from_str : Optional [str ],
879+ gas : Optional [str ],
880+ gas_price : Optional [str ],
881+ max_priority_fee_per_gas : Optional [str ],
882+ max_fee_per_gas : Optional [str ],
883+ fee_factor : Optional [float ],
884+ nonce : Optional [int ],
885+ chain_id : Optional [int ],
886+ contract_address_str : str ,
887+ ) -> None :
888+ """
889+ Set the Supply Control Contract address. Restricted to the Operator account. See
890+ `setSupplyControlContract` on Autonity contract.
891+ """
892+ from eth_utils import to_checksum_address
893+
894+ from aut .utils import (
895+ autonity_from_endpoint_arg ,
896+ create_contract_tx_from_args ,
897+ from_address_from_argument ,
898+ to_json ,
899+ )
900+
901+ contract_address = to_checksum_address (contract_address_str )
902+ from_addr = from_address_from_argument (from_str , keyfile )
903+ aut = autonity_from_endpoint_arg (rpc_endpoint )
904+
905+ tx = create_contract_tx_from_args (
906+ function = aut .set_supply_control_contract (contract_address ),
907+ from_addr = from_addr ,
908+ gas = gas ,
909+ gas_price = gas_price ,
910+ max_fee_per_gas = max_fee_per_gas ,
911+ max_priority_fee_per_gas = max_priority_fee_per_gas ,
912+ fee_factor = fee_factor ,
913+ nonce = nonce ,
914+ chain_id = chain_id ,
915+ )
916+ print (to_json (tx ))
917+
918+
919+ protocol_group .add_command (set_supply_control_contract )
920+
921+
922+ @command ()
923+ @rpc_endpoint_option
924+ @keyfile_option ()
925+ @from_option
926+ @tx_aux_options
927+ @argument ("contract-address-str" , metavar = "CONTRACT-ADDRESS" , nargs = 1 )
928+ def set_stabilization_contract (
929+ rpc_endpoint : Optional [str ],
930+ keyfile : Optional [str ],
931+ from_str : Optional [str ],
932+ gas : Optional [str ],
933+ gas_price : Optional [str ],
934+ max_priority_fee_per_gas : Optional [str ],
935+ max_fee_per_gas : Optional [str ],
936+ fee_factor : Optional [float ],
937+ nonce : Optional [int ],
938+ chain_id : Optional [int ],
939+ contract_address_str : str ,
940+ ) -> None :
941+ """
942+ Set the Supply Control Contract address. Restricted to the Operator account. See
943+ `setSupplyControlContract` on Autonity contract.
944+ """
945+ from eth_utils import to_checksum_address
946+
947+ from aut .utils import (
948+ autonity_from_endpoint_arg ,
949+ create_contract_tx_from_args ,
950+ from_address_from_argument ,
951+ to_json ,
952+ )
953+
954+ contract_address = to_checksum_address (contract_address_str )
955+ from_addr = from_address_from_argument (from_str , keyfile )
956+ aut = autonity_from_endpoint_arg (rpc_endpoint )
957+
958+ tx = create_contract_tx_from_args (
959+ function = aut .set_stabilization_contract (contract_address ),
960+ from_addr = from_addr ,
961+ gas = gas ,
962+ gas_price = gas_price ,
963+ max_fee_per_gas = max_fee_per_gas ,
964+ max_priority_fee_per_gas = max_priority_fee_per_gas ,
965+ fee_factor = fee_factor ,
966+ nonce = nonce ,
967+ chain_id = chain_id ,
968+ )
969+ print (to_json (tx ))
970+
971+
972+ protocol_group .add_command (set_stabilization_contract )
973+
974+
634975@command ()
635976@rpc_endpoint_option
636977@keyfile_option ()
0 commit comments