Skip to content

Commit

Permalink
DAO-721: fix: will count for, abstain vote only. (#251)
Browse files Browse the repository at this point in the history
fix: renamed votes column
  • Loading branch information
Freshenext authored Oct 7, 2024
1 parent 6cbeaa6 commit 24a658c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/proposals/LatestProposalsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const latestProposalsTransformer = (proposals: ReturnType<typeof getEventArgumen
)
return {
Proposal: withContext(<ProposalNameColumn />),
Votes: withContext(<VotesColumn />),
'Quorum Votes': withContext(<VotesColumn />),
Date: proposal.Starts.format('MM-DD-YYYY'),
'Time Remaining': withContext(<TimeRemainingColumn />),
Sentiment: withContext(<SentimentColumn key={`${proposal.proposalId}_${i}`} />),
Expand Down
5 changes: 4 additions & 1 deletion src/app/proposals/VotesColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { GovernorAbi } from '@/lib/abis/Governor'
import { GOVERNOR_ADDRESS } from '@/lib/constants'
import { formatBalanceToHuman } from '@/app/user/Balances/balanceUtils'

const sumVotes = (votes: string[]) => votes.reduce((prev, next) => Number(next) + prev, 0)

export const VotesColumn = () => {
const { proposalVotes, blockNumber } = useProposalContext()
const votes = proposalVotes.reduce((prev, next) => Number(next) + prev, 0)
const [, forVote, abstainVote] = proposalVotes
const votes = sumVotes([forVote, abstainVote])

const { data: quorumAtSnapshot } = useReadContract({
abi: GovernorAbi,
Expand Down

0 comments on commit 24a658c

Please sign in to comment.