mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
refactor: fixed stack too deep
This commit is contained in:
parent
03103fb63d
commit
7e02877966
|
@ -98,6 +98,8 @@ library ValidationLogic {
|
|||
uint256 userBorrowBalanceETH;
|
||||
uint256 availableLiquidity;
|
||||
uint256 healthFactor;
|
||||
uint256 totalSupplyStableDebt;
|
||||
uint256 totalSupplyVariableDebt;
|
||||
bool isActive;
|
||||
bool isFrozen;
|
||||
bool borrowingEnabled;
|
||||
|
@ -152,17 +154,18 @@ library ValidationLogic {
|
|||
Errors.VL_INVALID_INTEREST_RATE_MODE_SELECTED
|
||||
);
|
||||
|
||||
// not using this because stack too deep
|
||||
// uint256 totalStableDebt;
|
||||
// (totalStableDebt, ) = IStableDebtToken(reserve.stableDebtTokenAddress)
|
||||
// .getTotalSupplyAndAvgRate();
|
||||
(vars.totalSupplyStableDebt, ) = IStableDebtToken(reserve.stableDebtTokenAddress)
|
||||
.getTotalSupplyAndAvgRate();
|
||||
|
||||
vars.totalSupplyVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress)
|
||||
.scaledTotalSupply()
|
||||
.rayMul(reserve.variableBorrowIndex);
|
||||
|
||||
|
||||
require(
|
||||
IERC20(reserve.stableDebtTokenAddress).totalSupply()
|
||||
.add(IVariableDebtToken(reserve.variableDebtTokenAddress)
|
||||
.scaledTotalSupply()
|
||||
.rayMul(reserve.variableBorrowIndex)
|
||||
).add(amount)
|
||||
vars.totalSupplyStableDebt
|
||||
.add(vars.totalSupplyVariableDebt)
|
||||
.add(amount)
|
||||
< reserve.configuration.getBorrowCap(),
|
||||
Errors.VL_BORROW_CAP_EXCEEDED);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user