Skip to content

Commit

Permalink
fix: throw error if asset price not set in leverage lp keeper position (
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond authored Jul 8, 2024
1 parent 349d0d7 commit 9124b75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/leveragelp/keeper/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())))
Expand Down

0 comments on commit 9124b75

Please sign in to comment.