Skip to content

Commit

Permalink
voting turnout fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiolalombardim committed May 25, 2023
1 parent d8ec784 commit ce3401a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/services/lite/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,20 @@ export const calculateProposalTotal = (choices: Choice[], decimals: any) => {
return result
}

export const getTotalVoters = (choices: Choice[]) => {
let votersTotal = 0
choices.map((choice: Choice) => {
votersTotal += choice.walletAddresses.length
const getUsers = (options: Choice[]) => {
const addresses: string[] = []

options.map(option => {
return option.walletAddresses.map(wallet => addresses.push(wallet.address))
})
return votersTotal

return new Set(addresses)
}

export const getTotalVoters = (choices: Choice[]) => {
const totalVoters = getUsers(choices)

return totalVoters.size
}

export const getTreasuryPercentage = (proposalTotal: BigNumber, totalSupply: number, decimals: any) => {
Expand Down

0 comments on commit ce3401a

Please sign in to comment.