diff --git a/packages/react-hooks/src/useInflation.ts b/packages/react-hooks/src/useInflation.ts index a200bcc1ad..5611c8c437 100644 --- a/packages/react-hooks/src/useInflation.ts +++ b/packages/react-hooks/src/useInflation.ts @@ -17,7 +17,9 @@ const EMPTY: Inflation = { inflation: 0, stakedReturn: 0 }; export function calcInflation (api: ApiPromise, totalStaked: BN, totalIssuance: BN): Inflation { const { falloff, idealStake, maxInflation, minInflation } = getInflationParams(api); - const stakedFraction = totalStaked.mul(BN_MILLION).div(totalIssuance).toNumber() / BN_MILLION.toNumber(); + const stakedFraction = totalStaked.isZero() || totalIssuance.isZero() + ? 0 + : totalStaked.mul(BN_MILLION).div(totalIssuance).toNumber() / BN_MILLION.toNumber(); const idealInterest = maxInflation / idealStake; const inflation = 100 * (minInflation + ( stakedFraction <= idealStake