Skip to content

Commit

Permalink
feat(wasm): wire the wasm CustomQuerier in the app
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Feb 7, 2023
1 parent 3c68496 commit 9435cf6
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import (
intertx "github.com/cosmos/interchain-accounts/x/inter-tx"
intertxkeeper "github.com/cosmos/interchain-accounts/x/inter-tx/keeper"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
okp4wasm "github.com/okp4/okp4d/app/wasm"
logicmodule "github.com/okp4/okp4d/x/logic"
logicmodulekeeper "github.com/okp4/okp4d/x/logic/keeper"
logicmoduletypes "github.com/okp4/okp4d/x/logic/types"
Expand Down Expand Up @@ -545,6 +546,16 @@ func New(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

app.LogicKeeper = *logicmodulekeeper.NewKeeper(
appCodec,
keys[logicmoduletypes.StoreKey],
keys[logicmoduletypes.MemStoreKey],
app.GetSubspace(logicmoduletypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
)
logicModule := logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper)

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand All @@ -556,6 +567,8 @@ func New(
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}

wasmOpts = append(wasmOpts, wasmkeeper.WithQueryPlugins(okp4wasm.CustomQueryPlugins(app.LogicKeeper)))

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1"
Expand Down Expand Up @@ -606,16 +619,6 @@ func New(
govConfig,
)

app.LogicKeeper = *logicmodulekeeper.NewKeeper(
appCodec,
keys[logicmoduletypes.StoreKey],
keys[logicmoduletypes.MemStoreKey],
app.GetSubspace(logicmoduletypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
)
logicModule := logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper)

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
Expand Down

0 comments on commit 9435cf6

Please sign in to comment.