diff --git a/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.spec.tsx b/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.spec.tsx index efa63fb27..f3a286c33 100644 --- a/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.spec.tsx +++ b/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.spec.tsx @@ -281,8 +281,8 @@ describe('VoteBreakdown', () => { }); it('Progress bar displays status - LP majority', () => { - const yesVotesLP = 800; - const noVotesLP = 200; + const yesVotesLP = 0.8; + const noVotesLP = 0.2; const expectedProgress = (yesVotesLP / (yesVotesLP + noVotesLP)) * 100; // 80% renderComponent( diff --git a/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.tsx b/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.tsx index 7e8ae8c9c..df82865c9 100644 --- a/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.tsx +++ b/apps/governance/src/routes/proposals/components/vote-breakdown/vote-breakdown.tsx @@ -105,8 +105,6 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => { yesLPPercentage, yesTokens, noTokens, - yesEquityLikeShareWeight, - noEquityLikeShareWeight, totalEquityLikeShareWeight, requiredMajorityPercentage, requiredMajorityLPPercentage, @@ -135,6 +133,7 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => { .multipliedBy(100), new BigNumber(100) ); + const willPass = willPassByTokenVote || willPassByLPVote; const updateMarketVotePassMethod = willPassByTokenVote ? t('byTokenVote') @@ -202,50 +201,24 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => {
{t('liquidityProviderVotesFor')}: {yesLPPercentage.toFixed(defaultDP)}% + } > - + - - ( - {yesLPPercentage.toFixed(defaultDP)}% - } - > - - - ) -
{t('liquidityProviderVotesAgainst')}: - - - - ( {noLPPercentage.toFixed(defaultDP)}% } > - + - )
@@ -282,13 +255,8 @@ export const VoteBreakdown = ({ proposal }: VoteBreakdownProps) => { defaultDP )} > - + {totalEquityLikeShareWeight.toFixed(1)}% - - ({totalEquityLikeShareWeight.toFixed(defaultDP)}%) - diff --git a/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts b/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts index d5253287b..117a79a67 100644 --- a/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts +++ b/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts @@ -54,8 +54,8 @@ describe('use-vote-information', () => { it('returns all required vote information', () => { const yesVotes = 40; const noVotes = 60; - const yesEquityLikeShareWeight = '30'; - const noEquityLikeShareWeight = '70'; + const yesEquityLikeShareWeight = '0.30'; + const noEquityLikeShareWeight = '0.70'; // Note - giving a fixedTokenValue of 1 means a ratio of 1:1 votes to tokens, making sums easier :) const fixedTokenValue = 1000000000000000000; @@ -195,10 +195,10 @@ describe('use-vote-information', () => { }); it('correctly shows whether an update market proposal will pass by token or LP vote - both failing', () => { - const yesVotes = 20; - const noVotes = 70; - const yesEquityLikeShareWeight = '30'; - const noEquityLikeShareWeight = '60'; + const yesVotes = 0.2; + const noVotes = 0.7; + const yesEquityLikeShareWeight = '0.30'; + const noEquityLikeShareWeight = '0.60'; const fixedTokenValue = 1000000000000000000; const proposal = generateProposal({ diff --git a/apps/governance/src/routes/proposals/hooks/use-vote-information.ts b/apps/governance/src/routes/proposals/hooks/use-vote-information.ts index 741e8f6c8..e66823b83 100644 --- a/apps/governance/src/routes/proposals/hooks/use-vote-information.ts +++ b/apps/governance/src/routes/proposals/hooks/use-vote-information.ts @@ -61,7 +61,7 @@ export const useVoteInformation = ({ const noEquityLikeShareWeight = !proposal?.votes.no .totalEquityLikeShareWeight ? new BigNumber(0) - : new BigNumber(proposal.votes.no.totalEquityLikeShareWeight); + : new BigNumber(proposal.votes.no.totalEquityLikeShareWeight).times(100); const yesTokens = new BigNumber( addDecimal(proposal?.votes.yes.totalTokens ?? 0, decimals) @@ -70,7 +70,7 @@ export const useVoteInformation = ({ const yesEquityLikeShareWeight = !proposal?.votes.yes .totalEquityLikeShareWeight ? new BigNumber(0) - : new BigNumber(proposal.votes.yes.totalEquityLikeShareWeight); + : new BigNumber(proposal.votes.yes.totalEquityLikeShareWeight).times(100); const totalTokensVoted = yesTokens.plus(noTokens); @@ -81,12 +81,7 @@ export const useVoteInformation = ({ const yesPercentage = totalTokensVoted.isZero() ? new BigNumber(0) : yesTokens.multipliedBy(100).dividedBy(totalTokensVoted); - - const yesLPPercentage = totalEquityLikeShareWeight.isZero() - ? new BigNumber(0) - : yesEquityLikeShareWeight - .multipliedBy(100) - .dividedBy(totalEquityLikeShareWeight); + const yesLPPercentage = yesEquityLikeShareWeight; const noPercentage = totalTokensVoted.isZero() ? new BigNumber(0) @@ -103,9 +98,7 @@ export const useVoteInformation = ({ ); const participationLPMet = requiredParticipationLP - ? totalEquityLikeShareWeight.isGreaterThan( - totalSupply.multipliedBy(requiredParticipationLP) - ) + ? totalEquityLikeShareWeight.isGreaterThan(requiredParticipationLP) : false; const majorityMet = yesPercentage.isGreaterThanOrEqualTo( @@ -120,9 +113,7 @@ export const useVoteInformation = ({ .multipliedBy(100) .dividedBy(totalSupply); - const totalLPTokensPercentage = totalEquityLikeShareWeight - .multipliedBy(100) - .dividedBy(totalSupply); + const totalLPTokensPercentage = totalEquityLikeShareWeight; const willPassByTokenVote = participationMet && diff --git a/apps/governance/src/routes/proposals/test-helpers/generate-proposals.ts b/apps/governance/src/routes/proposals/test-helpers/generate-proposals.ts index 83b0251f4..48fb0aae6 100644 --- a/apps/governance/src/routes/proposals/test-helpers/generate-proposals.ts +++ b/apps/governance/src/routes/proposals/test-helpers/generate-proposals.ts @@ -116,7 +116,8 @@ export const generateYesVotes = ( fixedTokenValue?: number, totalEquityLikeShareWeight?: string ): Votes => { - const votes = Array.from(Array(numberOfVotes)).map(() => { + const votes = []; + for (let i = 0; i < numberOfVotes; i++) { const vote: Vote = { __typename: 'Vote', value: Schema.VoteValue.VALUE_YES, @@ -152,8 +153,9 @@ export const generateYesVotes = ( datetime: faker.date.past().toISOString(), }; - return vote; - }); + votes.push(vote); + } + return { __typename: 'ProposalVoteSide', totalNumber: votes.length.toString(), @@ -172,7 +174,8 @@ export const generateNoVotes = ( fixedTokenValue?: number, totalEquityLikeShareWeight?: string ): Votes => { - const votes = Array.from(Array(numberOfVotes)).map(() => { + const votes = []; + for (let i = 0; i < numberOfVotes; i++) { const vote: Vote = { __typename: 'Vote', value: Schema.VoteValue.VALUE_NO, @@ -207,8 +210,9 @@ export const generateNoVotes = ( }, datetime: faker.date.past().toISOString(), }; - return vote; - }); + votes.push(vote); + } + return { __typename: 'ProposalVoteSide', totalNumber: votes.length.toString(), diff --git a/libs/i18n/src/locales/en/governance.json b/libs/i18n/src/locales/en/governance.json index 0f2485318..de010474b 100644 --- a/libs/i18n/src/locales/en/governance.json +++ b/libs/i18n/src/locales/en/governance.json @@ -298,8 +298,8 @@ "liquidityOnsenIntro": "Earn rewards for providing liquidity on the", "liquidityOnsenLinkText": "SushiSwap Onsen Menu", "liquidityProviderVote": "Liquidity provider vote", - "liquidityProviderVotesAgainst": "LP votes against", - "liquidityProviderVotesFor": "LP votes for", + "liquidityProviderVotesAgainst": "LP share against", + "liquidityProviderVotesFor": "LP share for", "liquidityRewardsTitle": "Active liquidity rewards", "liquidityRewardsTitlePrevious": "Previous liquidity rewards", "liquidityStakedBalance": "SLP token balance", @@ -759,7 +759,7 @@ "Total stake": "Total stake", "Total supply": "Total supply", "totalDistributed": "Total distributed", - "totalLiquidityProviderTokensVoted": "Total LP tokens voted", + "totalLiquidityProviderTokensVoted": "Total LP share voted", "totalPenalties": "Total penalties", "TotalPenaltiesDescription": "Total of penalties taking into account performance (considering proportion of blocks proposed against the number of blocks the validator was expected to propose) and any overstaking.", "totalStake": "Total stake",