From da98ec951d6d1f66e6469467889951be477cccb2 Mon Sep 17 00:00:00 2001 From: emidev98 Date: Tue, 31 Oct 2023 09:13:30 +0200 Subject: [PATCH] fix: var shadowing --- .../provider/alliance/alliance_protocols_info.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/provider/alliance/alliance_protocols_info.go b/internal/provider/alliance/alliance_protocols_info.go index a3c24e9..e769d66 100644 --- a/internal/provider/alliance/alliance_protocols_info.go +++ b/internal/provider/alliance/alliance_protocols_info.go @@ -280,15 +280,21 @@ func calculateNormalizedRewardWeight( alliance alliancetypes.AllianceAsset, ) sdktypes.Dec { - // We shouldd consider that reward weight + // If alliance, is not initiated return zero. + if !alliance.IsInitialized { + return sdktypes.ZeroDec() + } + + // We should consider that reward weight // starts at one because it also takes in // consideration the OneDec. rewardsWeight := sdktypes.OneDec() for _, alliance := range alliances { // When an alliance is not initialized, it means that users are not - // receiving rewards so NormalizedRewardWeight is zero (right now). + // receiving rewards so NormalizedRewardWeight for this alliance shouldn't + // be considered. if !alliance.IsInitialized { - return sdktypes.ZeroDec() + continue } // If an alliance is not initialized it means that // rewards are not distributed to that alliance so