From 758675c132ae74fb99b2bb293ecd193159d3fd91 Mon Sep 17 00:00:00 2001 From: The3D Date: Wed, 30 Sep 2020 17:59:47 +0200 Subject: [PATCH] Fixes tests --- .../LendingPoolCollateralManager.sol | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/contracts/lendingpool/LendingPoolCollateralManager.sol b/contracts/lendingpool/LendingPoolCollateralManager.sol index 75f4f659..bfec17cd 100644 --- a/contracts/lendingpool/LendingPoolCollateralManager.sol +++ b/contracts/lendingpool/LendingPoolCollateralManager.sol @@ -238,12 +238,15 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor principalReserve.variableBorrowIndex ); } else { - IVariableDebtToken(principalReserve.variableDebtTokenAddress).burn( - user, - vars.userVariableDebt, - principalReserve.variableBorrowIndex - ); - + //if the user does not have variable debt, no need to try to burn variable + //debt tokens + if (vars.userVariableDebt > 0) { + IVariableDebtToken(principalReserve.variableDebtTokenAddress).burn( + user, + vars.userVariableDebt, + principalReserve.variableBorrowIndex + ); + } IStableDebtToken(principalReserve.stableDebtTokenAddress).burn( user, vars.actualAmountToLiquidate.sub(vars.userVariableDebt) @@ -412,7 +415,11 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor vars.actualAmountToLiquidate, 0 ); - IERC20(principal).safeTransferFrom(receiver, vars.principalAToken, vars.actualAmountToLiquidate); + IERC20(principal).safeTransferFrom( + receiver, + vars.principalAToken, + vars.actualAmountToLiquidate + ); if (vars.userVariableDebt >= vars.actualAmountToLiquidate) { IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn(