Skip to content

Commit

Permalink
Merge pull request #437 from comdex-official/bug_fix
Browse files Browse the repository at this point in the history
Exclude disabled pools from child pools
  • Loading branch information
dheerajkd30 authored Sep 6, 2022
2 parents e0403de + 7f6a233 commit 9b1bf56
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x/liquidity/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ func (k Querier) PoolIncentives(c context.Context, req *types.QueryPoolsIncentiv
if len(gauge.GetLiquidityMetaData().ChildPoolIds) == 0 {
pools := k.GetAllPools(ctx, req.AppId)
for _, pool := range pools {
if pool.Id != gauge.GetLiquidityMetaData().PoolId {
if pool.Id != gauge.GetLiquidityMetaData().PoolId && !pool.Disabled {
childPoolIds = append(childPoolIds, pool.Id)
}
}
Expand Down
2 changes: 1 addition & 1 deletion x/liquidity/keeper/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (k Keeper) GetFarmingRewardsData(ctx sdk.Context, appID uint64, coinsToDist
if len(liquidityGaugeData.ChildPoolIds) == 0 {
pools := k.GetAllPools(ctx, appID)
for _, pool := range pools {
if pool.Id != liquidityGaugeData.PoolId {
if pool.Id != liquidityGaugeData.PoolId && !pool.Disabled {
childPoolIds = append(childPoolIds, pool.Id)
}
}
Expand Down
3 changes: 3 additions & 0 deletions x/rewards/keeper/gauge.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func (k Keeper) ValidateMsgCreateGaugeLiquidityMetaData(ctx sdk.Context, appID u

childPoolIds := kind.LiquidityMetaData.ChildPoolIds
for _, poolID := range childPoolIds {
if poolID == kind.LiquidityMetaData.PoolId {
return sdkerrors.Wrap(types.ErrSamePoolID, fmt.Sprintf("pool id : %d", poolID))
}
_, found := k.liquidityKeeper.GetPool(ctx, appID, poolID)
if !found {
return sdkerrors.Wrap(types.ErrInvalidPoolID, fmt.Sprintf("invalid child pool id : %d", poolID))
Expand Down
1 change: 1 addition & 0 deletions x/rewards/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
ErrNoGaugeForDuration = sdkerrors.Register(ModuleName, 8, "no gauges found for given duration")
ErrDepositSmallThanEpoch = sdkerrors.Register(ModuleName, 9, "deposit amount smaller than total epochs/triggers")
ErrInvalidCalculatedAMount = sdkerrors.Register(ModuleName, 10, "available distribution coins smaller than calculated distribution amount")
ErrSamePoolID = sdkerrors.Register(ModuleName, 11, "same pool id cannot exists in child pool ids")

ErrAssetIDDoesNotExist = sdkerrors.Register(ModuleName, 1101, "Asset Id does not exist in locker for App_Mapping")
ErrNegativeTimeElapsed = sdkerrors.Register(ModuleName, 1102, "negative time elapsed since last interest time")
Expand Down

0 comments on commit 9b1bf56

Please sign in to comment.