diff --git a/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx b/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx index 6bba9e682..daf939573 100644 --- a/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx +++ b/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx @@ -17,6 +17,22 @@ import type { } from './__generated__/NetworkParametersQuery'; import orderBy from 'lodash/orderBy'; +const PERCENTAGE_PARAMS = [ + 'governance.proposal.asset.requiredMajority', + 'governance.proposal.asset.requiredParticipation', + 'governance.proposal.freeform.requiredMajority', + 'governance.proposal.freeform.requiredParticipation', + 'governance.proposal.market.requiredMajority', + 'governance.proposal.market.requiredParticipation', + 'governance.proposal.updateMarket.requiredMajority', + 'governance.proposal.updateMarket.requiredMajorityLP', + 'governance.proposal.updateMarket.requiredParticipation', + 'governance.proposal.updateMarket.requiredParticipationLP', + 'governance.proposal.updateNetParam.requiredMajority', + 'governance.proposal.updateNetParam.requiredParticipation', + 'validators.vote.required', +]; + const BIG_NUMBER_PARAMS = [ 'spam.protection.delegation.min.tokens', 'validators.delegation.minAmount', @@ -37,11 +53,13 @@ const BIG_NUMBER_PARAMS = [ 'governance.proposal.market.minVoterBalance', ]; -export const renderRow = ({ - key, - value, -}: NetworkParametersQuery_networkParameters) => { +export const NetworkParameterRow = ({ + row: { key, value }, +}: { + row: NetworkParametersQuery_networkParameters; +}) => { const isSyntaxRow = isJsonObject(value); + return ( - {(ascParams || []).map((row) => renderRow(row))} + {(ascParams || []).map((row) => ( + + ))} ); }} diff --git a/apps/token/src/routes/governance/components/vote-details/vote-progress.tsx b/apps/token/src/routes/governance/components/vote-details/vote-progress.tsx index bf6d4934d..88cb0c7d8 100644 --- a/apps/token/src/routes/governance/components/vote-details/vote-progress.tsx +++ b/apps/token/src/routes/governance/components/vote-details/vote-progress.tsx @@ -8,7 +8,7 @@ export const VoteProgress = ({ progress: BigNumber; }) => { return ( -
+
- requiredMajority ? new BigNumber(requiredMajority) : new BigNumber(100), + requiredMajority + ? new BigNumber(requiredMajority).times(100) + : new BigNumber(100), [requiredMajority] ); @@ -110,7 +112,7 @@ export const useVoteInformation = ({ }, new BigNumber(0) ); - return new BigNumber(addDecimal(new BigNumber(totalNoVotes), 18)); + return new BigNumber(addDecimal(totalNoVotes, 18)); }, [proposal.votes.no.votes]); const yesTokens = React.useMemo(() => { @@ -125,7 +127,7 @@ export const useVoteInformation = ({ }, new BigNumber(0) ); - return new BigNumber(addDecimal(new BigNumber(totalYesVotes), 18)); + return new BigNumber(addDecimal(totalYesVotes, 18)); }, [proposal.votes.yes.votes]); const totalTokensVoted = React.useMemo( @@ -152,8 +154,11 @@ export const useVoteInformation = ({ }, [requiredParticipation, totalTokensVoted, totalSupply]); const majorityMet = React.useMemo(() => { - return totalTokensVoted.isGreaterThanOrEqualTo(requiredMajority); - }, [requiredMajority, totalTokensVoted]); + return ( + yesPercentage.isGreaterThanOrEqualTo(requiredMajorityPercentage) || + noPercentage.isGreaterThanOrEqualTo(requiredMajorityPercentage) + ); + }, [yesPercentage, noPercentage, requiredMajorityPercentage]); const totalTokensPercentage = React.useMemo(() => { return totalTokensVoted.multipliedBy(100).dividedBy(totalSupply);