-
Notifications
You must be signed in to change notification settings - Fork 55
/
genesis.go
34 lines (30 loc) 路 856 Bytes
/
genesis.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
package types
import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
// NewGenesisState returns new GenesisState instance.
func NewGenesisState(params Params, liquidValidators []LiquidValidator) *GenesisState {
return &GenesisState{
Params: params,
LiquidValidators: liquidValidators,
}
}
// DefaultGenesisState returns the default genesis state.
func DefaultGenesisState() *GenesisState {
return NewGenesisState(
DefaultParams(),
[]LiquidValidator{},
)
}
// ValidateGenesis validates GenesisState.
func ValidateGenesis(data GenesisState) error {
if err := data.Params.Validate(); err != nil {
return err
}
for _, lv := range data.LiquidValidators {
if err := lv.Validate(); err != nil {
return sdkerrors.Wrapf(
sdkerrors.ErrInvalidAddress,
"invalid liquid validator %s: %v", lv, err)
}
}
return nil
}