Skip to content

Commit

Permalink
Have contracts_from_registry return a dict of contract name -> contra…
Browse files Browse the repository at this point in the history
…ct instance instead of a list.
  • Loading branch information
derekpierre committed Sep 26, 2023
1 parent 77eb119 commit 70617af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions deployment/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
from typing import Dict, List, NamedTuple, Optional

from ape.contracts import ContractInstance
from eth_typing import ChecksumAddress
from eth_utils import to_checksum_address

from deployment.params import get_contract_container
from deployment.utils import check_registry_filepath
from eth_typing import ChecksumAddress
from eth_utils import to_checksum_address


class RegistryEntry(NamedTuple):
Expand Down Expand Up @@ -191,12 +190,12 @@ def merge_registries(
return output_filepath


def contracts_from_registry(registry_filepath: Path):
registry_entries = read_registry(filepath=registry_filepath)
deployments = list()
def contracts_from_registry(filepath: Path) -> Dict[str, ContractInstance]:
registry_entries = read_registry(filepath=filepath)
deployments = dict()
for registry_entry in registry_entries:
contract_type = registry_entry.contract_name
contract_container = get_contract_container(contract_type)
contract_instance = contract_container.at(registry_entry.contract_address)
deployments.append(contract_instance)
deployments[contract_type] = contract_instance
return deployments
2 changes: 1 addition & 1 deletion scripts/lynx/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

def main():
contracts = contracts_from_registry(REGISTRY_FILEPATH)
verify_contracts(contracts)
verify_contracts(list(contracts.values()))

0 comments on commit 70617af

Please sign in to comment.