forked from bandprotocol/bandchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pool.go
42 lines (35 loc) · 976 Bytes
/
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
40
41
42
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// MintPool
type MintPool struct {
TreasuryPool sdk.Coins `json:"treasury_pool" yaml:"treasury_pool"`
EligiblePool AddrPool `json:"eligible_accounts_pool" yaml:"eligible_accounts_pool"` // eligible to mint accounts
}
// InitialMintPool returns the initial state of MintPool
func InitialMintPool() MintPool {
return MintPool{
TreasuryPool: sdk.Coins{},
EligiblePool: AddrPool{},
}
}
// ValidateGenesis validates the mint pool for a genesis state
func (m MintPool) ValidateGenesis() error {
if m.TreasuryPool.IsAnyNegative() {
return fmt.Errorf("negative TreasuryPool in mint pool, is %v", m.TreasuryPool)
}
return nil
}
// AddrPool defines a pool of addresses
type AddrPool []sdk.AccAddress
// Contains checks id addr exists in the slice
func (p AddrPool) Contains(addr sdk.AccAddress) bool {
for _, item := range p {
if item.Equals(addr) {
return true
}
}
return false
}