From 4dfc5f4d4eaac4fb0928e78170eb957d7716b6f0 Mon Sep 17 00:00:00 2001 From: jinoosss Date: Mon, 11 Dec 2023 22:24:50 +0900 Subject: [PATCH] fix: Handle tick bitmap large number --- packages/swap-router/src/swap-simulator/utility/tick.util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/swap-router/src/swap-simulator/utility/tick.util.ts b/packages/swap-router/src/swap-simulator/utility/tick.util.ts index 4d9bf8ed7..01d1fc86a 100644 --- a/packages/swap-router/src/swap-simulator/utility/tick.util.ts +++ b/packages/swap-router/src/swap-simulator/utility/tick.util.ts @@ -102,7 +102,7 @@ export function nextInitializedTickWithinOneWord( if (isTickToLeft) { const { wordPos, bitPos } = tickBitmapPosition(compressed); const mask = (1n << BigInt(bitPos)) - 1n + (1n << BigInt(bitPos)); - const bitmap = BigInt(tickBitmaps[wordPos] || 0n); + const bitmap = BigInt(Number(tickBitmaps[wordPos]) || 0n); const masked = bitmap & mask; const initialized = masked !== 0n; @@ -114,7 +114,7 @@ export function nextInitializedTickWithinOneWord( const { wordPos, bitPos } = tickBitmapPosition(compressed + 1); const mask = ~((1n << BigInt(bitPos)) - 1n); - const bitmap = BigInt(tickBitmaps[wordPos] || 0n); + const bitmap = BigInt(Number(tickBitmaps[wordPos]) || 0n); const masked = bitmap & mask; const initialized = masked !== 0n;