From b2e4c7f97583ed264a6febfba08a2c1235daa573 Mon Sep 17 00:00:00 2001 From: damnnou Date: Thu, 14 Mar 2024 13:06:52 +0300 Subject: [PATCH] fix: chore fix --- src/components/farming/ActiveFarming/index.tsx | 2 +- src/components/position/ActiveFarmingCard/index.tsx | 2 +- src/hooks/farming/useRewardEarnedUSD.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/farming/ActiveFarming/index.tsx b/src/components/farming/ActiveFarming/index.tsx index 5e7e7bb..f770d60 100644 --- a/src/components/farming/ActiveFarming/index.tsx +++ b/src/components/farming/ActiveFarming/index.tsx @@ -51,7 +51,7 @@ const ActiveFarming = ({ }); const bonusRewardEarnedUSD = useRewardEarnedUSD({ - token: farming.rewardToken, + token: farming.bonusRewardToken, reward: bonusRewardEarned, }); diff --git a/src/components/position/ActiveFarmingCard/index.tsx b/src/components/position/ActiveFarmingCard/index.tsx index 7ad46bc..ddf725a 100644 --- a/src/components/position/ActiveFarmingCard/index.tsx +++ b/src/components/position/ActiveFarmingCard/index.tsx @@ -30,7 +30,7 @@ const ActiveFarmingCard = ({ }); const bonusRewardEarnedUSD = useRewardEarnedUSD({ - token: farming.rewardToken, + token: farming.bonusRewardToken, reward: bonusRewardEarned, }); diff --git a/src/hooks/farming/useRewardEarnedUSD.ts b/src/hooks/farming/useRewardEarnedUSD.ts index db1de60..57efadc 100644 --- a/src/hooks/farming/useRewardEarnedUSD.ts +++ b/src/hooks/farming/useRewardEarnedUSD.ts @@ -9,18 +9,18 @@ export function useRewardEarnedUSD({ token, reward, }: { - token: TokenFieldsFragment; + token: TokenFieldsFragment | null; reward: bigint; }): number { const { data: nativePrice } = useNativePriceQuery(); return useMemo(() => { const formattedRewardEarned = Number( - formatUnits(reward, token.decimals) + formatUnits(reward, token?.decimals) ); const rewardUSD = - token.derivedMatic * + token?.derivedMatic * formattedRewardEarned * nativePrice?.bundles[0].maticPriceUSD;