From 70a627bcd6294482db18017a1f836766dac017be Mon Sep 17 00:00:00 2001 From: liquid-8 Date: Mon, 10 Jun 2024 06:14:19 +0300 Subject: [PATCH] more stupidity fix --- uniswap/types.py | 6 +++--- uniswap/uniswap4.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/uniswap/types.py b/uniswap/types.py index e58ee8b..e131b7a 100644 --- a/uniswap/types.py +++ b/uniswap/types.py @@ -37,12 +37,12 @@ def __repr__(self) -> str: @dataclass class UniswapV4_path_key: # The lower currency of the pool, sorted numerically - currency0 : Address + currency0 : str # The higher currency of the pool, sorted numerically - currency1 : Address + currency1 : str # The pool swap fee, capped at 1_000_000. If the first bit is 1, the pool has a dynamic fee and must be exactly equal to 0x800000 fee : int # Ticks that involve positions must be a multiple of tick spacing tickSpacing : int # The hooks of the pool - hooks : List[Address] + hooks : str diff --git a/uniswap/uniswap4.py b/uniswap/uniswap4.py index 240dc57..9128eb0 100644 --- a/uniswap/uniswap4.py +++ b/uniswap/uniswap4.py @@ -777,8 +777,8 @@ def get_token(self, address: AddressLike, abi_name: str = "erc20") -> ERC20Token return ERC20Token(symbol, address, name, decimals) def get_pool_id(self, currency0: Union[AddressLike, str, None], currency1: Union[AddressLike, str, None], fee : int, tickSpacing : int, hooks : Union[AddressLike, str, None] = NOHOOK_ADDRESS) -> bytes: - currency0 = str(currency0) - currency1 = str(currency1) + currency0 = str(self.w3.to_checksum_address(currency0)) + currency1 = str(self.w3.to_checksum_address(currency1)) if int(currency0, 16) > int(currency1, 16): currency0 , currency1 = currency1 , currency0 pool_id = bytes(self.w3.solidity_keccak(["address", "address", "int24", "int24", "address"], [(currency0, currency1, fee, tickSpacing, hooks)]))