-
Notifications
You must be signed in to change notification settings - Fork 572
/
genesis.go
39 lines (31 loc) · 1.18 KB
/
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
package types
import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
)
var _ codectypes.UnpackInterfacesMessage = GenesisState{}
// DefaultGenesisState returns the ibc module's default genesis state.
func DefaultGenesisState() *GenesisState {
return &GenesisState{
ClientGenesis: clienttypes.DefaultGenesisState(),
ConnectionGenesis: connectiontypes.DefaultGenesisState(),
ChannelGenesis: channeltypes.DefaultGenesisState(),
}
}
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (gs GenesisState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return gs.ClientGenesis.UnpackInterfaces(unpacker)
}
// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs *GenesisState) Validate() error {
if err := gs.ClientGenesis.Validate(); err != nil {
return err
}
if err := gs.ConnectionGenesis.Validate(); err != nil {
return err
}
return gs.ChannelGenesis.Validate()
}