Skip to content

Commit

Permalink
Restrict value choices for taco domain cli parameter, and fix initiat…
Browse files Browse the repository at this point in the history
…e_ritual bug to adjust providers list based on provided domain.
  • Loading branch information
derekpierre committed Oct 16, 2023
1 parent 6eb9eb6 commit 5d6f1b7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
13 changes: 11 additions & 2 deletions deployment/constants.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pathlib import Path

from ape import project

import deployment
from ape import project

DEPLOYMENT_DIR = Path(deployment.__file__).parent
CONSTRUCTOR_PARAMS_DIR = DEPLOYMENT_DIR / "constructor_params"
Expand All @@ -15,6 +14,16 @@
PROXY_NAME = "TransparentUpgradeableProxy"
OZ_DEPENDENCY = project.dependencies["openzeppelin"]["4.9.1"]

#
# Domains
#
LYNX = "lynx"
TAPIR = "tapir"
MAINNET = "mainnet"

SUPPORTED_TACO_DOMAINS = [LYNX, TAPIR, MAINNET]


LYNX_NODES = {
# staking provider -> operator
"0xb15d5a4e2be34f4be154a1b08a94ab920ffd8a41": "0x890069745E9497C6f99Db68C4588deC5669F3d3E",
Expand Down
3 changes: 2 additions & 1 deletion scripts/authorize_enrico.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import click
from ape import project
from ape.cli import NetworkBoundCommand, account_option, network_option
from deployment.constants import SUPPORTED_TACO_DOMAINS
from deployment.params import Transactor
from deployment.registry import contracts_from_registry
from deployment.utils import check_plugins, registry_filepath_from_domain
Expand All @@ -16,7 +17,7 @@
"--domain",
"-d",
help="TACo domain",
type=click.STRING,
type=click.Choice(SUPPORTED_TACO_DOMAINS),
required=True,
)
@click.option(
Expand Down
3 changes: 2 additions & 1 deletion scripts/grant_initiator_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import click
from ape import networks, project
from ape.cli import NetworkBoundCommand, account_option, network_option
from deployment.constants import SUPPORTED_TACO_DOMAINS
from deployment.params import Transactor
from deployment.registry import contracts_from_registry
from deployment.utils import check_plugins, registry_filepath_from_domain
Expand All @@ -15,7 +16,7 @@
"--domain",
"-d",
help="TACo domain",
type=click.STRING,
type=click.Choice(SUPPORTED_TACO_DOMAINS),
required=True,
)
def cli(network, account, domain):
Expand Down
13 changes: 10 additions & 3 deletions scripts/initiate_ritual.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click
from ape import project
from ape.cli import NetworkBoundCommand, account_option, network_option
from deployment.constants import LYNX_NODES
from deployment.constants import LYNX, LYNX_NODES, SUPPORTED_TACO_DOMAINS, TAPIR, TAPIR_NODES
from deployment.params import Transactor
from deployment.registry import contracts_from_registry
from deployment.utils import check_plugins, registry_filepath_from_domain
Expand All @@ -16,7 +16,7 @@
"--domain",
"-d",
help="TACo domain",
type=click.STRING,
type=click.Choice(SUPPORTED_TACO_DOMAINS),
required=True,
)
@click.option(
Expand All @@ -34,6 +34,14 @@ def cli(domain, duration, network, account):
print(f"Using account: {account}")
transactor = Transactor(account=account)

if domain == LYNX:
providers = list(sorted(LYNX_NODES.keys()))
elif domain == TAPIR:
providers = list(sorted(TAPIR_NODES.keys()))
else:
# mainnet sampling not currently supported
raise ValueError(f"Sampling of providers not supported for domain '{domain}'")

registry_filepath = registry_filepath_from_domain(domain=domain)

chain_id = project.chain_manager.chain_id
Expand All @@ -42,7 +50,6 @@ def cli(domain, duration, network, account):

global_allow_list = deployments[project.GlobalAllowList.contract_type.name]
authority = transactor.get_account().address
providers = list(sorted(LYNX_NODES.keys()))

while True:
transactor.transact(
Expand Down
3 changes: 2 additions & 1 deletion scripts/verify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import click
from ape import networks
from ape.cli import NetworkBoundCommand, network_option
from deployment.constants import SUPPORTED_TACO_DOMAINS
from deployment.registry import contracts_from_registry
from deployment.utils import registry_filepath_from_domain, verify_contracts

Expand All @@ -11,7 +12,7 @@
"--domain",
"-d",
help="TACo domain",
type=click.STRING,
type=click.Choice(SUPPORTED_TACO_DOMAINS),
required=True,
)
def cli(network, domain):
Expand Down

0 comments on commit 5d6f1b7

Please sign in to comment.