Open beejuice opened 6 months ago
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
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