Skip to content

Commit 1bc019d

Browse files
authored
Issue 145 (#185)
Reorder the health check before closing liquidation window so fresh collateral amount is used
1 parent 1064b6a commit 1bc019d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

contracts/lendingPool/libraries/LiquidationLogic.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ library LiquidationLogic {
8383
ILender.RepayParams({ agent: params.agent, asset: params.asset, amount: liquidated, caller: params.caller })
8484
);
8585

86-
(,,,,, health) = ViewLogic.agent($, params.agent);
87-
if (health >= 1e27) _closeLiquidation($, params.agent);
88-
8986
liquidatedValue =
9087
(liquidated + (liquidated * bonus / 1e27)) * assetPrice / (10 ** $.reservesData[params.asset].decimals);
9188
if (totalSlashableCollateral < liquidatedValue) liquidatedValue = totalSlashableCollateral;
9289

9390
if (liquidatedValue > 0) IDelegation($.delegation).slash(params.agent, params.caller, liquidatedValue);
9491

92+
(,,,,, health) = ViewLogic.agent($, params.agent);
93+
if (health >= 1e27) _closeLiquidation($, params.agent);
94+
9595
emit Liquidate(params.agent, params.caller, params.asset, liquidated, liquidatedValue);
9696
}
9797

0 commit comments

Comments
 (0)