forked from LaconicNetwork/cosmos-explorer
25 lines
499 B
JavaScript
25 lines
499 B
JavaScript
import { percent } from './data'
|
|
|
|
export default class StakingPool {
|
|
constructor() {
|
|
this.element = null
|
|
this.bondedToken = 0
|
|
this.notBondedToken = 0
|
|
}
|
|
|
|
init(element) {
|
|
this.element = element
|
|
this.bondedToken = Number(element.bonded_tokens)
|
|
this.notBondedToken = Number(element.not_bonded_tokens)
|
|
return this
|
|
}
|
|
|
|
total() {
|
|
return this.bondedToken + this.notBondedToken
|
|
}
|
|
|
|
bondedRatio() {
|
|
return percent((this.bondedToken * 100) / this.total())
|
|
}
|
|
}
|