Skip to main content
Provides functions for computing liquidity amounts from token amounts and prices

Functions

getLiquidityForAmount0

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:

Return Values:

getLiquidityForAmount1

Computes the amount of liquidity received for a given amount of token1 and price range Calculates amount1 / (sqrt(upper) - sqrt(lower)).

Parameters:

Return Values:

getLiquidityForAmounts

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

Parameters:

Return Values:

getAmount0ForLiquidity

Computes the amount of token0 for a given amount of liquidity and a price range

Parameters:

Return Values:

getAmount1ForLiquidity

Computes the amount of token1 for a given amount of liquidity and a price range

Parameters:

Return Values:

getAmountsForLiquidity

Computes the token0 and token1 value for a given amount of liquidity, the current pool prices and the prices at the tick boundaries

Parameters:

Return Values: