From 3ccf0305c2e57af3745ead5f8420da2d59ac4164 Mon Sep 17 00:00:00 2001 From: Mark Hinschberger Date: Wed, 29 Nov 2023 10:19:29 +0000 Subject: [PATCH] chore: oracle --- src/modules/staking/StakingPanel.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/staking/StakingPanel.tsx b/src/modules/staking/StakingPanel.tsx index ada011e3b3..1a24650f7b 100644 --- a/src/modules/staking/StakingPanel.tsx +++ b/src/modules/staking/StakingPanel.tsx @@ -3,6 +3,7 @@ import { GetUserStakeUIDataHumanized, } from '@aave/contract-helpers/dist/esm/uiStakeDataProvider-contract/types'; import { valueToBigNumber } from '@aave/math-utils'; +import { AaveSafetyModule } from '@bgd-labs/aave-address-book'; import { RefreshIcon } from '@heroicons/react/outline'; import { Trans } from '@lingui/macro'; import { @@ -134,11 +135,13 @@ export const StakingPanel: React.FC = ({ 18 + 18 + 8 // userBalance (18), stakedTokenPriceEth (18), ethPriceUsd (8) ); + const isPricedInEth = stakedToken === AaveSafetyModule.STK_AAVE; + const claimableUSD = formatUnits( BigNumber.from(stakeUserData?.userIncentivesToClaim || '0') .mul(stakeData?.rewardTokenPriceEth || '0') - .mul(ethPriceUsd || '1'), - 18 + 18 + 8 // incentivesBalance (18), rewardTokenPriceEth (18), ethPriceUsd (8) + .mul(isPricedInEth ? ethPriceUsd || '1' : '1'), + 18 + 18 + (isPricedInEth ? 8 : 0) // Add 8 decimal places if ethPriceUsd is used ); const aavePerMonth = formatEther(