/
gov.go
56 lines (43 loc) · 1.36 KB
/
gov.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
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"strings"
)
const ProposalTypeUpdateFees = "UpdateMerkledropFeesProposal"
func init() {
govtypes.RegisterProposalType(ProposalTypeUpdateFees)
govtypes.RegisterProposalTypeCodec(&UpdateFeesProposal{}, "go-incubus/merkledrop/UpdateFeesProposal")
}
var _ govtypes.Content = &UpdateFeesProposal{}
func NewUpdateFeesProposal(title, description string, creationFee sdk.Coin) govtypes.Content {
return &UpdateFeesProposal{
Title: title,
Description: description,
CreationFee: creationFee,
}
}
func (p *UpdateFeesProposal) GetTitle() string { return p.Title }
func (p *UpdateFeesProposal) GetDescription() string { return p.Description }
func (p *UpdateFeesProposal) ProposalRoute() string { return RouterKey }
func (p *UpdateFeesProposal) ProposalType() string { return ProposalTypeUpdateFees }
func (p *UpdateFeesProposal) ValidateBasic() error {
err := govtypes.ValidateAbstract(p)
if err != nil {
return err
}
if err := p.CreationFee.Validate(); err != nil {
return err
}
return nil
}
func (p UpdateFeesProposal) String() string {
var b strings.Builder
b.WriteString(fmt.Sprintf(`Update Merkledrop Fees Proposal:
Title: %s
Description: %s
Creation Fee: %s
`, p.Title, p.Description, p.CreationFee))
return b.String()
}