LiquidityAmounts
Last updated
Last updated
Provides functions for computing liquidity amounts from token amounts and prices
Computes the amount of liquidity received for a given amount of token0 and price range
Calculates amount0 (sqrt(upper) sqrt(lower)) / (sqrt(upper) - sqrt(lower))
Parameters:
sqrtRatioAX96
uint160
A sqrt price representing the first tick boundary
sqrtRatioBX96
uint160
A sqrt price representing the second tick boundary
amount0
uint256
The amount0 being sent in
Return Values:
liquidity
uint128
The amount of returned liquidity
Computes the amount of liquidity received for a given amount of token1 and price range
Calculates amount1 / (sqrt(upper) - sqrt(lower)).
sqrtRatioAX96
uint160
A sqrt price representing the first tick boundary
sqrtRatioBX96
uint160
A sqrt price representing the second tick boundary
amount1
uint256
The amount1 being sent in
liquidity
uint128
The amount of returned liquidity
Computes the maximum amount of liquidity received for a given amount of token0, token1, the current pool prices and the prices at the tick boundaries
sqrtRatioX96
uint160
A sqrt price representing the current pool prices
sqrtRatioAX96
uint160
A sqrt price representing the first tick boundary
sqrtRatioBX96
uint160
A sqrt price representing the second tick boundary
amount0
uint256
The amount of token0 being sent in
amount1
uint256
The amount of token1 being sent in
liquidity
uint128
The maximum amount of liquidity received
Computes the amount of token0 for a given amount of liquidity and a price range
sqrtRatioAX96
uint160
A sqrt price representing the first tick boundary
sqrtRatioBX96
uint160
A sqrt price representing the second tick boundary
liquidity
uint128
The liquidity being valued
amount0
uint256
The amount of token0
Computes the amount of token1 for a given amount of liquidity and a price range
sqrtRatioAX96
uint160
A sqrt price representing the first tick boundary
sqrtRatioBX96
uint160
A sqrt price representing the second tick boundary
liquidity
uint128
The liquidity being valued
amount1
uint256
The amount of token1
Computes the token0 and token1 value for a given amount of liquidity, the current pool prices and the prices at the tick boundaries
sqrtRatioX96
uint160
A sqrt price representing the current pool prices
sqrtRatioAX96
uint160
A sqrt price representing the first tick boundary
sqrtRatioBX96
uint160
A sqrt price representing the second tick boundary
liquidity
uint128
The liquidity being valued
amount0
uint256
The amount of token0
amount1
uint256
The amount of token1
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values:
Parameters:
Return Values: