Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: catch wider range of explorer excs #668

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions y/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,11 @@ async def get_code(self, block: Optional[Block] = None) -> HexBytes:
_contract_queue = a_sync.SmartProcessingQueue(Contract._coroutine, num_workers=32)

@memory.cache()
# TODO: async this and put it into ydb for quicker startups
#yLazyLogger(logger)
def is_contract(address: AnyAddressType) -> bool:
'''
Checks to see if the input address is a contract. Returns `True` if:
Checks to see if the input address is a contract. Returns `False` if:
- The address is not and has never been a contract
- The address used to be a contract but has self-destructed
'''
Expand Down Expand Up @@ -485,7 +486,7 @@ def _extract_abi_data(address):
raise ContractNotFound(address) from e
raise
except ValueError as e:
if "Invalid API Key" in str(e):
if str(e).startswith("Failed to retrieve data from API") or "invalid api key" in str(e).lower():
raise exceptions.InvalidAPIKeyError from e
if exceptions.contract_not_verified(e):
raise exceptions.ContractNotVerified(f'{address} on {Network.printable()}') from e
Expand Down
Loading