From 9c2911f786aaac362d846b1be2589d0de69e1d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E1=BA=B7c?= Date: Tue, 12 Sep 2023 12:38:49 +0700 Subject: [PATCH] fix minor setting ibchooks logic --- app/app.go | 2 +- x/ibchooks/wasm_hook.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index 8564d5f0..96e73695 100644 --- a/app/app.go +++ b/app/app.go @@ -519,7 +519,7 @@ func NewMigalooApp( app.IBCHooksKeeper = &hooksKeeper migalooPrefix := sdk.GetConfig().GetBech32AccountAddrPrefix() - wasmHooks := ibchooks.NewWasmHooks(app.IBCHooksKeeper, app.ContractKeeper, wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper), migalooPrefix) // The contract keeper + wasmHooks := ibchooks.NewWasmHooks(app.IBCHooksKeeper, nil, migalooPrefix) // The contract keeper needs to be set later app.Ics20WasmHooks = &wasmHooks app.HooksICS4Wrapper = ibchooks.NewICS4Middleware( diff --git a/x/ibchooks/wasm_hook.go b/x/ibchooks/wasm_hook.go index b7289499..446c3787 100644 --- a/x/ibchooks/wasm_hook.go +++ b/x/ibchooks/wasm_hook.go @@ -28,15 +28,13 @@ type ContractAck struct { } type WasmHooks struct { - WasmKeeper wasmtypes.ContractOpsKeeper ContractKeeper *wasmkeeper.PermissionedKeeper ibcHooksKeeper *keeper.Keeper bech32PrefixAccAddr string } -func NewWasmHooks(ibcHooksKeeper *keeper.Keeper, contractKeeper *wasmkeeper.PermissionedKeeper, wasmKeeper wasmtypes.ContractOpsKeeper, bech32PrefixAccAddr string) WasmHooks { +func NewWasmHooks(ibcHooksKeeper *keeper.Keeper, contractKeeper *wasmkeeper.PermissionedKeeper, bech32PrefixAccAddr string) WasmHooks { return WasmHooks{ - WasmKeeper: wasmKeeper, ContractKeeper: contractKeeper, ibcHooksKeeper: ibcHooksKeeper, bech32PrefixAccAddr: bech32PrefixAccAddr, @@ -132,7 +130,7 @@ func (h WasmHooks) execWasmMsg(ctx sdk.Context, execMsg *wasmtypes.MsgExecuteCon if err := execMsg.ValidateBasic(); err != nil { return nil, fmt.Errorf(types.ErrBadExecutionMsg, err.Error()) } - wasmMsgServer := wasmkeeper.NewMsgServerImpl(h.WasmKeeper) + wasmMsgServer := wasmkeeper.NewMsgServerImpl(h.ContractKeeper) return wasmMsgServer.ExecuteContract(sdk.WrapSDKContext(ctx), execMsg) }