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 userBorrowBalanceETH;
|
||||||
uint256 availableLiquidity;
|
uint256 availableLiquidity;
|
||||||
uint256 healthFactor;
|
uint256 healthFactor;
|
||||||
|
uint256 totalSupplyStableDebt;
|
||||||
|
uint256 totalSupplyVariableDebt;
|
||||||
bool isActive;
|
bool isActive;
|
||||||
bool isFrozen;
|
bool isFrozen;
|
||||||
bool borrowingEnabled;
|
bool borrowingEnabled;
|
||||||
|
@ -152,17 +154,18 @@ library ValidationLogic {
|
||||||
Errors.VL_INVALID_INTEREST_RATE_MODE_SELECTED
|
Errors.VL_INVALID_INTEREST_RATE_MODE_SELECTED
|
||||||
);
|
);
|
||||||
|
|
||||||
// not using this because stack too deep
|
(vars.totalSupplyStableDebt, ) = IStableDebtToken(reserve.stableDebtTokenAddress)
|
||||||
// uint256 totalStableDebt;
|
.getTotalSupplyAndAvgRate();
|
||||||
// (totalStableDebt, ) = IStableDebtToken(reserve.stableDebtTokenAddress)
|
|
||||||
// .getTotalSupplyAndAvgRate();
|
vars.totalSupplyVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress)
|
||||||
|
.scaledTotalSupply()
|
||||||
|
.rayMul(reserve.variableBorrowIndex);
|
||||||
|
|
||||||
|
|
||||||
require(
|
require(
|
||||||
IERC20(reserve.stableDebtTokenAddress).totalSupply()
|
vars.totalSupplyStableDebt
|
||||||
.add(IVariableDebtToken(reserve.variableDebtTokenAddress)
|
.add(vars.totalSupplyVariableDebt)
|
||||||
.scaledTotalSupply()
|
.add(amount)
|
||||||
.rayMul(reserve.variableBorrowIndex)
|
|
||||||
).add(amount)
|
|
||||||
< reserve.configuration.getBorrowCap(),
|
< reserve.configuration.getBorrowCap(),
|
||||||
Errors.VL_BORROW_CAP_EXCEEDED);
|
Errors.VL_BORROW_CAP_EXCEEDED);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user