From 9124b75a14390ad8480c02417d47daeac41be9ca Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:56:56 +0200 Subject: [PATCH] fix: throw error if asset price not set in leverage lp keeper position (#643) --- x/leveragelp/keeper/position.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x/leveragelp/keeper/position.go b/x/leveragelp/keeper/position.go index 774bd2d00..ebcd6e9c0 100644 --- a/x/leveragelp/keeper/position.go +++ b/x/leveragelp/keeper/position.go @@ -276,7 +276,10 @@ func (k Keeper) GetPositionsForAddress(ctx sdk.Context, positionAddress sdk.Addr k.cdc.MustUnmarshal(value, &p) var positionAndInterest types.PositionAndInterest positionAndInterest.Position = &p - price, _ := k.oracleKeeper.GetAssetPrice(ctx, p.Collateral.Denom) + price, found := k.oracleKeeper.GetAssetPrice(ctx, p.Collateral.Denom) + if !found { + return fmt.Errorf("asset price not set: %s", price.Asset) + } interestRateHour := params.InterestRate.Quo(hours) positionAndInterest.InterestRateHour = interestRateHour positionAndInterest.InterestRateHourUsd = interestRateHour.Mul(cosmosMath.LegacyDec(p.Liabilities.Mul(price.Price.RoundInt())))