mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Fixed non-initialized availableLiquidity on validateBorrow()
This commit is contained in:
parent
1cd7f2d5a0
commit
3f714b9dc8
|
@ -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,
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user