Skip to content

Commit

Permalink
fetched rewards changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed Nov 6, 2023
2 parents 39bfc6f + a462dd3 commit 57a60f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions x/liquidity/keeper/rewards.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
"fmt"
"math"
"strconv"
"time"
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion x/rewards/keeper/gauge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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")
)

0 comments on commit 57a60f6

Please sign in to comment.