interface
interface copied to clipboard
ActiveTick is incorrectly determined for stablecoin pools.
Quite often in stablecoin pairs, the current tick can be equal to zero. And this check does not work correctly.
const getActiveTick = (tickCurrent: number | undefined, feeAmount: FeeAmount | undefined) => tickCurrent && feeAmount ? Math.floor(tickCurrent / TICK_SPACINGS[feeAmount]) * TICK_SPACINGS[feeAmount] : undefined
I suggest as a replacement:
const getActiveTick = (tickCurrent: number | undefined, feeAmount: FeeAmount | undefined) => typeof tickCurrent === 'number' && feeAmount ? Math.floor(tickCurrent / TICK_SPACINGS[feeAmount]) * TICK_SPACINGS[feeAmount] : undefined