mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'fix/89-available-liquidity' into 'master'
Fixes #89 Closes #89 See merge request aave-tech/protocol-v2!103
This commit is contained in:
commit
2ac63ef16d
|
@ -882,6 +882,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
);
|
||||
|
||||
ValidationLogic.validateBorrow(
|
||||
vars.asset,
|
||||
reserve,
|
||||
vars.onBehalfOf,
|
||||
vars.amount,
|
||||
|
|
|
@ -104,6 +104,7 @@ library ValidationLogic {
|
|||
|
||||
/**
|
||||
* @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 userAddress the address of the user
|
||||
* @param amount the amount to be borrowed
|
||||
|
@ -117,6 +118,7 @@ library ValidationLogic {
|
|||
*/
|
||||
|
||||
function validateBorrow(
|
||||
address asset,
|
||||
ReserveLogic.ReserveData storage reserve,
|
||||
address userAddress,
|
||||
uint256 amount,
|
||||
|
@ -203,6 +205,8 @@ library ValidationLogic {
|
|||
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
|
||||
//available liquidity
|
||||
uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(maxStableLoanPercent);
|
||||
|
|
Loading…
Reference in New Issue
Block a user