pricing of LP as valuation through tokenValue on treasury
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
3b11ac0162
commit
c41ea74b60
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.31",
|
"version": "0.0.32",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@ -20,6 +20,7 @@ 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) => {
|
||||||
@ -175,7 +176,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);
|
||||||
// TODO: add lp price
|
const lpDaiFtsoPrice = useLpValuation(chainId, "GDAI_FTSO", 1000000000000000000n);
|
||||||
|
|
||||||
const tokens = {
|
const tokens = {
|
||||||
dai: {
|
dai: {
|
||||||
@ -215,7 +216,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
symbol: "UNI-V2",
|
symbol: "UNI-V2",
|
||||||
address: lpDaiFtsoBalanceAddress,
|
address: lpDaiFtsoBalanceAddress,
|
||||||
balance: lpDaiFtsoBalance,
|
balance: lpDaiFtsoBalance,
|
||||||
price: ftsoPrice,
|
price: lpDaiFtsoPrice,
|
||||||
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",
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,13 @@ 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, FTSO_DAI_LP_ADDRESSES[chainId]);
|
const { totalSupply: daiFtsoUniTotalSupply } = useTotalSupply(chainId, "GDAI_FTSO");
|
||||||
const daiFtsoUniValuation = useLpValuation(chainId, FTSO_DAI_LP_ADDRESSES[chainId], daiFtsoUniTotalSupply._value);
|
const daiFtsoUniValuation = useLpValuation(chainId, "GDAI_FTSO", daiFtsoUniTotalSupply._value);
|
||||||
|
|
||||||
const pools = [
|
const pools = [
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ export const getTokenAddress = (chainId, name) => {
|
|||||||
case "GHST":
|
case "GHST":
|
||||||
address = GHST_ADDRESSES[chainId];
|
address = GHST_ADDRESSES[chainId];
|
||||||
break;
|
break;
|
||||||
case "DAI_FTSO":
|
case "GDAI_FTSO":
|
||||||
address = FTSO_DAI_LP_ADDRESSES[chainId];
|
address = FTSO_DAI_LP_ADDRESSES[chainId];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ 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,6 +4,7 @@ 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({
|
||||||
@ -21,13 +22,14 @@ 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: [
|
||||||
pairAddress,
|
convertedPairAddress,
|
||||||
pairSupply,
|
pairSupply,
|
||||||
],
|
],
|
||||||
chainId,
|
chainId,
|
||||||
|
Loading…
Reference in New Issue
Block a user