Skip to content

Commit

Permalink
fix minor setting ibchooks logic
Browse files Browse the repository at this point in the history
  • Loading branch information
expertdicer committed Sep 12, 2023
1 parent 53aa796 commit 9c2911f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 2 additions & 4 deletions x/ibchooks/wasm_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 9c2911f

Please sign in to comment.