classic-ui/components/governance/mixins/quorum.js
FreezyEx b32527e057 Revert "minor fixes"
This reverts commit 7f8f7c2aa15c8b8c6a7449d177f46f8a417e2f67.
2022-10-13 16:03:54 +02:00

31 lines
791 B
JavaScript

import { mapGetters } from 'vuex'
const { toBN, fromWei, toWei } = require('web3-utils')
export default {
computed: {
...mapGetters('governance/gov', ['quorumVotes']),
results() {
const resultFor = toBN(toWei(this.data.results.for))
const resultAgainst = toBN(toWei(this.data.results.against))
return resultFor.add(resultAgainst)
},
quorumResult() {
return fromWei(this.results)
},
quorumVotesToWei() {
return toBN(toWei(this.quorumVotes))
},
isQuorumCompleted() {
return this.results.gte(this.quorumVotesToWei)
},
quorumPercent() {
return this.isQuorumCompleted
? 100
: toBN('100')
.mul(this.results)
.div(this.quorumVotesToWei)
.toNumber()
}
}
}