From d3706157147bc67a0956b4bb9745d99d219f1bd3 Mon Sep 17 00:00:00 2001 From: Riccardo Montagnin Date: Mon, 11 Sep 2023 09:23:34 -0500 Subject: [PATCH] feat: add MsgExec support for modules (cherry picked from commit 31ae8b52aa42e1aeae4e4f9c9a9aa2c97d67c653) --- modules/auth/handle_msg.go | 6 ++++++ modules/distribution/handle_msg.go | 6 ++++++ modules/feegrant/handle_msg.go | 6 ++++++ modules/gov/handle_msg.go | 7 +++++++ modules/staking/handle_msg.go | 8 +++++++- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/auth/handle_msg.go b/modules/auth/handle_msg.go index e07f6986d..e82f8f4c0 100644 --- a/modules/auth/handle_msg.go +++ b/modules/auth/handle_msg.go @@ -5,6 +5,7 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/gogoproto/proto" juno "github.com/forbole/juno/v5/types" "github.com/rs/zerolog/log" @@ -16,6 +17,11 @@ import ( "github.com/forbole/bdjuno/v4/types" ) +// HandleMsgExec implements modules.AuthzMessageModule +func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error { + return m.HandleMsg(index, executedMsg, tx) +} + // HandleMsg implements modules.MessageModule func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error { addresses, err := m.messagesParser(tx) diff --git a/modules/distribution/handle_msg.go b/modules/distribution/handle_msg.go index 0de58ffe1..5503b7e83 100644 --- a/modules/distribution/handle_msg.go +++ b/modules/distribution/handle_msg.go @@ -2,11 +2,17 @@ package distribution import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz" juno "github.com/forbole/juno/v5/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" ) +// HandleMsgExec implements modules.AuthzMessageModule +func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error { + return m.HandleMsg(index, executedMsg, tx) +} + // HandleMsg implements modules.MessageModule func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error { if len(tx.Logs) == 0 { diff --git a/modules/feegrant/handle_msg.go b/modules/feegrant/handle_msg.go index 069589b07..bfddf22d9 100644 --- a/modules/feegrant/handle_msg.go +++ b/modules/feegrant/handle_msg.go @@ -4,12 +4,18 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz" feegranttypes "github.com/cosmos/cosmos-sdk/x/feegrant" juno "github.com/forbole/juno/v5/types" "github.com/forbole/bdjuno/v4/types" ) +// HandleMsgExec implements modules.AuthzMessageModule +func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error { + return m.HandleMsg(index, executedMsg, tx) +} + // HandleMsg implements modules.MessageModule func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error { if len(tx.Logs) == 0 { diff --git a/modules/gov/handle_msg.go b/modules/gov/handle_msg.go index 3df6c9fec..db7995eaf 100644 --- a/modules/gov/handle_msg.go +++ b/modules/gov/handle_msg.go @@ -5,6 +5,8 @@ import ( "strconv" "time" + "github.com/cosmos/cosmos-sdk/x/authz" + "github.com/forbole/bdjuno/v4/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,6 +16,11 @@ import ( juno "github.com/forbole/juno/v5/types" ) +// HandleMsgExec implements modules.AuthzMessageModule +func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error { + return m.HandleMsg(index, executedMsg, tx) +} + // HandleMsg implements modules.MessageModule func (m *Module) HandleMsg(index int, msg sdk.Msg, tx *juno.Tx) error { if len(tx.Logs) == 0 { diff --git a/modules/staking/handle_msg.go b/modules/staking/handle_msg.go index db8790e66..68e9d2a9b 100644 --- a/modules/staking/handle_msg.go +++ b/modules/staking/handle_msg.go @@ -3,14 +3,20 @@ package staking import ( "fmt" + "github.com/cosmos/cosmos-sdk/x/authz" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" sdk "github.com/cosmos/cosmos-sdk/types" juno "github.com/forbole/juno/v5/types" ) +// HandleMsgExec implements modules.AuthzMessageModule +func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error { + return m.HandleMsg(index, executedMsg, tx) +} + // HandleMsg implements MessageModule -func (m *Module) HandleMsg(index int, msg sdk.Msg, tx *juno.Tx) error { +func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error { if len(tx.Logs) == 0 { return nil }