fix: configurator: added event borrowCapChanged in enableBorrowingOnReserve function

This commit is contained in:
Hadrien Charlanes 2021-05-25 09:48:08 +02:00
parent 3656bee3a1
commit 56bf996885

View File

@ -151,7 +151,8 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
(, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory(); (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory();
bytes memory encodedCall = abi.encodeWithSelector( bytes memory encodedCall =
abi.encodeWithSelector(
IInitializableAToken.initialize.selector, IInitializableAToken.initialize.selector,
cachedPool, cachedPool,
input.treasury, input.treasury,
@ -163,11 +164,7 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
input.params input.params
); );
_upgradeTokenImplementation( _upgradeTokenImplementation(reserveData.aTokenAddress, input.implementation, encodedCall);
reserveData.aTokenAddress,
input.implementation,
encodedCall
);
emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation); emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
} }
@ -179,10 +176,11 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
ILendingPool cachedPool = pool; ILendingPool cachedPool = pool;
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset); DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
(, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory(); (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory();
bytes memory encodedCall = abi.encodeWithSelector( bytes memory encodedCall =
abi.encodeWithSelector(
IInitializableDebtToken.initialize.selector, IInitializableDebtToken.initialize.selector,
cachedPool, cachedPool,
input.asset, input.asset,
@ -209,17 +207,15 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
/** /**
* @dev Updates the variable debt token implementation for the asset * @dev Updates the variable debt token implementation for the asset
**/ **/
function updateVariableDebtToken(UpdateDebtTokenInput calldata input) function updateVariableDebtToken(UpdateDebtTokenInput calldata input) external onlyPoolAdmin {
external
onlyPoolAdmin
{
ILendingPool cachedPool = pool; ILendingPool cachedPool = pool;
DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset); DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
(, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory(); (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory();
bytes memory encodedCall = abi.encodeWithSelector( bytes memory encodedCall =
abi.encodeWithSelector(
IInitializableDebtToken.initialize.selector, IInitializableDebtToken.initialize.selector,
cachedPool, cachedPool,
input.asset, input.asset,
@ -248,10 +244,11 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
* @param asset The address of the underlying asset of the 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 * @param stableBorrowRateEnabled True if stable borrow rate needs to be enabled by default on this reserve
**/ **/
function enableBorrowingOnReserve(address asset, uint256 borrowCap, bool stableBorrowRateEnabled) function enableBorrowingOnReserve(
external address asset,
onlyPoolAdmin uint256 borrowCap,
{ bool stableBorrowRateEnabled
) external onlyPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(true); currentConfig.setBorrowingEnabled(true);
@ -260,6 +257,7 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
pool.setConfiguration(asset, currentConfig.data); pool.setConfiguration(asset, currentConfig.data);
emit BorrowCapChanged(asset, borrowCap);
emit BorrowingEnabledOnReserve(asset, stableBorrowRateEnabled); emit BorrowingEnabledOnReserve(asset, stableBorrowRateEnabled);
} }