Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Align params stringify #286

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions x/market/internal/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ func DefaultParams() Params {
// Validate a set of params
func (params Params) Validate() error {
if params.BasePool.IsNegative() {
return fmt.Errorf("base pool should be positive or zero, is %s", params.BasePool.String())
return fmt.Errorf("base pool should be positive or zero, is %s", params.BasePool)
}
if params.PoolRecoveryPeriod <= 0 {
return fmt.Errorf("pool recovery period should be positive, is %d", params.PoolRecoveryPeriod)
}
if params.MinSpread.IsNegative() || params.MinSpread.GT(sdk.OneDec()) {
return fmt.Errorf("market minimum spead should be a value between [0,1], is %s", params.MinSpread.String())
return fmt.Errorf("market minimum spead should be a value between [0,1], is %s", params.MinSpread)
}
if params.TobinTax.IsNegative() || params.TobinTax.GT(sdk.OneDec()) {
return fmt.Errorf("tobin tax should be a value between [0,1], is %s", params.TobinTax.String())
return fmt.Errorf("tobin tax should be a value between [0,1], is %s", params.TobinTax)
}

return nil
Expand All @@ -85,9 +85,9 @@ func (params *Params) ParamSetPairs() subspace.ParamSetPairs {
// String implements fmt.Stringer interface
func (params Params) String() string {
return fmt.Sprintf(`Treasury Params:
BasePool: %d
BasePool: %d
PoolRecoveryPeriod: %d
MinSpread: %s
MinSpread: %s
TobinTax: %s
`, params.BasePool, params.PoolRecoveryPeriod, params.MinSpread, params.TobinTax)
}
2 changes: 1 addition & 1 deletion x/oracle/internal/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (params Params) String() string {
Whitelist %s
SlashFraction %s
SlashWindow %d
MinValidPerWindow %s
MinValidPerWindow %s
`, params.VotePeriod, params.VoteThreshold, params.RewardBand,
params.RewardDistributionWindow, params.Whitelist,
params.SlashFraction, params.SlashWindow, params.MinValidPerWindow)
Expand Down
8 changes: 4 additions & 4 deletions x/treasury/internal/types/constraint.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type PolicyConstraints struct {
// String implements fmt.Stringer interface
func (pc PolicyConstraints) String() string {
return fmt.Sprintf(`PolicyConstraints :
RateMin: %s
RateMax: %s
Cap: %s
ChangeRateMax: %v
RateMin: %s
RateMax: %s
Cap: %s
ChangeRateMax: %s
`, pc.RateMin, pc.RateMax, pc.Cap, pc.ChangeRateMax)
}

Expand Down
20 changes: 10 additions & 10 deletions x/treasury/internal/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ func DefaultParams() Params {
func (params Params) Validate() error {
if params.TaxPolicy.RateMax.LT(params.TaxPolicy.RateMin) {
return fmt.Errorf("treasury TaxPolicy.RateMax %s must be greater than TaxPolicy.RateMin %s",
params.TaxPolicy.RateMax.String(), params.TaxPolicy.RateMin.String())
params.TaxPolicy.RateMax, params.TaxPolicy.RateMin)
}

if params.TaxPolicy.RateMin.IsNegative() {
return fmt.Errorf("treasury parameter TaxPolicy.RateMin must be >= 0, is %s", params.TaxPolicy.RateMin.String())
return fmt.Errorf("treasury parameter TaxPolicy.RateMin must be >= 0, is %s", params.TaxPolicy.RateMin)
}

if params.RewardPolicy.RateMax.LT(params.RewardPolicy.RateMin) {
return fmt.Errorf("treasury RewardPolicy.RateMax %s must be greater than RewardPolicy.RateMin %s",
params.RewardPolicy.RateMax.String(), params.RewardPolicy.RateMin.String())
params.RewardPolicy.RateMax, params.RewardPolicy.RateMin)
}

if params.RewardPolicy.RateMin.IsNegative() {
return fmt.Errorf("treasury parameter RewardPolicy.RateMin must be >= 0, is %s", params.RewardPolicy.RateMin.String())
return fmt.Errorf("treasury parameter RewardPolicy.RateMin must be >= 0, is %s", params.RewardPolicy.RateMin)
}

return nil
Expand All @@ -113,14 +113,14 @@ func (params *Params) ParamSetPairs() subspace.ParamSetPairs {
// String implements fmt.Stringer interface
func (params Params) String() string {
return fmt.Sprintf(`Treasury Params:
Tax Policy : { %v }
Reward Policy : { %v }
Tax Policy : { %s }
Reward Policy : { %s }

SeigniorageBurdenTarget : %v
MiningIncrement : %v
SeigniorageBurdenTarget : %s
MiningIncrement : %s

WindowShort : %v
WindowLong : %v
WindowShort : %d
WindowLong : %d
`, params.TaxPolicy, params.RewardPolicy, params.SeigniorageBurdenTarget,
params.MiningIncrement, params.WindowShort, params.WindowLong)
}