mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-27 00:35:18 +00:00
306c43c9dc
* Fix compile warning & Search contract by name automatically Migrate to the new contract interfaces * Fix compile * Fix lint
15 lines
401 B
Python
15 lines
401 B
Python
from os.path import join
|
|
from pathlib import Path
|
|
import json
|
|
from web3 import Web3
|
|
|
|
|
|
def load_contract_metadata(base_path: str, name: str):
|
|
path = Path(join(base_path, "artifacts"))
|
|
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")
|
|
|