Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (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
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
35 lines
1 KiB
Go
35 lines
1 KiB
Go
package keeper
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
|
|
)
|
|
|
|
// InitGenesis initializes the ibc-transfer state and binds to PortID.
|
|
func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) {
|
|
k.SetPort(ctx, state.PortId)
|
|
|
|
for _, denom := range state.Denoms {
|
|
k.SetDenom(ctx, denom)
|
|
k.SetDenomMetadata(ctx, denom)
|
|
}
|
|
|
|
k.SetParams(ctx, state.Params)
|
|
|
|
// Every denom will have only one total escrow amount, since any
|
|
// duplicate entry will fail validation in Validate of GenesisState
|
|
for _, denomEscrow := range state.TotalEscrowed {
|
|
k.SetTotalEscrowForDenom(ctx, denomEscrow)
|
|
}
|
|
}
|
|
|
|
// ExportGenesis exports ibc-transfer module's portID and denom trace info into its genesis state.
|
|
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
|
|
return &types.GenesisState{
|
|
PortId: k.GetPort(ctx),
|
|
Denoms: k.GetAllDenoms(ctx),
|
|
Params: k.GetParams(ctx),
|
|
TotalEscrowed: k.GetAllTotalEscrowed(ctx),
|
|
}
|
|
}
|