mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: supply cap now by default disabled
This commit is contained in:
parent
f30d5baf8e
commit
62f3f47b84
|
@ -44,13 +44,15 @@ library ValidationLogic {
|
||||||
DataTypes.ReserveConfigurationMap memory reserveConfiguration = reserve.configuration;
|
DataTypes.ReserveConfigurationMap memory reserveConfiguration = reserve.configuration;
|
||||||
(bool isActive, bool isFrozen, , ) = reserveConfiguration.getFlagsMemory();
|
(bool isActive, bool isFrozen, , ) = reserveConfiguration.getFlagsMemory();
|
||||||
(, , , uint256 reserveDecimals, ) = reserveConfiguration.getParamsMemory();
|
(, , , uint256 reserveDecimals, ) = reserveConfiguration.getParamsMemory();
|
||||||
|
uint256 supplyCap = reserveConfiguration.getSupplyCapMemory();
|
||||||
|
|
||||||
require(amount != 0, Errors.VL_INVALID_AMOUNT);
|
require(amount != 0, Errors.VL_INVALID_AMOUNT);
|
||||||
require(isActive, Errors.VL_NO_ACTIVE_RESERVE);
|
require(isActive, Errors.VL_NO_ACTIVE_RESERVE);
|
||||||
require(!isFrozen, Errors.VL_RESERVE_FROZEN);
|
require(!isFrozen, Errors.VL_RESERVE_FROZEN);
|
||||||
require(
|
require(
|
||||||
|
supplyCap == 0 ||
|
||||||
IERC20(reserve.aTokenAddress).totalSupply().add(amount).div(10**reserveDecimals) <
|
IERC20(reserve.aTokenAddress).totalSupply().add(amount).div(10**reserveDecimals) <
|
||||||
reserveConfiguration.getSupplyCapMemory(),
|
supplyCap,
|
||||||
Errors.VL_SUPPLY_CAP_EXCEEDED
|
Errors.VL_SUPPLY_CAP_EXCEEDED
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -84,6 +86,7 @@ library ValidationLogic {
|
||||||
uint256 totalSupplyStableDebt;
|
uint256 totalSupplyStableDebt;
|
||||||
uint256 totalSupplyVariableDebt;
|
uint256 totalSupplyVariableDebt;
|
||||||
uint256 reserveDecimals;
|
uint256 reserveDecimals;
|
||||||
|
uint256 borrowCap;
|
||||||
bool isActive;
|
bool isActive;
|
||||||
bool isFrozen;
|
bool isFrozen;
|
||||||
bool borrowingEnabled;
|
bool borrowingEnabled;
|
||||||
|
@ -145,13 +148,15 @@ library ValidationLogic {
|
||||||
);
|
);
|
||||||
|
|
||||||
vars.totalSupplyStableDebt = IERC20(reserve.stableDebtTokenAddress).totalSupply();
|
vars.totalSupplyStableDebt = IERC20(reserve.stableDebtTokenAddress).totalSupply();
|
||||||
|
vars.borrowCap = reserveConfiguration.getBorrowCapMemory();
|
||||||
vars.totalSupplyVariableDebt = IERC20(reserve.variableDebtTokenAddress).totalSupply();
|
vars.totalSupplyVariableDebt = IERC20(reserve.variableDebtTokenAddress).totalSupply();
|
||||||
|
|
||||||
require(
|
require(
|
||||||
|
vars.borrowCap == 0 ||
|
||||||
vars.totalSupplyStableDebt.add(vars.totalSupplyVariableDebt).add(amount).div(
|
vars.totalSupplyStableDebt.add(vars.totalSupplyVariableDebt).add(amount).div(
|
||||||
10**vars.reserveDecimals
|
10**vars.reserveDecimals
|
||||||
) < reserveConfiguration.getBorrowCapMemory(),
|
) <
|
||||||
|
vars.borrowCap,
|
||||||
Errors.VL_BORROW_CAP_EXCEEDED
|
Errors.VL_BORROW_CAP_EXCEEDED
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user