39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package types
|
|
|
|
import (
|
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
|
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/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()
|
|
}
|