Skip to content

Commit

Permalink
refactor: avoid encoding twice
Browse files Browse the repository at this point in the history
Co-authored-by: antazoey <[email protected]>
  • Loading branch information
fubuloubu and antazoey committed Feb 2, 2024
1 parent 0363f7d commit c7e69e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ape_tokens/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ def __getitem__(self, symbol: str) -> ContractInstance:
except ValueError as err:
raise KeyError(f"Symbol '{symbol}' is not a known token symbol") from err

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

0 comments on commit c7e69e4

Please sign in to comment.