Exemplo n.º 1
0
def get_contract_address(chain_id, contract_name):
    try:
        network_contracts = get_contracts_deployment_info(chain_id)
        assert network_contracts
        return network_contracts["contracts"][contract_name]["address"]
    except (TypeError, AssertionError) as exc:
        log.warn(str(exc))
        return "0x0"
Exemplo n.º 2
0
    def get_available_configurations(cls):
        configurations = []
        for config_file_path in cls.list_existing_files():
            try:
                configurations.append(cls.load(config_file_path))
            except (ValueError, KeyError) as exc:
                log.warn(f"Failed to load {config_file_path} as configuration file: {exc}")

        return configurations
Exemplo n.º 3
0
def get_contract_address(chain_id, contract_name) -> Address:
    try:
        network_contracts = get_contracts_deployment_info(chain_id)
        assert network_contracts
        return to_canonical_address(
            network_contracts["contracts"][contract_name]["address"])
    except (TypeError, AssertionError, KeyError) as exc:
        log.warn(str(exc))
        raise ValueError(
            f"{contract_name} does not exist on chain id {chain_id}") from exc