From 7de4bfb801ed2da97ac16e345dc1e97466df51d1 Mon Sep 17 00:00:00 2001 From: eli-d <64763513+eli-d@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:42:41 +0930 Subject: [PATCH] correctly convert tick to display correct position balance --- web/src/app/stake/pool/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/app/stake/pool/page.tsx b/web/src/app/stake/pool/page.tsx index e7353661..3250d786 100644 --- a/web/src/app/stake/pool/page.tsx +++ b/web/src/app/stake/pool/page.tsx @@ -33,7 +33,7 @@ import { useStakeStore } from "@/stores/useStakeStore"; import { useSwapStore } from "@/stores/useSwapStore"; import { ammAddress } from "@/lib/addresses"; import { useSimulateContract, useWriteContract } from "wagmi"; -import { getTokenAmountsNumeric, sqrtPriceX96ToPrice } from "@/lib/math"; +import { getSqrtRatioAtTick, getTokenAmountsNumeric, sqrtPriceX96ToPrice } from "@/lib/math"; import { TokenIcon } from "@/components/TokenIcon"; import { maxUint128 } from "viem"; @@ -226,7 +226,7 @@ export default function PoolPage() { if (!positionLiquidity || !position) return 0; const [amount0, amount1] = getTokenAmountsNumeric( Number(positionLiquidity.result), - Number(curTick), + Number(getSqrtRatioAtTick(curTick)), position.lower, position.upper, );