Some checks failed
CodeQL / Analyze (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Has been cancelled
34 lines
1.3 KiB
Go
34 lines
1.3 KiB
Go
package connection
|
|
|
|
import (
|
|
sdk "git.cw.tr/mukan-network/mukan-sdk/types"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ibc/modules/core/03-connection/keeper"
|
|
"git.cw.tr/mukan-network/mukan-ibc/modules/core/03-connection/types"
|
|
)
|
|
|
|
// InitGenesis initializes the ibc connection submodule's state from a provided genesis
|
|
// state.
|
|
func InitGenesis(ctx sdk.Context, k *keeper.Keeper, gs types.GenesisState) {
|
|
for _, connection := range gs.Connections {
|
|
conn := types.NewConnectionEnd(connection.State, connection.ClientId, connection.Counterparty, connection.Versions, connection.DelayPeriod)
|
|
k.SetConnection(ctx, connection.Id, conn)
|
|
}
|
|
for _, connPaths := range gs.ClientConnectionPaths {
|
|
k.SetClientConnectionPaths(ctx, connPaths.ClientId, connPaths.Paths)
|
|
}
|
|
k.SetNextConnectionSequence(ctx, gs.NextConnectionSequence)
|
|
k.SetParams(ctx, gs.Params)
|
|
|
|
k.CreateSentinelLocalhostConnection(ctx)
|
|
}
|
|
|
|
// ExportGenesis returns the ibc connection submodule's exported genesis.
|
|
func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) types.GenesisState {
|
|
return types.GenesisState{
|
|
Connections: k.GetAllConnections(ctx),
|
|
ClientConnectionPaths: k.GetAllClientConnectionPaths(ctx),
|
|
NextConnectionSequence: k.GetNextConnectionSequence(ctx),
|
|
Params: k.GetParams(ctx),
|
|
}
|
|
}
|