mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge pull request #131 from aave/fix/130-refactor-lp-configurator
Add LendingPool Configurator refactor
This commit is contained in:
commit
93c0a9aae3
|
@ -190,4 +190,130 @@ interface ILendingPoolConfigurator {
|
||||||
address indexed proxy,
|
address indexed proxy,
|
||||||
address indexed implementation
|
address indexed implementation
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Initializes reserves in batch
|
||||||
|
* @param input The array of reserves initialization parameters
|
||||||
|
**/
|
||||||
|
function batchInitReserve(InitReserveInput[] calldata input) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Updates the aToken implementation for the reserve
|
||||||
|
* @param input The aToken update paramenters
|
||||||
|
**/
|
||||||
|
function updateAToken(UpdateATokenInput calldata input) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Updates the stable debt token implementation for the reserve
|
||||||
|
* @param input The stableDebtToken update parameters
|
||||||
|
**/
|
||||||
|
function updateStableDebtToken(UpdateDebtTokenInput calldata input) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Updates the variable debt token implementation for the asset
|
||||||
|
* @param input The variableDebtToken update parameters
|
||||||
|
**/
|
||||||
|
function updateVariableDebtToken(UpdateDebtTokenInput calldata input) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Enables borrowing on a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
* @param borrowCap The borrow cap for this specific asset, in absolute units of tokens
|
||||||
|
* @param stableBorrowRateEnabled True if stable borrow rate needs to be enabled by default on this reserve
|
||||||
|
**/
|
||||||
|
function enableBorrowingOnReserve(address asset, uint256 borrowCap, bool stableBorrowRateEnabled) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Disables borrowing on a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function disableBorrowingOnReserve(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Configures the reserve collateralization parameters
|
||||||
|
* all the values are expressed in percentages with two decimals of precision. A valid value is 10000, which means 100.00%
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
* @param ltv The loan to value of the asset when used as collateral
|
||||||
|
* @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
|
||||||
|
* @param liquidationBonus The bonus liquidators receive to liquidate this asset. The values is always above 100%. A value of 105%
|
||||||
|
* means the liquidator will receive a 5% bonus
|
||||||
|
**/
|
||||||
|
function configureReserveAsCollateral(
|
||||||
|
address asset,
|
||||||
|
uint256 ltv,
|
||||||
|
uint256 liquidationThreshold,
|
||||||
|
uint256 liquidationBonus
|
||||||
|
) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Enable stable rate borrowing on a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function enableReserveStableRate(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Disable stable rate borrowing on a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function disableReserveStableRate(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Activates a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function activateReserve(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Deactivates a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function deactivateReserve(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Freezes a reserve. A frozen reserve doesn't allow any new deposit, borrow or rate swap
|
||||||
|
* but allows repayments, liquidations, rate rebalances and withdrawals
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function freezeReserve(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Unfreezes a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
**/
|
||||||
|
function unfreezeReserve(address asset) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Updates the reserve factor of a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
* @param reserveFactor The new reserve factor of the reserve
|
||||||
|
**/
|
||||||
|
function setReserveFactor(address asset, uint256 reserveFactor) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Sets the interest rate strategy of a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
* @param rateStrategyAddress The new address of the interest strategy contract
|
||||||
|
**/
|
||||||
|
function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
|
||||||
|
external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev pauses or unpauses all the actions of the protocol, including aToken transfers
|
||||||
|
* @param val true if protocol needs to be paused, false otherwise
|
||||||
|
**/
|
||||||
|
function setPoolPause(bool val) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Updates the borrow cap of a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
* @param borrowCap The new borrow of the reserve
|
||||||
|
**/
|
||||||
|
function setBorrowCap(address asset, uint256 borrowCap) external;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Updates the supply cap of a reserve
|
||||||
|
* @param asset The address of the underlying asset of the reserve
|
||||||
|
* @param supplyCap The new supply of the reserve
|
||||||
|
**/
|
||||||
|
function setSupplyCap(address asset, uint256 supplyCap) external;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,17 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
using PercentageMath for uint256;
|
using PercentageMath for uint256;
|
||||||
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
|
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
|
||||||
|
|
||||||
ILendingPoolAddressesProvider internal addressesProvider;
|
ILendingPoolAddressesProvider internal _addressesProvider;
|
||||||
ILendingPool internal pool;
|
ILendingPool internal _pool;
|
||||||
|
|
||||||
modifier onlyPoolAdmin {
|
modifier onlyPoolAdmin {
|
||||||
require(addressesProvider.getPoolAdmin() == msg.sender, Errors.CALLER_NOT_POOL_ADMIN);
|
require(_addressesProvider.getPoolAdmin() == msg.sender, Errors.CALLER_NOT_POOL_ADMIN);
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier onlyEmergencyAdmin {
|
modifier onlyEmergencyAdmin {
|
||||||
require(
|
require(
|
||||||
addressesProvider.getEmergencyAdmin() == msg.sender,
|
_addressesProvider.getEmergencyAdmin() == msg.sender,
|
||||||
Errors.LPC_CALLER_NOT_EMERGENCY_ADMIN
|
Errors.LPC_CALLER_NOT_EMERGENCY_ADMIN
|
||||||
);
|
);
|
||||||
_;
|
_;
|
||||||
|
@ -53,15 +53,13 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize(ILendingPoolAddressesProvider provider) public initializer {
|
function initialize(ILendingPoolAddressesProvider provider) public initializer {
|
||||||
addressesProvider = provider;
|
_addressesProvider = provider;
|
||||||
pool = ILendingPool(addressesProvider.getLendingPool());
|
_pool = ILendingPool(_addressesProvider.getLendingPool());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Initializes reserves in batch
|
function batchInitReserve(InitReserveInput[] calldata input) external override onlyPoolAdmin {
|
||||||
**/
|
ILendingPool cachedPool = _pool;
|
||||||
function batchInitReserve(InitReserveInput[] calldata input) external onlyPoolAdmin {
|
|
||||||
ILendingPool cachedPool = pool;
|
|
||||||
for (uint256 i = 0; i < input.length; i++) {
|
for (uint256 i = 0; i < input.length; i++) {
|
||||||
_initReserve(cachedPool, input[i]);
|
_initReserve(cachedPool, input[i]);
|
||||||
}
|
}
|
||||||
|
@ -141,11 +139,9 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Updates the aToken implementation for the reserve
|
function updateAToken(UpdateATokenInput calldata input) external override onlyPoolAdmin {
|
||||||
**/
|
ILendingPool cachedPool = _pool;
|
||||||
function updateAToken(UpdateATokenInput calldata input) external onlyPoolAdmin {
|
|
||||||
ILendingPool cachedPool = pool;
|
|
||||||
|
|
||||||
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
|
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
|
||||||
|
|
||||||
|
@ -169,11 +165,13 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
|
emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Updates the stable debt token implementation for the reserve
|
function updateStableDebtToken(UpdateDebtTokenInput calldata input)
|
||||||
**/
|
external
|
||||||
function updateStableDebtToken(UpdateDebtTokenInput calldata input) external onlyPoolAdmin {
|
override
|
||||||
ILendingPool cachedPool = pool;
|
onlyPoolAdmin
|
||||||
|
{
|
||||||
|
ILendingPool cachedPool = _pool;
|
||||||
|
|
||||||
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
|
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
|
||||||
|
|
||||||
|
@ -204,11 +202,13 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Updates the variable debt token implementation for the asset
|
function updateVariableDebtToken(UpdateDebtTokenInput calldata input)
|
||||||
**/
|
external
|
||||||
function updateVariableDebtToken(UpdateDebtTokenInput calldata input) external onlyPoolAdmin {
|
override
|
||||||
ILendingPool cachedPool = pool;
|
onlyPoolAdmin
|
||||||
|
{
|
||||||
|
ILendingPool cachedPool = _pool;
|
||||||
|
|
||||||
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
|
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
|
||||||
|
|
||||||
|
@ -239,57 +239,42 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Enables borrowing on a reserve
|
|
||||||
* @param asset The address of the underlying asset of the reserve
|
|
||||||
* @param stableBorrowRateEnabled True if stable borrow rate needs to be enabled by default on this reserve
|
|
||||||
**/
|
|
||||||
function enableBorrowingOnReserve(
|
function enableBorrowingOnReserve(
|
||||||
address asset,
|
address asset,
|
||||||
uint256 borrowCap,
|
uint256 borrowCap,
|
||||||
bool stableBorrowRateEnabled
|
bool stableBorrowRateEnabled
|
||||||
) external onlyPoolAdmin {
|
) external override onlyPoolAdmin {
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
|
|
||||||
currentConfig.setBorrowingEnabled(true);
|
currentConfig.setBorrowingEnabled(true);
|
||||||
currentConfig.setBorrowCap(borrowCap);
|
currentConfig.setBorrowCap(borrowCap);
|
||||||
currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled);
|
currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit BorrowCapChanged(asset, borrowCap);
|
emit BorrowCapChanged(asset, borrowCap);
|
||||||
emit BorrowingEnabledOnReserve(asset, stableBorrowRateEnabled);
|
emit BorrowingEnabledOnReserve(asset, stableBorrowRateEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Disables borrowing on a reserve
|
function disableBorrowingOnReserve(address asset) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
**/
|
|
||||||
function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setBorrowingEnabled(false);
|
currentConfig.setBorrowingEnabled(false);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
emit BorrowingDisabledOnReserve(asset);
|
emit BorrowingDisabledOnReserve(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Configures the reserve collateralization parameters
|
|
||||||
* all the values are expressed in percentages with two decimals of precision. A valid value is 10000, which means 100.00%
|
|
||||||
* @param asset The address of the underlying asset of the reserve
|
|
||||||
* @param ltv The loan to value of the asset when used as collateral
|
|
||||||
* @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
|
|
||||||
* @param liquidationBonus The bonus liquidators receive to liquidate this asset. The values is always above 100%. A value of 105%
|
|
||||||
* means the liquidator will receive a 5% bonus
|
|
||||||
**/
|
|
||||||
function configureReserveAsCollateral(
|
function configureReserveAsCollateral(
|
||||||
address asset,
|
address asset,
|
||||||
uint256 ltv,
|
uint256 ltv,
|
||||||
uint256 liquidationThreshold,
|
uint256 liquidationThreshold,
|
||||||
uint256 liquidationBonus
|
uint256 liquidationBonus
|
||||||
) external onlyPoolAdmin {
|
) external override onlyPoolAdmin {
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
|
|
||||||
//validation of the parameters: the LTV can
|
//validation of the parameters: the LTV can
|
||||||
//only be lower or equal than the liquidation threshold
|
//only be lower or equal than the liquidation threshold
|
||||||
|
@ -322,139 +307,108 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
currentConfig.setLiquidationThreshold(liquidationThreshold);
|
currentConfig.setLiquidationThreshold(liquidationThreshold);
|
||||||
currentConfig.setLiquidationBonus(liquidationBonus);
|
currentConfig.setLiquidationBonus(liquidationBonus);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit CollateralConfigurationChanged(asset, ltv, liquidationThreshold, liquidationBonus);
|
emit CollateralConfigurationChanged(asset, ltv, liquidationThreshold, liquidationBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Enable stable rate borrowing on a reserve
|
function enableReserveStableRate(address asset) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
**/
|
|
||||||
function enableReserveStableRate(address asset) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setStableRateBorrowingEnabled(true);
|
currentConfig.setStableRateBorrowingEnabled(true);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit StableRateEnabledOnReserve(asset);
|
emit StableRateEnabledOnReserve(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Disable stable rate borrowing on a reserve
|
function disableReserveStableRate(address asset) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
**/
|
|
||||||
function disableReserveStableRate(address asset) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setStableRateBorrowingEnabled(false);
|
currentConfig.setStableRateBorrowingEnabled(false);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit StableRateDisabledOnReserve(asset);
|
emit StableRateDisabledOnReserve(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Activates a reserve
|
function activateReserve(address asset) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
**/
|
|
||||||
function activateReserve(address asset) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setActive(true);
|
currentConfig.setActive(true);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit ReserveActivated(asset);
|
emit ReserveActivated(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Deactivates a reserve
|
function deactivateReserve(address asset) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
|
||||||
**/
|
|
||||||
function deactivateReserve(address asset) external onlyPoolAdmin {
|
|
||||||
_checkNoLiquidity(asset);
|
_checkNoLiquidity(asset);
|
||||||
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
|
|
||||||
currentConfig.setActive(false);
|
currentConfig.setActive(false);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit ReserveDeactivated(asset);
|
emit ReserveDeactivated(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Freezes a reserve. A frozen reserve doesn't allow any new deposit, borrow or rate swap
|
function freezeReserve(address asset) external override onlyPoolAdmin {
|
||||||
* but allows repayments, liquidations, rate rebalances and withdrawals
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
* @param asset The address of the underlying asset of the reserve
|
|
||||||
**/
|
|
||||||
function freezeReserve(address asset) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setFrozen(true);
|
currentConfig.setFrozen(true);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit ReserveFrozen(asset);
|
emit ReserveFrozen(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Unfreezes a reserve
|
function unfreezeReserve(address asset) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
**/
|
|
||||||
function unfreezeReserve(address asset) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setFrozen(false);
|
currentConfig.setFrozen(false);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit ReserveUnfrozen(asset);
|
emit ReserveUnfrozen(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Updates the reserve factor of a reserve
|
function setReserveFactor(address asset, uint256 reserveFactor) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
* @param reserveFactor The new reserve factor of the reserve
|
|
||||||
**/
|
|
||||||
function setReserveFactor(address asset, uint256 reserveFactor) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setReserveFactor(reserveFactor);
|
currentConfig.setReserveFactor(reserveFactor);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit ReserveFactorChanged(asset, reserveFactor);
|
emit ReserveFactorChanged(asset, reserveFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///@inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Updates the borrow cap of a reserve
|
function setBorrowCap(address asset, uint256 borrowCap) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
* @param borrowCap The new borrow of the reserve
|
|
||||||
**/
|
|
||||||
function setBorrowCap(address asset, uint256 borrowCap) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setBorrowCap(borrowCap);
|
currentConfig.setBorrowCap(borrowCap);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit BorrowCapChanged(asset, borrowCap);
|
emit BorrowCapChanged(asset, borrowCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///@inheritdoc ILendingPoolConfigurator
|
||||||
* @dev Updates the supply cap of a reserve
|
function setSupplyCap(address asset, uint256 supplyCap) external override onlyPoolAdmin {
|
||||||
* @param asset The address of the underlying asset of the reserve
|
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
|
||||||
* @param supplyCap The new supply of the reserve
|
|
||||||
**/
|
|
||||||
function setSupplyCap(address asset, uint256 supplyCap) external onlyPoolAdmin {
|
|
||||||
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
|
|
||||||
|
|
||||||
currentConfig.setSupplyCap(supplyCap);
|
currentConfig.setSupplyCap(supplyCap);
|
||||||
|
|
||||||
pool.setConfiguration(asset, currentConfig.data);
|
_pool.setConfiguration(asset, currentConfig.data);
|
||||||
|
|
||||||
emit SupplyCapChanged(asset, supplyCap);
|
emit SupplyCapChanged(asset, supplyCap);
|
||||||
}
|
}
|
||||||
|
@ -466,18 +420,16 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
**/
|
**/
|
||||||
function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
|
function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
|
||||||
external
|
external
|
||||||
|
override
|
||||||
onlyPoolAdmin
|
onlyPoolAdmin
|
||||||
{
|
{
|
||||||
pool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress);
|
_pool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress);
|
||||||
emit ReserveInterestRateStrategyChanged(asset, rateStrategyAddress);
|
emit ReserveInterestRateStrategyChanged(asset, rateStrategyAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @inheritdoc ILendingPoolConfigurator
|
||||||
* @dev pauses or unpauses all the actions of the protocol, including aToken transfers
|
function setPoolPause(bool val) external override onlyEmergencyAdmin {
|
||||||
* @param val true if protocol needs to be paused, false otherwise
|
_pool.setPause(val);
|
||||||
**/
|
|
||||||
function setPoolPause(bool val) external onlyEmergencyAdmin {
|
|
||||||
pool.setPause(val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _initTokenWithProxy(address implementation, bytes memory initParams)
|
function _initTokenWithProxy(address implementation, bytes memory initParams)
|
||||||
|
@ -504,7 +456,7 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
|
||||||
}
|
}
|
||||||
|
|
||||||
function _checkNoLiquidity(address asset) internal view {
|
function _checkNoLiquidity(address asset) internal view {
|
||||||
DataTypes.ReserveData memory reserveData = pool.getReserveData(asset);
|
DataTypes.ReserveData memory reserveData = _pool.getReserveData(asset);
|
||||||
|
|
||||||
uint256 availableLiquidity = IERC20Detailed(asset).balanceOf(reserveData.aTokenAddress);
|
uint256 availableLiquidity = IERC20Detailed(asset).balanceOf(reserveData.aTokenAddress);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user