From 1a9b8514c925d48f0c980818b177cbe47e3bbca2 Mon Sep 17 00:00:00 2001 From: Kevin Davis Date: Thu, 28 Nov 2019 11:00:08 -0600 Subject: [PATCH] fix keys, return validation errors --- x/cdp/types/params.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/x/cdp/types/params.go b/x/cdp/types/params.go index 8cee7dcd..beed781f 100644 --- a/x/cdp/types/params.go +++ b/x/cdp/types/params.go @@ -13,6 +13,7 @@ var ( KeyGlobalDebtLimit = []byte("GlobalDebtLimit") KeyCollateralParams = []byte("CollateralParams") KeyDebtParams = []byte("DebtParams") + KeyCircuitBreaker = []byte("CircuitBreaker") DefaultGlobalDebt = sdk.Coins{} DefaultCircuitBreaker = false DefaultCollateralParams = CollateralParams{} @@ -117,9 +118,10 @@ func ParamKeyTable() params.KeyTable { // nolint func (p *Params) ParamSetPairs() params.ParamSetPairs { return params.ParamSetPairs{ - {KeyGlobalDebtLimit, &p.GlobalDebtLimit}, - {KeyCollateralParams, &p.CollateralParams}, - {KeyDebtParams, &p.DebtParams}, + {Key: KeyGlobalDebtLimit, Value: &p.GlobalDebtLimit}, + {Key: KeyCollateralParams, Value: &p.CollateralParams}, + {Key: KeyDebtParams, Value: &p.DebtParams}, + {Key: KeyCircuitBreaker, Value: &p.CircuitBreaker}, } } @@ -139,7 +141,7 @@ func (p Params) Validate() error { debtParamsDebtLimit = debtParamsDebtLimit.Add(dp.DebtLimit) } if debtParamsDebtLimit.IsAnyGT(p.GlobalDebtLimit) { - fmt.Errorf("debt limit exceeds global debt limit:\n\tglobal debt limit: %s\n\tdebt limits: %s", + return fmt.Errorf("debt limit exceeds global debt limit:\n\tglobal debt limit: %s\n\tdebt limits: %s", p.GlobalDebtLimit, debtParamsDebtLimit) } @@ -158,7 +160,7 @@ func (p Params) Validate() error { collateralParamsDebtLimit = collateralParamsDebtLimit.Add(cp.DebtLimit) } if collateralParamsDebtLimit.IsAnyGT(p.GlobalDebtLimit) { - fmt.Errorf("collateral debt limit exceeds global debt limit:\n\tglobal debt limit: %s\n\tcollateral debt limits: %s", + return fmt.Errorf("collateral debt limit exceeds global debt limit:\n\tglobal debt limit: %s\n\tcollateral debt limits: %s", p.GlobalDebtLimit, collateralParamsDebtLimit) }