Skip to content

Commit

Permalink
[Leveragelp]: Fix asset not found (#658)
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
amityadav0 authored Jul 17, 2024
1 parent f2891c6 commit d8fa76e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions x/leveragelp/keeper/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,10 @@ func (k Keeper) GetPositionsForAddress(ctx sdk.Context, positionAddress sdk.Addr
k.cdc.MustUnmarshal(value, &p)
var positionAndInterest types.PositionAndInterest
positionAndInterest.Position = &p
price, found := k.oracleKeeper.GetAssetPrice(ctx, p.Collateral.Denom)
if !found {
return fmt.Errorf("asset price not set: %s", price.Asset)
}
price := k.oracleKeeper.GetAssetPriceFromDenom(ctx, p.Collateral.Denom)
interestRateHour := params.InterestRate.Quo(hours)
positionAndInterest.InterestRateHour = interestRateHour
positionAndInterest.InterestRateHourUsd = interestRateHour.Mul(cosmosMath.LegacyDec(p.Liabilities.Mul(price.Price.RoundInt())))
positionAndInterest.InterestRateHourUsd = interestRateHour.Mul(cosmosMath.LegacyDec(p.Liabilities.Mul(price.RoundInt())))
debt := k.stableKeeper.UpdateInterestStackedByAddress(ctx, positionAndInterest.Position.GetPositionAddress())
positionAndInterest.Position.Liabilities = debt.Borrowed.Add(debt.InterestStacked).Sub(debt.InterestPaid)
positions = append(positions, &positionAndInterest)
Expand Down

0 comments on commit d8fa76e

Please sign in to comment.