-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
pool.go
39 lines (33 loc) · 1.07 KB
/
pool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// names used as root for pool module accounts:
//
// - NotBondedPool -> "not_bonded_tokens_pool"
//
// - BondedPool -> "bonded_tokens_pool"
const (
NotBondedPoolName = "not_bonded_tokens_pool"
BondedPoolName = "bonded_tokens_pool"
)
// Pool - tracking bonded and not-bonded token supply of the bond denomination
type Pool struct {
NotBondedTokens sdk.Int `json:"not_bonded_tokens" yaml:"not_bonded_tokens"` // tokens which are not bonded to a validator (unbonded or unbonding)
BondedTokens sdk.Int `json:"bonded_tokens" yaml:"bonded_tokens"` // tokens which are currently bonded to a validator
}
// NewPool creates a new Pool instance used for queries
func NewPool(notBonded, bonded sdk.Int) Pool {
return Pool{
NotBondedTokens: notBonded,
BondedTokens: bonded,
}
}
// String returns a human readable string representation of a pool.
func (p Pool) String() string {
return fmt.Sprintf(`Pool:
Not Bonded Tokens: %s
Bonded Tokens: %s`, p.NotBondedTokens,
p.BondedTokens)
}