-
Notifications
You must be signed in to change notification settings - Fork 0
/
genesis.go
30 lines (26 loc) · 1.23 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
package ibc
import (
sdk "github.com/brc20-collab/brczero/libs/cosmos-sdk/types"
client "github.com/brc20-collab/brczero/libs/ibc-go/modules/core/02-client"
connection "github.com/brc20-collab/brczero/libs/ibc-go/modules/core/03-connection"
channel "github.com/brc20-collab/brczero/libs/ibc-go/modules/core/04-channel"
"github.com/brc20-collab/brczero/libs/ibc-go/modules/core/keeper"
"github.com/brc20-collab/brczero/libs/ibc-go/modules/core/types"
)
// InitGenesis initializes the ibc state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, createLocalhost bool, gs *types.GenesisState) {
client.InitGenesis(ctx, k.ClientKeeper, gs.ClientGenesis)
connection.InitGenesis(ctx, k.ConnectionKeeper, gs.ConnectionGenesis)
channel.InitGenesis(ctx, k.ChannelKeeper, gs.ChannelGenesis)
k.SetParams(ctx, gs.Params)
}
// ExportGenesis returns the ibc exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
return &types.GenesisState{
ClientGenesis: client.ExportGenesis(ctx, k.ClientKeeper),
ConnectionGenesis: connection.ExportGenesis(ctx, k.ConnectionKeeper),
ChannelGenesis: channel.ExportGenesis(ctx, k.ChannelKeeper),
Params: k.GetParams(ctx),
}
}