-
Notifications
You must be signed in to change notification settings - Fork 206
/
unstake_proposal.go
47 lines (36 loc) · 1.2 KB
/
unstake_proposal.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)
const (
ProposalUnstake = "PairingUnstake"
)
func init() {
v1beta1.RegisterProposalType(ProposalUnstake)
}
func NewUnstakeProposal(title, description string, providers []ProviderUnstakeInfo) *UnstakeProposal {
return &UnstakeProposal{title, description, providers}
}
// GetTitle returns the title of a proposal.
func (up *UnstakeProposal) GetTitle() string { return up.Title }
// GetDescription returns the description of a proposal.
func (up *UnstakeProposal) GetDescription() string { return up.Description }
// ProposalRoute returns the routing key of a proposal.
func (up *UnstakeProposal) ProposalRoute() string { return ProposalsRouterKey }
// ProposalType returns the type of a proposal.
func (up *UnstakeProposal) ProposalType() string { return ProposalUnstake }
// ValidateBasic validates the proposal
func (up *UnstakeProposal) ValidateBasic() error {
err := v1beta1.ValidateAbstract(up)
if err != nil {
return err
}
for _, providerInfo := range up.ProvidersInfo {
_, err = sdk.AccAddressFromBech32(providerInfo.Provider)
if err != nil {
return err
}
}
return nil
}