diff --git a/src/dexorder/contract/__init__.py b/src/dexorder/contract/__init__.py index 0924b33..d7f9935 100644 --- a/src/dexorder/contract/__init__.py +++ b/src/dexorder/contract/__init__.py @@ -6,8 +6,14 @@ from .contract_proxy import ContractProxy def get_contract_data(name): - with open(f'../contract/out/{name}.sol/{name}.json', 'rt') as file: - return json.load(file) + try: + # try the interface file first + with open(f'../contract/out/I{name}.sol/I{name}.json', 'rt') as file: + return json.load(file) + except FileNotFoundError: + # if no interface exists, use the plain name + with open(f'../contract/out/{name}.sol/{name}.json', 'rt') as file: + return json.load(file) def get_contract_event(contract_name:str, event_name:str):