@gala-chain/api ∙ API
API > getNextSqrtPriceFromAmount0
Function: getNextSqrtPriceFromAmount0()
getNextSqrtPriceFromAmount0(
sqrtPrice
,liquidity
,amount
,add
):BigNumber
Gets the next square root price given a delta of token0.
Uses liquidity * sqrtPrice / (liquidity ± amount * sqrtPrice)
.
Parameters
▪ sqrtPrice: BigNumber
The starting price, before accounting for the token0 delta.
▪ liquidity: BigNumber
The amount of usable liquidity.
▪ amount: BigNumber
The amount of token0 to add or remove from virtual reserves.
▪ add: boolean
Whether to add (true
) or remove (false
) the amount of token0.
Returns
The price after adding or removing the specified amount.