-
Notifications
You must be signed in to change notification settings - Fork 37
/
proposal.go
144 lines (119 loc) · 5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
)
// constants
const (
ProposalTypeGrantBandOraclePrivilege string = "ProposalTypeGrantBandOraclePrivilege"
ProposalTypeRevokeBandOraclePrivilege string = "ProposalTypeRevokeBandOraclePrivilege"
ProposalTypeGrantPriceFeederOraclePrivilege string = "ProposalTypeGrantPriceFeederOraclePrivilege"
ProposalTypeRevokePriceFeederOraclePrivilege string = "ProposalTypeRevokePriceFeederOraclePrivilege"
)
func init() {
gov.RegisterProposalType(ProposalTypeGrantBandOraclePrivilege)
gov.RegisterProposalTypeCodec(&GrantBandOraclePrivilegeProposal{}, "injective/GrantBandOraclePrivilegeProposal")
gov.RegisterProposalType(ProposalTypeRevokeBandOraclePrivilege)
gov.RegisterProposalTypeCodec(&RevokeBandOraclePrivilegeProposal{}, "injective/RevokeBandOraclePrivilegeProposal")
gov.RegisterProposalType(ProposalTypeGrantPriceFeederOraclePrivilege)
gov.RegisterProposalTypeCodec(&GrantPriceFeederPrivilegeProposal{}, "injective/GrantPriceFeederPrivilegeProposal")
gov.RegisterProposalType(ProposalTypeRevokePriceFeederOraclePrivilege)
gov.RegisterProposalTypeCodec(&RevokePriceFeederPrivilegeProposal{}, "injective/RevokePriceFeederPrivilegeProposal")
}
// Implements Proposal Interface
var _ gov.Content = &GrantBandOraclePrivilegeProposal{}
var _ gov.Content = &RevokeBandOraclePrivilegeProposal{}
var _ gov.Content = &GrantPriceFeederPrivilegeProposal{}
var _ gov.Content = &RevokePriceFeederPrivilegeProposal{}
// GetTitle returns the title of this proposal.
func (p *GrantBandOraclePrivilegeProposal) GetTitle() string {
return p.Title
}
// GetDescription returns the description of this proposal.
func (p *GrantBandOraclePrivilegeProposal) GetDescription() string {
return p.Description
}
// ProposalRoute returns router key of this proposal.
func (p *GrantBandOraclePrivilegeProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns proposal type of this proposal.
func (p *GrantBandOraclePrivilegeProposal) ProposalType() string {
return ProposalTypeGrantBandOraclePrivilege
}
// ValidateBasic returns ValidateBasic result of this proposal.
func (p *GrantBandOraclePrivilegeProposal) ValidateBasic() error {
for _, relayer := range p.Relayers {
if _, err := sdk.AccAddressFromBech32(relayer); err != nil {
return err
}
}
return gov.ValidateAbstract(p)
}
// GetTitle returns the title of this proposal.
func (p *RevokeBandOraclePrivilegeProposal) GetTitle() string {
return p.Title
}
// GetDescription returns the description of this proposal.
func (p *RevokeBandOraclePrivilegeProposal) GetDescription() string {
return p.Description
}
// ProposalRoute returns router key of this proposal.
func (p *RevokeBandOraclePrivilegeProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns proposal type of this proposal.
func (p *RevokeBandOraclePrivilegeProposal) ProposalType() string {
return ProposalTypeRevokeBandOraclePrivilege
}
// ValidateBasic returns ValidateBasic result of this proposal.
func (p *RevokeBandOraclePrivilegeProposal) ValidateBasic() error {
for _, relayer := range p.Relayers {
if _, err := sdk.AccAddressFromBech32(relayer); err != nil {
return err
}
}
return gov.ValidateAbstract(p)
}
// GetTitle returns the title of this proposal.
func (p *GrantPriceFeederPrivilegeProposal) GetTitle() string {
return p.Title
}
// GetDescription returns the description of this proposal.
func (p *GrantPriceFeederPrivilegeProposal) GetDescription() string {
return p.Description
}
// ProposalRoute returns router key of this proposal.
func (p *GrantPriceFeederPrivilegeProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns proposal type of this proposal.
func (p *GrantPriceFeederPrivilegeProposal) ProposalType() string {
return ProposalTypeGrantPriceFeederOraclePrivilege
}
// ValidateBasic returns ValidateBasic result of this proposal.
func (p *GrantPriceFeederPrivilegeProposal) ValidateBasic() error {
for _, relayer := range p.Relayers {
if _, err := sdk.AccAddressFromBech32(relayer); err != nil {
return err
}
}
return gov.ValidateAbstract(p)
}
// GetTitle returns the title of this proposal.
func (p *RevokePriceFeederPrivilegeProposal) GetTitle() string {
return p.Title
}
// GetDescription returns the description of this proposal.
func (p *RevokePriceFeederPrivilegeProposal) GetDescription() string {
return p.Description
}
// ProposalRoute returns router key of this proposal.
func (p *RevokePriceFeederPrivilegeProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns proposal type of this proposal.
func (p *RevokePriceFeederPrivilegeProposal) ProposalType() string {
return ProposalTypeRevokePriceFeederOraclePrivilege
}
// ValidateBasic returns ValidateBasic result of this proposal.
func (p *RevokePriceFeederPrivilegeProposal) ValidateBasic() error {
for _, relayer := range p.Relayers {
if _, err := sdk.AccAddressFromBech32(relayer); err != nil {
return err
}
}
return gov.ValidateAbstract(p)
}