diff --git a/package.json b/package.json
index e85966d..1330a04 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
- "version": "0.3.3",
+ "version": "0.3.4",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/assets/tokens/ETC.svg b/src/assets/tokens/ETC.svg
new file mode 100644
index 0000000..d82a315
--- /dev/null
+++ b/src/assets/tokens/ETC.svg
@@ -0,0 +1,27 @@
+
+
diff --git a/src/assets/tokens/ETH.svg b/src/assets/tokens/ETH.svg
index 2b0b05d..2097243 100644
--- a/src/assets/tokens/ETH.svg
+++ b/src/assets/tokens/ETH.svg
@@ -1,13 +1,36 @@
-
diff --git a/src/assets/tokens/wETH.svg b/src/assets/tokens/wETH.svg
deleted file mode 100644
index 2097243..0000000
--- a/src/assets/tokens/wETH.svg
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/Token/Token.jsx b/src/components/Token/Token.jsx
index fbca19f..5f0b3c7 100644
--- a/src/components/Token/Token.jsx
+++ b/src/components/Token/Token.jsx
@@ -5,7 +5,8 @@ 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 WethIcon from "../../assets/tokens/wETH.svg?react";
+import EthIcon from "../../assets/tokens/ETH.svg?react";
+import EtcIcon from "../../assets/tokens/ETC.svg?react";
import UnknownIcon from "../../assets/tokens/Unknown.svg?react";
const PREFIX = "Token";
@@ -23,52 +24,55 @@ const StyledSvgIcon = styled(SvgIcon)(() => ({
},
}));
-const Token = ({ name, viewBox = "0 0 260 260", fontSize = "large", ...props }) => {
- const parseKnownToken = (name) => {
- let icon;
- switch (name?.toUpperCase()) {
- case "FTSO":
- icon = FtsoIcon;
- break;
- case "ECSPR":
- icon = FtsoIcon;
- break;
- case "STNK":
- icon = StnkIcon;
- break;
- case "SCSPR":
- icon = StnkIcon;
- break;
- case "GHST":
- icon = GhstIcon;
- break;
- case "CSPR":
- icon = GhstIcon;
- break;
- case "GDAI":
- icon = DaiIcon;
- break;
- case "DAI":
- icon = DaiIcon;
- break;
- case "ETH":
- icon = WethIcon;
- break;
- case "WETH":
- icon = WethIcon;
- break;
- case "METC":
- icon = WethIcon;
- break;
- default:
- icon = UnknownIcon;
- }
- return icon;
+export const parseKnownToken = (name) => {
+ let icon;
+ switch (name?.toUpperCase()) {
+ case "FTSO":
+ icon = FtsoIcon;
+ break;
+ case "ECSPR":
+ icon = FtsoIcon;
+ break;
+ case "STNK":
+ icon = StnkIcon;
+ break;
+ case "SCSPR":
+ icon = StnkIcon;
+ break;
+ case "GHST":
+ icon = GhstIcon;
+ break;
+ case "CSPR":
+ icon = GhstIcon;
+ break;
+ case "GDAI":
+ icon = DaiIcon;
+ break;
+ case "DAI":
+ icon = DaiIcon;
+ break;
+ case "ETH":
+ icon = EthIcon;
+ break;
+ case "WETH":
+ icon = EthIcon;
+ break;
+ case "METC":
+ icon = EtcIcon;
+ break;
+ case "WETC":
+ icon = EtcIcon;
+ break;
+ default:
+ icon = UnknownIcon;
}
+ return icon;
+}
+const Token = ({ name, viewBox = "0 0 260 260", fontSize = "large", ...props }) => {
return (
- {chains.map(chain => {
+ {chains.map((chain, i) => {
return (
diff --git a/src/components/TopBar/Wallet/InitialWalletView.tsx b/src/components/TopBar/Wallet/InitialWalletView.tsx
index a26a51c..3796636 100644
--- a/src/components/TopBar/Wallet/InitialWalletView.tsx
+++ b/src/components/TopBar/Wallet/InitialWalletView.tsx
@@ -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 { DAI_ADDRESSES, FTSO_ADDRESSES } from "../../../constants/addresses";
+import { RESERVE_ADDRESSES, FTSO_ADDRESSES } from "../../../constants/addresses";
import { useAccount, useDisconnect } from "wagmi";
@@ -156,9 +156,9 @@ function InitialWalletView({ isWalletOpen, address, chainId, onClose }) {
>
onBtnClick("uniswap", DAI_ADDRESSES[chainId], FTSO_ADDRESSES[chainId])}
+ onClick={() => onBtnClick("uniswap", RESERVE_ADDRESSES[chainId], FTSO_ADDRESSES[chainId])}
>
- {`${tokens?.ftso?.symbol}-${tokens?.dai?.symbol} on Uniswap`}
+ {`${tokens?.ftso?.symbol}-${tokens?.reserve?.symbol} on Uniswap`}
diff --git a/src/components/TopBar/Wallet/Token.tsx b/src/components/TopBar/Wallet/Token.tsx
index 998dffb..cc3d7cd 100644
--- a/src/components/TopBar/Wallet/Token.tsx
+++ b/src/components/TopBar/Wallet/Token.tsx
@@ -13,6 +13,8 @@ import { ChangeEvent, useState, useEffect } from "react";
import { useNavigate, createSearchParams } from "react-router-dom";
import { useQuery } from "react-query";
import { formatCurrency, formatNumber } from "../../../helpers";
+import { tokenNameConverter } from "../../../helpers/tokenConverter";
+import { isNetworkLegacy } from "../../../constants";
import GhostStyledIcon from "../../Icon/GhostIcon";
import TokenStack from "../../TokenStack/TokenStack";
@@ -68,7 +70,7 @@ export const Token = (props) => {
onAddTokenToWallet,
expanded,
onChangeExpanded,
- daiAddress,
+ reserveAddress,
onClose,
isPool
} = props;
@@ -76,7 +78,7 @@ export const Token = (props) => {
const navigate = useNavigate();
const useLink = (symbol, fromAddress, toAddress, isPool) => {
- if (symbol.toUpperCase() === "GDAI") {
+ if (symbol.toUpperCase() === "RESERVE") {
navigate({ pathname: "/faucet" })
} else {
navigate({
@@ -130,10 +132,10 @@ export const Token = (props) => {
Add to Wallet
useLink(symbol, daiAddress, address, isPool)}
+ onClick={() => useLink(symbol, reserveAddress, address, isPool)}
fullWidth
>
- Get on {symbol.toUpperCase() === "GDAI" ? "Faucet" : "Uniswap"}
+ Get on {symbol?.toUpperCase() === "RESERVE" ? "Faucet" : "Uniswap"}
@@ -147,10 +149,10 @@ const sumObjValues = (obj: Record = {}) =>
export const useWallet = (chainId, userAddress) => {
const {
- balance: daiBalance,
- refetch: daiRefetch,
- contractAddress: daiAddress,
- } = useBalance(chainId, "GDAI", userAddress);
+ balance: reserveBalance,
+ refetch: reserveRefetch,
+ contractAddress: reserveAddress,
+ } = useBalance(chainId, "RESERVE", userAddress);
const {
balance: ftsoBalance,
refetch: ftsoRefetch,
@@ -167,32 +169,34 @@ export const useWallet = (chainId, userAddress) => {
contractAddress: ghstAddress,
} = useBalance(chainId, "GHST", userAddress);
const {
- balance: lpDaiFtsoBalance,
- refetch: lpDaiFtsoRefetch,
- contractAddress: lpDaiFtsoBalanceAddress,
- } = useBalance(chainId, "GDAI_FTSO", userAddress);
+ balance: lpReserveFtsoBalance,
+ refetch: lpReserveFtsoRefetch,
+ contractAddress: lpReserveFtsoBalanceAddress,
+ } = useBalance(chainId, "RESERVE_FTSO", userAddress);
- const daiPrice = useDaiPrice(chainId);
+ const reservePrice = useDaiPrice(chainId);
const ftsoPrice = useFtsoPrice(chainId);
const stnkPrice = useStnkPrice(chainId);
const ghstPrice = useGhstPrice(chainId);
- const lpDaiFtsoPrice = useLpValuation(chainId, "GDAI_FTSO", 1000000000000000000n);
+ const lpReserveFtsoPrice = useLpValuation(chainId, "RESERVE_FTSO", 1000000000000000000n);
- const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
+ const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
const { symbol: stnkSymbol } = useTokenSymbol(chainId, "STNK");
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
- const { symbol: lpDaiFtsoSymbol } = useTokenSymbol(chainId, "GDAI_FTSO");
+ const { symbol: lpReserveFtsoSymbol } = useTokenSymbol(chainId, "RESERVE_FTSO");
const tokens = {
- dai: {
- symbol: daiSymbol,
- address: daiAddress,
- balance: daiBalance,
- price: daiPrice,
- icons: ["GDAI"],
- externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/gDAI.svg",
- refetch: daiRefetch,
+ 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,
},
ftso: {
symbol: ftsoSymbol,
@@ -221,15 +225,15 @@ export const useWallet = (chainId, userAddress) => {
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/GHST.svg",
refetch: ghstRefetch,
},
- daiFtso: {
+ reserveFtso: {
isPool: true,
- symbol: lpDaiFtsoSymbol,
- address: lpDaiFtsoBalanceAddress,
- balance: lpDaiFtsoBalance,
- price: lpDaiFtsoPrice,
- icons: ["GDAI", "FTSO"],
+ symbol: lpReserveFtsoSymbol,
+ address: lpReserveFtsoBalanceAddress,
+ balance: lpReserveFtsoBalance,
+ price: lpReserveFtsoPrice,
+ icons: ["FTSO", isNetworkLegacy(chainId) ? "GDAI" : tokenNameConverter(chainId, reserveSymbol)],
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
- refetch: lpDaiFtsoRefetch,
+ refetch: lpReserveFtsoRefetch,
}
};
@@ -246,12 +250,12 @@ export const useWallet = (chainId, userAddress) => {
export const Tokens = ({ address, tokens, onClose }) => {
const [expanded, setExpanded] = useState(null);
- const alwaysShowTokens = [tokens.dai, tokens.ftso, tokens.stnk, tokens.ghst, tokens.daiFtso];
+ const alwaysShowTokens = [tokens.reserve, tokens.ftso, tokens.stnk, tokens.ghst, tokens.reserveFtso];
const tokenProps = (token) => ({
...token,
expanded: expanded === token.symbol,
- daiAddress: tokens.dai.address,
+ reserveAddress: tokens.reserve.address,
onChangeExpanded: (e, isExpanded) => setExpanded(isExpanded ? token.symbol : null),
onAddTokenToWallet: () => addTokenToWallet(token, address),
onClose: () => onClose(),
diff --git a/src/config.js b/src/config.js
index aef3dd5..cdab829 100644
--- a/src/config.js
+++ b/src/config.js
@@ -8,7 +8,7 @@ const mordor = defineChain({
nativeCurrency: {
decimals: 18,
name: 'METC',
- symbol: 'METC',
+ symbol: 'mETC',
},
rpcUrls: {
default: { http: ['https://rpc.mordor.etccooperative.org'] },
diff --git a/src/constants/addresses.js b/src/constants/addresses.js
index aba233c..5241bd2 100644
--- a/src/constants/addresses.js
+++ b/src/constants/addresses.js
@@ -30,7 +30,7 @@ export const FTSO_STNK_LP_ADDRESSES = {
[NetworkId.TESTNET_MORDOR]: "0x0000000000000000000000000000000000000000",
}
-export const DAI_ADDRESSES = {
+export const RESERVE_ADDRESSES = {
[NetworkId.TESTNET_SEPOLIA]: "0x5f63a27a9214a0352F2EF8dAF1eD4974d713192B",
[NetworkId.TESTNET_HOODI]: "0x80c6676c334BCcE60b3CC852085B72143379CE58",
[NetworkId.TESTNET_MORDOR]: "0x6af91B3763b5d020E0985f85555EB50e5852d7AC",
diff --git a/src/containers/Dex/Dex.jsx b/src/containers/Dex/Dex.jsx
index cbdba53..073d8a7 100644
--- a/src/containers/Dex/Dex.jsx
+++ b/src/containers/Dex/Dex.jsx
@@ -26,7 +26,7 @@ import { Tab, Tabs } from "../../components/Tabs/Tabs";
import {
UNISWAP_V2_ROUTER,
UNISWAP_V2_FACTORY,
- DAI_ADDRESSES,
+ RESERVE_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(DAI_ADDRESSES[chainId]);
+ const [tokenAddressTop, setTokenAddressTop] = useState(RESERVE_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(DAI_ADDRESSES[chainId]);
- newQueryParameters.set("from", DAI_ADDRESSES[chainId]);
+ setTokenAddressTop(RESERVE_ADDRESSES[chainId]);
+ newQueryParameters.set("from", RESERVE_ADDRESSES[chainId]);
}
if (currentQueryParameters.has("to")) {
diff --git a/src/containers/Dex/SwapContainer.jsx b/src/containers/Dex/SwapContainer.jsx
index 1f7b310..19d7ae1 100644
--- a/src/containers/Dex/SwapContainer.jsx
+++ b/src/containers/Dex/SwapContainer.jsx
@@ -187,11 +187,11 @@ const SwapContainer = ({
>
Current price:
- {formatCurrency(currentPrice, formatDecimals)}
+ {formatCurrency(currentPrice, formatDecimals, tokenNameTop)}
Next price:
- {formatCurrency(nextPrice === "" ? currentPrice : nextPrice, formatDecimals)}
+ {formatCurrency(nextPrice === "" ? currentPrice : nextPrice, formatDecimals, tokenNameTop)}
Transaction deadline:
diff --git a/src/containers/Dex/TokenModal.jsx b/src/containers/Dex/TokenModal.jsx
index 180008a..2345c7e 100644
--- a/src/containers/Dex/TokenModal.jsx
+++ b/src/containers/Dex/TokenModal.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useMemo } from "react";
+import { useConfig } from "wagmi";
import {
Divider,
Typography,
@@ -20,7 +21,7 @@ import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
import { formatNumber } from "../../helpers/";
import { useBalance, useTokenSymbol } from "../../hooks/tokens";
import { isNetworkLegacy } from "../../constants";
-import { DAI_ADDRESSES, FTSO_ADDRESSES, STNK_ADDRESSES, GHST_ADDRESSES } from "../../constants/addresses";
+import { RESERVE_ADDRESSES, FTSO_ADDRESSES, STNK_ADDRESSES, GHST_ADDRESSES } from "../../constants/addresses";
const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }) => {
const isSmallScreen = useMediaQuery("(max-width: 599px)");
@@ -38,16 +39,19 @@ const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }
const { symbol: searchSymbol } = useTokenSymbol(chainId, address);
const { balance: searchBalance } = useBalance(chainId, address, account);
- const { balance: daiBalance } = useBalance(chainId, "GDAI", account);
+ const { balance: reserveBalance } = useBalance(chainId, "RESERVE", account);
const { balance: ftsoBalance } = useBalance(chainId, "FTSO", account);
const { balance: stnkBalance } = useBalance(chainId, "STNK", account);
const { balance: ghstBalance } = useBalance(chainId, "GHST", account);
- const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
+ const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
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,
@@ -60,10 +64,10 @@ const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }
const knownTokens = useMemo(() => {
return [
{
- name: daiSymbol,
- icons: isNetworkLegacy(chainId) ? ["GDAI"] : ["WETH"],
- balance: daiBalance,
- address: DAI_ADDRESSES[chainId]
+ name: reserveSymbol,
+ icons: isNetworkLegacy(chainId) ? ["GDAI"] : [nativeSymbol],
+ balance: reserveBalance,
+ address: RESERVE_ADDRESSES[chainId]
},
{
name: ftsoSymbol,
@@ -84,7 +88,7 @@ const TokenModal = ({ chainId, account, listOpen, setListOpen, setTokenAddress }
address: GHST_ADDRESSES[chainId]
}
]
- }, [daiSymbol, ftsoSymbol, stnkSymbol, ghstSymbol, daiBalance, ftsoBalance, stnkBalance, ghstBalance]);
+ }, [reserveSymbol, ftsoSymbol, stnkSymbol, ghstSymbol, reserveBalance, ftsoBalance, stnkBalance, ghstBalance]);
useEffect(() => {
if (isAddress(userInput)) {
diff --git a/src/containers/Faucet/Faucet.jsx b/src/containers/Faucet/Faucet.jsx
index 0d0eba0..1b69a41 100644
--- a/src/containers/Faucet/Faucet.jsx
+++ b/src/containers/Faucet/Faucet.jsx
@@ -11,7 +11,7 @@ import TokenStack from "../../components/TokenStack/TokenStack";
import { PrimaryButton } from "../../components/Button";
import { Tab, Tabs } from "../../components/Tabs/Tabs";
-import { DAI_ADDRESSES } from "../../constants/addresses";
+import { RESERVE_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 daiConversionRate = useConversionRate(chainId, "GDAI");
- const accumulatedDonation = useAccumulatedDonation(chainId, "GDAI");
+ const reserveConversionRate = useConversionRate(chainId, "RESERVE");
+ const accumulatedDonation = useAccumulatedDonation(chainId, "RESERVE");
- const { balance: daiBalance, refetch: daiBalanceRefetch } = useTokenBalance(chainId, "GDAI", address);
+ const { balance: reserveBalance, refetch: reserveBalanceRefetch } = useTokenBalance(chainId, "RESERVE", address);
const { data: nativeBalance, refetch: balanceRefetch } = useBalance({ address });
- const { data: contractBalance, refetch: contractBalanceRefetch } = useBalance({ address: DAI_ADDRESSES[chainId] });
- const { totalSupply: reserveTotalSupply, refetch: refetchReserveTotalSupply } = useTotalSupply(chainId, "GDAI");
- const { symbol: faucetSymbol } = useTokenSymbol(chainId, "GDAI");
+ const { data: contractBalance, refetch: contractBalanceRefetch } = useBalance({ address: RESERVE_ADDRESSES[chainId] });
+ const { totalSupply: reserveTotalSupply, refetch: refetchReserveTotalSupply } = useTotalSupply(chainId, "RESERVE");
+ const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
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(daiConversionRate.toString(), 0);
+ const rate = new DecimalBigNumber(reserveConversionRate.toString(), 0);
const value = new DecimalBigNumber(amount, nativeInfo.decimals);
return value.mul(rate);
- }, [amount, daiConversionRate, nativeInfo]);
+ }, [amount, reserveConversionRate, nativeInfo]);
const contractBalanceFree = useMemo(() => {
const realContractBalance = contractBalance ? contractBalance.value : 0n;
@@ -129,7 +129,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
}
await balanceRefetch();
- await daiBalanceRefetch();
+ await reserveBalanceRefetch();
await contractBalanceRefetch();
await refetchReserveTotalSupply();
setAmount("");
@@ -159,7 +159,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
-
+
{
{!isSemiSmallScreen &&
Check on {scanInfo.name}
}
@@ -211,14 +211,14 @@ const Faucet = ({ chainId, address, config, connect }) => {
{!isMint && }
- info={`${formatCurrency(daiBalance.toString(), 4, faucetSymbol)}`}
+ tokenName={reserveSymbol}
+ token={}
+ info={`${formatCurrency(reserveBalance.toString(), 4, reserveSymbol)}`}
value={amount}
onChange={event => setAmount(event.currentTarget.value)}
inputProps={{ "data-testid": "fromInput" }}
endString={"Max"}
- endStringOnClick={() => setAmount(daiBalance.toString())}
+ endStringOnClick={() => setAmount(reserveBalance.toString())}
/>}
{
<>
{!isVerySmallScreen && {nativeInfo.symbol} multiplier:}
- {formatNumber(daiConversionRate, 2)}
+ {formatNumber(reserveConversionRate, 2)}
{!isVerySmallScreen && You will get:}
- {formatCurrency(estimatedAmountIn, 5, faucetSymbol)}
+ {formatCurrency(estimatedAmountIn, 5, reserveSymbol)}
- {!isVerySmallScreen && Your {faucetSymbol} balance:}
- {formatCurrency(daiBalance, 5, faucetSymbol)}
+ {!isVerySmallScreen && Your {reserveSymbol} balance:}
+ {formatCurrency(reserveBalance, 5, reserveSymbol)}
>
)}
@@ -267,7 +267,7 @@ const Faucet = ({ chainId, address, config, connect }) => {
preparedAmount?._value === 0n ||
isPending ||
(isMint && balance?.lt(preparedAmount)) ||
- (!isMint && daiBalance?.lt(preparedAmount))
+ (!isMint && reserveBalance?.lt(preparedAmount))
)
}
loading={isPending}
diff --git a/src/containers/Stake/components/FarmPools.jsx b/src/containers/Stake/components/FarmPools.jsx
index eba7cfd..d8b24bc 100644
--- a/src/containers/Stake/components/FarmPools.jsx
+++ b/src/containers/Stake/components/FarmPools.jsx
@@ -16,34 +16,33 @@ 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 {
- DAI_ADDRESSES,
- FTSO_ADDRESSES,
-} from "../../../constants/addresses";
+import { RESERVE_ADDRESSES, FTSO_ADDRESSES } from "../../../constants/addresses";
const FarmPools = ({ chainId }) => {
const isSmallScreen = useMediaQuery("(max-width: 775px)");
- const { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, "GDAI_FTSO");
- const daiFtsoUniValuation = useLpValuation(chainId, "GDAI_FTSO", daiFtsoUniTotalSupply._value);
+ const { totalSupply: reserveFtsoUniTotalSupply } = useTotalSupply(chainId, "RESERVE_FTSO");
+ const reserveFtsoUniValuation = useLpValuation(chainId, "RESERVE_FTSO", reserveFtsoUniTotalSupply._value);
- const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
+ const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
const pools = [
{
- icons: ["FTSO", "GDAI"],
- name: `${ftsoSymbol}-${daiSymbol}`,
+ icons: ["FTSO", isNetworkLegacy(chainId) ? "GDAI" : tokenNameConverter(chainId, reserveSymbol)],
+ name: `${ftsoSymbol}-${reserveSymbol}`,
dex: "Uniswap V2",
url: "/dex/uniswap",
- tvl: daiFtsoUniValuation,
+ tvl: reserveFtsoUniValuation,
params: createSearchParams({
pool: "true",
- from: `${DAI_ADDRESSES[chainId]}`,
+ from: `${RESERVE_ADDRESSES[chainId]}`,
to: `${FTSO_ADDRESSES[chainId]}`,
})
},
diff --git a/src/containers/TreasuryDashboard/components/TokenInfo.jsx b/src/containers/TreasuryDashboard/components/TokenInfo.jsx
index ab90c9d..1030890 100644
--- a/src/containers/TreasuryDashboard/components/TokenInfo.jsx
+++ b/src/containers/TreasuryDashboard/components/TokenInfo.jsx
@@ -1,5 +1,5 @@
import { Grid, Box, Typography, useTheme } from "@mui/material";
-import { useAccount } from "wagmi";
+import { useAccount, useConfig, useBalance as useBalanceNative } from "wagmi";
import { useNavigate, createSearchParams } from "react-router-dom";
import Token from "../../../components/Token/Token";
@@ -15,6 +15,7 @@ import {
useGhstPrice,
useDaiPrice,
} from "../../../hooks/prices";
+import { tokenNameConverter } from "../../../helpers/tokenConverter";
const TokenTab = ({ isMobileScreen, theme, tokenName, tokenUrl, tokenUrlParams, balance, price, description }) => {
const navigate = useNavigate();
@@ -75,20 +76,24 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
const theme = useTheme();
const { address } = useAccount();
+ const config = useConfig();
+ const nativeSymbol = config?.getClient()?.chain?.nativeCurrency?.symbol;
+
const ftsoPrice = useFtsoPrice(chainId);
const stnkPrice = useStnkPrice(chainId);
const ghstPrice = useGhstPrice(chainId);
- const daiPrice = useDaiPrice(chainId);
+ const reservePrice = useDaiPrice(chainId);
- const { symbol: daiSymbol } = useTokenSymbol(chainId, "GDAI");
+ const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
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: daiBalance, contractAddress: daiAddress } = useBalance(chainId, "GDAI", address);
+ const { balance: reserveBalance, contractAddress: reserveAddress } = useBalance(chainId, "RESERVE", address);
return (
@@ -97,7 +102,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
isMobileScreen={isMobileScreen}
tokenUrl="/dex/uniswap"
tokenUrlParams={createSearchParams({
- from: `${daiAddress}`,
+ from: `${reserveAddress}`,
to: `${ftsoAddress}`,
})}
theme={theme}
@@ -110,7 +115,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
isMobileScreen={isMobileScreen}
tokenUrl="/dex/uniswap"
tokenUrlParams={createSearchParams({
- from: `${daiAddress}`,
+ from: `${reserveAddress}`,
to: `${stnkAddress}`,
})}
theme={theme}
@@ -123,7 +128,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
isMobileScreen={isMobileScreen}
tokenUrl="/dex/uniswap"
tokenUrlParams={createSearchParams({
- from: `${daiAddress}`,
+ from: `${reserveAddress}`,
to: `${ghstAddress}`,
})}
theme={theme}
@@ -137,12 +142,29 @@ const TokenInfo = ({ chainId, isMobileScreen }) => {
tokenUrl={isNetworkLegacy(chainId) ? "/faucet" : "/wrapper"}
tokenUrlParams=""
theme={theme}
- 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.`}
+ 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.`
+ }
/>
+ {!isNetworkLegacy(chainId) && (
+
+
+
+ )}
)
}
diff --git a/src/containers/WethWrapper/WethWrapper.jsx b/src/containers/WethWrapper/WethWrapper.jsx
index 67d7873..c9b6cf6 100644
--- a/src/containers/WethWrapper/WethWrapper.jsx
+++ b/src/containers/WethWrapper/WethWrapper.jsx
@@ -11,7 +11,7 @@ import TokenStack from "../../components/TokenStack/TokenStack";
import { PrimaryButton } from "../../components/Button";
import { Tab, Tabs } from "../../components/Tabs/Tabs";
-import { DAI_ADDRESSES } from "../../constants/addresses";
+import { RESERVE_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: daiBalance, refetch: daiBalanceRefetch } = useTokenBalance(chainId, "GDAI", address);
+ const { balance: reserveBalance, refetch: reserveBalanceRefetch } = useTokenBalance(chainId, "RESERVE", address);
const { data: nativeBalance, refetch: balanceRefetch } = useBalance({ address });
- const { symbol: faucetSymbol } = useTokenSymbol(chainId, "GDAI");
+ const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
useEffect(() => {
ReactGA.send({ hitType: "pageview", page: "/wrapper" });
@@ -109,7 +109,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
}
await balanceRefetch();
- await daiBalanceRefetch();
+ await reserveBalanceRefetch();
setAmount("");
setIsPending(false);
}
@@ -137,7 +137,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
-
+
{
{!isSemiSmallScreen &&
Check on {scanInfo.name}
}
@@ -189,14 +189,14 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
{!isMint && }
- info={`${formatCurrency(daiBalance.toString(), 4, faucetSymbol)}`}
+ tokenName={reserveSymbol}
+ token={}
+ info={`${formatCurrency(reserveBalance.toString(), 4, reserveSymbol)}`}
value={amount}
onChange={event => setAmount(event.currentTarget.value)}
inputProps={{ "data-testid": "fromInput" }}
endString={"Max"}
- endStringOnClick={() => setAmount(daiBalance.toString())}
+ endStringOnClick={() => setAmount(reserveBalance.toString())}
/>}
{
<>
{!isVerySmallScreen && You will get:}
- {formatCurrency(estimatedAmountIn, 5, faucetSymbol)}
+ {formatCurrency(estimatedAmountIn, 5, reserveSymbol)}
- {!isVerySmallScreen && Your {faucetSymbol} balance:}
- {formatCurrency(daiBalance, 5, faucetSymbol)}
+ {!isVerySmallScreen && Your {reserveSymbol} balance:}
+ {formatCurrency(reserveBalance, 5, reserveSymbol)}
>
)}
@@ -237,7 +237,7 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
preparedAmount?._value === 0n ||
isPending ||
(isMint && balance?.lt(preparedAmount)) ||
- (!isMint && daiBalance?.lt(preparedAmount))
+ (!isMint && reserveBalance?.lt(preparedAmount))
)
}
loading={isPending}
diff --git a/src/helpers/tokenConverter.js b/src/helpers/tokenConverter.js
new file mode 100644
index 0000000..d01e4d5
--- /dev/null
+++ b/src/helpers/tokenConverter.js
@@ -0,0 +1,10 @@
+export const tokenNameConverter = (chainId, name) => {
+ if (name?.toUpperCase() === "WETH") {
+ switch (chainId) {
+ case 63:
+ name = "WETC"
+ break;
+ }
+ }
+ return name;
+}
diff --git a/src/hooks/helpers.js b/src/hooks/helpers.js
index 34a6b30..e38342a 100644
--- a/src/hooks/helpers.js
+++ b/src/hooks/helpers.js
@@ -1,5 +1,5 @@
import {
- DAI_ADDRESSES,
+ RESERVE_ADDRESSES,
FTSO_ADDRESSES,
STNK_ADDRESSES,
GHST_ADDRESSES,
@@ -24,6 +24,9 @@ export const getTokenAbi = (name) => {
case "GDAI":
abi = DaiAbi;
break;
+ case "RESERVE":
+ abi = DaiAbi;
+ break;
case "FTSO":
abi = FatsoAbi;
break;
@@ -59,6 +62,9 @@ export const getTokenDecimals = (name) => {
case "GDAI":
decimals = 18;
break;
+ case "RESERVE":
+ decimals = 18;
+ break;
case "FTSO":
decimals = 9;
break;
@@ -89,10 +95,13 @@ export const getTokenAddress = (chainId, name) => {
let address = name;
switch (name?.toUpperCase()) {
case "DAI":
- address = DAI_ADDRESSES[chainId];
+ address = RESERVE_ADDRESSES[chainId];
break;
case "GDAI":
- address = DAI_ADDRESSES[chainId];
+ address = RESERVE_ADDRESSES[chainId];
+ break;
+ case "RESERVE":
+ address = RESERVE_ADDRESSES[chainId];
break;
case "FTSO":
address = FTSO_ADDRESSES[chainId];
@@ -115,9 +124,15 @@ 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;
}
@@ -126,8 +141,8 @@ export const getTokenAddress = (chainId, name) => {
export const getTokenIcons = (chainId, address) => {
let icons = [""];
switch (address) {
- case DAI_ADDRESSES[chainId]:
- icons = ["GDAI"];
+ case RESERVE_ADDRESSES[chainId]:
+ icons = ["RESERVE"];
break;
case FTSO_ADDRESSES[chainId]:
icons = ["FTSO"];
@@ -139,7 +154,7 @@ export const getTokenIcons = (chainId, address) => {
icons = ["GHST"];
break;
case FTSO_DAI_LP_ADDRESSES[chainId]:
- icons = ["FTSO", "GDAI"];
+ icons = ["FTSO", "RESERVE"];
break;
}
return icons;
@@ -155,11 +170,14 @@ export const getBondNameDisplayName = (chainId, stringValue, tokenAddress) => {
export const getTokenPurchaseLink = (chainId, tokenAddress) => {
let purchaseUrl = "https://app.dao.ghostchain.io/#/dex/uniswap";
switch (tokenAddress) {
- case DAI_ADDRESSES[chainId]:
+ case RESERVE_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=${DAI_ADDRESSES[chainId]}&to=${FTSO_ADDRESSES[chainId]}`;
+ purchaseUrl += `?pool=true&from=${RESERVE_ADDRESSES[chainId]}&to=${FTSO_ADDRESSES[chainId]}`;
break;
}
return purchaseUrl;
diff --git a/src/hooks/prices/index.js b/src/hooks/prices/index.js
index a3d54a7..ff7955d 100644
--- a/src/hooks/prices/index.js
+++ b/src/hooks/prices/index.js
@@ -6,7 +6,7 @@ import { useUniswapV2PairReserves } from "../uniswapv2";
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
import {
FTSO_DAI_LP_ADDRESSES,
- DAI_ADDRESSES,
+ RESERVE_ADDRESSES,
FTSO_ADDRESSES,
CEX_TICKERS
} from "../../constants/addresses";
@@ -69,7 +69,7 @@ export const useDaiPrice = (chainId) => {
.then(response => {
if ('data' in response) {
const coinPrice = Number(response?.data?.amount ?? 0.0);
- const priceInWei = Math.floor(coinPrice * 1e18);
+ const priceInWei = Math.floor(coinPrice * 1e18 / 0.99);
setDaiPrice(new DecimalBigNumber(BigInt(priceInWei), 18));
} else if ('price' in response) {
const coinPrice = Number(response?.price ?? 0.0);
@@ -88,17 +88,10 @@ export const useDaiPrice = (chainId) => {
};
export const useFtsoPrice = (chainId) => {
- const { reserves, tokens, refetch } = useUniswapV2PairReserves(
- chainId,
- FTSO_DAI_LP_ADDRESSES[chainId],
- 9,
- 18,
- "FTSO",
- "GDAI",
- );
+ const { reserves, tokens, refetch } = useUniswapV2PairReserves(chainId, FTSO_DAI_LP_ADDRESSES[chainId]);
const reservePrice = useDaiPrice(chainId);
- const reserveAddress = DAI_ADDRESSES[chainId];
+ const reserveAddress = RESERVE_ADDRESSES[chainId];
const ftsoAddress = FTSO_ADDRESSES[chainId];
if (!reserveAddress || !ftsoAddress) {
return new DecimalBigNumber(0n, 9);
diff --git a/src/hooks/tokens/index.js b/src/hooks/tokens/index.js
index fbb8795..a43c0db 100644
--- a/src/hooks/tokens/index.js
+++ b/src/hooks/tokens/index.js
@@ -6,6 +6,7 @@ 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) => {
@@ -68,7 +69,9 @@ export const useTokenSymbol = (chainId, name) => {
chainId: chainId,
});
- const symbol = data ? data : "";
+ let symbol = data ? data : "";
+ symbol = tokenNameConverter(chainId, symbol);
+
return { symbol, refetch };
}
@@ -240,8 +243,8 @@ export const depositNative = async (chainId, account, value) => {
chainId: chainId,
value: value
});
-
const txHash = await writeContract(config, request);
+
await waitForTransactionReceipt(config, {
hash: txHash,
onReplaced: () => toast("WETH9 deposit transaction was replaced. Wait for inclusion please."),