-
Notifications
You must be signed in to change notification settings - Fork 113
/
msg_deregister_controller.go
48 lines (39 loc) · 1.44 KB
/
msg_deregister_controller.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// NewDeregisterControllerRequest is the constructor for DeregisterControllerRequest
func NewDeregisterControllerRequest(sender sdk.AccAddress, controller sdk.AccAddress) *DeregisterControllerRequest {
return &DeregisterControllerRequest{
Sender: sender,
Controller: controller,
}
}
// Route returns the route for this message
func (m DeregisterControllerRequest) Route() string {
return RouterKey
}
// Type returns the type of the message
func (m DeregisterControllerRequest) Type() string {
return "DeregisterController"
}
// ValidateBasic executes a stateless message validation
func (m DeregisterControllerRequest) ValidateBasic() error {
if err := sdk.VerifyAddressFormat(m.Sender); err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, sdkerrors.Wrap(err, "sender").Error())
}
if err := sdk.VerifyAddressFormat(m.Controller); err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, sdkerrors.Wrap(err, "controller").Error())
}
return nil
}
// GetSignBytes returns the message bytes that need to be signed
func (m DeregisterControllerRequest) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&m)
return sdk.MustSortJSON(bz)
}
// GetSigners returns the set of signers for this message
func (m DeregisterControllerRequest) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{m.Sender}
}