import { TableContainer, TableHead, TableBody, TableRow, TableCell, Table, Typography, Box, useMediaQuery, } from "@mui/material"; import { useNavigate, createSearchParams } from "react-router-dom"; import Paper from "../../../components/Paper/Paper"; import { SecondaryButton } from "../../../components/Button"; import TokenStack from "../../../components/TokenStack/TokenStack"; import { DecimalBigNumber } from "../../../helpers/DecimalBigNumber"; import { formatCurrency } from "../../../helpers"; import { tokenNameConverter } from "../../../helpers/tokenConverter"; import { isNetworkLegacy } from "../../../constants"; import { useLpValuation } from "../../../hooks/treasury"; import { useTotalSupply, useTokenSymbol } from "../../../hooks/tokens"; import { RESERVE_ADDRESSES, FTSO_ADDRESSES } from "../../../constants/addresses"; const FarmPools = ({ chainId }) => { const isSmallScreen = useMediaQuery("(max-width: 775px)"); const { totalSupply: reserveFtsoUniTotalSupply } = useTotalSupply(chainId, "RESERVE_FTSO"); const reserveFtsoUniValuation = useLpValuation(chainId, "RESERVE_FTSO", reserveFtsoUniTotalSupply._value); const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE"); const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO"); const pools = [ { icons: ["FTSO", isNetworkLegacy(chainId) ? "GDAI" : tokenNameConverter(chainId, reserveSymbol)], name: `${ftsoSymbol}-${reserveSymbol}`, dex: "Uniswap V2", url: "/dex/uniswap", tvl: reserveFtsoUniValuation, params: createSearchParams({ pool: "true", from: `${RESERVE_ADDRESSES[chainId]}`, to: `${FTSO_ADDRESSES[chainId]}`, }) }, ]; if (isSmallScreen) { return ( <> {pools.map((pool, id) => { return ( ) })} ) } return ( Asset TVL {pools.map((pool, id) => { return ( ) })}
) } const FarmPoolCard = ({ id, pool }) => { return ( {pool.name} {formatCurrency(pool.tvl, 2)} Get on {pool.dex} ) } const FarmPoolRow = ({ id, pool }) => { const navigate = useNavigate(); return ( {pool.name} {formatCurrency(pool.tvl, 2)} navigate({ pathname: pool.url, search: pool.params.toString() })} > Get on {pool.dex} ) } export default FarmPools;