load_contract_abi
Function
def load_contract_abi(address):
try:
abi = json.load(open("./data/abi/{}.json".format(address)))
except FileNotFoundError:
try:
abi = get_abi_from_blockscout(address)
except Exception as e:
logging.debug(e)
raise FileNotFoundError("Download a copy of the abi from Blockscout to this folder")
else:
if abi:
open("./data/abi/{}.json".format(address), 'w').write(json.dumps(abi, indent=4))
else:
raise FileNotFoundError("No abi found for this contract")
return abi