-
Notifications
You must be signed in to change notification settings - Fork 30
/
proposal.go
61 lines (52 loc) · 1.66 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
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)
const (
ProposalTypeCreateFarmPool string = "CommunityPoolCreateFarm"
)
// Implements Proposal Interface
var _ govv1beta1.Content = &CommunityPoolCreateFarmProposal{}
func init() {
govv1beta1.RegisterProposalType(ProposalTypeCreateFarmPool)
}
func (cfp *CommunityPoolCreateFarmProposal) GetTitle() string { return cfp.Title }
func (cfp *CommunityPoolCreateFarmProposal) GetDescription() string { return cfp.Description }
func (cfp *CommunityPoolCreateFarmProposal) ProposalRoute() string { return RouterKey }
func (cfp *CommunityPoolCreateFarmProposal) ProposalType() string { return ProposalTypeCreateFarmPool }
func (cfp *CommunityPoolCreateFarmProposal) ValidateBasic() error {
// Validate gov base proposal
if err := govv1beta1.ValidateAbstract(cfp); err != nil {
return err
}
if err := ValidateDescription(cfp.PoolDescription); err != nil {
return err
}
if err := ValidateLpTokenDenom(cfp.LptDenom); err != nil {
return err
}
if err := ValidateCoins("RewardsPerBlock", cfp.RewardPerBlock...); err != nil {
return err
}
return ValidateFund(cfp.RewardPerBlock, cfp.FundApplied, cfp.FundSelfBond)
}
func (cfp CommunityPoolCreateFarmProposal) String() string {
return fmt.Sprintf(`Community Pool Create Farm Proposal:
Title: %s
Description: %s
PoolDescription: %s
LpTokenDenom: %s
RewardPerBlock: %s
FundApplied: %s
FundSelfBond: %s
`, cfp.Title,
cfp.Description,
cfp.PoolDescription,
cfp.LptDenom,
sdk.Coins(cfp.RewardPerBlock),
sdk.Coins(cfp.FundApplied),
sdk.Coins(cfp.FundSelfBond),
)
}