Skip to content

Commit

Permalink
Merge pull request #382 from comdex-official/feature/dev
Browse files Browse the repository at this point in the history
Feature/dev
  • Loading branch information
dheerajkd30 authored Aug 5, 2022
2 parents 6f1dd16 + 9d2fe3f commit 765f866
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 765f866

Please sign in to comment.