Skip to content

Commit

Permalink
fix: Add checks to turn off borrowing.
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Jan 11, 2022
1 parent c3f9fa8 commit f9ec711
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contracts/protocol/libraries/logic/LiquidationLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ library LiquidationLogic {
vars.actualDebtToLiquidate,
vars.debtReserveCache.nextVariableBorrowIndex
);
if (vars.userStableDebt == 0 && vars.userVariableDebt == vars.actualDebtToLiquidate) {
userConfig.setBorrowing(debtReserve.id, false);
}
} else {
// If the user doesn't have variable debt, no need to try to burn variable debt tokens
if (vars.userVariableDebt > 0) {
Expand All @@ -208,6 +211,10 @@ library LiquidationLogic {
params.user,
vars.actualDebtToLiquidate - vars.userVariableDebt
);
if (vars.userStableDebt == vars.actualDebtToLiquidate - vars.userVariableDebt) {
// all variable debt is already burned here
userConfig.setBorrowing(debtReserve.id, false);
}
}
debtReserve.updateInterestRates(
vars.debtReserveCache,
Expand Down

0 comments on commit f9ec711

Please sign in to comment.