import { UsageChart } from "@unioncredit/ui"; import UnionStat from "components/UnionStat"; import format, { formatDetailed } from "util/formatValue"; import useUTokenStats from "hooks/stats/uTokenStats"; import StatCardHeader from "components/StatCardHeader"; import { tokenValue } from "./values"; import useCurToken from "hooks/useCurToken"; import styles from "./stats.module.css"; export default function UTokenStats() { const { uTokenSupply, totalBorrows, totalReserves, uTokenRate, loanableAmount, totalFrozen, totalDefault, } = useUTokenStats(); const curToken = useCurToken(); const stats = [ { label: `${curToken} available to be borrowed`, value: <>{tokenValue(loanableAmount, null, curToken)}, }, { label: `Total ${curToken} Borrowed`, value: tokenValue(totalBorrows, null, curToken), }, { label: "Reserves", value: tokenValue(totalReserves, null, curToken) }, { label: "Frozen Amount", value: tokenValue(totalFrozen, null, curToken) }, { label: "Defaulted Amount", value: tokenValue(totalDefault, null, curToken), }, { label: `Total u${curToken} Supply`, value: ( <> {formatDetailed(uTokenSupply)} u{curToken} ), }, { label: `${curToken}/u${curToken} Exchange Rate`, value: format(uTokenRate, 4), }, ]; return (
{stats.slice(0, 1).map((stat) => ( ))}
{stats.slice(1, 2).map((stat) => ( ))}
{/* TOdo Add Defaulted amount here */}
{stats.slice(2, 3).map((stat) => ( ))} {stats.slice(3, 4).map((stat) => ( ))} {stats.slice(4, 5).map((stat) => ( ))} {stats.slice(5, 9).map((stat) => ( ))}
); }