From b5a78a65a5a58a2520af059c393acef916833272 Mon Sep 17 00:00:00 2001 From: DaveVodrazka Date: Mon, 30 Sep 2024 11:26:49 +0200 Subject: [PATCH] fix: bigint rounding error when withdrawing --- src/components/Yield/handleAction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Yield/handleAction.ts b/src/components/Yield/handleAction.ts index 02fda730..bbcc01ee 100644 --- a/src/components/Yield/handleAction.ts +++ b/src/components/Yield/handleAction.ts @@ -105,7 +105,7 @@ const calculateTokens = ( const NUM_PRECISSION = 1_000_000; const percentageWithPrecission = - (BigInt(amount * NUM_PRECISSION) * 10n ** BigInt(pool.digits)) / + (BigInt(Math.round(amount * NUM_PRECISSION)) * 10n ** BigInt(pool.digits)) / pool.valueBase; const tokens =