Content pfp
Content
@
0 reply
0 recast
0 reaction

fico pfp
fico
@fico23
is there a way to calculate 2% slippage on both tokens? like how many tokens0 we need to reach 2% slippage.
1 reply
0 recast
0 reaction

Haardik pfp
Haardik
@haardikkk
Given the current price P 2% slippage (depending on direction) will be hit when price is 1.02*P or 0.98*P Take the square root and convert to Q Notation to get the sqrtPriceLimitX96
1 reply
0 recast
1 reaction

fico pfp
fico
@fico23
yeah I figured that part, but there isnt any periphery or sdk function that does that? they're all either exact input or exact output. but i need something like: getInput(target_sqrPriceLimitX96)
2 replies
0 recast
0 reaction

Haardik pfp
Haardik
@haardikkk
I think you can get the total liquidity within the range of current price to target price, and a swap that can cover that liquidity will (roughly) shift the price to that target (i say roughly because things like swap fees etc can have some affect)
1 reply
0 recast
0 reaction

Haardik pfp
Haardik
@haardikkk
Not sure about helper functions for that - I’ll try looking Tagging @poi as well if you know this
0 reply
0 recast
2 reactions