Skip to content

Commit

Permalink
Fix genesis balances skewing rewards rate
Browse files Browse the repository at this point in the history
  • Loading branch information
BradleyOlson64 committed Aug 30, 2024
1 parent 2f03a4d commit d94f9fa
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/pages/Overview/Stats/HistoricalRewardsRate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ export const HistoricalRewardsRateStat = () => {
const { inflation, stakedReturn } = useInflation();
const { totalIssuance } = metrics;

const value = `${
totalIssuance.isZero()
? '0'
: new BigNumber(stakedReturn).decimalPlaces(2).toFormat()
}%`;

// Includes conditions to prevent genesis balances from skewing the amount
const value =
stakedReturn > 1000
? '% Calculated starting era 25'
: `${
totalIssuance.isZero()
? '0'
: new BigNumber(stakedReturn).decimalPlaces(2).toFormat()
}%`;
// Includes conditions to prevent genesis balances from skewing the amount
const secondaryValue =
totalIssuance.isZero() || stakedReturn === 0
? undefined
: `/ ${new BigNumber(Math.max(0, stakedReturn - inflation))
.decimalPlaces(2)
.toFormat()}% ${t('overview.afterInflation')}`;
: stakedReturn > 1000
? undefined
: `/ ${new BigNumber(Math.max(0, stakedReturn - inflation))
.decimalPlaces(2)
.toFormat()}% ${t('overview.afterInflation')}`;

const params = {
label: t('overview.historicalRewardsRate'),
Expand Down

0 comments on commit d94f9fa

Please # to comment.