feat: added exposure cap == 0 means no exposure cap

This commit is contained in:
Hadrien Charlanes 2021-06-03 16:33:26 +02:00
parent 129a96a3cf
commit 485a41a0ef

View File

@ -116,6 +116,7 @@ library GenericLogic {
vars.totalCollateralInETH = vars.totalCollateralInETH.add(vars.userBalanceETH);
vars.exposureCap = currentReserve.configuration.getExposureCap();
vars.exposureCapped =
vars.exposureCap != 0 &&
IERC20(currentReserve.aTokenAddress).totalSupply().div(10**vars.decimals) >
vars.exposureCap;
vars.avgLtv = vars.avgLtv.add(vars.exposureCapped ? 0 : vars.userBalanceETH.mul(vars.ltv));