diff --git a/package.json b/package.json index 352af5c..94280fd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.0.31", + "version": "0.0.32", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/TopBar/Wallet/Token.tsx b/src/components/TopBar/Wallet/Token.tsx index 514cd6c..0cd273e 100644 --- a/src/components/TopBar/Wallet/Token.tsx +++ b/src/components/TopBar/Wallet/Token.tsx @@ -20,6 +20,7 @@ import { PrimaryButton, SecondaryButton } from "../../Button"; import { useBalance } from "../../../hooks/tokens"; import { useDaiPrice, useFtsoPrice, useStnkPrice, useGhstPrice } from "../../../hooks/prices"; +import { useLpValuation } from "../../../hooks/treasury"; import { useAccount } from "wagmi"; const addTokenToWallet = async (token, userAddress) => { @@ -175,7 +176,7 @@ export const useWallet = (chainId, userAddress) => { const ftsoPrice = useFtsoPrice(chainId); const stnkPrice = useStnkPrice(chainId); const ghstPrice = useGhstPrice(chainId); - // TODO: add lp price + const lpDaiFtsoPrice = useLpValuation(chainId, "GDAI_FTSO", 1000000000000000000n); const tokens = { dai: { @@ -215,7 +216,7 @@ export const useWallet = (chainId, userAddress) => { symbol: "UNI-V2", address: lpDaiFtsoBalanceAddress, balance: lpDaiFtsoBalance, - price: ftsoPrice, + price: lpDaiFtsoPrice, icons: ["GDAI", "FTSO"], externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg", } diff --git a/src/containers/Stake/components/FarmPools.jsx b/src/containers/Stake/components/FarmPools.jsx index 70d7876..277426f 100644 --- a/src/containers/Stake/components/FarmPools.jsx +++ b/src/containers/Stake/components/FarmPools.jsx @@ -23,16 +23,13 @@ import { useTotalSupply } from "../../../hooks/tokens"; import { DAI_ADDRESSES, FTSO_ADDRESSES, - STNK_ADDRESSES, - GHST_ADDRESSES, - FTSO_DAI_LP_ADDRESSES, } from "../../../constants/addresses"; const FarmPools = ({ chainId }) => { const isSmallScreen = useMediaQuery("(max-width: 775px)"); - const { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, FTSO_DAI_LP_ADDRESSES[chainId]); - const daiFtsoUniValuation = useLpValuation(chainId, FTSO_DAI_LP_ADDRESSES[chainId], daiFtsoUniTotalSupply._value); + const { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, "GDAI_FTSO"); + const daiFtsoUniValuation = useLpValuation(chainId, "GDAI_FTSO", daiFtsoUniTotalSupply._value); const pools = [ { diff --git a/src/hooks/helpers.js b/src/hooks/helpers.js index d49c7b6..52231ec 100644 --- a/src/hooks/helpers.js +++ b/src/hooks/helpers.js @@ -65,7 +65,7 @@ export const getTokenAddress = (chainId, name) => { case "GHST": address = GHST_ADDRESSES[chainId]; break; - case "DAI_FTSO": + case "GDAI_FTSO": address = FTSO_DAI_LP_ADDRESSES[chainId]; break; } diff --git a/src/hooks/prices/index.js b/src/hooks/prices/index.js index 3d8d492..c99c1b5 100644 --- a/src/hooks/prices/index.js +++ b/src/hooks/prices/index.js @@ -2,7 +2,6 @@ import { useReadContract } from "wagmi"; import { useCurrentIndex } from "../staking"; import { useUniswapV2PairReserves } from "../uniswapv2"; -import { useLpValuation } from "../treasury"; import { DecimalBigNumber } from "../../helpers/DecimalBigNumber"; import { FTSO_DAI_LP_ADDRESSES, DAI_ADDRESSES } from "../../constants/addresses"; diff --git a/src/hooks/treasury/index.js b/src/hooks/treasury/index.js index 9747358..7315adb 100644 --- a/src/hooks/treasury/index.js +++ b/src/hooks/treasury/index.js @@ -4,6 +4,7 @@ import { DAO_TREASURY_ADDRESSES } from "../../constants/addresses"; import { abi as TreasuryAbi } from "../../abi/GhostTreasury.json"; import { DecimalBigNumber } from "../../helpers/DecimalBigNumber"; +import { getTokenAddress } from "../helpers"; export const useTotalReserves = (chainId) => { const { data: totalReservesRaw } = useReadContract({ @@ -21,13 +22,14 @@ export const useTotalReserves = (chainId) => { }; export const useLpValuation = (chainId, pairAddress, pairSupply) => { + const convertedPairAddress = getTokenAddress(chainId, pairAddress); const { data: valuationRaw } = useReadContract({ abi: TreasuryAbi, address: DAO_TREASURY_ADDRESSES[chainId], functionName: "tokenValue", scopeKey: `tokenValue-${pairAddress}-${pairSupply.toString()}-${chainId}`, args: [ - pairAddress, + convertedPairAddress, pairSupply, ], chainId,