Skip to content

Commit

Permalink
Move address to config
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Nov 11, 2024
1 parent 237f61f commit 2567a49
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions indexers-v2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,21 @@ def load_network_config(path):
name = contract["name"]
package = contract["package"]
contract_data = snx.contracts[package][name]
save_abi(contract_data["abi"], name)
contracts.append({"name": name, "address": contract_data["address"]})
abi = contract_data["abi"]
address = contract_data["address"]
save_abi(abi, name)
contracts.append({"name": name, "address": address})
elif "contracts_from_abi" in custom_config:
contracts_from_abi = custom_config["contracts_from_abi"]
for contract in contracts_from_abi:
if contract_names is not None:
if contract["name"] not in parsed_contract_names:
continue
name = contract["name"]
address = contract["address"]
with open(f"{path}/abi/{name}.json", "r") as file:
contract_data = json.load(file)
save_abi(contract_data["abi"], name)
contracts.append({"name": name, "address": address})
abi = json.load(file)
save_abi(abi, name)
contracts.append({"name": name, "address": contract["address"]})
else:
message = "No contracts found in network config"
raise Exception(message)
Expand Down

0 comments on commit 2567a49

Please sign in to comment.