Compare commits
No commits in common. "0925c79ff8ceafcfe947572a9e6a6dbe2952c09f" and "3113810d5c037f31041cb33d6aea9f6fd0c4535f" have entirely different histories.
0925c79ff8
...
3113810d5c
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.3.5",
|
||||
"version": "0.3.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="uuid-723be126-5781-41fb-bcc4-bdb45b6b02eb" data-name="EthereumClassic" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 490.4 490.4">
|
||||
<defs>
|
||||
<style>
|
||||
.uuid-a01d8d83-9865-40b4-947f-2b6803a6d620 {
|
||||
fill: #0b8311;
|
||||
}
|
||||
|
||||
.uuid-2015837c-ff9d-4f6a-bb1d-31a3faa20f59 {
|
||||
fill: #3ab83a;
|
||||
}
|
||||
|
||||
.uuid-dcb9c215-f551-46cc-8a77-32519c324ec8 {
|
||||
fill: #146714;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g id="uuid-2f5b15ae-2601-440f-a162-6e46c060a66e" data-name="EthereumClassicLogo">
|
||||
<path id="uuid-4255207d-9c11-4e06-b23d-b1e6c0b336cf" data-name="EthereumClassicBackground" d="m245.2,490.4c135.4,0,245.2-109.8,245.2-245.2S380.6,0,245.2,0,0,109.8,0,245.2c.1,135.4,109.8,245.2,245.2,245.2Z"/>
|
||||
<g id="uuid-95ae1854-3c20-440e-b7f3-d33adda6d257" data-name="EthereumClassicIcon">
|
||||
<path id="uuid-b0109fdc-5144-47e3-be85-fe9368b87b3b" data-name="path1599" class="uuid-2015837c-ff9d-4f6a-bb1d-31a3faa20f59" d="m144.29,259.73c35.56,18.89,72.67,38.65,101.33,53.95l100.5-53.95c-36.39,54.06-66.71,99.06-100.5,148.87-33.85-49.7-71.23-104.54-101.33-148.87Zm3.87-14.91l97.57-52.07,96.3,51.69-96.25,52.12-97.63-51.74Zm97.46-68.75l-101.33,53.34,100.89-147.71,100.94,148.04-100.5-53.67Z"/>
|
||||
<path id="uuid-4d16a1f3-17b9-4f57-9e83-11954024333f" data-name="path1593" class="uuid-a01d8d83-9865-40b4-947f-2b6803a6d620" d="m245.61,313.68l100.5-53.95c-36.39,54.06-100.5,148.87-100.5,148.87v-94.92Zm.11-120.93l96.3,51.69-96.25,52.12-.05-103.81Zm-.11-16.68l-.44-94.37,100.94,148.04-100.5-53.67Z"/>
|
||||
<path id="uuid-957b728e-6255-4f68-ab1c-d23105c266ea" data-name="path1603" class="uuid-a01d8d83-9865-40b4-947f-2b6803a6d620" d="m148.15,244.82l97.58,8.01,96.3-8.34-96.25,52.13-97.63-51.8Z"/>
|
||||
<path id="uuid-6bf52594-e28e-460d-a05f-c1fb25c91e38" data-name="path1606" class="uuid-dcb9c215-f551-46cc-8a77-32519c324ec8" d="m245.72,252.83l96.3-8.34-96.25,52.13-.05-43.79Z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@ -1,36 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="uuid-39ebc51d-db02-45d2-ad4b-e7ae31bb915b" data-name="Ethereum" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 250 250">
|
||||
<defs>
|
||||
<style>
|
||||
.uuid-e080659c-91a4-4965-9905-603394020b2c {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.uuid-ca9afedd-40fd-4006-99f9-d2c3cf46bc21 {
|
||||
fill: #627eea;
|
||||
}
|
||||
|
||||
.uuid-bb37a35d-b2ce-440e-86f6-0142a60ec718 {
|
||||
fill: rgba(255, 255, 255, .2);
|
||||
}
|
||||
|
||||
.uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50 {
|
||||
fill: rgba(255, 255, 255, .6);
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g id="uuid-c49657cc-831e-4816-83c0-b3ceca5eead0" data-name="Ethereum">
|
||||
<g id="uuid-559a2235-ac8a-4942-be49-ac3193ebd3cd" data-name="EthereumBackground">
|
||||
<circle class="uuid-ca9afedd-40fd-4006-99f9-d2c3cf46bc21" cx="125" cy="125" r="122.5"/>
|
||||
<path class="uuid-e080659c-91a4-4965-9905-603394020b2c" d="m125,5c32.05,0,62.19,12.48,84.85,35.15,22.67,22.66,35.15,52.8,35.15,84.85s-12.48,62.19-35.15,84.85-52.8,35.15-84.85,35.15-62.19-12.48-84.85-35.15C17.48,187.19,5,157.05,5,125s12.48-62.19,35.15-84.85C62.81,17.48,92.95,5,125,5m0-5C55.96,0,0,55.96,0,125s55.96,125,125,125,125-55.96,125-125S194.04,0,125,0h0Z"/>
|
||||
</g>
|
||||
<g id="uuid-0bd28738-f2c4-4934-8365-8668de7b64ac" data-name="EthereumIcon">
|
||||
<path class="uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50" d="m128.89,31.25v69.3l58.57,26.17-58.57-95.47Z"/>
|
||||
<path class="uuid-e080659c-91a4-4965-9905-603394020b2c" d="m128.89,31.25l-58.58,95.47,58.58-26.17V31.25Z"/>
|
||||
<path class="uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50" d="m128.89,171.62v47.09l58.61-81.09-58.61,34Z"/>
|
||||
<path class="uuid-e080659c-91a4-4965-9905-603394020b2c" d="m128.89,218.71v-47.09l-58.58-33.99,58.58,81.09Z"/>
|
||||
<path class="uuid-bb37a35d-b2ce-440e-86f6-0142a60ec718" d="m128.89,160.73l58.57-34.01-58.57-26.16v60.16Z"/>
|
||||
<path class="uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50" d="m70.31,126.72l58.58,34.01v-60.16l-58.58,26.16Z"/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="2500" height="2500" viewBox="0 0 32 32">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<circle cx="16" cy="16" r="16" fill="#627EEA"/>
|
||||
<g fill="#FFF" fill-rule="nonzero">
|
||||
<path fill-opacity=".602" d="M16.498 4v8.87l7.497 3.35z"/>
|
||||
<path d="M16.498 4L9 16.22l7.498-3.35z"/>
|
||||
<path fill-opacity=".602" d="M16.498 21.968v6.027L24 17.616z"/>
|
||||
<path d="M16.498 27.995v-6.028L9 17.616z"/>
|
||||
<path fill-opacity=".2" d="M16.498 20.573l7.497-4.353-7.497-3.348z"/>
|
||||
<path fill-opacity=".602" d="M9 16.22l7.498 4.353v-7.701z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 617 B |
36
src/assets/tokens/wETH.svg
Normal file
36
src/assets/tokens/wETH.svg
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="uuid-39ebc51d-db02-45d2-ad4b-e7ae31bb915b" data-name="Ethereum" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 250 250">
|
||||
<defs>
|
||||
<style>
|
||||
.uuid-e080659c-91a4-4965-9905-603394020b2c {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.uuid-ca9afedd-40fd-4006-99f9-d2c3cf46bc21 {
|
||||
fill: #627eea;
|
||||
}
|
||||
|
||||
.uuid-bb37a35d-b2ce-440e-86f6-0142a60ec718 {
|
||||
fill: rgba(255, 255, 255, .2);
|
||||
}
|
||||
|
||||
.uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50 {
|
||||
fill: rgba(255, 255, 255, .6);
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g id="uuid-c49657cc-831e-4816-83c0-b3ceca5eead0" data-name="Ethereum">
|
||||
<g id="uuid-559a2235-ac8a-4942-be49-ac3193ebd3cd" data-name="EthereumBackground">
|
||||
<circle class="uuid-ca9afedd-40fd-4006-99f9-d2c3cf46bc21" cx="125" cy="125" r="122.5"/>
|
||||
<path class="uuid-e080659c-91a4-4965-9905-603394020b2c" d="m125,5c32.05,0,62.19,12.48,84.85,35.15,22.67,22.66,35.15,52.8,35.15,84.85s-12.48,62.19-35.15,84.85-52.8,35.15-84.85,35.15-62.19-12.48-84.85-35.15C17.48,187.19,5,157.05,5,125s12.48-62.19,35.15-84.85C62.81,17.48,92.95,5,125,5m0-5C55.96,0,0,55.96,0,125s55.96,125,125,125,125-55.96,125-125S194.04,0,125,0h0Z"/>
|
||||
</g>
|
||||
<g id="uuid-0bd28738-f2c4-4934-8365-8668de7b64ac" data-name="EthereumIcon">
|
||||
<path class="uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50" d="m128.89,31.25v69.3l58.57,26.17-58.57-95.47Z"/>
|
||||
<path class="uuid-e080659c-91a4-4965-9905-603394020b2c" d="m128.89,31.25l-58.58,95.47,58.58-26.17V31.25Z"/>
|
||||
<path class="uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50" d="m128.89,171.62v47.09l58.61-81.09-58.61,34Z"/>
|
||||
<path class="uuid-e080659c-91a4-4965-9905-603394020b2c" d="m128.89,218.71v-47.09l-58.58-33.99,58.58,81.09Z"/>
|
||||
<path class="uuid-bb37a35d-b2ce-440e-86f6-0142a60ec718" d="m128.89,160.73l58.57-34.01-58.57-26.16v60.16Z"/>
|
||||
<path class="uuid-933ff958-c1b5-4023-94a9-0cca9b4aab50" d="m70.31,126.72l58.58,34.01v-60.16l-58.58,26.16Z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@ -5,8 +5,7 @@ import FtsoIcon from "../../assets/tokens/FTSO.svg?react";
|
||||
import StnkIcon from "../../assets/tokens/STNK.svg?react";
|
||||
import GhstIcon from "../../assets/tokens/GHST.svg?react";
|
||||
import DaiIcon from "../../assets/tokens/DAI.svg?react";
|
||||
import EthIcon from "../../assets/tokens/ETH.svg?react";
|
||||
import EtcIcon from "../../assets/tokens/ETC.svg?react";
|
||||
import WethIcon from "../../assets/tokens/wETH.svg?react";
|
||||
import UnknownIcon from "../../assets/tokens/Unknown.svg?react";
|
||||
|
||||
const PREFIX = "Token";
|
||||
@ -24,7 +23,8 @@ const StyledSvgIcon = styled(SvgIcon)(() => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export const parseKnownToken = (name) => {
|
||||
const Token = ({ name, viewBox = "0 0 260 260", fontSize = "large", ...props }) => {
|
||||
const parseKnownToken = (name) => {
|
||||
let icon;
|
||||
switch (name?.toUpperCase()) {
|
||||
case "FTSO":
|
||||
@ -52,16 +52,13 @@ export const parseKnownToken = (name) => {
|
||||
icon = DaiIcon;
|
||||
break;
|
||||
case "ETH":
|
||||
icon = EthIcon;
|
||||
icon = WethIcon;
|
||||
break;
|
||||
case "WETH":
|
||||
icon = EthIcon;
|
||||
icon = WethIcon;
|
||||
break;
|
||||
case "METC":
|
||||
icon = EtcIcon;
|
||||
break;
|
||||
case "WETC":
|
||||
icon = EtcIcon;
|
||||
icon = WethIcon;
|
||||
break;
|
||||
default:
|
||||
icon = UnknownIcon;
|
||||
@ -69,10 +66,9 @@ export const parseKnownToken = (name) => {
|
||||
return icon;
|
||||
}
|
||||
|
||||
const Token = ({ name, viewBox = "0 0 260 260", fontSize = "large", ...props }) => {
|
||||
return (
|
||||
<StyledSvgIcon
|
||||
inheritViewBox
|
||||
viewBox={viewBox}
|
||||
fontSize={fontSize}
|
||||
component={parseKnownToken(name)}
|
||||
{...props}
|
||||
|
||||
@ -9,7 +9,7 @@ import FormControl from '@mui/material/FormControl';
|
||||
import Select from '@mui/material/Select';
|
||||
|
||||
import { isNetworkAvailable } from "../../constants";
|
||||
import { parseKnownToken } from "../../components/Token/Token";
|
||||
import EthIcon from "../../assets/tokens/ETH.svg?react";
|
||||
|
||||
import { useSwitchChain } from 'wagmi';
|
||||
import toast from "react-hot-toast";
|
||||
@ -53,11 +53,11 @@ function SelectNetwork({ chainId, wrongNetworkToastId, setWrongNetworkToastId, s
|
||||
}
|
||||
}}
|
||||
>
|
||||
{chains.map((chain, i) => {
|
||||
{chains.map(chain => {
|
||||
return (
|
||||
<MenuItem key={chain.name} value={chain.id}>
|
||||
<Box gap="10px" display="flex" flexDirection="row" alignItems="center">
|
||||
<SvgIcon component={parseKnownToken(chain?.nativeCurrency?.symbol)} inheritViewBox />
|
||||
<SvgIcon component={EthIcon} viewBox="0 0 32 32" />
|
||||
{!small && <Typography>{chain.name}</Typography>}
|
||||
</Box>
|
||||
</MenuItem>
|
||||
|
||||
@ -22,7 +22,7 @@ import { PrimaryButton, SecondaryButton } from "../../Button";
|
||||
import ArrowUpIcon from "../../../assets/icons/arrow-up.svg?react";
|
||||
import { formatCurrency, shorten } from "../../../helpers";
|
||||
import { DecimalBigNumber } from "../../../helpers/DecimalBigNumber";
|
||||
import { RESERVE_ADDRESSES, FTSO_ADDRESSES } from "../../../constants/addresses";
|
||||
import { DAI_ADDRESSES, FTSO_ADDRESSES } from "../../../constants/addresses";
|
||||
|
||||
import { useAccount, useDisconnect } from "wagmi";
|
||||
|
||||
@ -156,9 +156,9 @@ function InitialWalletView({ isWalletOpen, address, chainId, onClose }) {
|
||||
>
|
||||
<SecondaryButton
|
||||
fullWidth
|
||||
onClick={() => onBtnClick("uniswap", RESERVE_ADDRESSES[chainId], FTSO_ADDRESSES[chainId])}
|
||||
onClick={() => onBtnClick("uniswap", DAI_ADDRESSES[chainId], FTSO_ADDRESSES[chainId])}
|
||||
>
|
||||
<Typography>{`${tokens?.ftso?.symbol}-${tokens?.reserve?.symbol} on Uniswap`}</Typography>
|
||||
<Typography>{`${tokens?.ftso?.symbol}-${tokens?.dai?.symbol} on Uniswap`}</Typography>
|
||||
</SecondaryButton>
|
||||
</Box>
|
||||
|
||||
|
||||
@ -13,24 +13,15 @@ import { ChangeEvent, useState, useEffect } from "react";
|
||||
import { useNavigate, createSearchParams } from "react-router-dom";
|
||||
import { useQuery } from "react-query";
|
||||
import { formatCurrency, formatNumber } from "../../../helpers";
|
||||
import { DecimalBigNumber } from "../../../helpers/DecimalBigNumber"
|
||||
import { tokenNameConverter } from "../../../helpers/tokenConverter";
|
||||
import { isNetworkLegacy } from "../../../constants";
|
||||
|
||||
import GhostStyledIcon from "../../Icon/GhostIcon";
|
||||
import TokenStack from "../../TokenStack/TokenStack";
|
||||
import { PrimaryButton, SecondaryButton } from "../../Button";
|
||||
|
||||
import { useBalance, useTokenSymbol } from "../../../hooks/tokens";
|
||||
import {
|
||||
useNativePrice,
|
||||
useReservePrice,
|
||||
useFtsoPrice,
|
||||
useStnkPrice,
|
||||
useGhstPrice
|
||||
} from "../../../hooks/prices";
|
||||
import { useDaiPrice, useFtsoPrice, useStnkPrice, useGhstPrice } from "../../../hooks/prices";
|
||||
import { useLpValuation } from "../../../hooks/treasury";
|
||||
import { useAccount, useBalance as useNativeBalance, useConfig } from "wagmi";
|
||||
import { useAccount } from "wagmi";
|
||||
|
||||
const addTokenToWallet = async (token, userAddress) => {
|
||||
if (!window.ethereum) return;
|
||||
@ -69,7 +60,6 @@ const BalanceValue = ({
|
||||
|
||||
export const Token = (props) => {
|
||||
const {
|
||||
isNative,
|
||||
symbol,
|
||||
icons,
|
||||
address,
|
||||
@ -78,7 +68,7 @@ export const Token = (props) => {
|
||||
onAddTokenToWallet,
|
||||
expanded,
|
||||
onChangeExpanded,
|
||||
reserveAddress,
|
||||
daiAddress,
|
||||
onClose,
|
||||
isPool
|
||||
} = props;
|
||||
@ -86,7 +76,7 @@ export const Token = (props) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const useLink = (symbol, fromAddress, toAddress, isPool) => {
|
||||
if (symbol.toUpperCase() === "RESERVE") {
|
||||
if (symbol.toUpperCase() === "GDAI") {
|
||||
navigate({ pathname: "/faucet" })
|
||||
} else {
|
||||
navigate({
|
||||
@ -108,11 +98,8 @@ export const Token = (props) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Accordion expanded={isNative ? false : expanded} onChange={onChangeExpanded}>
|
||||
<AccordionSummary
|
||||
sx={{ paddingRight: isNative ? "37.43px" : "" }}
|
||||
expandIcon={isNative ? null : <GhostStyledIcon component={ExpandMoreIcon} color="disabled" />}
|
||||
>
|
||||
<Accordion expanded={expanded} onChange={onChangeExpanded}>
|
||||
<AccordionSummary expandIcon={<GhostStyledIcon component={ExpandMoreIcon} color="disabled" />}>
|
||||
<Box sx={{ display: "flex", justifyContent: "space-between", width: "100%", marginRight: "10px" }}>
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: "15px" }}>
|
||||
<TokenStack
|
||||
@ -130,7 +117,7 @@ export const Token = (props) => {
|
||||
/>
|
||||
</Box>
|
||||
</AccordionSummary>
|
||||
{!isNative && <AccordionDetails style={{ margin: "auto", padding: theme.spacing(1, 0) }}>
|
||||
<AccordionDetails style={{ margin: "auto", padding: theme.spacing(1, 0) }}>
|
||||
<Box
|
||||
sx={{ display: "flex", flexDirection: "column", flex: 1, mx: "32px", justifyContent: "center" }}
|
||||
style={{ gap: theme.spacing(1) }}
|
||||
@ -143,14 +130,14 @@ export const Token = (props) => {
|
||||
<Typography>Add to Wallet</Typography>
|
||||
</PrimaryButton>
|
||||
<SecondaryButton
|
||||
onClick={() => useLink(symbol, reserveAddress, address, isPool)}
|
||||
onClick={() => useLink(symbol, daiAddress, address, isPool)}
|
||||
fullWidth
|
||||
>
|
||||
<Typography>Get on {symbol?.toUpperCase() === "RESERVE" ? "Faucet" : "Uniswap"}</Typography>
|
||||
<Typography>Get on {symbol.toUpperCase() === "GDAI" ? "Faucet" : "Uniswap"}</Typography>
|
||||
</SecondaryButton>
|
||||
</Box>
|
||||
</Box>
|
||||
</AccordionDetails>}
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
);
|
||||
};
|
||||
@ -160,15 +147,10 @@ const sumObjValues = (obj: Record<string, string> = {}) =>
|
||||
|
||||
export const useWallet = (chainId, userAddress) => {
|
||||
const {
|
||||
data: nativeBalanceRaw,
|
||||
refetch: nativeBalanceRefetch
|
||||
} = useNativeBalance({ address: userAddress });
|
||||
const nativeBalance = new DecimalBigNumber(nativeBalanceRaw?.value ?? 0n, 18);
|
||||
const {
|
||||
balance: reserveBalance,
|
||||
refetch: reserveRefetch,
|
||||
contractAddress: reserveAddress,
|
||||
} = useBalance(chainId, "RESERVE", userAddress);
|
||||
balance: daiBalance,
|
||||
refetch: daiRefetch,
|
||||
contractAddress: daiAddress,
|
||||
} = useBalance(chainId, "GDAI", userAddress);
|
||||
const {
|
||||
balance: ftsoBalance,
|
||||
refetch: ftsoRefetch,
|
||||
@ -185,45 +167,32 @@ export const useWallet = (chainId, userAddress) => {
|
||||
contractAddress: ghstAddress,
|
||||
} = useBalance(chainId, "GHST", userAddress);
|
||||
const {
|
||||
balance: lpReserveFtsoBalance,
|
||||
refetch: lpReserveFtsoRefetch,
|
||||
contractAddress: lpReserveFtsoBalanceAddress,
|
||||
} = useBalance(chainId, "RESERVE_FTSO", userAddress);
|
||||
balance: lpDaiFtsoBalance,
|
||||
refetch: lpDaiFtsoRefetch,
|
||||
contractAddress: lpDaiFtsoBalanceAddress,
|
||||
} = useBalance(chainId, "GDAI_FTSO", userAddress);
|
||||
|
||||
const nativePrice = useNativePrice(chainId);
|
||||
const reservePrice = useReservePrice(chainId);
|
||||
const daiPrice = useDaiPrice(chainId);
|
||||
const ftsoPrice = useFtsoPrice(chainId);
|
||||
const stnkPrice = useStnkPrice(chainId);
|
||||
const ghstPrice = useGhstPrice(chainId);
|
||||
const lpReserveFtsoPrice = useLpValuation(chainId, "RESERVE_FTSO", 1000000000000000000n);
|
||||
const lpDaiFtsoPrice = useLpValuation(chainId, "GDAI_FTSO", 1000000000000000000n);
|
||||
|
||||
const config = useConfig();
|
||||
|
||||
const nativeSymbol = config?.getClient()?.chain?.nativeCurrency?.symbol;
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
|
||||
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||
const { symbol: stnkSymbol } = useTokenSymbol(chainId, "STNK");
|
||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||
const { symbol: lpReserveFtsoSymbol } = useTokenSymbol(chainId, "RESERVE_FTSO");
|
||||
const { symbol: lpDaiFtsoSymbol } = useTokenSymbol(chainId, "GDAI_FTSO");
|
||||
|
||||
const tokens = {
|
||||
native: {
|
||||
symbol: nativeSymbol,
|
||||
icons: [nativeSymbol],
|
||||
balance: nativeBalance,
|
||||
price: nativePrice,
|
||||
refetch: nativeBalanceRefetch
|
||||
},
|
||||
reserve: {
|
||||
symbol: reserveSymbol,
|
||||
address: reserveAddress,
|
||||
balance: reserveBalance,
|
||||
price: reservePrice,
|
||||
icons: isNetworkLegacy(chainId) ? ["GDAI"] : [tokenNameConverter(chainId, reserveSymbol)],
|
||||
externalUrl: isNetworkLegacy(chainId)
|
||||
? "https://ghostchain.io/wp-content/uploads/2025/03/gDAI.svg"
|
||||
: "https://ghostchain.io/wp-content/uploads/2025/11/6A-Classic-ETC-Token.svg",
|
||||
refetch: reserveRefetch,
|
||||
dai: {
|
||||
symbol: daiSymbol,
|
||||
address: daiAddress,
|
||||
balance: daiBalance,
|
||||
price: daiPrice,
|
||||
icons: ["GDAI"],
|
||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/gDAI.svg",
|
||||
refetch: daiRefetch,
|
||||
},
|
||||
ftso: {
|
||||
symbol: ftsoSymbol,
|
||||
@ -252,15 +221,15 @@ export const useWallet = (chainId, userAddress) => {
|
||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/GHST.svg",
|
||||
refetch: ghstRefetch,
|
||||
},
|
||||
reserveFtso: {
|
||||
daiFtso: {
|
||||
isPool: true,
|
||||
symbol: lpReserveFtsoSymbol,
|
||||
address: lpReserveFtsoBalanceAddress,
|
||||
balance: lpReserveFtsoBalance,
|
||||
price: lpReserveFtsoPrice,
|
||||
icons: ["FTSO", isNetworkLegacy(chainId) ? "GDAI" : tokenNameConverter(chainId, reserveSymbol)],
|
||||
symbol: lpDaiFtsoSymbol,
|
||||
address: lpDaiFtsoBalanceAddress,
|
||||
balance: lpDaiFtsoBalance,
|
||||
price: lpDaiFtsoPrice,
|
||||
icons: ["GDAI", "FTSO"],
|
||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
|
||||
refetch: lpReserveFtsoRefetch,
|
||||
refetch: lpDaiFtsoRefetch,
|
||||
}
|
||||
};
|
||||
|
||||
@ -277,12 +246,12 @@ export const useWallet = (chainId, userAddress) => {
|
||||
|
||||
export const Tokens = ({ address, tokens, onClose }) => {
|
||||
const [expanded, setExpanded] = useState(null);
|
||||
const alwaysShowTokens = [tokens.native, tokens.reserve, tokens.ftso, tokens.stnk, tokens.ghst, tokens.reserveFtso];
|
||||
const alwaysShowTokens = [tokens.dai, tokens.ftso, tokens.stnk, tokens.ghst, tokens.daiFtso];
|
||||
|
||||
const tokenProps = (token) => ({
|
||||
...token,
|
||||
expanded: expanded === token.symbol,
|
||||
reserveAddress: tokens.reserve.address,
|
||||
daiAddress: tokens.dai.address,
|
||||
onChangeExpanded: (e, isExpanded) => setExpanded(isExpanded ? token.symbol : null),
|
||||
onAddTokenToWallet: () => addTokenToWallet(token, address),
|
||||
onClose: () => onClose(),
|
||||
@ -291,7 +260,7 @@ export const Tokens = ({ address, tokens, onClose }) => {
|
||||
return (
|
||||
<>
|
||||
{alwaysShowTokens.map((token, i) => (
|
||||
<Token key={i} isNative={i === 0} {...tokenProps(token)} />
|
||||
<Token key={i} {...tokenProps(token)} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
@ -8,7 +8,7 @@ const mordor = defineChain({
|
||||
nativeCurrency: {
|
||||
decimals: 18,
|
||||
name: 'METC',
|
||||
symbol: 'mETC',
|
||||
symbol: 'METC',
|
||||
},
|
||||
rpcUrls: {
|
||||
default: { http: ['https://rpc.mordor.etccooperative.org'] },
|
||||
|
||||
@ -30,7 +30,7 @@ export const FTSO_STNK_LP_ADDRESSES = {
|
||||
[NetworkId.TESTNET_MORDOR]: "0x0000000000000000000000000000000000000000",
|
||||
}
|
||||
|
||||
export const RESERVE_ADDRESSES = {
|
||||
export const DAI_ADDRESSES = {
|
||||
[NetworkId.TESTNET_SEPOLIA]: "0x5f63a27a9214a0352F2EF8dAF1eD4974d713192B",
|
||||
[NetworkId.TESTNET_HOODI]: "0x80c6676c334BCcE60b3CC852085B72143379CE58",
|
||||
[NetworkId.TESTNET_MORDOR]: "0x6af91B3763b5d020E0985f85555EB50e5852d7AC",
|
||||
@ -95,21 +95,6 @@ export const UNISWAP_V2_FACTORY = {
|
||||
[NetworkId.TESTNET_MORDOR]: "0x909f96C1a436B3386E9962e30f3Ce753070ff524",
|
||||
};
|
||||
|
||||
export const NATIVE_TICKERS = {
|
||||
[NetworkId.TESTNET_SEPOLIA]: [
|
||||
"https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT",
|
||||
"https://api.coinbase.com/v2/prices/ETH-USDT/spot",
|
||||
],
|
||||
[NetworkId.TESTNET_HOODI]: [
|
||||
"https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT",
|
||||
"https://api.coinbase.com/v2/prices/ETH-USDT/spot",
|
||||
],
|
||||
[NetworkId.TESTNET_MORDOR]: [
|
||||
"https://api.binance.com/api/v3/ticker/price?symbol=ETCUSDT",
|
||||
"https://api.coinbase.com/v2/prices/ETC-USDT/spot",
|
||||
],
|
||||
}
|
||||
|
||||
export const CEX_TICKERS = {
|
||||
[NetworkId.TESTNET_MORDOR]: [
|
||||
"https://api.binance.com/api/v3/ticker/price?symbol=ETCUSDT",
|
||||
|
||||
@ -26,7 +26,7 @@ import { Tab, Tabs } from "../../components/Tabs/Tabs";
|
||||
import {
|
||||
UNISWAP_V2_ROUTER,
|
||||
UNISWAP_V2_FACTORY,
|
||||
RESERVE_ADDRESSES,
|
||||
DAI_ADDRESSES,
|
||||
FTSO_ADDRESSES,
|
||||
} from "../../constants/addresses";
|
||||
import { useTokenSymbol } from "../../hooks/tokens";
|
||||
@ -56,7 +56,7 @@ const Dex = ({ chainId, address, connect }) => {
|
||||
const [slippage, setSlippage] = useState(localStorage.getItem("dex-slippage") || "5");
|
||||
const [formatDecimals, setFormatDecimals] = useState(localStorage.getItem("dex-decimals") || "5");
|
||||
|
||||
const [tokenAddressTop, setTokenAddressTop] = useState(RESERVE_ADDRESSES[chainId]);
|
||||
const [tokenAddressTop, setTokenAddressTop] = useState(DAI_ADDRESSES[chainId]);
|
||||
const [tokenAddressBottom, setTokenAddressBottom] = useState(FTSO_ADDRESSES[chainId]);
|
||||
|
||||
const { symbol: tokenNameTop } = useTokenSymbol(chainId, tokenAddressTop);
|
||||
@ -75,8 +75,8 @@ const Dex = ({ chainId, address, connect }) => {
|
||||
setTokenAddressTop(currentQueryParameters.get("from"));
|
||||
newQueryParameters.set("from", currentQueryParameters.get("from"));
|
||||
} else {
|
||||
setTokenAddressTop(RESERVE_ADDRESSES[chainId]);
|
||||
newQueryParameters.set("from", RESERVE_ADDRESSES[chainId]);
|
||||
setTokenAddressTop(DAI_ADDRESSES[chainId]);
|
||||
newQueryParameters.set("from", DAI_ADDRESSES[chainId]);
|
||||
}
|
||||
|
||||
if (currentQueryParameters.has("to")) {
|
||||
|
||||
@ -187,11 +187,11 @@ const SwapContainer = ({
|
||||
>
|
||||
<Box width="100%" display="flex" justifyContent="space-between">
|
||||
<Typography fontSize="12px" lineHeight="15px">Current price:</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(currentPrice, formatDecimals, tokenNameTop)}</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(currentPrice, formatDecimals)}</Typography>
|
||||
</Box>
|
||||
<Box width="100%" display="flex" justifyContent="space-between">
|
||||
<Typography fontSize="12px" lineHeight="15px">Next price:</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(nextPrice === "" ? currentPrice : nextPrice, formatDecimals, tokenNameTop)}</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(nextPrice === "" ? currentPrice : nextPrice, formatDecimals)}</Typography>
|
||||
</Box>
|
||||
<Box width="100%" display="flex" justifyContent="space-between">
|
||||
<Typography fontSize="12px" lineHeight="15px">Transaction deadline:</Typography>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { useConfig } from "wagmi";
|
||||
import {
|
||||
Divider,
|
||||
Typography,
|
||||
@ -21,7 +20,7 @@ import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { formatNumber } from "../../helpers/";
|
||||
import { useBalance, useTokenSymbol } from "../../hooks/tokens";
|
||||
import { isNetworkLegacy } from "../../constants";
|
||||
import { RESERVE_ADDRESSES, FTSO_ADDRESSES, STNK_ADDRESSES, GHST_ADDRESSES } from "../../constants/addresses";
|
||||
import { DAI_ADDRESSES, FTSO_ADDRESSES, STNK_ADDRESSES, GHST_ADDRESSES } from "../../constants/addresses";
|
||||
|
||||
const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }) => {
|
||||
const isSmallScreen = useMediaQuery("(max-width: 599px)");
|
||||
@ -39,19 +38,16 @@ const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }
|
||||
const { symbol: searchSymbol } = useTokenSymbol(chainId, address);
|
||||
const { balance: searchBalance } = useBalance(chainId, address, account);
|
||||
|
||||
const { balance: reserveBalance } = useBalance(chainId, "RESERVE", account);
|
||||
const { balance: daiBalance } = useBalance(chainId, "GDAI", account);
|
||||
const { balance: ftsoBalance } = useBalance(chainId, "FTSO", account);
|
||||
const { balance: stnkBalance } = useBalance(chainId, "STNK", account);
|
||||
const { balance: ghstBalance } = useBalance(chainId, "GHST", account);
|
||||
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
|
||||
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||
const { symbol: stnkSymbol } = useTokenSymbol(chainId, "STNK");
|
||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||
|
||||
const config = useConfig();
|
||||
const nativeSymbol = config?.getClient()?.chain?.nativeCurrency?.symbol;
|
||||
|
||||
const searchToken = useMemo(() => {
|
||||
return [{
|
||||
name: searchSymbol,
|
||||
@ -64,10 +60,10 @@ const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }
|
||||
const knownTokens = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
name: reserveSymbol,
|
||||
icons: isNetworkLegacy(chainId) ? ["GDAI"] : [nativeSymbol],
|
||||
balance: reserveBalance,
|
||||
address: RESERVE_ADDRESSES[chainId]
|
||||
name: daiSymbol,
|
||||
icons: isNetworkLegacy(chainId) ? ["GDAI"] : ["WETH"],
|
||||
balance: daiBalance,
|
||||
address: DAI_ADDRESSES[chainId]
|
||||
},
|
||||
{
|
||||
name: ftsoSymbol,
|
||||
@ -88,7 +84,7 @@ const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }
|
||||
address: GHST_ADDRESSES[chainId]
|
||||
}
|
||||
]
|
||||
}, [reserveSymbol, ftsoSymbol, stnkSymbol, ghstSymbol, reserveBalance, ftsoBalance, stnkBalance, ghstBalance]);
|
||||
}, [daiSymbol, ftsoSymbol, stnkSymbol, ghstSymbol, daiBalance, ftsoBalance, stnkBalance, ghstBalance]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isAddress(userInput)) {
|
||||
|
||||
@ -11,7 +11,7 @@ import TokenStack from "../../components/TokenStack/TokenStack";
|
||||
import { PrimaryButton } from "../../components/Button";
|
||||
import { Tab, Tabs } from "../../components/Tabs/Tabs";
|
||||
|
||||
import { RESERVE_ADDRESSES } from "../../constants/addresses";
|
||||
import { DAI_ADDRESSES } from "../../constants/addresses";
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { formatCurrency, formatNumber } from "../../helpers";
|
||||
|
||||
@ -44,14 +44,14 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
symbol: "",
|
||||
})
|
||||
|
||||
const reserveConversionRate = useConversionRate(chainId, "RESERVE");
|
||||
const accumulatedDonation = useAccumulatedDonation(chainId, "RESERVE");
|
||||
const daiConversionRate = useConversionRate(chainId, "GDAI");
|
||||
const accumulatedDonation = useAccumulatedDonation(chainId, "GDAI");
|
||||
|
||||
const { balance: reserveBalance, refetch: reserveBalanceRefetch } = useTokenBalance(chainId, "RESERVE", address);
|
||||
const { balance: daiBalance, refetch: daiBalanceRefetch } = useTokenBalance(chainId, "GDAI", address);
|
||||
const { data: nativeBalance, refetch: balanceRefetch } = useBalance({ address });
|
||||
const { data: contractBalance, refetch: contractBalanceRefetch } = useBalance({ address: RESERVE_ADDRESSES[chainId] });
|
||||
const { totalSupply: reserveTotalSupply, refetch: refetchReserveTotalSupply } = useTotalSupply(chainId, "RESERVE");
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
const { data: contractBalance, refetch: contractBalanceRefetch } = useBalance({ address: DAI_ADDRESSES[chainId] });
|
||||
const { totalSupply: reserveTotalSupply, refetch: refetchReserveTotalSupply } = useTotalSupply(chainId, "GDAI");
|
||||
const { symbol: faucetSymbol } = useTokenSymbol(chainId, "GDAI");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: "/faucet" });
|
||||
@ -93,10 +93,10 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
}, [amount, balance, nativeInfo])
|
||||
|
||||
const estimatedAmountIn = useMemo(() => {
|
||||
const rate = new DecimalBigNumber(reserveConversionRate.toString(), 0);
|
||||
const rate = new DecimalBigNumber(daiConversionRate.toString(), 0);
|
||||
const value = new DecimalBigNumber(amount, nativeInfo.decimals);
|
||||
return value.mul(rate);
|
||||
}, [amount, reserveConversionRate, nativeInfo]);
|
||||
}, [amount, daiConversionRate, nativeInfo]);
|
||||
|
||||
const contractBalanceFree = useMemo(() => {
|
||||
const realContractBalance = contractBalance ? contractBalance.value : 0n;
|
||||
@ -129,7 +129,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
}
|
||||
|
||||
await balanceRefetch();
|
||||
await reserveBalanceRefetch();
|
||||
await daiBalanceRefetch();
|
||||
await contractBalanceRefetch();
|
||||
await refetchReserveTotalSupply();
|
||||
setAmount("");
|
||||
@ -159,7 +159,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
<meta name="twitter:image" content="https://ghostchain.io/wp-content/uploads/2025/03/ghostFaucet-Featured_Image.png" />
|
||||
</Helmet>
|
||||
|
||||
<PageTitle name={`${reserveSymbol} Faucet`} subtitle={`Swap Sepolia ${nativeInfo.symbol} for ${reserveSymbol}.`} />
|
||||
<PageTitle name={`${faucetSymbol} Faucet`} subtitle={`Swap Sepolia ${nativeInfo.symbol} for ${faucetSymbol}.`} />
|
||||
<Container
|
||||
style={{
|
||||
paddingLeft: isSmallScreen || isVerySmallScreen ? "0" : "3.3rem",
|
||||
@ -188,7 +188,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
</Tabs>
|
||||
{!isSemiSmallScreen && <PrimaryButton
|
||||
variant="text"
|
||||
href={`${scanInfo.url}/token/${RESERVE_ADDRESSES[chainId]}`}
|
||||
href={`${scanInfo.url}/token/${DAI_ADDRESSES[chainId]}`}
|
||||
>
|
||||
Check on {scanInfo.name}
|
||||
</PrimaryButton>}
|
||||
@ -211,14 +211,14 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
{!isMint && <SwapCard
|
||||
id={`faucet-sepolia-eth`}
|
||||
inputWidth={isVerySmallScreen ? "100px" : isSemiSmallScreen ? "180px" : "250px"}
|
||||
tokenName={reserveSymbol}
|
||||
token={<TokenStack tokens={[reserveSymbol]} sx={{ fontSize: "21px" }} />}
|
||||
info={`${formatCurrency(reserveBalance.toString(), 4, reserveSymbol)}`}
|
||||
tokenName={faucetSymbol}
|
||||
token={<TokenStack tokens={[faucetSymbol]} sx={{ fontSize: "21px" }} />}
|
||||
info={`${formatCurrency(daiBalance.toString(), 4, faucetSymbol)}`}
|
||||
value={amount}
|
||||
onChange={event => setAmount(event.currentTarget.value)}
|
||||
inputProps={{ "data-testid": "fromInput" }}
|
||||
endString={"Max"}
|
||||
endStringOnClick={() => setAmount(reserveBalance.toString())}
|
||||
endStringOnClick={() => setAmount(daiBalance.toString())}
|
||||
/>}
|
||||
<Box
|
||||
mb="20px"
|
||||
@ -231,15 +231,15 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
<>
|
||||
<Box maxWidth="416px" display="flex" justifyContent={isVerySmallScreen ? "end" : "space-between"}>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">{nativeInfo.symbol} multiplier:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatNumber(reserveConversionRate, 2)}</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatNumber(daiConversionRate, 2)}</Typography>
|
||||
</Box>
|
||||
<Box maxWidth="416px" display="flex" justifyContent={isVerySmallScreen ? "end" : "space-between"}>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">You will get:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(estimatedAmountIn, 5, reserveSymbol)}</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(estimatedAmountIn, 5, faucetSymbol)}</Typography>
|
||||
</Box>
|
||||
<Box display="flex" justifyContent={isVerySmallScreen ? "end" : "space-between"}>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">Your {reserveSymbol} balance:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(reserveBalance, 5, reserveSymbol)}</Typography>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">Your {faucetSymbol} balance:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(daiBalance, 5, faucetSymbol)}</Typography>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
@ -267,7 +267,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
preparedAmount?._value === 0n ||
|
||||
isPending ||
|
||||
(isMint && balance?.lt(preparedAmount)) ||
|
||||
(!isMint && reserveBalance?.lt(preparedAmount))
|
||||
(!isMint && daiBalance?.lt(preparedAmount))
|
||||
)
|
||||
}
|
||||
loading={isPending}
|
||||
|
||||
@ -16,33 +16,34 @@ 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";
|
||||
import {
|
||||
DAI_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 { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, "GDAI_FTSO");
|
||||
const daiFtsoUniValuation = useLpValuation(chainId, "GDAI_FTSO", daiFtsoUniTotalSupply._value);
|
||||
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
|
||||
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||
|
||||
const pools = [
|
||||
{
|
||||
icons: ["FTSO", isNetworkLegacy(chainId) ? "GDAI" : tokenNameConverter(chainId, reserveSymbol)],
|
||||
name: `${ftsoSymbol}-${reserveSymbol}`,
|
||||
icons: ["FTSO", "GDAI"],
|
||||
name: `${ftsoSymbol}-${daiSymbol}`,
|
||||
dex: "Uniswap V2",
|
||||
url: "/dex/uniswap",
|
||||
tvl: reserveFtsoUniValuation,
|
||||
tvl: daiFtsoUniValuation,
|
||||
params: createSearchParams({
|
||||
pool: "true",
|
||||
from: `${RESERVE_ADDRESSES[chainId]}`,
|
||||
from: `${DAI_ADDRESSES[chainId]}`,
|
||||
to: `${FTSO_ADDRESSES[chainId]}`,
|
||||
})
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Grid, Box, Typography, useTheme } from "@mui/material";
|
||||
import { useAccount, useConfig, useBalance as useBalanceNative } from "wagmi";
|
||||
import { useAccount } from "wagmi";
|
||||
import { useNavigate, createSearchParams } from "react-router-dom";
|
||||
|
||||
import Token from "../../../components/Token/Token";
|
||||
@ -13,10 +13,8 @@ import {
|
||||
useFtsoPrice,
|
||||
useStnkPrice,
|
||||
useGhstPrice,
|
||||
useReservePrice,
|
||||
useNativePrice,
|
||||
useDaiPrice,
|
||||
} from "../../../hooks/prices";
|
||||
import { tokenNameConverter } from "../../../helpers/tokenConverter";
|
||||
|
||||
const TokenTab = ({ isMobileScreen, theme, tokenName, tokenUrl, tokenUrlParams, balance, price, description }) => {
|
||||
const navigate = useNavigate();
|
||||
@ -77,25 +75,20 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
|
||||
const theme = useTheme();
|
||||
const { address } = useAccount();
|
||||
|
||||
const config = useConfig();
|
||||
const nativeSymbol = config?.getClient()?.chain?.nativeCurrency?.symbol;
|
||||
|
||||
const nativePrice = useNativePrice(chainId);
|
||||
const ftsoPrice = useFtsoPrice(chainId);
|
||||
const stnkPrice = useStnkPrice(chainId);
|
||||
const ghstPrice = useGhstPrice(chainId);
|
||||
const reservePrice = useReservePrice(chainId);
|
||||
const daiPrice = useDaiPrice(chainId);
|
||||
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
|
||||
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||
const { symbol: stnkSymbol } = useTokenSymbol(chainId, "STNK");
|
||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||
|
||||
const { data: nativeBalance } = useBalanceNative({ address });
|
||||
const { balance: ftsoBalance, contractAddress: ftsoAddress } = useBalance(chainId, "FTSO", address);
|
||||
const { balance: stnkBalance, contractAddress: stnkAddress } = useBalance(chainId, "STNK", address);
|
||||
const { balance: ghstBalance, contractAddress: ghstAddress } = useBalance(chainId, "GHST", address);
|
||||
const { balance: reserveBalance, contractAddress: reserveAddress } = useBalance(chainId, "RESERVE", address);
|
||||
const { balance: daiBalance, contractAddress: daiAddress } = useBalance(chainId, "GDAI", address);
|
||||
|
||||
return (
|
||||
<Grid container spacing={0} justifyContent={"center"}>
|
||||
@ -104,7 +97,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
|
||||
isMobileScreen={isMobileScreen}
|
||||
tokenUrl="/dex/uniswap"
|
||||
tokenUrlParams={createSearchParams({
|
||||
from: `${reserveAddress}`,
|
||||
from: `${daiAddress}`,
|
||||
to: `${ftsoAddress}`,
|
||||
})}
|
||||
theme={theme}
|
||||
@ -117,7 +110,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
|
||||
isMobileScreen={isMobileScreen}
|
||||
tokenUrl="/dex/uniswap"
|
||||
tokenUrlParams={createSearchParams({
|
||||
from: `${reserveAddress}`,
|
||||
from: `${daiAddress}`,
|
||||
to: `${stnkAddress}`,
|
||||
})}
|
||||
theme={theme}
|
||||
@ -130,7 +123,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
|
||||
isMobileScreen={isMobileScreen}
|
||||
tokenUrl="/dex/uniswap"
|
||||
tokenUrlParams={createSearchParams({
|
||||
from: `${reserveAddress}`,
|
||||
from: `${daiAddress}`,
|
||||
to: `${ghstAddress}`,
|
||||
})}
|
||||
theme={theme}
|
||||
@ -144,29 +137,12 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
|
||||
tokenUrl={isNetworkLegacy(chainId) ? "/faucet" : "/wrapper"}
|
||||
tokenUrlParams=""
|
||||
theme={theme}
|
||||
tokenName={reserveSymbol}
|
||||
balance={reserveBalance}
|
||||
price={reservePrice}
|
||||
description={isNetworkLegacy(chainId)
|
||||
? `${ftsoSymbol} is backed by a treasury reserve of crypto assets, with ${reserveSymbol} being the primary and most liquid asset.`
|
||||
: `${reserveSymbol} is wrapped version of the native ${nativeSymbol} coin with a fixed ration 1:1 and fully ERC-20 compatible.`
|
||||
}
|
||||
tokenName={daiSymbol}
|
||||
balance={daiBalance}
|
||||
price={daiPrice}
|
||||
description={`${ftsoSymbol} is backed by a treasury reserve of crypto assets, with ${daiSymbol} being the primary and most liquid asset.`}
|
||||
/>
|
||||
</Box>
|
||||
{!isNetworkLegacy(chainId) && (
|
||||
<Box width="100%" mt="25px">
|
||||
<TokenTab
|
||||
isMobileScreen={true}
|
||||
tokenUrl={isNetworkLegacy(chainId) ? "/faucet" : "/wrapper"}
|
||||
tokenUrlParams=""
|
||||
theme={theme}
|
||||
tokenName={nativeSymbol}
|
||||
balance={new DecimalBigNumber(nativeBalance?.value ?? 0n, 18)}
|
||||
price={reservePrice}
|
||||
description={`${nativeSymbol} is the original cryptocurrency of a blockchain, required for all basic network functions like transactions and smart contracts. It's the primary digital asset that operates without relying on any other blockchain's infrastructure. Thus it's the most reliable backing for the ${ftsoSymbol}.`}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
</Grid>
|
||||
)
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import TokenStack from "../../components/TokenStack/TokenStack";
|
||||
import { PrimaryButton } from "../../components/Button";
|
||||
import { Tab, Tabs } from "../../components/Tabs/Tabs";
|
||||
|
||||
import { RESERVE_ADDRESSES } from "../../constants/addresses";
|
||||
import { DAI_ADDRESSES } from "../../constants/addresses";
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { formatCurrency, formatNumber } from "../../helpers";
|
||||
|
||||
@ -45,9 +45,9 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
symbol: "",
|
||||
})
|
||||
|
||||
const { balance: reserveBalance, refetch: reserveBalanceRefetch } = useTokenBalance(chainId, "RESERVE", address);
|
||||
const { balance: daiBalance, refetch: daiBalanceRefetch } = useTokenBalance(chainId, "GDAI", address);
|
||||
const { data: nativeBalance, refetch: balanceRefetch } = useBalance({ address });
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
const { symbol: faucetSymbol } = useTokenSymbol(chainId, "GDAI");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: "/wrapper" });
|
||||
@ -109,7 +109,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
}
|
||||
|
||||
await balanceRefetch();
|
||||
await reserveBalanceRefetch();
|
||||
await daiBalanceRefetch();
|
||||
setAmount("");
|
||||
setIsPending(false);
|
||||
}
|
||||
@ -137,7 +137,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
<meta name="twitter:image" content="https://ghostchain.io/wp-content/uploads/2025/03/ghostFaucet-Featured_Image.png" />
|
||||
</Helmet>
|
||||
|
||||
<PageTitle name={`${reserveSymbol} Faucet`} subtitle={`Swap ${chainName} ${nativeInfo.symbol} for ${reserveSymbol}.`} />
|
||||
<PageTitle name={`${faucetSymbol} Faucet`} subtitle={`Swap ${chainName} ${nativeInfo.symbol} for ${faucetSymbol}.`} />
|
||||
<Container
|
||||
style={{
|
||||
paddingLeft: isSmallScreen || isVerySmallScreen ? "0" : "3.3rem",
|
||||
@ -166,7 +166,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
</Tabs>
|
||||
{!isSemiSmallScreen && <PrimaryButton
|
||||
variant="text"
|
||||
href={`${scanInfo.url}/token/${RESERVE_ADDRESSES[chainId]}`}
|
||||
href={`${scanInfo.url}/token/${DAI_ADDRESSES[chainId]}`}
|
||||
>
|
||||
Check on {scanInfo.name}
|
||||
</PrimaryButton>}
|
||||
@ -189,14 +189,14 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
{!isMint && <SwapCard
|
||||
id={`faucet-sepolia-eth`}
|
||||
inputWidth={isVerySmallScreen ? "100px" : isSemiSmallScreen ? "180px" : "250px"}
|
||||
tokenName={reserveSymbol}
|
||||
token={<TokenStack tokens={[reserveSymbol]} sx={{ fontSize: "21px" }} />}
|
||||
info={`${formatCurrency(reserveBalance.toString(), 4, reserveSymbol)}`}
|
||||
tokenName={faucetSymbol}
|
||||
token={<TokenStack tokens={[faucetSymbol]} sx={{ fontSize: "21px" }} />}
|
||||
info={`${formatCurrency(daiBalance.toString(), 4, faucetSymbol)}`}
|
||||
value={amount}
|
||||
onChange={event => setAmount(event.currentTarget.value)}
|
||||
inputProps={{ "data-testid": "fromInput" }}
|
||||
endString={"Max"}
|
||||
endStringOnClick={() => setAmount(reserveBalance.toString())}
|
||||
endStringOnClick={() => setAmount(daiBalance.toString())}
|
||||
/>}
|
||||
<Box
|
||||
mb="20px"
|
||||
@ -209,11 +209,11 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
<>
|
||||
<Box maxWidth="416px" display="flex" justifyContent={isVerySmallScreen ? "end" : "space-between"}>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">You will get:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(estimatedAmountIn, 5, reserveSymbol)}</Typography>
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(estimatedAmountIn, 5, faucetSymbol)}</Typography>
|
||||
</Box>
|
||||
<Box display="flex" justifyContent={isVerySmallScreen ? "end" : "space-between"}>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">Your {reserveSymbol} balance:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(reserveBalance, 5, reserveSymbol)}</Typography>
|
||||
{!isVerySmallScreen && <Typography fontSize="12px" lineHeight="15px">Your {faucetSymbol} balance:</Typography>}
|
||||
<Typography fontSize="12px" lineHeight="15px">{formatCurrency(daiBalance, 5, faucetSymbol)}</Typography>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
@ -237,7 +237,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
preparedAmount?._value === 0n ||
|
||||
isPending ||
|
||||
(isMint && balance?.lt(preparedAmount)) ||
|
||||
(!isMint && reserveBalance?.lt(preparedAmount))
|
||||
(!isMint && daiBalance?.lt(preparedAmount))
|
||||
)
|
||||
}
|
||||
loading={isPending}
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
export const tokenNameConverter = (chainId, name) => {
|
||||
if (name?.toUpperCase() === "WETH") {
|
||||
switch (chainId) {
|
||||
case 63:
|
||||
name = "WETC"
|
||||
break;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
import {
|
||||
RESERVE_ADDRESSES,
|
||||
DAI_ADDRESSES,
|
||||
FTSO_ADDRESSES,
|
||||
STNK_ADDRESSES,
|
||||
GHST_ADDRESSES,
|
||||
@ -24,9 +24,6 @@ export const getTokenAbi = (name) => {
|
||||
case "GDAI":
|
||||
abi = DaiAbi;
|
||||
break;
|
||||
case "RESERVE":
|
||||
abi = DaiAbi;
|
||||
break;
|
||||
case "FTSO":
|
||||
abi = FatsoAbi;
|
||||
break;
|
||||
@ -62,9 +59,6 @@ export const getTokenDecimals = (name) => {
|
||||
case "GDAI":
|
||||
decimals = 18;
|
||||
break;
|
||||
case "RESERVE":
|
||||
decimals = 18;
|
||||
break;
|
||||
case "FTSO":
|
||||
decimals = 9;
|
||||
break;
|
||||
@ -95,13 +89,10 @@ export const getTokenAddress = (chainId, name) => {
|
||||
let address = name;
|
||||
switch (name?.toUpperCase()) {
|
||||
case "DAI":
|
||||
address = RESERVE_ADDRESSES[chainId];
|
||||
address = DAI_ADDRESSES[chainId];
|
||||
break;
|
||||
case "GDAI":
|
||||
address = RESERVE_ADDRESSES[chainId];
|
||||
break;
|
||||
case "RESERVE":
|
||||
address = RESERVE_ADDRESSES[chainId];
|
||||
address = DAI_ADDRESSES[chainId];
|
||||
break;
|
||||
case "FTSO":
|
||||
address = FTSO_ADDRESSES[chainId];
|
||||
@ -124,15 +115,9 @@ export const getTokenAddress = (chainId, name) => {
|
||||
case "GDAI_FTSO":
|
||||
address = FTSO_DAI_LP_ADDRESSES[chainId];
|
||||
break;
|
||||
case "RESERVE_FTSO":
|
||||
address = FTSO_DAI_LP_ADDRESSES[chainId];
|
||||
break;
|
||||
case "WETH":
|
||||
address = WETH_ADDRESSES[chainId];
|
||||
break;
|
||||
case "WETC":
|
||||
address = WETH_ADDRESSES[chainId];
|
||||
break;
|
||||
}
|
||||
return address;
|
||||
}
|
||||
@ -141,8 +126,8 @@ export const getTokenAddress = (chainId, name) => {
|
||||
export const getTokenIcons = (chainId, address) => {
|
||||
let icons = [""];
|
||||
switch (address) {
|
||||
case RESERVE_ADDRESSES[chainId]:
|
||||
icons = ["RESERVE"];
|
||||
case DAI_ADDRESSES[chainId]:
|
||||
icons = ["GDAI"];
|
||||
break;
|
||||
case FTSO_ADDRESSES[chainId]:
|
||||
icons = ["FTSO"];
|
||||
@ -154,7 +139,7 @@ export const getTokenIcons = (chainId, address) => {
|
||||
icons = ["GHST"];
|
||||
break;
|
||||
case FTSO_DAI_LP_ADDRESSES[chainId]:
|
||||
icons = ["FTSO", "RESERVE"];
|
||||
icons = ["FTSO", "GDAI"];
|
||||
break;
|
||||
}
|
||||
return icons;
|
||||
@ -170,14 +155,11 @@ export const getBondNameDisplayName = (chainId, stringValue, tokenAddress) => {
|
||||
export const getTokenPurchaseLink = (chainId, tokenAddress) => {
|
||||
let purchaseUrl = "https://app.dao.ghostchain.io/#/dex/uniswap";
|
||||
switch (tokenAddress) {
|
||||
case RESERVE_ADDRESSES[chainId]:
|
||||
case DAI_ADDRESSES[chainId]:
|
||||
purchaseUrl = "https://app.dao.ghostchain.io/#/faucet";
|
||||
if (chainId == 63) {
|
||||
purchaseUrl = "https://app.dao.ghostchain.io/#/wrapper";
|
||||
}
|
||||
break;
|
||||
case FTSO_DAI_LP_ADDRESSES[chainId]:
|
||||
purchaseUrl += `?pool=true&from=${RESERVE_ADDRESSES[chainId]}&to=${FTSO_ADDRESSES[chainId]}`;
|
||||
purchaseUrl += `?pool=true&from=${DAI_ADDRESSES[chainId]}&to=${FTSO_ADDRESSES[chainId]}`;
|
||||
break;
|
||||
}
|
||||
return purchaseUrl;
|
||||
|
||||
@ -6,15 +6,14 @@ import { useUniswapV2PairReserves } from "../uniswapv2";
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import {
|
||||
FTSO_DAI_LP_ADDRESSES,
|
||||
RESERVE_ADDRESSES,
|
||||
DAI_ADDRESSES,
|
||||
FTSO_ADDRESSES,
|
||||
CEX_TICKERS,
|
||||
NATIVE_TICKERS,
|
||||
CEX_TICKERS
|
||||
} from "../../constants/addresses";
|
||||
|
||||
const cexPriceGetters = new Map();
|
||||
|
||||
function callWithCacheTTL(fn, ttlMs = 10000) {
|
||||
function callWithCacheTTL(fn, ttlMs = 5000) {
|
||||
let lastFetchTime = 0;
|
||||
let cachedValue;
|
||||
let inFlight = null;
|
||||
@ -42,59 +41,13 @@ function callWithCacheTTL(fn, ttlMs = 10000) {
|
||||
}
|
||||
}
|
||||
|
||||
export const useNativePrice = (chainId) => {
|
||||
const [nativePrice, setNativePrice] = useState(new DecimalBigNumber(1000000000000000000n, 18));
|
||||
const cexApis = NATIVE_TICKERS[chainId];
|
||||
|
||||
useEffect(() => {
|
||||
if (!cexApis) {
|
||||
setNativePrice(new DecimalBigNumber(1000000000000000000n, 18));
|
||||
return;
|
||||
}
|
||||
|
||||
let getCexPriceCached = cexPriceGetters.get(chainId);
|
||||
if (!getCexPriceCached) {
|
||||
getCexPriceCached = callWithCacheTTL(() => {
|
||||
const fetchPromises = cexApis.map(url => fetch(url)
|
||||
.then(res => {
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return res.json();
|
||||
})
|
||||
)
|
||||
return Promise.any(fetchPromises);
|
||||
}, 5000);
|
||||
cexPriceGetters.set(chainId, getCexPriceCached);
|
||||
}
|
||||
|
||||
getCexPriceCached()
|
||||
.then(response => {
|
||||
if ('data' in response) {
|
||||
const coinPrice = Number(response?.data?.amount ?? 0.0);
|
||||
const priceInWei = Math.floor(coinPrice * 1e18 / 0.99);
|
||||
setNativePrice(new DecimalBigNumber(BigInt(priceInWei), 18));
|
||||
} else if ('price' in response) {
|
||||
const coinPrice = Number(response?.price ?? 0.0);
|
||||
const priceInWei = Math.floor(coinPrice * 1e18)
|
||||
setNativePrice(new DecimalBigNumber(BigInt(priceInWei), 18));
|
||||
} else {
|
||||
throw Error("Unexpected json in response.");
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
setNativePrice(new DecimalBigNumber(0n, 18));
|
||||
});
|
||||
}, [chainId, cexApis])
|
||||
|
||||
return nativePrice;
|
||||
}
|
||||
|
||||
export const useReservePrice = (chainId) => {
|
||||
const [reservePrice, setReservePrice] = useState(new DecimalBigNumber(1000000000000000000n, 18));
|
||||
export const useDaiPrice = (chainId) => {
|
||||
const [daiPrice, setDaiPrice] = useState(new DecimalBigNumber(1000000000000000000n, 18));
|
||||
const cexApis = CEX_TICKERS[chainId];
|
||||
|
||||
useEffect(() => {
|
||||
if (!cexApis) {
|
||||
setReservePrice(new DecimalBigNumber(1000000000000000000n, 18));
|
||||
setDaiPrice(new DecimalBigNumber(1000000000000000000n, 18));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -116,29 +69,36 @@ export const useReservePrice = (chainId) => {
|
||||
.then(response => {
|
||||
if ('data' in response) {
|
||||
const coinPrice = Number(response?.data?.amount ?? 0.0);
|
||||
const priceInWei = Math.floor(coinPrice * 1e18 / 0.99);
|
||||
setReservePrice(new DecimalBigNumber(BigInt(priceInWei), 18));
|
||||
const priceInWei = Math.floor(coinPrice * 1e18);
|
||||
setDaiPrice(new DecimalBigNumber(BigInt(priceInWei), 18));
|
||||
} else if ('price' in response) {
|
||||
const coinPrice = Number(response?.price ?? 0.0);
|
||||
const priceInWei = Math.floor(coinPrice * 1e18)
|
||||
setReservePrice(new DecimalBigNumber(BigInt(priceInWei), 18));
|
||||
setDaiPrice(new DecimalBigNumber(BigInt(priceInWei), 18));
|
||||
} else {
|
||||
throw Error("Unexpected json in response.");
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
setReservePrice(new DecimalBigNumber(0n, 18));
|
||||
setDaiPrice(new DecimalBigNumber(0n, 18));
|
||||
});
|
||||
}, [chainId, cexApis])
|
||||
|
||||
return reservePrice;
|
||||
return daiPrice;
|
||||
};
|
||||
|
||||
export const useFtsoPrice = (chainId) => {
|
||||
const { reserves, tokens, refetch } = useUniswapV2PairReserves(chainId, FTSO_DAI_LP_ADDRESSES[chainId]);
|
||||
const { reserves, tokens, refetch } = useUniswapV2PairReserves(
|
||||
chainId,
|
||||
FTSO_DAI_LP_ADDRESSES[chainId],
|
||||
9,
|
||||
18,
|
||||
"FTSO",
|
||||
"GDAI",
|
||||
);
|
||||
|
||||
const reservePrice = useReservePrice(chainId);
|
||||
const reserveAddress = RESERVE_ADDRESSES[chainId];
|
||||
const reservePrice = useDaiPrice(chainId);
|
||||
const reserveAddress = DAI_ADDRESSES[chainId];
|
||||
const ftsoAddress = FTSO_ADDRESSES[chainId];
|
||||
if (!reserveAddress || !ftsoAddress) {
|
||||
return new DecimalBigNumber(0n, 9);
|
||||
|
||||
@ -6,7 +6,6 @@ import { getTokenAbi, getTokenAddress, getTokenDecimals } from "../helpers";
|
||||
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { shorten } from "../../helpers";
|
||||
import { tokenNameConverter } from "../../helpers/tokenConverter";
|
||||
import { config } from "../../config";
|
||||
|
||||
export const useTotalSupply = (chainId, name) => {
|
||||
@ -69,9 +68,7 @@ export const useTokenSymbol = (chainId, name) => {
|
||||
chainId: chainId,
|
||||
});
|
||||
|
||||
let symbol = data ? data : "";
|
||||
symbol = tokenNameConverter(chainId, symbol);
|
||||
|
||||
const symbol = data ? data : "";
|
||||
return { symbol, refetch };
|
||||
}
|
||||
|
||||
@ -243,8 +240,8 @@ export const depositNative = async (chainId, account, value) => {
|
||||
chainId: chainId,
|
||||
value: value
|
||||
});
|
||||
const txHash = await writeContract(config, request);
|
||||
|
||||
const txHash = await writeContract(config, request);
|
||||
await waitForTransactionReceipt(config, {
|
||||
hash: txHash,
|
||||
onReplaced: () => toast("WETH9 deposit transaction was replaced. Wait for inclusion please."),
|
||||
|
||||
@ -3,7 +3,7 @@ import { useReadContract } from "wagmi";
|
||||
import { DAO_TREASURY_ADDRESSES } from "../../constants/addresses";
|
||||
import { abi as TreasuryAbi } from "../../abi/GhostTreasury.json";
|
||||
|
||||
import { useReservePrice } from "../prices/index";
|
||||
import { useDaiPrice } from "../prices/index";
|
||||
|
||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||
import { getTokenAddress } from "../helpers";
|
||||
@ -30,7 +30,7 @@ export const useTotalReserves = (chainId) => {
|
||||
});
|
||||
|
||||
const original = useOrinalCoefficient(chainId);
|
||||
const price = useReservePrice(chainId);
|
||||
const price = useDaiPrice(chainId);
|
||||
|
||||
const totalReservesPrepared = totalReservesRaw ? totalReservesRaw : 0n;
|
||||
const totalReserves = new DecimalBigNumber(totalReservesPrepared, 9);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user