use actual max bond discount on the dashboard

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-04-14 14:25:34 +03:00
parent e90691620b
commit 73f9014ade
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 13 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
"version": "0.7.18",
"version": "0.7.19",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -4,6 +4,7 @@ import { useConfig } from "wagmi";
import { useNavigate, createSearchParams } from "react-router-dom";
import { formatNumber } from "../../../helpers";
import { useLiveBonds } from "../../../hooks/bonds/index";
import { useEpoch, useGatekeeperApy } from "../../../hooks/staking";
import { useTokenSymbol, useBalance, useCirculatingSupply } from "../../../hooks/tokens";
import { SecondaryButton } from "../../../components/Button";
@ -66,11 +67,21 @@ const ProtocolDetails = ({ chainId, isMobileScreen, theme, }) => {
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
const { symbol: csprSymbol } = useTokenSymbol(chainId, "CSPR");
const { contractAddress: ftsoAddress } = useBalance(chainId, "FTSO", EMPTY_ADDRESS);
const { liveBonds } = useLiveBonds(chainId);
const circulatingSupply = useCirculatingSupply(chainId, "STNK");
const gatekeepedApy = useGatekeeperApy(chainId);
const { epoch } = useEpoch(chainId);
const maxBondDiscountTest = useMemo(() => {
if (liveBonds?.length === 0) return "Coming Up";
const maxDiscountBond = liveBonds.reduce((prev, current) =>
(prev.discount > current.discount) ? prev : current
);
const maxDiscount = maxDiscountBond.discount.mul(new DecimalBigNumber(100, 0));
return `Up to ${formatNumber(maxDiscount, 0)}% Discount`;
}, [liveBonds]);
const apyInner = useMemo(() => {
let apy = Infinity;
if (circulatingSupply._value > 0n) {
@ -108,7 +119,7 @@ const ProtocolDetails = ({ chainId, isMobileScreen, theme, }) => {
theme={theme}
url={`/${networkName.toLowerCase()}/bonds`}
name="(1, 1) Bond"
sideName="Up to 40% Discount"
sideName={maxBondDiscountTest}
description={`Bonding strategy grows Treasury and builds Protocol Owned Liquidity (POL) by allowing usersto acquire ${csprSymbol} at a discount. Take advantage of the next available bond.`}
/>