0g-storage-node/tests/test_framework/contracts.py

14 lines
347 B
Python
Raw Normal View History

from pathlib import Path
import json
from web3 import Web3
2024-07-22 09:32:51 +00:00
def load_contract_metadata(path: str, name: str):
path = Path(path)
try:
found_file = next(path.rglob(f"{name}.json"))
return json.loads(open(found_file, "r").read())
except StopIteration:
raise Exception(f"Cannot found contract {name}'s metadata")