refactor: created separate function to get Reserve Borrow cap, so interface for getReserveConfiguration remains identical

This commit is contained in:
Hadrien Charlanes 2021-04-26 09:17:02 +02:00
parent 4ce1bfcb8c
commit a869be648b

View File

@ -73,7 +73,6 @@ contract AaveProtocolDataProvider {
uint256 liquidationThreshold, uint256 liquidationThreshold,
uint256 liquidationBonus, uint256 liquidationBonus,
uint256 reserveFactor, uint256 reserveFactor,
uint256 borrowCap,
bool usageAsCollateralEnabled, bool usageAsCollateralEnabled,
bool borrowingEnabled, bool borrowingEnabled,
bool stableBorrowRateEnabled, bool stableBorrowRateEnabled,
@ -81,19 +80,28 @@ contract AaveProtocolDataProvider {
bool isFrozen bool isFrozen
) )
{ {
DataTypes.ReserveConfigurationMap memory configuration =
ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getConfiguration(asset);
(ltv, liquidationThreshold, liquidationBonus, decimals, reserveFactor, ) = (ltv, liquidationThreshold, liquidationBonus, decimals, reserveFactor, ) =
ILendingPool(ADDRESSES_PROVIDER.getLendingPool()) configuration.getParamsMemory();
.getConfiguration(asset)
.getParamsMemory();
(isActive, isFrozen, borrowingEnabled, stableBorrowRateEnabled) = (isActive, isFrozen, borrowingEnabled, stableBorrowRateEnabled) =
ILendingPool(ADDRESSES_PROVIDER.getLendingPool()) configuration.getFlagsMemory();
.getConfiguration(asset)
.getFlagsMemory();
usageAsCollateralEnabled = liquidationThreshold > 0; usageAsCollateralEnabled = liquidationThreshold > 0;
} }
function getReserveBorrowCap(address asset)
external
view
returns (uint256 borrowCap) {
(, , , , , borrowCap) = ILendingPool(ADDRESSES_PROVIDER.getLendingPool())
.getConfiguration(asset)
.getParamsMemory();
}
function getReserveData(address asset) function getReserveData(address asset)
external external
view view