-
Notifications
You must be signed in to change notification settings - Fork 9
/
genesis.go
35 lines (28 loc) · 1.11 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
package types
import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
clienttypes "github.com/bianjieai/tibc-go/modules/tibc/core/02-client/types"
packettypes "github.com/bianjieai/tibc-go/modules/tibc/core/04-packet/types"
routingtypes "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing/types"
)
var _ codectypes.UnpackInterfacesMessage = GenesisState{}
// DefaultGenesisState returns the tibc module's default genesis state.
func DefaultGenesisState() *GenesisState {
return &GenesisState{
ClientGenesis: clienttypes.DefaultGenesisState(),
PacketGenesis: packettypes.DefaultGenesisState(),
RoutingGenesis: routingtypes.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
}
return gs.PacketGenesis.Validate()
}