legacy msg support for earn msgs (#1296)

This commit is contained in:
Draco Li 2022-09-04 11:43:45 -04:00 committed by GitHub
parent 0c7e357f10
commit fe89ba938d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}