Skip to content
Merged
Show file tree
Hide file tree
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 uniswap/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Union
from dataclasses import dataclass
from eth_typing.evm import Address, ChecksumAddress
from typing import List, Tuple


AddressLike = Union[Address, ChecksumAddress]
Expand Down Expand Up @@ -44,7 +45,7 @@ class UniswapV4_PathKey:
# Ticks that involve positions must be a multiple of tick spacing
tickSpacing : int
# The hooks of the pool
hooks : list[Address]
hooks : List[Address]

def __repr__(self) -> (Address, Address, int, int, list[Address]):
def __repr__(self) -> Tuple(Address, Address, int, int, List[Address]):
return (self.currency0, self.currency1, self.fee, self.tickSpacing, self.hooks)
14 changes: 4 additions & 10 deletions uniswap/uniswap4.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_quote_exact_input_single(
sqrt_price_limit_x96: int = 0,
zero_for_one: bool = True,
hooks: Union[AddressLike, str, None] = NOHOOK_ADDRESS,
):
) -> Any:
"""
:if `zero_to_one` is true: given `qty` amount of the input `token0`, returns the maximum output amount of output `token1`.
:if `zero_to_one` is false: returns the minimum amount of `token0` required to buy `qty` amount of `token1`.
Expand Down Expand Up @@ -173,7 +173,7 @@ def get_quote_exact_output_single(
sqrt_price_limit_x96: int = 0,
zero_for_one: bool = True,
hooks: Union[AddressLike, str, None] = NOHOOK_ADDRESS,
):
) -> Any:
"""
:if `zero_to_one` is true: given `qty` amount of the input `token0`, returns the maximum output amount of output `token1`.
:if `zero_to_one` is false: returns the minimum amount of `token0` required to buy `qty` amount of `token1`.
Expand Down Expand Up @@ -210,14 +210,11 @@ def get_quote_exact_input(
currency: AddressLike, # input token
qty: int,
path : list[UniswapV4_PathKey],
):
) -> Any:
"""
:path is a swap route
"""

if currency0 == currency1:
raise ValueError

quote_params = {
"exactCurrency": currency,
"path": path,
Expand All @@ -236,14 +233,11 @@ def get_quote_exact_output(
currency: AddressLike, # input token
qty: int,
path : list[UniswapV4_PathKey],
):
) -> Any:
"""
:path is a swap route
"""

if currency0 == currency1:
raise ValueError

quote_params = {
"exactCurrency": currency,
"path": path,
Expand Down