@@ -20,14 +20,18 @@ var (
20
20
ParamStoreKeyBaseProposerReward = []byte ("baseproposerreward" )
21
21
ParamStoreKeyBonusProposerReward = []byte ("bonusproposerreward" )
22
22
ParamStoreKeyWithdrawAddrEnabled = []byte ("withdrawaddrenabled" )
23
+ ParamSecretFoundationTax = []byte ("secretfoundationtax" )
24
+ ParamSecretFoundationAddress = []byte ("secretfoundationaddress" )
23
25
)
24
26
25
27
// Params defines the set of distribution parameters.
26
28
type Params struct {
27
- CommunityTax sdk.Dec `json:"community_tax" yaml:"community_tax"`
28
- BaseProposerReward sdk.Dec `json:"base_proposer_reward" yaml:"base_proposer_reward"`
29
- BonusProposerReward sdk.Dec `json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"`
30
- WithdrawAddrEnabled bool `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"`
29
+ CommunityTax sdk.Dec `json:"community_tax" yaml:"community_tax"`
30
+ BaseProposerReward sdk.Dec `json:"base_proposer_reward" yaml:"base_proposer_reward"`
31
+ BonusProposerReward sdk.Dec `json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"`
32
+ WithdrawAddrEnabled bool `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"`
33
+ SecretFoundationTax sdk.Dec `json:"secret_foundation_tax" yaml:"secret_foundation_tax"`
34
+ SecretFoundationAddress sdk.AccAddress `json:"secret_foundation_address" yaml:"secret_foundation_address"`
31
35
}
32
36
33
37
// ParamKeyTable returns the parameter key table.
@@ -38,10 +42,12 @@ func ParamKeyTable() params.KeyTable {
38
42
// DefaultParams returns default distribution parameters
39
43
func DefaultParams () Params {
40
44
return Params {
41
- CommunityTax : sdk .NewDecWithPrec (2 , 2 ), // 2%
42
- BaseProposerReward : sdk .NewDecWithPrec (1 , 2 ), // 1%
43
- BonusProposerReward : sdk .NewDecWithPrec (4 , 2 ), // 4%
44
- WithdrawAddrEnabled : true ,
45
+ CommunityTax : sdk .NewDecWithPrec (2 , 2 ), // 2%
46
+ SecretFoundationTax : sdk .ZeroDec (), // 0%
47
+ SecretFoundationAddress : sdk.AccAddress {},
48
+ BaseProposerReward : sdk .NewDecWithPrec (1 , 2 ), // 1%
49
+ BonusProposerReward : sdk .NewDecWithPrec (4 , 2 ), // 4%
50
+ WithdrawAddrEnabled : true ,
45
51
}
46
52
}
47
53
@@ -57,6 +63,8 @@ func (p *Params) ParamSetPairs() params.ParamSetPairs {
57
63
params .NewParamSetPair (ParamStoreKeyBaseProposerReward , & p .BaseProposerReward , validateBaseProposerReward ),
58
64
params .NewParamSetPair (ParamStoreKeyBonusProposerReward , & p .BonusProposerReward , validateBonusProposerReward ),
59
65
params .NewParamSetPair (ParamStoreKeyWithdrawAddrEnabled , & p .WithdrawAddrEnabled , validateWithdrawAddrEnabled ),
66
+ params .NewParamSetPair (ParamSecretFoundationTax , & p .SecretFoundationTax , validateSecretFoundationTax ),
67
+ params .NewParamSetPair (ParamSecretFoundationAddress , & p .SecretFoundationAddress , validateSecretFoundationAddress ),
60
68
}
61
69
}
62
70
@@ -67,6 +75,11 @@ func (p Params) ValidateBasic() error {
67
75
"community tax should non-negative and less than one: %s" , p .CommunityTax ,
68
76
)
69
77
}
78
+ if p .SecretFoundationTax .IsNegative () || p .SecretFoundationTax .GT (sdk .OneDec ()) {
79
+ return fmt .Errorf (
80
+ "secret foundation tax should non-negative and less than one: %s" , p .SecretFoundationTax ,
81
+ )
82
+ }
70
83
if p .BaseProposerReward .IsNegative () {
71
84
return fmt .Errorf (
72
85
"base proposer reward should be positive: %s" , p .BaseProposerReward ,
@@ -105,6 +118,38 @@ func validateCommunityTax(i interface{}) error {
105
118
return nil
106
119
}
107
120
121
+ func validateSecretFoundationTax (i interface {}) error {
122
+ v , ok := i .(sdk.Dec )
123
+ if ! ok {
124
+ return fmt .Errorf ("invalid parameter type: %T" , i )
125
+ }
126
+
127
+ if v .IsNil () {
128
+ return fmt .Errorf ("secret foundation tax must be not nil" )
129
+ }
130
+ if v .IsNegative () {
131
+ return fmt .Errorf ("secret foundation tax must be positive: %s" , v )
132
+ }
133
+ if v .GT (sdk .OneDec ()) {
134
+ return fmt .Errorf ("secret foundation tax too large: %s" , v )
135
+ }
136
+
137
+ return nil
138
+ }
139
+
140
+ func validateSecretFoundationAddress (i interface {}) error {
141
+ v , ok := i .(sdk.AccAddress )
142
+ if ! ok {
143
+ return fmt .Errorf ("invalid parameter type: %T" , i )
144
+ }
145
+
146
+ if ! v .Empty () {
147
+ return sdk .VerifyAddressFormat (v )
148
+ }
149
+
150
+ return nil
151
+ }
152
+
108
153
func validateBaseProposerReward (i interface {}) error {
109
154
v , ok := i .(sdk.Dec )
110
155
if ! ok {
0 commit comments