Skip to content

Commit

Permalink
fix: use ape.Contract before default ERC20 contract type
Browse files Browse the repository at this point in the history
fixes: #8
  • Loading branch information
fubuloubu committed Feb 2, 2024
1 parent ef9419c commit 8449b7b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ape_tokens/managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ape.contracts import ContractInstance
from ape.exceptions import ContractNotFoundError
from ape.types import ContractType
from ape.utils import ManagerAccessMixin, cached_property
from eth_utils import to_checksum_address
Expand Down Expand Up @@ -122,6 +123,9 @@ def __getitem__(self, symbol: str) -> ContractInstance:
except ValueError as err:
raise KeyError(f"Symbol '{symbol}' is not a known token symbol") from err

return self.chain_manager.contracts.instance_at(
to_checksum_address(token_info.address), contract_type=ERC20
)
try:
return self.chain_manager.contracts.instance_at(to_checksum_address(token_info.address))
except ContractNotFoundError:
return self.chain_manager.contracts.instance_at(
to_checksum_address(token_info.address), contract_type=ERC20
)

0 comments on commit 8449b7b

Please sign in to comment.