- Fixed non-initialized availableLiquidity on validateBorrow()

This commit is contained in:
eboado 2020-10-28 11:48:55 +01:00
parent 1cd7f2d5a0
commit 3f714b9dc8
2 changed files with 5 additions and 0 deletions

View File

@ -844,6 +844,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
); );
ValidationLogic.validateBorrow( ValidationLogic.validateBorrow(
vars.asset,
reserve, reserve,
vars.onBehalfOf, vars.onBehalfOf,
vars.amount, vars.amount,

View File

@ -99,6 +99,7 @@ library ValidationLogic {
/** /**
* @dev validates a borrow. * @dev validates a borrow.
* @param asset the address of the asset to borrow
* @param reserve the reserve state from which the user is borrowing * @param reserve the reserve state from which the user is borrowing
* @param userAddress the address of the user * @param userAddress the address of the user
* @param amount the amount to be borrowed * @param amount the amount to be borrowed
@ -112,6 +113,7 @@ library ValidationLogic {
*/ */
function validateBorrow( function validateBorrow(
address asset,
ReserveLogic.ReserveData storage reserve, ReserveLogic.ReserveData storage reserve,
address userAddress, address userAddress,
uint256 amount, uint256 amount,
@ -198,6 +200,8 @@ library ValidationLogic {
Errors.CALLATERAL_SAME_AS_BORROWING_CURRENCY Errors.CALLATERAL_SAME_AS_BORROWING_CURRENCY
); );
vars.availableLiquidity = IERC20(asset).balanceOf(reserve.aTokenAddress);
//calculate the max available loan size in stable rate mode as a percentage of the //calculate the max available loan size in stable rate mode as a percentage of the
//available liquidity //available liquidity
uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(maxStableLoanPercent); uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(maxStableLoanPercent);