diff --git a/package.json b/package.json index b46d2ea..00dcf51 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.5.21", + "version": "0.5.22", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/Progress/LinearProgressBar.jsx b/src/components/Progress/LinearProgressBar.jsx index 7b699b5..049a7de 100644 --- a/src/components/Progress/LinearProgressBar.jsx +++ b/src/components/Progress/LinearProgressBar.jsx @@ -25,7 +25,7 @@ const LinearProgressBar = (props) => { {props.target && } - tooltip={`The total amount of payout asset you will receive from this bond purchase`} + tooltip={`Total amount of ${ftsoSymbol} you will receive from this bond purchase`} /> {bond.baseToken.tokenAddress.toUpperCase() === bond.quoteToken.quoteTokenAddress.toUpperCase() @@ -195,14 +195,14 @@ const BondInputArea = ({ } - tooltip={`The bond discount is the percentage difference between ${ftsoSymbol} market value and the bond's price`} - /> + tooltip={`The discount (or premium) between ${ftsoSymbol} market price and bond price. Higher discount = better deal for bond buyers.`} + /> } - tooltip={"The duration of the Bond whereby the bond can be claimed in its entirety"} - /> + tooltip={"Time until bond fully vests and becomes claimable. Vesting period aligns bond buyer with the protocol by encouraging longer-term holding."} + /> {recipientAddress !== address && ( diff --git a/src/containers/Governance/ProposalDetails.jsx b/src/containers/Governance/ProposalDetails.jsx index 662ece5..4907bca 100644 --- a/src/containers/Governance/ProposalDetails.jsx +++ b/src/containers/Governance/ProposalDetails.jsx @@ -112,47 +112,42 @@ const ProposalDetails = ({ chainId, address, connect, config }) => { const votePercentage = useMemo(() => { if (totalSupply._value === 0n) return 0; - const value = (totalVotes?._value ?? 0n) * 100n / (totalSupply?._value ?? 1n); - return new DecimalBigNumber(value, 0); + return totalVotes * HUNDRED / totalSupply; }, [totalVotes, totalSupply]); const forPercentage = useMemo(() => { if (totalSupply._value === 0n) return new DecimalBigNumber(0n, 2); - const value = (forVotes?._value ?? 0n) * 10000n / (totalSupply?._value ?? 1n); - return new DecimalBigNumber(value, 2); + return forVotes * HUNDRED / totalSupply; }, [forVotes, totalSupply]); const againstPercentage= useMemo(() => { if (totalSupply._value === 0n) return new DecimalBigNumber(0n, 2); - const value = (againstVotes?._value ?? 0n) * 10000n / (totalSupply?._value ?? 1n); - return new DecimalBigNumber(value, 2); + return againstVotes * HUNDRED / totalSupply; }, [againstVotes, totalSupply]); const voteWeightPercentage = useMemo(() => { if (totalSupply._value === 0n) return new DecimalBigNumber(0n, 2); - const value = (pastVotes?._value ?? 0n) * 10000n / (totalSupply?._value ?? 1n); - return new DecimalBigNumber(value, 2); + return pastVotes * HUNDRED / totalSupply; }, [pastVotes, totalSupply]); const voteValue = useMemo(() => { if (totalVotes?._value == 0n) { return 0; } - return Number(forVotes._value * 100n / totalVotes._value); + const value = forVotes * HUNDRED / totalVotes; + return Math.floor(Number(value.toString())); }, [forVotes, totalVotes]); const voteTarget = useMemo(() => { - const first = (5n * againstVotes._value + forVotes._value); - const second = BigInt(Math.floor(Math.sqrt(Number(totalVotes._value)))); - const bias = 3n * first + second; - const denominator = totalVotes._value + bias; - - if (denominator === 0n) { + if (totalSupply._value == 0n) { return 80; } - return Number(totalVotes?._value * 100n / denominator); - }, [againstVotes, forVotes, totalVotes]); + const value = Number(totalVotes / totalSupply); + const result = (5 - Math.sqrt(1 + 80/9 * (value - 0.1) )) / 4 + + return Math.floor(result * 100); + }, [totalVotes, totalSupply]); const nativeCurrency = useMemo(() => { const client = config?.getClient(); diff --git a/src/containers/Governance/components/ProposalsList.jsx b/src/containers/Governance/components/ProposalsList.jsx index e8534e6..f8feb9a 100644 --- a/src/containers/Governance/components/ProposalsList.jsx +++ b/src/containers/Governance/components/ProposalsList.jsx @@ -23,6 +23,7 @@ import ArrowUpIcon from "../../../assets/icons/arrow-up.svg?react"; import { networkAvgBlockSpeed } from "../../../constants"; import { prettifySecondsInDays, prettifySeconds } from "../../../helpers/timeUtil"; +import { DecimalBigNumber } from "../../../helpers/DecimalBigNumber"; import Chip from "../../../components/Chip/Chip"; import Modal from "../../../components/Modal/Modal"; @@ -40,9 +41,7 @@ import { import { useScreenSize } from "../../../hooks/useScreenSize"; -import { - useProposals, -} from "../../../hooks/governance"; +import { useProposals } from "../../../hooks/governance"; const MAX_PROPOSALS_TO_SHOW = 10; @@ -188,30 +187,38 @@ const ProposalRow = ({ proposal, blockNumber, openProposal, chainId }) => { const theme = useTheme(); const voteValue = useMemo(() => { - const againstVotes = proposal?.votes?.at(0)?._value ?? 0n; + const againstVotes = proposal?.votes?.at(0)?._value ?? 0n const forVotes = proposal?.votes?.at(1)?._value ?? 0n; const totalVotes = againstVotes + forVotes; - if (totalVotes == 0) { + + if (totalVotes == 0n) { return 0; } - return Number(forVotes * 100n / totalVotes); + const value = forVotes * 100n / totalVotes; + return Math.floor(Number(value.toString())); }, [proposal]); const voteTarget = useMemo(() => { const againstVotes = proposal?.votes?.at(0)?._value ?? 0n; const forVotes = proposal?.votes?.at(1)?._value ?? 0n; - const totalVotes = againstVotes + forVotes; - const first = (5n * againstVotes + forVotes); - const second = BigInt(Math.floor(Math.sqrt(Number(totalVotes)))); - const bias = 3n * first + second; - const denominator = totalVotes + bias; + const totalSupply = new DecimalBigNumber( + proposal?.pastTotalSupply?._value ?? 0n, + proposal?.pastTotalSupply?._decimals + ); + const totalVotes = new DecimalBigNumber( + againstVotes + forVotes, + proposal?.pastTotalSupply?._decimals + ); - if (denominator === 0n) { + if (totalSupply._value == 0n) { return 80; } - return Number(totalVotes * 100n / denominator); + const value = Number(totalVotes / totalSupply); + const result = (5 - Math.sqrt(1 + 80/9 * (value - 0.1) )) / 4; + + return Math.floor(result * 100); }, [proposal]); return ( diff --git a/src/containers/Governance/components/functions/CreateBond.jsx b/src/containers/Governance/components/functions/CreateBond.jsx index 047a30e..ad1e363 100644 --- a/src/containers/Governance/components/functions/CreateBond.jsx +++ b/src/containers/Governance/components/functions/CreateBond.jsx @@ -118,7 +118,7 @@ export const CreateBondSteps = ({ nativeCurrency, ftsoSymbol, chainId, toInitial }, [step, tokenAddress, capacity, initialPrice, debtBuffer, depositInterval, tuneInterval]); const possibleTokens = [ - { value: FTSO_DAI_LP_ADDRESSES[chainId], symbol: `${ftsoSymbol}-${nativeCurrency} LP`, label: `${ftsoSymbol}-${nativeCurrency} LP: ${shorten(FTSO_DAI_LP_ADDRESSES[chainId])}` }, + { value: FTSO_DAI_LP_ADDRESSES[chainId], symbol: `${ftsoSymbol}-${reserveSymbol} LP`, label: `${ftsoSymbol}-${reserveSymbol} LP: ${shorten(FTSO_DAI_LP_ADDRESSES[chainId])}` }, { value: RESERVE_ADDRESSES[chainId], symbol: reserveSymbol, label: `${reserveSymbol}: ${shorten(RESERVE_ADDRESSES[chainId])}` }, ]; diff --git a/src/containers/Stake/components/Metric.jsx b/src/containers/Stake/components/Metric.jsx index e05e5a9..b30cc62 100644 --- a/src/containers/Stake/components/Metric.jsx +++ b/src/containers/Stake/components/Metric.jsx @@ -52,7 +52,7 @@ export const TotalDeposit = props => { const _props = { ...props, label: "Total Deposit", - tooltip: `The total stablecoin reserves in the ghostDAO treasury backing the entire circulating supply of ${props.stnkSymbol}.`, + tooltip: `The total native coin reserves in the ghostDAO treasury backing the entire circulating supply of ${props.stnkSymbol}.`, }; if (deposit) _props.metric = `${formatCurrency(deposit, 2)}`; diff --git a/src/containers/TreasuryDashboard/components/Metric.jsx b/src/containers/TreasuryDashboard/components/Metric.jsx index e0a0c1e..20252c2 100644 --- a/src/containers/TreasuryDashboard/components/Metric.jsx +++ b/src/containers/TreasuryDashboard/components/Metric.jsx @@ -84,7 +84,7 @@ export const FatsoBacking = props => { const _props = { ...props, label: `Backing per ${props.ftsoSymbol}`, - tooltip: `The total amount of stablecoins held by the ghostDAO treasury to support the value of each ${props.ftsoSymbol} in circulation.` + tooltip: `The total amount of native coins held by the ghostDAO treasury to support the value of each ${props.ftsoSymbol} in circulation.` }; if (backing) _props.metric = formatCurrency(backing, 2); diff --git a/src/containers/TreasuryDashboard/components/TokenInfo.jsx b/src/containers/TreasuryDashboard/components/TokenInfo.jsx index 32b0203..c8fd4af 100644 --- a/src/containers/TreasuryDashboard/components/TokenInfo.jsx +++ b/src/containers/TreasuryDashboard/components/TokenInfo.jsx @@ -138,7 +138,7 @@ const TokenInfo = ({ chainId, isMobileScreen }) => { tokenName={ghstSymbol} balance={ghstBalance} price={ghstPrice} - description={`${ghstSymbol} enables ghostDAO to have on-chain governance and to be truly cross-chain. ${ghstSymbol} Price = ${ftsoSymbol} Price x Current Index.`} + description={`${ghstSymbol} is the governance token enabling pure Web3 cross-chain magic. 1 ${ghstSymbol} = 1 ${ftsoSymbol} x Current Index.`} /> { proposer: proposalProposer?.at(index)?.result, details: proposalsDetailsAt?.at(index)?.result, deadline: proposalDeadlines?.at(index)?.result ?? 0n, + snapshot: proposalSnapshots?.at(index)?.result ?? 0n, state: proposalStates?.at(index)?.result ?? 0, pastTotalSupply: new DecimalBigNumber(pastTotalSupplies?.at(index)?.result ?? 0n, decimals), quorum: new DecimalBigNumber(proposalQuorums?.at(index)?.result ?? 0n, decimals), - snapshot: new DecimalBigNumber(proposalSnapshots?.at(index)?.result ?? 0n, decimals), votes: proposalVotes?.at(index)?.result?.map( vote => new DecimalBigNumber(vote ?? 0n, decimals), ),