Skip to content

Commit

Permalink
ST-558: Update circulation supply, update chart to unbounding
Browse files Browse the repository at this point in the history
  • Loading branch information
BoThe1K committed Oct 3, 2024
1 parent b6adda2 commit 8caf29d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 2 additions & 8 deletions apps/web-stratos/src/pages/api/circulating-supply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ import { getMetrics } from '@/screens/home/components/tokenomics/queries';
import { bigToNativeDecimals } from '@/screens/home/components/tokenomics/utils';

type MetricsData = {
total_supply: string;
total_mining_supply: string;
total_mined_tokens: string;
circulation_supply: string;
};

export default async function handler(req: NextApiRequest, res: NextApiResponse<string>) {
try {
const result: MetricsData = await getMetrics();
const total_supply = ethers.utils.parseUnits(result.total_supply, 'wei');
const to_be_mined = ethers.utils
.parseUnits(result.total_mining_supply, 'wei')
.sub(ethers.utils.parseUnits(result.total_mined_tokens, 'wei'));
res.status(200).send(bigToNativeDecimals(total_supply.sub(to_be_mined).toString()));
res.status(200).send(bigToNativeDecimals(result.circulation_supply));
} catch (err) {
res.status(400).json({ error: 'failed to load data' });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ const Tokenomics: FC<ComponentDefault> = ({ className }) => {
fill: theme.palette.custom.tokenomics.three,
},
{
legendKey: t('unbonded'),
percentKey: 'unbondedPercent',
value: prettyFormat(tokenomics.unbonded, 18, 2),
percent: `${prettyFormat(tokenomics.unbonded.mul(1_000_000).div(tokenomics.total), 4, 6)}%`,
legendKey: t('unbonding'),
percentKey: 'unbondingPercent',
value: prettyFormat(tokenomics.unbonding, 18, 2),
percent: `${prettyFormat(tokenomics.unbonding.mul(1_000_000).div(tokenomics.total), 4, 6)}%`,
fill: theme.palette.custom.tokenomics.four,
},
{
Expand Down

0 comments on commit 8caf29d

Please sign in to comment.