diff --git a/x/liquidity/keeper/rewards.go b/x/liquidity/keeper/rewards.go index 8d297ef05..3054cb7b6 100644 --- a/x/liquidity/keeper/rewards.go +++ b/x/liquidity/keeper/rewards.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "math" "strconv" "time" @@ -169,6 +170,10 @@ func (k Keeper) GetFarmingRewardsData(ctx sdk.Context, appID uint64, coinsToDist pair := deserializerKit.Pair pool := deserializerKit.Pool + if pool.Disabled { + return nil, sdkerrors.Wrap(types.ErrDisabledPool, fmt.Sprintf("pool is disabled : %d", pool.Id)) + } + asset, err := k.GetAssetWhoseOraclePriceExists(ctx, pair.QuoteCoinDenom, pair.BaseCoinDenom) if err != nil { return nil, err diff --git a/x/rewards/keeper/gauge.go b/x/rewards/keeper/gauge.go index d36965b82..e0a6f1577 100644 --- a/x/rewards/keeper/gauge.go +++ b/x/rewards/keeper/gauge.go @@ -95,10 +95,13 @@ func (k Keeper) ValidateMsgCreateGaugeLiquidityMetaData(ctx sdk.Context, appID u if poolID == kind.LiquidityMetaData.PoolId { return sdkerrors.Wrap(types.ErrSamePoolID, fmt.Sprintf("pool id : %d", poolID)) } - _, found := k.liquidityKeeper.GetPool(ctx, appID, poolID) + pool, found := k.liquidityKeeper.GetPool(ctx, appID, poolID) if !found { return sdkerrors.Wrap(types.ErrInvalidPoolID, fmt.Sprintf("invalid child pool id : %d", poolID)) } + if pool.Disabled { + return sdkerrors.Wrap(types.ErrDisabledPool, fmt.Sprintf("pool is disabled : %d", poolID)) + } } return nil diff --git a/x/rewards/types/errors.go b/x/rewards/types/errors.go index f8c38526e..93c6d7f09 100644 --- a/x/rewards/types/errors.go +++ b/x/rewards/types/errors.go @@ -27,4 +27,5 @@ var ( ErrInvalidAppID = sdkerrors.Register(ModuleName, 1117, "invalid app id") ErrInternalRewardsNotFound = sdkerrors.Register(ModuleName, 1118, "Internal rewards not found") ErrStablemintVaultFound = sdkerrors.Register(ModuleName, 1119, "Can't give reward to stablemint vault") + ErrDisabledPool = sdkerrors.Register(ModuleName, 1120, "diabled pool") )