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
40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package keeper
|
|
|
|
import (
|
|
sdk "git.cw.tr/mukan-network/mukan-sdk/types"
|
|
|
|
genesistypes "git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/genesis/types"
|
|
)
|
|
|
|
// InitGenesis initializes the interchain accounts controller application state from a provided genesis state
|
|
func InitGenesis(ctx sdk.Context, keeper Keeper, state genesistypes.ControllerGenesisState) {
|
|
for _, portID := range state.Ports {
|
|
keeper.setPort(ctx, portID)
|
|
}
|
|
|
|
for _, ch := range state.ActiveChannels {
|
|
keeper.SetActiveChannelID(ctx, ch.ConnectionId, ch.PortId, ch.ChannelId)
|
|
|
|
if ch.IsMiddlewareEnabled {
|
|
keeper.SetMiddlewareEnabled(ctx, ch.PortId, ch.ConnectionId)
|
|
} else {
|
|
keeper.SetMiddlewareDisabled(ctx, ch.PortId, ch.ConnectionId)
|
|
}
|
|
}
|
|
|
|
for _, acc := range state.InterchainAccounts {
|
|
keeper.SetInterchainAccountAddress(ctx, acc.ConnectionId, acc.PortId, acc.AccountAddress)
|
|
}
|
|
|
|
keeper.SetParams(ctx, state.Params)
|
|
}
|
|
|
|
// ExportGenesis returns the interchain accounts controller exported genesis
|
|
func ExportGenesis(ctx sdk.Context, keeper Keeper) genesistypes.ControllerGenesisState {
|
|
return genesistypes.NewControllerGenesisState(
|
|
keeper.GetAllActiveChannels(ctx),
|
|
keeper.GetAllInterchainAccounts(ctx),
|
|
keeper.GetAllPorts(ctx),
|
|
keeper.GetParams(ctx),
|
|
)
|
|
}
|