Skip to content

Commit

Permalink
Don't use test utils for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Nov 27, 2023
1 parent 7f78b30 commit 8883c78
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
4 changes: 1 addition & 3 deletions scripts/change_registry_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import boa
from rich.console import Console as RichConsole

from scripts.deployment_utils import setup_environment
from tests.utils import ZERO_ADDRESS, get_deployed_contract
from scripts.deployment_utils import setup_environment, ZERO_ADDRESS, get_deployed_contract

RICH_CONSOLE = RichConsole(file=sys.stdout)
ADDRESS_PROVIDER = "0x0000000022D53366457F9d5E68Ec105046FC4383"
CRYPTO_REGISTRY_HANDLER = "0x5f493fEE8D67D3AE3bA730827B34126CFcA0ae94"
CRYPTO_REGISTRY_HANDLER_ID = 2
OLD_CRYPTO_REGISTRY_HANDLER = "0x22ceb131d3170f9f2FeA6b4b1dE1B45fcfC86E56"
Expand Down
3 changes: 3 additions & 0 deletions scripts/class_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
the dependencies between contracts.
Usage:
python scripts/class_diagram.py [glob_pattern] (--internal) (--members)
Unfortunately, rich doesn't support images in the terminal yet, so you'll have to
copy the source or link to the image and paste it in your browser.
"""
import sys
from base64 import b64encode
Expand Down
16 changes: 14 additions & 2 deletions scripts/deployment_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

import boa
from boa.network import NetworkEnv
from boa.vyper.contract import VyperContract
from eth_account import Account
from rich.console import Console as RichConsole

FIDDYDEPLOYER = "0x2d12D0907A388811e3AA855A550F959501d303EE"
ADDRESS_PROVIDER = "0x0000000022D53366457F9d5E68Ec105046FC4383"
FIDDY_DEPLOYER = "0x2d12D0907A388811e3AA855A550F959501d303EE"
ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"


def setup_environment(console: RichConsole):
Expand All @@ -30,5 +33,14 @@ def setup_environment(console: RichConsole):

console.log("Simulation Mode. Writing to mainnet-fork.")
boa.env.fork(url=environ["RPC_ETHEREUM"])
boa.env.eoa = FIDDYDEPLOYER
boa.env.eoa = FIDDY_DEPLOYER
return False

def get_deployed_contract(contract_name: str, address: str) -> VyperContract:
"""
Loads a contract and retrieves a deployed instance of it with the given address.
:param contract_name: The name of the contract ABI to load.
:param address: The address of the deployed contract.
"""
file_name = f"contracts/interfaces/{contract_name}.json"
return boa.load_abi(file_name).at(address)
3 changes: 3 additions & 0 deletions scripts/print_missing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Print the missing functions from the registry.
"""
import json

import boa
Expand Down
3 changes: 1 addition & 2 deletions scripts/setup_metaregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import boa
from rich.console import Console as RichConsole

from scripts.deployment_utils import setup_environment
from tests.utils import ZERO_ADDRESS, get_deployed_contract
from scripts.deployment_utils import ZERO_ADDRESS, get_deployed_contract, setup_environment

RICH_CONSOLE = RichConsole(file=sys.stdout)

Expand Down

0 comments on commit 8883c78

Please sign in to comment.