infrastructure-upgrade/lib/v3-periphery/test/shared/ticks.ts

10 lines
421 B
TypeScript
Raw Normal View History

2023-04-08 21:46:18 +03:00
import { BigNumber } from 'ethers'
export const getMinTick = (tickSpacing: number) => Math.ceil(-887272 / tickSpacing) * tickSpacing
export const getMaxTick = (tickSpacing: number) => Math.floor(887272 / tickSpacing) * tickSpacing
export const getMaxLiquidityPerTick = (tickSpacing: number) =>
BigNumber.from(2)
.pow(128)
.sub(1)
.div((getMaxTick(tickSpacing) - getMinTick(tickSpacing)) / tickSpacing + 1)