Update gov module

This commit is contained in:
liangping
2021-12-22 16:55:58 +08:00
parent 4ea72891e5
commit 7d9618653c
5 changed files with 54 additions and 48 deletions
+5 -7
View File
@@ -1,5 +1,3 @@
import { percent } from '../utils'
export default class ProposalTally {
constructor() {
this.total = 0
@@ -17,11 +15,11 @@ export default class ProposalTally {
} else {
this.total = total
}
this.yes = percent(Number(element.yes) / this.total)
this.no = percent(Number(element.no) / this.total)
this.veto = percent(Number(element.no_with_veto) / this.total)
this.abstain = percent(Number(element.abstain) / this.total)
this.turnout = percent(subtotal / this.total)
this.yes = Number(element.yes) / this.total
this.no = Number(element.no) / this.total
this.veto = Number(element.no_with_veto) / this.total
this.abstain = Number(element.abstain) / this.total
this.turnout = subtotal / this.total
return this
}
+5 -5
View File
@@ -1,5 +1,4 @@
import compareVersions from 'compare-versions'
import { toDay, formatToken } from '../utils'
import ProposalTally from './proposal-tally'
export default class Proposal {
@@ -28,10 +27,11 @@ export default class Proposal {
this.title = element.content.value.title
this.description = element.content.value.description
this.tally = new ProposalTally().init(element.final_tally_result, total)
this.submit_time = toDay(element.submit_time, 'date')
this.voting_end_time = toDay(element.voting_end_time, 'date')
this.voting_start_time = toDay(element.voting_start_time, 'date')
this.total_deposit = formatToken(element.total_deposit[0])
this.submit_time = element.submit_time
this.voting_end_time = element.voting_end_time
this.voting_start_time = element.voting_start_time
// eslint-disable-next-line prefer-destructuring
this.total_deposit = element.total_deposit[0]
this.contents = element.content.value
return this
}
+1 -3
View File
@@ -1,5 +1,3 @@
import { percent } from '../utils'
export default class StakingPool {
constructor() {
this.element = null
@@ -19,6 +17,6 @@ export default class StakingPool {
}
bondedRatio() {
return percent((this.bondedToken * 100) / this.total())
return (this.bondedToken * 100) / this.total()
}
}