From f9f9fb89bd5101cb7445659edde8497fc9fcec09 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 12:05:10 +0530 Subject: [PATCH] fix --- x/amm/keeper/query_pool.go | 5 ++++- x/amm/keeper/update_pool_for_swap.go | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/x/amm/keeper/query_pool.go b/x/amm/keeper/query_pool.go index 4623940d1..945730fc4 100644 --- a/x/amm/keeper/query_pool.go +++ b/x/amm/keeper/query_pool.go @@ -18,7 +18,10 @@ func (k Keeper) PoolExtraInfo(ctx sdk.Context, pool types.Pool) types.PoolExtraI tvl, _ := pool.TVL(ctx, k.oracleKeeper, k.accountedPoolKeeper) lpTokenPrice, _ := pool.LpTokenPrice(ctx, k.oracleKeeper, k.accountedPoolKeeper) avg := k.GetWeightBreakingSlippageAvg(ctx, pool.PoolId) - apr := avg.Mul(math.LegacyNewDec(52)).Quo(tvl) + apr := math.LegacyZeroDec() + if tvl.IsPositive() { + apr = avg.Mul(math.LegacyNewDec(52)).Quo(tvl) + } return types.PoolExtraInfo{ Tvl: tvl, LpTokenPrice: lpTokenPrice, diff --git a/x/amm/keeper/update_pool_for_swap.go b/x/amm/keeper/update_pool_for_swap.go index 5da440793..f11a111e4 100644 --- a/x/amm/keeper/update_pool_for_swap.go +++ b/x/amm/keeper/update_pool_for_swap.go @@ -113,7 +113,6 @@ func (k Keeper) UpdatePoolForSwap( return err } - // TODO: Some issue in weight breaking fee amount as we already multiply it k.TrackWeightBreakingSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenIn.Denom, weightRecoveryFeeAmount)) }