fix claim query: owner && depositType (#687)

This commit is contained in:
Denali Marsh 2020-10-13 16:37:46 +02:00 committed by GitHub
parent 69eacdddb0
commit 5fdf23a2ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,18 +188,22 @@ func queryGetClaims(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, e
}) })
case owner && depositType: case owner && depositType:
harvestParams := k.GetParams(ctx) harvestParams := k.GetParams(ctx)
switch {
case params.DepositType == types.LP:
for _, lps := range harvestParams.LiquidityProviderSchedules { for _, lps := range harvestParams.LiquidityProviderSchedules {
claim, found := k.GetClaim(ctx, params.Owner, lps.DepositDenom, params.DepositType) claim, found := k.GetClaim(ctx, params.Owner, lps.DepositDenom, params.DepositType)
if found { if found {
claims = append(claims, claim) claims = append(claims, claim)
} }
} }
case params.DepositType == types.Stake:
for _, dss := range harvestParams.DelegatorDistributionSchedules { for _, dss := range harvestParams.DelegatorDistributionSchedules {
claim, found := k.GetClaim(ctx, params.Owner, dss.DistributionSchedule.DepositDenom, params.DepositType) claim, found := k.GetClaim(ctx, params.Owner, dss.DistributionSchedule.DepositDenom, params.DepositType)
if found { if found {
claims = append(claims, claim) claims = append(claims, claim)
} }
} }
}
case depositDenom: case depositDenom:
for _, dt := range types.DepositTypesClaimQuery { for _, dt := range types.DepositTypesClaimQuery {
k.IterateClaimsByTypeAndDenom(ctx, dt, params.DepositDenom, func(claim types.Claim) (stop bool) { k.IterateClaimsByTypeAndDenom(ctx, dt, params.DepositDenom, func(claim types.Claim) (stop bool) {