Skip to content

Commit

Permalink
require network option
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Aug 7, 2024
1 parent 345b4de commit 646e3eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions scripts/initiate_ritual.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3

import click
from ape.cli import ConnectedProviderCommand, account_option
from ape.cli import ConnectedProviderCommand, account_option, network_option

from deployment import registry
from deployment.constants import ACCESS_CONTROLLERS, FEE_MODELS, SUPPORTED_TACO_DOMAINS
Expand All @@ -12,6 +12,7 @@

@click.command(cls=ConnectedProviderCommand, name="initiate-ritual")
@account_option()
@network_option(required=True)
@click.option(
"--domain",
"-d",
Expand Down Expand Up @@ -66,8 +67,9 @@
)
def cli(
domain,
duration,
account,
network,
duration,
access_controller,
fee_model,
authority,
Expand All @@ -79,6 +81,7 @@ def cli(

# Setup
check_plugins()
click.echo(f"Connected to {network.name} network.")
if not (bool(handpicked) ^ (num_nodes is not None)):
raise click.BadOptionUsage(
option_name="--num-nodes",
Expand Down
14 changes: 10 additions & 4 deletions scripts/manage_subscription.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import click
from ape import Contract
from ape.cli import account_option, ConnectedProviderCommand
from ape.cli import account_option, ConnectedProviderCommand, network_option

from deployment import registry
from deployment.options import (
Expand Down Expand Up @@ -51,6 +51,7 @@ def cli():

@cli.command(cls=ConnectedProviderCommand)
@account_option()
@network_option(required=True)
@domain_option
@subscription_contract_option
@encryptor_slots_option
Expand All @@ -59,9 +60,10 @@ def cli():
default=0,
help="Subscription billing period number to pay for.",
)
def pay_subscription(account, domain, subscription_contract, encryptor_slots, period):
def pay_subscription(account, network, domain, subscription_contract, encryptor_slots, period):
"""Pay for a new subscription period and initial encryptor slots."""
check_plugins()
click.echo(f"Connected to {network.name} network.")
transactor = Transactor(account=account)
subscription_contract = registry.get_contract(
contract_name=subscription_contract,
Expand Down Expand Up @@ -92,12 +94,14 @@ def pay_subscription(account, domain, subscription_contract, encryptor_slots, pe

@cli.command(cls=ConnectedProviderCommand)
@account_option()
@network_option(required=True)
@domain_option
@subscription_contract_option
@encryptor_slots_option
def pay_slots(account, domain, subscription_contract, encryptor_slots):
def pay_slots(account, network, domain, subscription_contract, encryptor_slots):
"""Pay for additional encryptor slots in the current billing period."""
check_plugins()
click.echo(f"Connected to {network.name} network.")
transactor = Transactor(account=account)
subscription_contract = registry.get_contract(
contract_name=subscription_contract,
Expand All @@ -123,12 +127,14 @@ def pay_slots(account, domain, subscription_contract, encryptor_slots):

@cli.command(cls=ConnectedProviderCommand)
@account_option()
@network_option(required=True)
@domain_option
@ritual_id_option
@access_controller_option
@encryptors_option
def add_encryptors(account, domain, ritual_id, access_controller, encryptors):
def add_encryptors(account, network, domain, ritual_id, access_controller, encryptors):
"""Authorize encryptors to the access control contract for a ritual."""
click.echo(f"Connected to {network.name} network.")
access_controller = registry.get_contract(
contract_name=access_controller,
domain=domain
Expand Down

0 comments on commit 646e3eb

Please sign in to comment.