Updated configurator, LendingPool interface

This commit is contained in:
The3D 2020-10-09 17:59:10 +02:00
parent 640f30c786
commit 44ba72540c
2 changed files with 22 additions and 24 deletions

View File

@ -3,6 +3,8 @@ pragma solidity ^0.6.8;
import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol';
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
pragma experimental ABIEncoderV2;
interface ILendingPool {
@ -361,6 +363,8 @@ interface ILendingPool {
function getReserveNormalizedVariableDebt(address reserve) external view returns (uint256);
function getReserveData(address asset) external view returns (ReserveLogic.ReserveData memory);
function balanceDecreaseAllowed(
address reserve,
address user,

View File

@ -14,6 +14,7 @@ import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddresses
import {ILendingPool} from '../interfaces/ILendingPool.sol';
import {IERC20Detailed} from '../interfaces/IERC20Detailed.sol';
import {Errors} from '../libraries/helpers/Errors.sol';
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
/**
* @title LendingPoolConfigurator contract
@ -260,11 +261,11 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param implementation the address of the new aToken implementation
**/
function updateAToken(address asset, address implementation) external onlyAaveAdmin {
(address aTokenAddress, , ) = pool.getReserveTokensAddresses(asset);
ReserveLogic.ReserveData memory reserveData = pool.getReserveData(asset);
_upgradeTokenImplementation(asset, aTokenAddress, implementation);
_upgradeTokenImplementation(asset, reserveData.aTokenAddress, implementation);
emit ATokenUpgraded(asset, aTokenAddress, implementation);
emit ATokenUpgraded(asset, reserveData.aTokenAddress, implementation);
}
/**
@ -273,11 +274,11 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param implementation the address of the new aToken implementation
**/
function updateStableDebtToken(address asset, address implementation) external onlyAaveAdmin {
(, address stableDebtToken, ) = pool.getReserveTokensAddresses(asset);
ReserveLogic.ReserveData memory reserveData = pool.getReserveData(asset);
_upgradeTokenImplementation(asset, stableDebtToken, implementation);
_upgradeTokenImplementation(asset, reserveData.stableDebtTokenAddress, implementation);
emit StableDebtTokenUpgraded(asset, stableDebtToken, implementation);
emit StableDebtTokenUpgraded(asset, reserveData.stableDebtTokenAddress, implementation);
}
/**
@ -286,11 +287,11 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param implementation the address of the new aToken implementation
**/
function updateVariableDebtToken(address asset, address implementation) external onlyAaveAdmin {
(, , address variableDebtToken) = pool.getReserveTokensAddresses(asset);
ReserveLogic.ReserveData memory reserveData = pool.getReserveData(asset);
_upgradeTokenImplementation(asset, variableDebtToken, implementation);
_upgradeTokenImplementation(asset, reserveData.variableDebtTokenAddress, implementation);
emit VariableDebtTokenUpgraded(asset, variableDebtToken, implementation);
emit VariableDebtTokenUpgraded(asset, reserveData.variableDebtTokenAddress, implementation);
}
/**
@ -410,18 +411,12 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function deactivateReserve(address asset) external onlyAaveAdmin {
(
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVariableDebt,
,
,
,
,
,
,
ReserveLogic.ReserveData memory reserveData = pool.getReserveData(asset);
uint256 availableLiquidity = IERC20Detailed(reserveData.aTokenAddress).totalSupply();
uint256 totalStableDebt = IERC20Detailed(reserveData.stableDebtTokenAddress).totalSupply();
uint256 totalVariableDebt = IERC20Detailed(reserveData.variableDebtTokenAddress).totalSupply();
) = pool.getReserveData(asset);
require(
availableLiquidity == 0 && totalStableDebt == 0 && totalVariableDebt == 0,
Errors.RESERVE_LIQUIDITY_NOT_0
@ -479,7 +474,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
emit ReserveBaseLtvChanged(asset, ltv);
}
/**
/**
* @dev updates the reserve factor of a reserve
* @param asset the address of the reserve
* @param reserveFactor the new reserve factor of the reserve
@ -494,7 +489,6 @@ contract LendingPoolConfigurator is VersionedInitializable {
emit ReserveFactorChanged(asset, reserveFactor);
}
/**
* @dev updates the liquidation threshold of a reserve.
* @param asset the address of the reserve
@ -582,11 +576,11 @@ contract LendingPoolConfigurator is VersionedInitializable {
payable(proxyAddress)
);
(uint256 decimals, , , , , , , , , , ) = pool.getReserveConfigurationData(asset);
ReserveConfiguration.Map memory configuration = pool.getConfiguration(asset);
bytes memory params = abi.encodeWithSignature(
'initialize(uint8,string,string)',
uint8(decimals),
uint8(configuration.getDecimals()),
IERC20Detailed(implementation).name(),
IERC20Detailed(implementation).symbol()
);