From 90f9ab9e72bb732b9e7f82e06928a3a1f0496940 Mon Sep 17 00:00:00 2001 From: Chef Huan Date: Tue, 7 Jan 2025 16:03:00 +0700 Subject: [PATCH] Fix Q192 mapping issue --- template/utils/pricing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/utils/pricing.ts b/template/utils/pricing.ts index ecbe67e..3c7d7ea 100644 --- a/template/utils/pricing.ts +++ b/template/utils/pricing.ts @@ -22,7 +22,7 @@ let STABLE_COINS: string[] = '0x55d398326f99059ff775485246999027b3197955,0xe9e7c let MINIMUM_ETH_LOCKED = BigDecimal.fromString('10') -let Q192 = 2 ** 192 +let Q192 = BigInt.fromI32(2).pow(192) // Ensure safe calculation of 2^192 using BigInt export function sqrtPriceX96ToTokenPrices(sqrtPriceX96: BigInt, token0: Token, token1: Token): BigDecimal[] { let num = sqrtPriceX96.times(sqrtPriceX96).toBigDecimal() let denom = BigDecimal.fromString(Q192.toString())