From fe89ba938d9020ea9d66785bd438df581efd05e3 Mon Sep 17 00:00:00 2001 From: Draco Li Date: Sun, 4 Sep 2022 11:43:45 -0400 Subject: [PATCH] legacy msg support for earn msgs (#1296) --- x/earn/types/msg.go | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/x/earn/types/msg.go b/x/earn/types/msg.go index cde644f9..edd406b2 100644 --- a/x/earn/types/msg.go +++ b/x/earn/types/msg.go @@ -3,11 +3,20 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx" ) var ( - _ sdk.Msg = &MsgDeposit{} - _ sdk.Msg = &MsgWithdraw{} + _ sdk.Msg = &MsgDeposit{} + _ sdk.Msg = &MsgWithdraw{} + _ legacytx.LegacyMsg = &MsgDeposit{} + _ legacytx.LegacyMsg = &MsgWithdraw{} +) + +// legacy message types +const ( + TypeMsgDeposit = "earn_msg_deposit" + TypeMsgWithdraw = "earn_msg_withdraw" ) // NewMsgDeposit returns a new MsgDeposit. @@ -47,6 +56,16 @@ func (msg MsgDeposit) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{depositor} } +// Route implements the LegacyMsg.Route method. +func (msg MsgDeposit) Route() string { + return RouterKey +} + +// Type implements the LegacyMsg.Type method. +func (msg MsgDeposit) Type() string { + return TypeMsgDeposit +} + // NewMsgWithdraw returns a new MsgWithdraw. func NewMsgWithdraw(from string, amount sdk.Coin) *MsgWithdraw { return &MsgWithdraw{ @@ -83,3 +102,13 @@ func (msg MsgWithdraw) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{depositor} } + +// Route implements the LegacyMsg.Route method. +func (msg MsgWithdraw) Route() string { + return RouterKey +} + +// Type implements the LegacyMsg.Type method. +func (msg MsgWithdraw) Type() string { + return TypeMsgWithdraw +}