From 18fc7252b6b7f42589c027f6c97b397714bd6635 Mon Sep 17 00:00:00 2001 From: Hadrien Charlanes Date: Thu, 27 May 2021 08:02:41 +0200 Subject: [PATCH] feat: removed user updates on droped reserves --- contracts/protocol/libraries/logic/GenericLogic.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/protocol/libraries/logic/GenericLogic.sol b/contracts/protocol/libraries/logic/GenericLogic.sol index 381fe804..549328a8 100644 --- a/contracts/protocol/libraries/logic/GenericLogic.sol +++ b/contracts/protocol/libraries/logic/GenericLogic.sol @@ -93,6 +93,9 @@ library GenericLogic { } vars.currentReserveAddress = reserves[vars.i]; + + if (vars.currentReserveAddress == address(0)) continue; + DataTypes.ReserveData storage currentReserve = reservesData[vars.currentReserveAddress]; (vars.ltv, vars.liquidationThreshold, , vars.decimals, ) = currentReserve @@ -132,7 +135,7 @@ library GenericLogic { IERC20(currentReserve.stableDebtTokenAddress).balanceOf(user) ); vars.userDebtETH = vars.assetPrice.mul(vars.userDebt).div(vars.assetUnit); - vars.totalDebtInETH = vars.totalDebtInETH.add(vars.userDebtETH); + vars.totalDebtInETH = vars.totalDebtInETH.add(vars.userDebtETH); } }