TickMath
Functions
tickSqrtPrices
Compute the lower and upper sqrtPrice of a tick.
Parameters
tickSpacing
uint256
The tick spacing used for calculations.
_tick
int32
The input tick value.
subTickIndex
Compute the base tick value from the pool tick and the tickSpacing. Revert if base tick is beyond the max tick boundary.
Parameters
tickSpacing
uint256
The tick spacing used for calculations.
_tick
int32
The input tick value.
tickSqrtPrice
Calculate the square root price for a given tick and tick spacing.
Parameters
tickSpacing
uint256
The tick spacing used for calculations.
_tick
int32
The input tick value.
Returns
_result
uint256
The square root price.
getTickL
Calculate liquidity of a tick.
Parameters
reserveA
uint256
Tick reserve of token A.
reserveB
uint256
Tick reserve of token B.
sqrtLowerTickPrice
uint256
The square root price of the lower tick edge.
sqrtUpperTickPrice
uint256
The square root price of the upper tick edge.
getSqrtPrice
Calculate square root price of a tick. Returns left edge of the tick if the tick has no reserves.
Parameters
reserveA
uint256
Tick reserve of token A.
reserveB
uint256
Tick reserve of token B.
sqrtLowerTickPrice
uint256
The square root price of the lower tick edge.
sqrtUpperTickPrice
uint256
The square root price of the upper tick edge.
liquidity
uint256
Returns
sqrtPrice
uint256
The calculated square root price.
getTickSqrtPriceAndL
Calculate square root price of a tick. Returns left edge of the tick if the tick has no reserves.
Parameters
reserveA
uint256
Tick reserve of token A.
reserveB
uint256
Tick reserve of token B.
sqrtLowerTickPrice
uint256
The square root price of the lower tick edge.
sqrtUpperTickPrice
uint256
The square root price of the upper tick edge.
Returns
sqrtPrice
uint256
The calculated square root price.
liquidity
uint256
The calculated liquidity.
Errors
TickMaxExceeded
Last updated