From efeb3734ed7e5c36d6cac259743222839f33fc2d Mon Sep 17 00:00:00 2001 From: Marc Puig Date: Tue, 23 Jan 2024 15:41:40 +0100 Subject: [PATCH] fix: Remove magic numbers (#743) * remove magic numbers * move to keys --- x/liquidstakeibc/keeper/keeper.go | 2 +- x/liquidstakeibc/types/keys.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/x/liquidstakeibc/keeper/keeper.go b/x/liquidstakeibc/keeper/keeper.go index 3d00e10a6..ba908427b 100644 --- a/x/liquidstakeibc/keeper/keeper.go +++ b/x/liquidstakeibc/keeper/keeper.go @@ -345,7 +345,7 @@ func (k *Keeper) CValueWithinLimits(hc *types.HostChain) bool { } func (k *Keeper) CalculateAutocompoundLimit(autocompoundFactor sdk.Dec) sdk.Dec { - return autocompoundFactor.Quo(sdk.NewDec(100)).Quo(sdk.NewDec(365)) + return autocompoundFactor.Quo(sdk.NewDec(types.Percentage)).Quo(sdk.NewDec(types.DaysInYear)) } // Hooks gets the hooks for liquidstakeibc *Keeper { diff --git a/x/liquidstakeibc/types/keys.go b/x/liquidstakeibc/types/keys.go index 5814973bc..5d85cab7d 100644 --- a/x/liquidstakeibc/types/keys.go +++ b/x/liquidstakeibc/types/keys.go @@ -56,6 +56,10 @@ const ( UnbondingStateEpochLimit = 4 LSMDepositFilterLimit = 10000 + + Percentage int64 = 100 + + DaysInYear int64 = 365 ) // Consts for KV updates, update host chain