Skip to content

Commit

Permalink
Merge pull request #381 from comdex-official/feature/lend_refactor
Browse files Browse the repository at this point in the history
Feature/lend refactor
  • Loading branch information
dheerajkd30 authored Aug 5, 2022
2 parents ce98d74 + 42fc641 commit 9d2fe3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x/liquidation/keeper/liquidate_borrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func (k Keeper) LiquidateBorrows(ctx sdk.Context) error {
liqThreshold, _ := k.GetAssetRatesStats(ctx, lendPair.AssetIn)
liqThresholdBridgedAssetOne, _ := k.GetAssetRatesStats(ctx, pool.FirstBridgedAssetID)
liqThresholdBridgedAssetTwo, _ := k.GetAssetRatesStats(ctx, pool.SecondBridgedAssetID)
k.UpdateBorrowStats(ctx, lendPair, borrowPos, borrowPos.AmountOut.Amount, false)

if borrowPos.BridgedAssetAmount.Amount.Equal(sdk.ZeroInt()) {
currentCollateralizationRatio, _ = k.CalculateLendCollaterlizationRatio(ctx, borrowPos.AmountIn.Amount, assetIn, borrowPos.UpdatedAmountOut, assetOut)
Expand All @@ -38,6 +37,7 @@ func (k Keeper) LiquidateBorrows(ctx sdk.Context) error {
if err != nil {
continue
}
k.UpdateBorrowStats(ctx, lendPair, borrowPos, borrowPos.AmountOut.Amount, false)
k.DeleteBorrow(ctx, v)
err = k.UpdateUserBorrowIDMapping(ctx, lendPos.Owner, v, false)
if err != nil {
Expand All @@ -63,6 +63,7 @@ func (k Keeper) LiquidateBorrows(ctx sdk.Context) error {
if err != nil {
continue
}
k.UpdateBorrowStats(ctx, lendPair, borrowPos, borrowPos.AmountOut.Amount, false)
k.DeleteBorrow(ctx, v)
err = k.UpdateUserBorrowIDMapping(ctx, lendPos.Owner, v, false)
if err != nil {
Expand All @@ -86,6 +87,7 @@ func (k Keeper) LiquidateBorrows(ctx sdk.Context) error {
if err != nil {
continue
}
k.UpdateBorrowStats(ctx, lendPair, borrowPos, borrowPos.AmountOut.Amount, false)
k.DeleteBorrow(ctx, v)
err = k.UpdateUserBorrowIDMapping(ctx, lendPos.Owner, v, false)
if err != nil {
Expand Down

0 comments on commit 9d2fe3f

Please sign in to comment.