From 5fdf23a2bae2fcc19fc3cfcd4c9ae70b0086609d Mon Sep 17 00:00:00 2001 From: Denali Marsh Date: Tue, 13 Oct 2020 16:37:46 +0200 Subject: [PATCH] fix claim query: owner && depositType (#687) --- x/harvest/keeper/querier.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/x/harvest/keeper/querier.go b/x/harvest/keeper/querier.go index 5c14019a..a6a7e3bb 100644 --- a/x/harvest/keeper/querier.go +++ b/x/harvest/keeper/querier.go @@ -188,16 +188,20 @@ func queryGetClaims(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, e }) case owner && depositType: harvestParams := k.GetParams(ctx) - for _, lps := range harvestParams.LiquidityProviderSchedules { - claim, found := k.GetClaim(ctx, params.Owner, lps.DepositDenom, params.DepositType) - if found { - claims = append(claims, claim) + switch { + case params.DepositType == types.LP: + for _, lps := range harvestParams.LiquidityProviderSchedules { + claim, found := k.GetClaim(ctx, params.Owner, lps.DepositDenom, params.DepositType) + if found { + claims = append(claims, claim) + } } - } - for _, dss := range harvestParams.DelegatorDistributionSchedules { - claim, found := k.GetClaim(ctx, params.Owner, dss.DistributionSchedule.DepositDenom, params.DepositType) - if found { - claims = append(claims, claim) + case params.DepositType == types.Stake: + for _, dss := range harvestParams.DelegatorDistributionSchedules { + claim, found := k.GetClaim(ctx, params.Owner, dss.DistributionSchedule.DepositDenom, params.DepositType) + if found { + claims = append(claims, claim) + } } } case depositDenom: