Skip to content

Commit

Permalink
chore: oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
foodaka committed Nov 29, 2023
1 parent 1dfb0d9 commit 3ccf030
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/staking/StakingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -134,11 +135,13 @@ export const StakingPanel: React.FC<StakingPanelProps> = ({
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(
Expand Down

0 comments on commit 3ccf030

Please sign in to comment.