diff --git a/contracts/protocol/libraries/logic/GenericLogic.sol b/contracts/protocol/libraries/logic/GenericLogic.sol index 395300ee..36d50fa2 100644 --- a/contracts/protocol/libraries/logic/GenericLogic.sol +++ b/contracts/protocol/libraries/logic/GenericLogic.sol @@ -116,10 +116,7 @@ library GenericLogic { vars.totalCollateralInETH = vars.totalCollateralInETH.add(vars.userBalanceETH); vars.exposureCap = currentReserve.configuration.getExposureCap(); vars.exposureCapped = - IERC20(currentReserve.stableDebtTokenAddress) - .totalSupply() - .add(IERC20(currentReserve.variableDebtTokenAddress).totalSupply()) - .div(10**vars.decimals) > + IERC20(currentReserve.aTokenAddress).totalSupply().div(10**vars.decimals) > vars.exposureCap; vars.avgLtv = vars.avgLtv.add(vars.exposureCapped ? 0 : vars.userBalanceETH.mul(vars.ltv)); vars.avgLiquidationThreshold = vars.avgLiquidationThreshold.add( diff --git a/contracts/protocol/libraries/logic/ValidationLogic.sol b/contracts/protocol/libraries/logic/ValidationLogic.sol index 14217e6d..fe72983b 100644 --- a/contracts/protocol/libraries/logic/ValidationLogic.sol +++ b/contracts/protocol/libraries/logic/ValidationLogic.sol @@ -467,8 +467,7 @@ library ValidationLogic { ); uint256 exposureCap = reserve.configuration.getExposureCapMemory(); - uint256 totalSupplyStableDebt = IERC20(reserve.stableDebtTokenAddress).totalSupply(); - uint256 totalSupplyVariableDebt = IERC20(reserve.variableDebtTokenAddress).totalSupply(); + uint256 totalSupplyAtoken = IERC20(reserve.aTokenAddress).totalSupply(); (, , , uint256 reserveDecimals, ) = reserve.configuration.getParamsMemory(); require( @@ -477,9 +476,7 @@ library ValidationLogic { ); require( - exposureCap == 0 || - ltv == 0 || - totalSupplyStableDebt.add(totalSupplyVariableDebt).div(10**reserveDecimals) < exposureCap, + exposureCap == 0 || ltv == 0 || totalSupplyAtoken.div(10**reserveDecimals) < exposureCap, Errors.VL_COLLATERAL_EXPOSURE_CAP_EXCEEDED ); }