gpu-compute-chain/x/colinearcore/types/message_unlock_all_funds.go

46 lines
1015 B
Go

package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgUnlockAllFunds = "unlock_all_funds"
var _ sdk.Msg = &MsgUnlockAllFunds{}
func NewMsgUnlockAllFunds(creator string) *MsgUnlockAllFunds {
return &MsgUnlockAllFunds{
Creator: creator,
}
}
func (msg *MsgUnlockAllFunds) Route() string {
return RouterKey
}
func (msg *MsgUnlockAllFunds) Type() string {
return TypeMsgUnlockAllFunds
}
func (msg *MsgUnlockAllFunds) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgUnlockAllFunds) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgUnlockAllFunds) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}