use actual max bond discount on the dashboard
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
e90691620b
commit
73f9014ade
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.7.18",
|
||||
"version": "0.7.19",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -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.`}
|
||||
/>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user