diff --git a/components/staking/StakedEXASummary/index.tsx b/components/staking/StakedEXASummary/index.tsx index 5f168cbdb..80fcad677 100644 --- a/components/staking/StakedEXASummary/index.tsx +++ b/components/staking/StakedEXASummary/index.tsx @@ -115,7 +115,7 @@ function StakedEXASummary() { ) : ( - {formatNumber(Number(totalRewardsAPR))}% + {formatNumber(totalRewardsAPR)}% )} {rewardsTokens === undefined ? ( @@ -160,7 +160,7 @@ function StakedEXASummary() { type RewardData = { symbol: string; - apr: bigint; + apr: number; }; const TooltipContent: FC<{ rewardsData?: RewardData[] }> = ({ rewardsData }) => { @@ -178,7 +178,7 @@ const TooltipContent: FC<{ rewardsData?: RewardData[] }> = ({ rewardsData }) => {symbol} - {formatNumber(Number(apr))}% + {formatNumber(apr)}% ); diff --git a/utils/calculateStakingAPR.ts b/utils/calculateStakingAPR.ts index 6d7f7b605..1677fa0ed 100644 --- a/utils/calculateStakingAPR.ts +++ b/utils/calculateStakingAPR.ts @@ -15,15 +15,14 @@ export const calculateStakingRewardsAPR = ( const rewardPrice = symbol === 'EXA' ? exaPrice : getVouchersPrice(accountData, symbol); const decimals = accountData.find((token) => token.symbol.includes(symbol))?.decimals || 18; - const decimalWAD = 10n ** BigInt(decimals); - const apr = (rate * yearInSeconds * rewardPrice * 100n) / (totalAssets * exaPrice) / decimalWAD; + const apr = Number((rate * yearInSeconds * rewardPrice * 100n) / (totalAssets * exaPrice)) / 10 ** decimals; return { symbol, apr }; }); }; -export const calculateTotalStakingRewardsAPR = (rewardsAPR: Array<{ symbol: string; apr: bigint }>) => { +export const calculateTotalStakingRewardsAPR = (rewardsAPR: Array<{ symbol: string; apr: number }>) => { if (!rewardsAPR) return 0n; - return rewardsAPR.reduce((acc, { apr }) => acc + apr, 0n); + return rewardsAPR.reduce((acc, { apr }) => acc + apr, 0); };