Compare commits
No commits in common. "c41ea74b60bdcf3df0efdd72356ea80d2084474e" and "42ebad8697501de9ee2767e06f15b5ee6fc61cc1" have entirely different histories.
c41ea74b60
...
42ebad8697
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.32",
|
"version": "0.0.30",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -20,7 +20,6 @@ import { PrimaryButton, SecondaryButton } from "../../Button";
|
|||||||
|
|
||||||
import { useBalance } from "../../../hooks/tokens";
|
import { useBalance } from "../../../hooks/tokens";
|
||||||
import { useDaiPrice, useFtsoPrice, useStnkPrice, useGhstPrice } from "../../../hooks/prices";
|
import { useDaiPrice, useFtsoPrice, useStnkPrice, useGhstPrice } from "../../../hooks/prices";
|
||||||
import { useLpValuation } from "../../../hooks/treasury";
|
|
||||||
import { useAccount } from "wagmi";
|
import { useAccount } from "wagmi";
|
||||||
|
|
||||||
const addTokenToWallet = async (token, userAddress) => {
|
const addTokenToWallet = async (token, userAddress) => {
|
||||||
@ -176,7 +175,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
const ftsoPrice = useFtsoPrice(chainId);
|
const ftsoPrice = useFtsoPrice(chainId);
|
||||||
const stnkPrice = useStnkPrice(chainId);
|
const stnkPrice = useStnkPrice(chainId);
|
||||||
const ghstPrice = useGhstPrice(chainId);
|
const ghstPrice = useGhstPrice(chainId);
|
||||||
const lpDaiFtsoPrice = useLpValuation(chainId, "GDAI_FTSO", 1000000000000000000n);
|
// TODO: add lp price
|
||||||
|
|
||||||
const tokens = {
|
const tokens = {
|
||||||
dai: {
|
dai: {
|
||||||
@ -216,7 +215,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
symbol: "UNI-V2",
|
symbol: "UNI-V2",
|
||||||
address: lpDaiFtsoBalanceAddress,
|
address: lpDaiFtsoBalanceAddress,
|
||||||
balance: lpDaiFtsoBalance,
|
balance: lpDaiFtsoBalance,
|
||||||
price: lpDaiFtsoPrice,
|
price: ftsoPrice,
|
||||||
icons: ["GDAI", "FTSO"],
|
icons: ["GDAI", "FTSO"],
|
||||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
|
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,6 @@ export const GHOST_GOVERNANCE_ADDRESSES = {
|
|||||||
[NetworkId.TESTNET_SEPOLIA]: "0xD40E6442Ee01c234CD8AaF335122CfbB2aec8548",
|
[NetworkId.TESTNET_SEPOLIA]: "0xD40E6442Ee01c234CD8AaF335122CfbB2aec8548",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BONDING_CALCULATOR_ADDRESSES = {
|
|
||||||
[NetworkId.TESTNET_SEPOLIA]: "0x29a6bb5De7a1049632E107544CaEF05e518451e7",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const UNISWAP_V2_ROUTER = {
|
export const UNISWAP_V2_ROUTER = {
|
||||||
[NetworkId.TESTNET_SEPOLIA]: "0xee567fe1712faf6149d80da1e6934e354124cfe3",
|
[NetworkId.TESTNET_SEPOLIA]: "0xee567fe1712faf6149d80da1e6934e354124cfe3",
|
||||||
};
|
};
|
||||||
|
@ -23,13 +23,16 @@ import { useTotalSupply } from "../../../hooks/tokens";
|
|||||||
import {
|
import {
|
||||||
DAI_ADDRESSES,
|
DAI_ADDRESSES,
|
||||||
FTSO_ADDRESSES,
|
FTSO_ADDRESSES,
|
||||||
|
STNK_ADDRESSES,
|
||||||
|
GHST_ADDRESSES,
|
||||||
|
FTSO_DAI_LP_ADDRESSES,
|
||||||
} from "../../../constants/addresses";
|
} from "../../../constants/addresses";
|
||||||
|
|
||||||
const FarmPools = ({ chainId }) => {
|
const FarmPools = ({ chainId }) => {
|
||||||
const isSmallScreen = useMediaQuery("(max-width: 775px)");
|
const isSmallScreen = useMediaQuery("(max-width: 775px)");
|
||||||
|
|
||||||
const { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, "GDAI_FTSO");
|
const { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, FTSO_DAI_LP_ADDRESSES[chainId]);
|
||||||
const daiFtsoUniValuation = useLpValuation(chainId, "GDAI_FTSO", daiFtsoUniTotalSupply._value);
|
const daiFtsoUniValuation = useLpValuation(chainId, FTSO_DAI_LP_ADDRESSES[chainId], daiFtsoUniTotalSupply._value);
|
||||||
|
|
||||||
const pools = [
|
const pools = [
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,9 @@ import toast from "react-hot-toast";
|
|||||||
|
|
||||||
import { config } from "../../config";
|
import { config } from "../../config";
|
||||||
|
|
||||||
import {
|
import { BOND_DEPOSITORY_ADDRESSES, DAO_TREASURY_ADDRESSES } from "../../constants/addresses";
|
||||||
BOND_DEPOSITORY_ADDRESSES,
|
|
||||||
DAO_TREASURY_ADDRESSES,
|
|
||||||
BONDING_CALCULATOR_ADDRESSES,
|
|
||||||
} from "../../constants/addresses";
|
|
||||||
import { abi as BondAbi } from "../../abi/GhostBondDepository.json";
|
import { abi as BondAbi } from "../../abi/GhostBondDepository.json";
|
||||||
import { abi as TreasuryAbi } from "../../abi/GhostTreasury.json";
|
import { abi as TreasuryAbi } from "../../abi/GhostTreasury.json";
|
||||||
import { abi as BondingCalculatorAbi } from "../../abi/GhostBondingCalculator.json";
|
|
||||||
|
|
||||||
import { useFtsoPrice } from "../prices";
|
import { useFtsoPrice } from "../prices";
|
||||||
import { getTokenAddress, getTokenIcons, getTokenName, getBondNameDisplayName, getTokenPurchaseLink } from "../helpers";
|
import { getTokenAddress, getTokenIcons, getTokenName, getBondNameDisplayName, getTokenPurchaseLink } from "../helpers";
|
||||||
@ -90,20 +85,6 @@ export const useLiveBonds = (chainId) => {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: markdowns } = useReadContracts({
|
|
||||||
contracts: markets?.map((_, index) => {
|
|
||||||
const quoteTokenAddress = markets?.at(index).result?.at(1) ? markets.at(index).result.at(1) : "";
|
|
||||||
return {
|
|
||||||
abi: BondingCalculatorAbi,
|
|
||||||
address: BONDING_CALCULATOR_ADDRESSES[chainId],
|
|
||||||
functionName: "markdown",
|
|
||||||
args: [quoteTokenAddress],
|
|
||||||
scopeKey: `markdown-${quoteTokenAddress}-${chainId}`,
|
|
||||||
chainId: chainId,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
const liveBonds = liveIndexesRaw ? liveIndexesRaw.map((bondIndex, index) => {
|
const liveBonds = liveIndexesRaw ? liveIndexesRaw.map((bondIndex, index) => {
|
||||||
const id = Number(bondIndex);
|
const id = Number(bondIndex);
|
||||||
|
|
||||||
@ -116,12 +97,9 @@ export const useLiveBonds = (chainId) => {
|
|||||||
const quoteTokenPerUsd = quotePrices?.at(index).result
|
const quoteTokenPerUsd = quotePrices?.at(index).result
|
||||||
? new DecimalBigNumber(quotePrices.at(index).result * (10n ** 9n), quoteTokenDecimals)
|
? new DecimalBigNumber(quotePrices.at(index).result * (10n ** 9n), quoteTokenDecimals)
|
||||||
: new DecimalBigNumber(0n, quoteTokenDecimals);
|
: new DecimalBigNumber(0n, quoteTokenDecimals);
|
||||||
const markdown = markdowns?.at(index).result
|
|
||||||
? new DecimalBigNumber(markdowns.at(index).result, quoteTokenDecimals)
|
|
||||||
: new DecimalBigNumber(1n, 0);
|
|
||||||
|
|
||||||
const quoteTokenPerBaseToken = new DecimalBigNumber(marketPrice, 9);
|
const quoteTokenPerBaseToken = new DecimalBigNumber(marketPrice, 9);
|
||||||
const priceInUsd = quoteTokenPerUsd.mul(quoteTokenPerBaseToken).mul(markdown);
|
const priceInUsd = quoteTokenPerUsd.mul(quoteTokenPerBaseToken);
|
||||||
const discount = baseTokenPerUsd._value > 0n
|
const discount = baseTokenPerUsd._value > 0n
|
||||||
? baseTokenPerUsd.sub(priceInUsd).div(baseTokenPerUsd)
|
? baseTokenPerUsd.sub(priceInUsd).div(baseTokenPerUsd)
|
||||||
: new DecimalBigNumber("0", baseTokenPerUsd._decimals);
|
: new DecimalBigNumber("0", baseTokenPerUsd._decimals);
|
||||||
|
@ -65,7 +65,7 @@ export const getTokenAddress = (chainId, name) => {
|
|||||||
case "GHST":
|
case "GHST":
|
||||||
address = GHST_ADDRESSES[chainId];
|
address = GHST_ADDRESSES[chainId];
|
||||||
break;
|
break;
|
||||||
case "GDAI_FTSO":
|
case "DAI_FTSO":
|
||||||
address = FTSO_DAI_LP_ADDRESSES[chainId];
|
address = FTSO_DAI_LP_ADDRESSES[chainId];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { useReadContract } from "wagmi";
|
|||||||
|
|
||||||
import { useCurrentIndex } from "../staking";
|
import { useCurrentIndex } from "../staking";
|
||||||
import { useUniswapV2PairReserves } from "../uniswapv2";
|
import { useUniswapV2PairReserves } from "../uniswapv2";
|
||||||
|
import { useLpValuation } from "../treasury";
|
||||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||||
import { FTSO_DAI_LP_ADDRESSES, DAI_ADDRESSES } from "../../constants/addresses";
|
import { FTSO_DAI_LP_ADDRESSES, DAI_ADDRESSES } from "../../constants/addresses";
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import { DAO_TREASURY_ADDRESSES } from "../../constants/addresses";
|
|||||||
import { abi as TreasuryAbi } from "../../abi/GhostTreasury.json";
|
import { abi as TreasuryAbi } from "../../abi/GhostTreasury.json";
|
||||||
|
|
||||||
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
||||||
import { getTokenAddress } from "../helpers";
|
|
||||||
|
|
||||||
export const useTotalReserves = (chainId) => {
|
export const useTotalReserves = (chainId) => {
|
||||||
const { data: totalReservesRaw } = useReadContract({
|
const { data: totalReservesRaw } = useReadContract({
|
||||||
@ -22,14 +21,13 @@ export const useTotalReserves = (chainId) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useLpValuation = (chainId, pairAddress, pairSupply) => {
|
export const useLpValuation = (chainId, pairAddress, pairSupply) => {
|
||||||
const convertedPairAddress = getTokenAddress(chainId, pairAddress);
|
|
||||||
const { data: valuationRaw } = useReadContract({
|
const { data: valuationRaw } = useReadContract({
|
||||||
abi: TreasuryAbi,
|
abi: TreasuryAbi,
|
||||||
address: DAO_TREASURY_ADDRESSES[chainId],
|
address: DAO_TREASURY_ADDRESSES[chainId],
|
||||||
functionName: "tokenValue",
|
functionName: "tokenValue",
|
||||||
scopeKey: `tokenValue-${pairAddress}-${pairSupply.toString()}-${chainId}`,
|
scopeKey: `tokenValue-${pairAddress}-${pairSupply.toString()}-${chainId}`,
|
||||||
args: [
|
args: [
|
||||||
convertedPairAddress,
|
pairAddress,
|
||||||
pairSupply,
|
pairSupply,
|
||||||
],
|
],
|
||||||
chainId,
|
chainId,
|
||||||
|
Loading…
Reference in New Issue
Block a user