Skip to content

Commit

Permalink
Merge pull request #42 from ReflectiveChimp/fix/classic-interaction-usd
Browse files Browse the repository at this point in the history
Fix: classic interaction usd value calc
  • Loading branch information
ReflectiveChimp authored Dec 11, 2024
2 parents 879717c + 47a0610 commit dba7fc5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit dba7fc5

Please sign in to comment.