/
proposal.go
71 lines (55 loc) · 1.64 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package types
import (
"fmt"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)
const (
ProposalTypeAddManagedCellars = "AddManagedCellars"
ProposalTypeRemoveManagedCellars = "RemoveManagedCellars"
)
var _ govtypes.Content = &AddManagedCellarsProposal{}
var _ govtypes.Content = &RemoveManagedCellarsProposal{}
func NewAddManagedCellarsProposal(title string, description string, cellarIds []string) *AddManagedCellarsProposal {
return &AddManagedCellarsProposal{
Title: title,
Description: description,
CellarIds: cellarIds,
}
}
func (m *AddManagedCellarsProposal) ProposalRoute() string {
return RouterKey
}
func (m *AddManagedCellarsProposal) ProposalType() string {
return ProposalTypeAddManagedCellars
}
func (m *AddManagedCellarsProposal) ValidateBasic() error {
if err := govtypes.ValidateAbstract(m); err != nil {
return err
}
if len(m.CellarIds) == 0 {
return fmt.Errorf("can't have an add prosoposal with no cellars")
}
return nil
}
func NewRemoveManagedCellarsProposal(title string, description string, cellarIds []string) *RemoveManagedCellarsProposal {
return &RemoveManagedCellarsProposal{
Title: title,
Description: description,
CellarIds: cellarIds,
}
}
func (m *RemoveManagedCellarsProposal) ProposalRoute() string {
return RouterKey
}
func (m *RemoveManagedCellarsProposal) ProposalType() string {
return ProposalTypeRemoveManagedCellars
}
func (m *RemoveManagedCellarsProposal) ValidateBasic() error {
if err := govtypes.ValidateAbstract(m); err != nil {
return err
}
if len(m.CellarIds) == 0 {
return fmt.Errorf("can't have a remove prosoposal with no cellars")
}
return nil
}