Skip to content

Commit

Permalink
Address & link, #1423
Browse files Browse the repository at this point in the history
  • Loading branch information
leocs2417 committed Nov 14, 2024
1 parent 26e2a14 commit 79887e7
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions site/src/pages/Overview/polkadot/treasuryDetail/mythToken.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,42 @@ import useAssetHubForeignAssets from "../../../../hooks/assetHub/useAssetHubFore
import { MYTH } from "../../../../constants/foreignAssets";
import { MYTH_TOKEN_ACCOUNT } from "../../../../constants/foreignAssets";
import useFiatPrice from "../../../../hooks/useFiatPrice";
import AssetItem from "./common/assetItem";

export default function TreasuryDetailMythToken() {
const mythTokenAssetsBalance = useAssetHubForeignAssets(MYTH_TOKEN_ACCOUNT);
const { price: mythTokenPrice, isLoading: isFiatPriceLoading } =
useFiatPrice("mythos");

const totalMythToken = mythTokenAssetsBalance.balance;
const mythTokenBalance = mythTokenAssetsBalance.balance;

const total = BigNumber.sum(
BigNumber(toPrecision(totalMythToken, MYTH.decimals)).multipliedBy(
mythTokenPrice,
),
).toString();
const totalValue = toPrecision(
BigNumber(mythTokenBalance).multipliedBy(mythTokenPrice),
MYTH.decimals,
);

const isLoading = isFiatPriceLoading || mythTokenAssetsBalance.isLoading;

return (
<TreasuryDetailItem
title="Myth Token"
titleTooltipContent="Airdrop & distribution of Myth tokens"
iconSrc="/imgs/data-asset-myth.svg" // TODO
content={<ValueDisplay value={total} precision={0} />}
iconSrc="/imgs/data-myth.svg"
content={<ValueDisplay value={totalValue} prefix="$" />}
isLoading={isLoading}
footer={
<AssetWrapper>
{/* TODO link */}
<AssetValueDisplay
value={totalMythToken}
isLoading={isLoading}
precision={MYTH.decimals}
symbol={MYTH.symbol}
/>
<AssetItem
title="Distribution Addr"
titleLink={`https://assethub-polkadot.subscan.io/account/${MYTH_TOKEN_ACCOUNT}`}
>
<AssetValueDisplay
value={mythTokenBalance}
isLoading={isLoading}
precision={MYTH.decimals}
symbol={MYTH.symbol}
/>
</AssetItem>
</AssetWrapper>
}
/>
Expand Down

0 comments on commit 79887e7

Please sign in to comment.