def add_wallet_args(sub: Any): sub.add_argument( "--pem", required=not (utils.is_arg_present("--keyfile", sys.argv)), help="🔑 the PEM file, if keyfile not provided") sub.add_argument( "--pem-index", default=0, help="🔑 the index in the PEM file (default: %(default)s)") sub.add_argument("--keyfile", required=not (utils.is_arg_present("--pem", sys.argv)), help="🔑 a JSON keyfile, if PEM not provided") sub.add_argument( "--passfile", required=not (utils.is_arg_present("--pem", sys.argv)), help="🔑 a file containing keyfile's password, if keyfile provided")
def setup_parser(subparsers: Any) -> Any: parser = cli_shared.add_group_subparser( subparsers, "staking-provider", "Create New Delegation Contract " "and some more staking-provider related " "options") subparsers = parser.add_subparsers() # create new delegation contract sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "create-new-delegation-contract", "Create a new delegation system smart contract, transferred value must be" "greater than baseIssuingCost + min deposit value") _add_common_arguments(sub) sub.add_argument("--total-delegation-cap", required=True, help="the total delegation contract capacity") sub.add_argument("--service-fee", required=True, help="the delegation contract service fee") sub.set_defaults(func=do_create_delegation_contract) # get contract address sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "get-contract-address", "Get create contract address by transaction hash") sub.add_argument("--create-tx-hash", required=True, help="the hash") sub.add_argument("--sender", required=False, help="the sender address") cli_shared.add_proxy_arg(sub) cli_shared.add_omit_fields_arg(sub) sub.set_defaults(func=get_contract_address_by_deploy_tx_hash) # add a new node sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "add-nodes", "Add new nodes must be called by the contract owner") sub.add_argument("--validators-file", required=True, help="a JSON file describing the Nodes") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=add_new_nodes) # remove nodes sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "remove-nodes", "Remove nodes must be called by the contract owner") sub.add_argument("--bls-keys", required=True, help="a list with the bls keys of the nodes") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=remove_nodes) # stake nodes sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "stake-nodes", "Stake nodes must be called by the contract owner") sub.add_argument("--bls-keys", required=True, help="a list with the bls keys of the nodes") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=stake_nodes) # unbond nodes sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "unbond-nodes", "Unbond nodes must be called by the contract owner") sub.add_argument("--bls-keys", required=True, help="a list with the bls keys of the nodes") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=unbond_nodes) # unstake nodes sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "unstake-nodes", "Unstake nodes must be called by the contract owner") sub.add_argument("--bls-keys", required=True, help="a list with the bls keys of the nodes") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=unstake_nodes) # unjail nodes sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "unjail-nodes", "Unjail nodes must be called by the contract owner") sub.add_argument("--bls-keys", required=True, help="a list with the bls keys of the nodes") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=unjail_nodes) # change service fee sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "change-service-fee", "Change service fee must be called by the contract owner") sub.add_argument("--service-fee", required=True, help="new service fee value") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=change_service_fee) # modify total delegation cap sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "modify-delegation-cap", "Modify delegation cap must be called by the contract owner") sub.add_argument("--delegation-cap", required=True, help="new delegation contract capacity") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=modify_delegation_cap) # set automatic activation sub = cli_shared.add_command_subparser( subparsers, "staking-provider", "automatic-activation", "Automatic activation must be called by the contract owner") sub.add_argument("--set", action="store_true", required=not (utils.is_arg_present("--unset", sys.argv)), help="set automatic activation True") sub.add_argument("--unset", action="store_true", required=not (utils.is_arg_present("--set", sys.argv)), help="set automatic activation False") sub.add_argument("--delegation-contract", required=True, help="address of the delegation contract") _add_common_arguments(sub) sub.set_defaults(func=automatic_activation)
def setup_parser(subparsers: Any) -> Any: parser = cli_shared.add_group_subparser(subparsers, "validator", "Stake, UnStake, UnBond, Unjail and other " "actions useful for " "Validators") subparsers = parser.add_subparsers() sub = cli_shared.add_command_subparser(subparsers, "validator", "stake", "Stake value into the Network") _add_common_arguments(sub) sub.add_argument("--reward-address", default="", help="the reward address") sub.add_argument("--validators-file", required=not (utils.is_arg_present("--top-up", sys.argv)), help="a JSON file describing the Nodes") sub.add_argument("--top-up", action="store_true", default=False, required=not (utils.is_arg_present("--validators-file", sys.argv)), help="Stake value for top up") sub.set_defaults(func=do_stake) sub = cli_shared.add_command_subparser(subparsers, "validator", "unstake", "Unstake value") _add_common_arguments(sub) _add_nodes_arg(sub) sub.set_defaults(func=do_unstake) sub = cli_shared.add_command_subparser(subparsers, "validator", "unjail", "Unjail a Validator Node") _add_common_arguments(sub) _add_nodes_arg(sub) sub.set_defaults(func=do_unjail) sub = cli_shared.add_command_subparser(subparsers, "validator", "unbond", "Unbond tokens for a bls key") _add_common_arguments(sub) _add_nodes_arg(sub) sub.set_defaults(func=do_unbond) sub = cli_shared.add_command_subparser(subparsers, "validator", "change-reward-address", "Change the reward address") _add_common_arguments(sub) sub.add_argument("--reward-address", required=True, help="the new reward address") sub.set_defaults(func=change_reward_address) sub = cli_shared.add_command_subparser(subparsers, "validator", "claim", "Claim rewards") _add_common_arguments(sub) sub.set_defaults(func=do_claim) sub = cli_shared.add_command_subparser(subparsers, "validator", "unstake-nodes", "Unstake-nodes will unstake " "nodes for provided bls keys") _add_common_arguments(sub) _add_nodes_arg(sub) sub.set_defaults(func=do_unstake_nodes) sub = cli_shared.add_command_subparser(subparsers, "validator", "unstake-tokens", "This command will un-stake the " "given amount (if value is " "greater than the existing " "topUp value, it will unStake " "one or several nodes)") _add_common_arguments(sub) sub.add_argument("--unstake-value", default=0, help="the unstake value") sub.set_defaults(func=do_unstake_tokens) sub = cli_shared.add_command_subparser(subparsers, "validator", "unbond-nodes", "It will unBond nodes") _add_common_arguments(sub) _add_nodes_arg(sub) sub.set_defaults(func=do_unbond_nodes) sub = cli_shared.add_command_subparser(subparsers, "validator", "unbond-tokens", "It will unBond tokens, if " "provided value is bigger that " "topUp value will unBond nodes") _add_common_arguments(sub) sub.add_argument("--unbond-value", default=0, help="the unbond value") sub.set_defaults(func=do_unbond_tokens) sub = cli_shared.add_command_subparser(subparsers, "validator", "clean-registered-data", "Deletes duplicated keys " "from registered data") _add_common_arguments(sub) sub.set_defaults(func=do_clean_registered_data) sub = cli_shared.add_command_subparser(subparsers, "validator", "restake-unstaked-nodes", "It will reStake UnStaked nodes") _add_common_arguments(sub) _add_nodes_arg(sub) sub.set_defaults(func=do_restake_unstaked_nodes) parser.epilog = cli_shared.build_group_epilog(subparsers) return subparsers