Skip to content

Commit

Permalink
display ... in case the economics data is malformed/missing
Browse files Browse the repository at this point in the history
  • Loading branch information
radumojic committed Jul 2, 2024
1 parent cacc09c commit 460e9fa
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/helpers/processData/processEconomics.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BigNumber from 'bignumber.js';
import { ELLIPSIS } from 'appConstants';
import { DIGITS } from 'config';
import { EconomicsType } from 'types/economics.types';

Expand All @@ -15,14 +16,20 @@ export const processEconomics = (data: EconomicsType) => {
totalSupply: new BigNumber(data.totalSupply).toFormat(0),
circulatingSupply: new BigNumber(data.circulatingSupply).toFormat(0),
staked: new BigNumber(data.staked).toFormat(0),
price: `$${new BigNumber(data.price).toFormat(DIGITS)}`,
marketCap: `$${new BigNumber(data.marketCap).toFormat(0)}`,
price: data.price
? `$${new BigNumber(data.price).toFormat(DIGITS)}`
: ELLIPSIS,
marketCap: data.marketCap
? `$${new BigNumber(data.marketCap).toFormat(0)}`
: ELLIPSIS,
apr: `${new BigNumber(data.apr).times(100).toFormat(DIGITS)}%`,
topUpApr: `${new BigNumber(data.topUpApr).times(100).toFormat(DIGITS)}%`,
baseApr: `${new BigNumber(data.baseApr).times(100).toFormat(DIGITS)}%`,
tokenMarketCap: `$${new BigNumber(data.tokenMarketCap).toFormat(0)}`,
tokenMarketCap: data.tokenMarketCap
? `$${new BigNumber(data.tokenMarketCap).toFormat(0)}`
: ELLIPSIS,

totalStakedPercent: `${totalStakedPercent}%`,
ecosystemMarketCap: `$${ecosystemMarketCap}`
ecosystemMarketCap: ecosystemMarketCap ? `$${ecosystemMarketCap}` : ELLIPSIS
};
};

0 comments on commit 460e9fa

Please sign in to comment.