-
Notifications
You must be signed in to change notification settings - Fork 5
/
tx.go
33 lines (28 loc) · 1 KB
/
tx.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// GetSignBytes implements the LegacyMsg interface.
func (msg MsgSetVirtualStakingMaxCap) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
// GetSigners returns the expected signers for MsgSoftwareUpgrade.
func (msg MsgSetVirtualStakingMaxCap) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{addr}
}
// ValidateBasic validate basic constraints
func (msg MsgSetVirtualStakingMaxCap) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err)
}
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
return errorsmod.Wrap(err, "contract")
}
if err := msg.MaxCap.Validate(); err != nil {
return errorsmod.Wrap(err, "max cap")
}
return nil
}