From 47a06103a766dbe97b4c132310edb378ab40197b Mon Sep 17 00:00:00 2001 From: ReflectiveChimp <55021052+ReflectiveChimp@users.noreply.github.com> Date: Wed, 11 Dec 2024 19:09:57 +0000 Subject: [PATCH] Fix: classic interaction usd value calc --- src/utils/timeline.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/timeline.ts b/src/utils/timeline.ts index ee7b256..f2b7cbb 100644 --- a/src/utils/timeline.ts +++ b/src/utils/timeline.ts @@ -307,6 +307,7 @@ const mergeClassicPositionInteractions = ( const nativeToUsd = interpretAsDecimal(interaction.nativeToUSDPrice, 18); const shareToUnderlying = totalUnderlyingInVault.div(vaultTotalSupply); const underlyingToUsd = underlyingToNative.mul(nativeToUsd); + const shareToUsd = shareToUnderlying.mul(underlyingToUsd); const underlyingToBreakdown = underlyingBreakdownTokens.map((breakdownToken, i) => interpretAsDecimal( interaction.vaultUnderlyingBreakdownBalances[i] || '0', @@ -341,8 +342,8 @@ const mergeClassicPositionInteractions = ( delta: vault.delta.add(rewardPoolTotal.delta), }; const usd: BalanceDelta = { - balance: total.balance.mul(underlyingToUsd), - delta: total.delta.mul(underlyingToUsd), + balance: total.balance.mul(shareToUsd), + delta: total.delta.mul(shareToUsd), }; const txHash: string = interaction.createdWith.hash;