Skip to content

typing fixes #392

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

Merged
merged 1 commit into from
Jun 5, 2024
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
3 changes: 0 additions & 3 deletions uniswap/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,3 @@ class UniswapV4_PathKey:
tickSpacing : int
# The hooks of the pool
hooks : List[Address]

def __repr__(self) -> Tuple[Address, Address, int, int, List[Address]]:
return (self.currency0, self.currency1, self.fee, self.tickSpacing, self.hooks)
6 changes: 4 additions & 2 deletions uniswap/uniswap4.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ def get_quote_exact_input(
:path is a swap route
"""

quote_path = [item.astulpe() for item in path]
quote_params = {
"exactCurrency": currency,
"path": path,
"path": quote_path,
"recipient": self.address,
"exactAmount": qty,
}
Expand All @@ -238,9 +239,10 @@ def get_quote_exact_output(
:path is a swap route
"""

quote_path = [item.astulpe() for item in path]
quote_params = {
"exactCurrency": currency,
"path": path,
"path": quote_path,
"recipient": self.address,
"exactAmount": qty,
}
Expand Down
7 changes: 5 additions & 2 deletions uniswap/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ def _encode_path(token_in: AddressLike, route: List[Tuple[int, AddressLike]]) ->


# Adapted from: https://github.com/Uniswap/v3-sdk/blob/main/src/utils/encodeSqrtRatioX96.ts
def decode_sqrt_ratioX96(amount_0: int, amount_1: int) -> int:
return int(amount_0 * amount_0 * 10**amount_1 >> 192)
def decode_sqrt_ratioX96(sqrtPriceX96: int) -> float:
Q96 = 2**96
ratio = sqrtPriceX96 / Q96
price = ratio**2
return price

# Adapted from: https://github.com/Uniswap/v3-sdk/blob/main/src/utils/encodeSqrtRatioX96.ts
def encode_sqrt_ratioX96(amount_0: int, amount_1: int) -> int:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy