diff --git a/package.json b/package.json
index 699b5d3..ed76c59 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
- "version": "0.6.3",
+ "version": "0.6.4",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/components/TopBar/Wallet/Token.tsx b/src/components/TopBar/Wallet/Token.tsx
index 774455a..7b5bd29 100644
--- a/src/components/TopBar/Wallet/Token.tsx
+++ b/src/components/TopBar/Wallet/Token.tsx
@@ -9,7 +9,7 @@ import {
useTheme,
} from "@mui/material";
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
-import { ChangeEvent, useState, useEffect } from "react";
+import { ChangeEvent, useState, useMemo, useEffect } from "react";
import { useNavigate, createSearchParams } from "react-router-dom";
import { useQuery } from "react-query";
import { formatCurrency, formatNumber } from "../../../helpers";
@@ -30,6 +30,8 @@ import {
useGhstPrice
} from "../../../hooks/prices";
import { useLpValuation } from "../../../hooks/treasury";
+import { useUniswapV2PairReserves } from "../../../hooks/uniswapv2";
+import { getTokenIcons } from "../../../hooks/helpers";
import { useAccount, useBalance as useNativeBalance, useConfig } from "wagmi";
const addTokenToWallet = async (token, userAddress) => {
@@ -71,6 +73,7 @@ export const Token = (props) => {
const {
isNative,
symbol,
+ faucetPath,
icons,
address,
price = 0,
@@ -86,8 +89,8 @@ export const Token = (props) => {
const navigate = useNavigate();
const useLink = (symbol, fromAddress, toAddress, isPool) => {
- if (symbol.toUpperCase() === "RESERVE") {
- navigate({ pathname: "/faucet" })
+ if (faucetPath) {
+ navigate({ pathname: faucetPath })
} else {
navigate({
pathname: "/dex/uniswap",
@@ -146,7 +149,7 @@ export const Token = (props) => {
onClick={() => useLink(symbol, reserveAddress, address, isPool)}
fullWidth
>
- Get on {symbol?.toUpperCase() === "RESERVE" ? "Faucet" : "Uniswap"}
+ Get {faucetPath ? "for Free" : "on DEX"}
@@ -189,6 +192,9 @@ export const useWallet = (chainId, userAddress) => {
refetch: lpReserveFtsoRefetch,
contractAddress: lpReserveFtsoBalanceAddress,
} = useBalance(chainId, "RESERVE_FTSO", userAddress);
+ const {
+ tokens: lpReserveFtsoTokens,
+ } = useUniswapV2PairReserves(chainId, "RESERVE_FTSO");
const nativePrice = useNativePrice(chainId);
const reservePrice = useReservePrice(chainId);
@@ -206,13 +212,29 @@ export const useWallet = (chainId, userAddress) => {
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
const { symbol: lpReserveFtsoSymbol } = useTokenSymbol(chainId, "RESERVE_FTSO");
+ const lpReserveFtsoTokenNames = useMemo(() => {
+ const token0 = getTokenIcons(chainId, lpReserveFtsoTokens?.token0 ?? []);
+ const token1 = getTokenIcons(chainId, lpReserveFtsoTokens?.token1 ?? []);
+
+ let tokenAddresses = [lpReserveFtsoTokens?.token1, lpReserveFtsoTokens?.token0];
+ let tokenNames = [...token1, ...token0];
+
+ if (token0?.at(0) === reserveSymbol) {
+ tokenAddresses = [lpReserveFtsoTokens?.token0, lpReserveFtsoTokens?.token1];
+ let tokenNames = [...token0, ...token1];
+ }
+
+ return { tokenAddresses, tokenNames }
+ }, [chainId, reserveSymbol, lpReserveFtsoTokens]);
+
const tokens = {
native: {
symbol: nativeSymbol,
icons: [nativeSymbol],
balance: nativeBalance,
price: nativePrice,
- refetch: nativeBalanceRefetch
+ refetch: nativeBalanceRefetch,
+ faucetPath: isNetworkLegacy(chainId) ? "/faucet" : "/wrapper",
},
reserve: {
symbol: reserveSymbol,
@@ -224,6 +246,7 @@ export const useWallet = (chainId, userAddress) => {
? "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,
+ faucetPath: isNetworkLegacy(chainId) ? "/faucet" : "/wrapper",
},
ftso: {
symbol: ftsoSymbol,
@@ -255,10 +278,10 @@ export const useWallet = (chainId, userAddress) => {
reserveFtso: {
isPool: true,
symbol: lpReserveFtsoSymbol,
- address: lpReserveFtsoBalanceAddress,
+ address: lpReserveFtsoTokenNames?.tokenAddresses.at(1) ?? "",
balance: lpReserveFtsoBalance,
price: lpReserveFtsoPrice,
- icons: ["FTSO", isNetworkLegacy(chainId) ? "GDAI" : tokenNameConverter(chainId, reserveSymbol)],
+ icons: lpReserveFtsoTokenNames?.tokenNames,
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
refetch: lpReserveFtsoRefetch,
}
diff --git a/src/hooks/helpers.js b/src/hooks/helpers.js
index baddf59..c365879 100644
--- a/src/hooks/helpers.js
+++ b/src/hooks/helpers.js
@@ -164,6 +164,8 @@ export const getTokenIcons = (chainId, address) => {
case FTSO_DAI_LP_ADDRESSES[chainId]:
icons = ["FTSO", "WETH"];
break;
+ default:
+ icons = [""]
}
return icons;
}
diff --git a/src/hooks/uniswapv2/UniswapV2Pair.js b/src/hooks/uniswapv2/UniswapV2Pair.js
index 0025846..6f87127 100644
--- a/src/hooks/uniswapv2/UniswapV2Pair.js
+++ b/src/hooks/uniswapv2/UniswapV2Pair.js
@@ -6,7 +6,9 @@ import { abi as Erc20Abi } from "../../abi/ERC20.json";
import { getTokenAddress } from "../helpers";
-export const useUniswapV2PairReserves = (chainId, contractAddress) => {
+export const useUniswapV2PairReserves = (chainId, rawContractAddress) => {
+ const contractAddress = getTokenAddress(chainId, rawContractAddress);
+
const { data: pairReserves, refetch: pairReservesRefetch } = useReadContract({
abi: UniswapV2Pair,
address: contractAddress,