Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3deff6f

Browse files
authored
Merge pull request#392 from liquid-8/dev
typing fixes
2 parents56be7db +ab23b04 commit3deff6f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

‎uniswap/types.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,3 @@ class UniswapV4_PathKey:
4646
tickSpacing :int
4747
# The hooks of the pool
4848
hooks :List[Address]
49-
50-
def__repr__(self)->Tuple[Address,Address,int,int,List[Address]]:
51-
return (self.currency0,self.currency1,self.fee,self.tickSpacing,self.hooks)

‎uniswap/uniswap4.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ def get_quote_exact_input(
215215
:path is a swap route
216216
"""
217217

218+
quote_path= [item.astulpe()foriteminpath]
218219
quote_params= {
219220
"exactCurrency":currency,
220-
"path":path,
221+
"path":quote_path,
221222
"recipient":self.address,
222223
"exactAmount":qty,
223224
}
@@ -238,9 +239,10 @@ def get_quote_exact_output(
238239
:path is a swap route
239240
"""
240241

242+
quote_path= [item.astulpe()foriteminpath]
241243
quote_params= {
242244
"exactCurrency":currency,
243-
"path":path,
245+
"path":quote_path,
244246
"recipient":self.address,
245247
"exactAmount":qty,
246248
}

‎uniswap/util.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ def _encode_path(token_in: AddressLike, route: List[Tuple[int, AddressLike]]) ->
9292

9393

9494
# Adapted from: https://github.com/Uniswap/v3-sdk/blob/main/src/utils/encodeSqrtRatioX96.ts
95-
defdecode_sqrt_ratioX96(amount_0:int,amount_1:int)->int:
96-
returnint(amount_0*amount_0*10**amount_1>>192)
95+
defdecode_sqrt_ratioX96(sqrtPriceX96:int)->float:
96+
Q96=2**96
97+
ratio=sqrtPriceX96/Q96
98+
price=ratio**2
99+
returnprice
97100

98101
# Adapted from: https://github.com/Uniswap/v3-sdk/blob/main/src/utils/encodeSqrtRatioX96.ts
99102
defencode_sqrt_ratioX96(amount_0:int,amount_1:int)->int:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp