-
Notifications
You must be signed in to change notification settings - Fork 38
/
genesis.go
41 lines (33 loc) · 944 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
35
36
37
38
39
40
41
package v2
import types "github.com/peggyjv/sommelier/v7/x/cork/types"
const DefaultParamspace = types.ModuleName
// DefaultGenesisState get raw genesis raw message for testing
func DefaultGenesisState() GenesisState {
return GenesisState{
Params: DefaultParams(),
CellarIds: CellarIDSet{},
InvalidationNonce: 0,
ScheduledCorks: []*ScheduledCork{},
CorkResults: []*CorkResult{},
}
}
// Validate performs a basic stateless validation of the genesis fields.
func (gs GenesisState) Validate() error {
if err := gs.Params.ValidateBasic(); err != nil {
return err
}
if err := gs.CellarIds.ValidateBasic(); err != nil {
return err
}
for _, scheduledCork := range gs.ScheduledCorks {
if err := scheduledCork.ValidateBasic(); err != nil {
return err
}
}
for _, corkResult := range gs.CorkResults {
if err := corkResult.ValidateBasic(); err != nil {
return err
}
}
return nil
}