Merge branch '41-rename-liqudiationmanager' into 'master'

Misc renaming

Closes #41

See merge request aave-tech/protocol-v2!52
This commit is contained in:
The-3D 2020-09-16 14:45:52 +00:00
commit faf15605bf
14 changed files with 155 additions and 162 deletions

View File

@ -21,8 +21,8 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
bytes32 private constant LENDING_POOL = 'LENDING_POOL'; bytes32 private constant LENDING_POOL = 'LENDING_POOL';
bytes32 private constant LENDING_POOL_CORE = 'LENDING_POOL_CORE'; bytes32 private constant LENDING_POOL_CORE = 'LENDING_POOL_CORE';
bytes32 private constant LENDING_POOL_CONFIGURATOR = 'LENDING_POOL_CONFIGURATOR'; bytes32 private constant LENDING_POOL_CONFIGURATOR = 'LENDING_POOL_CONFIGURATOR';
bytes32 private constant LENDING_POOL_MANAGER = 'LENDING_POOL_MANAGER'; bytes32 private constant AAVE_ADMIN = 'AAVE_ADMIN';
bytes32 private constant LENDING_POOL_LIQUIDATION_MANAGER = 'LIQUIDATION_MANAGER'; bytes32 private constant LENDING_POOL_COLLATERAL_MANAGER = 'COLLATERAL_MANAGER';
bytes32 private constant LENDING_POOL_FLASHLOAN_PROVIDER = 'FLASHLOAN_PROVIDER'; bytes32 private constant LENDING_POOL_FLASHLOAN_PROVIDER = 'FLASHLOAN_PROVIDER';
bytes32 private constant DATA_PROVIDER = 'DATA_PROVIDER'; bytes32 private constant DATA_PROVIDER = 'DATA_PROVIDER';
bytes32 private constant ETHEREUM_ADDRESS = 'ETHEREUM_ADDRESS'; bytes32 private constant ETHEREUM_ADDRESS = 'ETHEREUM_ADDRESS';
@ -65,23 +65,23 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
} }
/** /**
* @dev returns the address of the LendingPoolLiquidationManager. Since the manager is used * @dev returns the address of the LendingPoolCollateralManager. Since the manager is used
* through delegateCall within the LendingPool contract, the proxy contract pattern does not work properly hence * through delegateCall within the LendingPool contract, the proxy contract pattern does not work properly hence
* the addresses are changed directly. * the addresses are changed directly.
* @return the address of the Lending pool liquidation manager * @return the address of the Lending pool collateral manager
**/ **/
function getLendingPoolLiquidationManager() external override view returns (address) { function getLendingPoolCollateralManager() external override view returns (address) {
return _addresses[LENDING_POOL_LIQUIDATION_MANAGER]; return _addresses[LENDING_POOL_COLLATERAL_MANAGER];
} }
/** /**
* @dev updates the address of the Lending pool liquidation manager * @dev updates the address of the Lending pool collateral manager
* @param manager the new lending pool liquidation manager address * @param manager the new lending pool collateral manager address
**/ **/
function setLendingPoolLiquidationManager(address manager) external override onlyOwner { function setLendingPoolCollateralManager(address manager) external override onlyOwner {
_addresses[LENDING_POOL_LIQUIDATION_MANAGER] = manager; _addresses[LENDING_POOL_COLLATERAL_MANAGER] = manager;
emit LendingPoolLiquidationManagerUpdated(manager); emit LendingPoolCollateralManagerUpdated(manager);
} }
/** /**
@ -89,13 +89,13 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
* hence the upgradable proxy pattern is not used * hence the upgradable proxy pattern is not used
**/ **/
function getLendingPoolManager() external override view returns (address) { function getAaveAdmin() external override view returns (address) {
return _addresses[LENDING_POOL_MANAGER]; return _addresses[AAVE_ADMIN];
} }
function setLendingPoolManager(address lendingPoolManager) external override onlyOwner { function setAaveAdmin(address aaveAdmin) external override onlyOwner {
_addresses[LENDING_POOL_MANAGER] = lendingPoolManager; _addresses[AAVE_ADMIN] = aaveAdmin;
emit LendingPoolManagerUpdated(lendingPoolManager); emit AaveAdminUpdated(aaveAdmin);
} }
function getPriceOracle() external override view returns (address) { function getPriceOracle() external override view returns (address) {

View File

@ -111,7 +111,7 @@ interface ILendingPool {
); );
/** /**
* @dev these events are not emitted directly by the LendingPool * @dev these events are not emitted directly by the LendingPool
* but they are declared here as the LendingPoolLiquidationManager * but they are declared here as the LendingPoolCollateralManager
* is executed using a delegateCall(). * is executed using a delegateCall().
* This allows to have the events in the generated ABI for LendingPool. * This allows to have the events in the generated ABI for LendingPool.
**/ **/
@ -439,5 +439,5 @@ interface ILendingPool {
/** /**
* @dev Returns if the LendingPool is paused * @dev Returns if the LendingPool is paused
*/ */
function paused() external view returns(bool); function paused() external view returns (bool);
} }

View File

@ -9,9 +9,9 @@ pragma solidity ^0.6.8;
interface ILendingPoolAddressesProvider { interface ILendingPoolAddressesProvider {
//events //events
event LendingPoolUpdated(address indexed newAddress); event LendingPoolUpdated(address indexed newAddress);
event LendingPoolManagerUpdated(address indexed newAddress); event AaveAdminUpdated(address indexed newAddress);
event LendingPoolConfiguratorUpdated(address indexed newAddress); event LendingPoolConfiguratorUpdated(address indexed newAddress);
event LendingPoolLiquidationManagerUpdated(address indexed newAddress); event LendingPoolCollateralManagerUpdated(address indexed newAddress);
event EthereumAddressUpdated(address indexed newAddress); event EthereumAddressUpdated(address indexed newAddress);
event PriceOracleUpdated(address indexed newAddress); event PriceOracleUpdated(address indexed newAddress);
event LendingRateOracleUpdated(address indexed newAddress); event LendingRateOracleUpdated(address indexed newAddress);
@ -26,13 +26,13 @@ interface ILendingPoolAddressesProvider {
function setLendingPoolConfiguratorImpl(address configurator) external; function setLendingPoolConfiguratorImpl(address configurator) external;
function getLendingPoolLiquidationManager() external view returns (address); function getLendingPoolCollateralManager() external view returns (address);
function setLendingPoolLiquidationManager(address manager) external; function setLendingPoolCollateralManager(address manager) external;
function getLendingPoolManager() external view returns (address); function getAaveAdmin() external view returns (address);
function setLendingPoolManager(address lendingPoolManager) external; function setAaveAdmin(address aaveAdmin) external;
function getPriceOracle() external view returns (address); function getPriceOracle() external view returns (address);

View File

@ -21,7 +21,7 @@ import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol'
import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol'; import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol';
import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol'; import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol';
import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol'; import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol';
import {LendingPoolLiquidationManager} from './LendingPoolLiquidationManager.sol'; import {LendingPoolCollateralManager} from './LendingPoolCollateralManager.sol';
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {ILendingPool} from '../interfaces/ILendingPool.sol'; import {ILendingPool} from '../interfaces/ILendingPool.sol';
@ -451,10 +451,10 @@ contract LendingPool is VersionedInitializable, ILendingPool {
bool receiveAToken bool receiveAToken
) external override { ) external override {
whenNotPaused(); whenNotPaused();
address liquidationManager = _addressesProvider.getLendingPoolLiquidationManager(); address collateralManager = _addressesProvider.getLendingPoolCollateralManager();
//solium-disable-next-line //solium-disable-next-line
(bool success, bytes memory result) = liquidationManager.delegatecall( (bool success, bytes memory result) = collateralManager.delegatecall(
abi.encodeWithSignature( abi.encodeWithSignature(
'liquidationCall(address,address,address,uint256,bool)', 'liquidationCall(address,address,address,uint256,bool)',
collateral, collateral,
@ -511,10 +511,10 @@ contract LendingPool is VersionedInitializable, ILendingPool {
require(!_flashLiquidationLocked, Errors.REENTRANCY_NOT_ALLOWED); require(!_flashLiquidationLocked, Errors.REENTRANCY_NOT_ALLOWED);
_flashLiquidationLocked = true; _flashLiquidationLocked = true;
address liquidationManager = _addressesProvider.getLendingPoolLiquidationManager(); address collateralManager = _addressesProvider.getLendingPoolCollateralManager();
//solium-disable-next-line //solium-disable-next-line
(bool success, bytes memory result) = liquidationManager.delegatecall( (bool success, bytes memory result) = collateralManager.delegatecall(
abi.encodeWithSignature( abi.encodeWithSignature(
'repayWithCollateral(address,address,address,uint256,address,bytes)', 'repayWithCollateral(address,address,address,uint256,address,bytes)',
collateral, collateral,
@ -618,10 +618,10 @@ contract LendingPool is VersionedInitializable, ILendingPool {
bytes calldata params bytes calldata params
) external override { ) external override {
whenNotPaused(); whenNotPaused();
address liquidationManager = _addressesProvider.getLendingPoolLiquidationManager(); address collateralManager = _addressesProvider.getLendingPoolCollateralManager();
//solium-disable-next-line //solium-disable-next-line
(bool success, bytes memory result) = liquidationManager.delegatecall( (bool success, bytes memory result) = collateralManager.delegatecall(
abi.encodeWithSignature( abi.encodeWithSignature(
'swapLiquidity(address,address,address,uint256,bytes)', 'swapLiquidity(address,address,address,uint256,bytes)',
receiverAddress, receiverAddress,
@ -1035,7 +1035,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
/** /**
* @dev Returns if the LendingPool is paused * @dev Returns if the LendingPool is paused
*/ */
function paused() external view override returns(bool) { function paused() external override view returns (bool) {
return _paused; return _paused;
} }
} }

View File

@ -24,12 +24,13 @@ import {Errors} from '../libraries/helpers/Errors.sol';
import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol'; import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol';
/** /**
* @title LendingPoolLiquidationManager contract * @title LendingPoolCollateralManager contract
* @author Aave * @author Aave
* @notice Implements the liquidation function. * @notice Implements actions involving management of collateral in the protocol.
* @dev LendingPoolLiquidationManager inherits Pausable from OpenZeppelin to have the same storage layout as LendingPool * @notice this contract will be ran always through delegatecall
* @dev LendingPoolCollateralManager inherits VersionedInitializable from OpenZeppelin to have the same storage layout as LendingPool
**/ **/
contract LendingPoolLiquidationManager is VersionedInitializable { contract LendingPoolCollateralManager is VersionedInitializable {
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
using SafeMath for uint256; using SafeMath for uint256;
using WadRayMath for uint256; using WadRayMath for uint256;
@ -185,7 +186,7 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
vars.userVariableDebt vars.userVariableDebt
); );
if (Errors.LiquidationErrors(vars.errorCode) != Errors.LiquidationErrors.NO_ERROR) { if (Errors.CollateralManagerErrors(vars.errorCode) != Errors.CollateralManagerErrors.NO_ERROR) {
return (vars.errorCode, vars.errorMsg); return (vars.errorCode, vars.errorMsg);
} }
@ -228,7 +229,7 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
); );
if (currentAvailableCollateral < vars.maxCollateralToLiquidate) { if (currentAvailableCollateral < vars.maxCollateralToLiquidate) {
return ( return (
uint256(Errors.LiquidationErrors.NOT_ENOUGH_LIQUIDITY), uint256(Errors.CollateralManagerErrors.NOT_ENOUGH_LIQUIDITY),
Errors.NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE Errors.NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE
); );
} }
@ -300,7 +301,7 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
receiveAToken receiveAToken
); );
return (uint256(Errors.LiquidationErrors.NO_ERROR), Errors.NO_ERRORS); return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
} }
/** /**
@ -349,7 +350,7 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
vars.userVariableDebt vars.userVariableDebt
); );
if (Errors.LiquidationErrors(vars.errorCode) != Errors.LiquidationErrors.NO_ERROR) { if (Errors.CollateralManagerErrors(vars.errorCode) != Errors.CollateralManagerErrors.NO_ERROR) {
return (vars.errorCode, vars.errorMsg); return (vars.errorCode, vars.errorMsg);
} }
@ -445,7 +446,7 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
vars.maxCollateralToLiquidate vars.maxCollateralToLiquidate
); );
return (uint256(Errors.LiquidationErrors.NO_ERROR), Errors.NO_ERRORS); return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
} }
/** /**
@ -476,7 +477,7 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
toAsset toAsset
); );
if (Errors.LiquidationErrors(vars.errorCode) != Errors.LiquidationErrors.NO_ERROR) { if (Errors.CollateralManagerErrors(vars.errorCode) != Errors.CollateralManagerErrors.NO_ERROR) {
return (vars.errorCode, vars.errorMsg); return (vars.errorCode, vars.errorMsg);
} }
@ -538,12 +539,12 @@ contract LendingPoolLiquidationManager is VersionedInitializable {
if (vars.healthFactor < GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD) { if (vars.healthFactor < GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD) {
return ( return (
uint256(Errors.LiquidationErrors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD), uint256(Errors.CollateralManagerErrors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD),
Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
); );
} }
return (uint256(Errors.LiquidationErrors.NO_ERROR), Errors.NO_ERRORS); return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
} }
/** /**

View File

@ -176,11 +176,8 @@ contract LendingPoolConfigurator is VersionedInitializable {
/** /**
* @dev only the lending pool manager can call functions affected by this modifier * @dev only the lending pool manager can call functions affected by this modifier
**/ **/
modifier onlyLendingPoolManager { modifier onlyAaveAdmin {
require( require(addressesProvider.getAaveAdmin() == msg.sender, Errors.CALLER_NOT_AAVE_ADMIN);
addressesProvider.getLendingPoolManager() == msg.sender,
Errors.CALLER_NOT_LENDING_POOL_MANAGER
);
_; _;
} }
@ -211,7 +208,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
address variableDebtTokenImpl, address variableDebtTokenImpl,
uint8 underlyingAssetDecimals, uint8 underlyingAssetDecimals,
address interestRateStrategyAddress address interestRateStrategyAddress
) public onlyLendingPoolManager { ) public onlyAaveAdmin {
address aTokenProxyAddress = _initTokenWithProxy(aTokenImpl, underlyingAssetDecimals); address aTokenProxyAddress = _initTokenWithProxy(aTokenImpl, underlyingAssetDecimals);
address stableDebtTokenProxyAddress = _initTokenWithProxy( address stableDebtTokenProxyAddress = _initTokenWithProxy(
@ -255,7 +252,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve to be updated * @param asset the address of the reserve to be updated
* @param implementation the address of the new aToken implementation * @param implementation the address of the new aToken implementation
**/ **/
function updateAToken(address asset, address implementation) external onlyLendingPoolManager { function updateAToken(address asset, address implementation) external onlyAaveAdmin {
(address aTokenAddress, , ) = pool.getReserveTokensAddresses(asset); (address aTokenAddress, , ) = pool.getReserveTokensAddresses(asset);
_upgradeTokenImplementation(asset, aTokenAddress, implementation); _upgradeTokenImplementation(asset, aTokenAddress, implementation);
@ -268,10 +265,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve to be updated * @param asset the address of the reserve to be updated
* @param implementation the address of the new aToken implementation * @param implementation the address of the new aToken implementation
**/ **/
function updateStableDebtToken(address asset, address implementation) function updateStableDebtToken(address asset, address implementation) external onlyAaveAdmin {
external
onlyLendingPoolManager
{
(, address stableDebtToken, ) = pool.getReserveTokensAddresses(asset); (, address stableDebtToken, ) = pool.getReserveTokensAddresses(asset);
_upgradeTokenImplementation(asset, stableDebtToken, implementation); _upgradeTokenImplementation(asset, stableDebtToken, implementation);
@ -284,10 +278,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve to be updated * @param asset the address of the reserve to be updated
* @param implementation the address of the new aToken implementation * @param implementation the address of the new aToken implementation
**/ **/
function updateVariableDebtToken(address asset, address implementation) function updateVariableDebtToken(address asset, address implementation) external onlyAaveAdmin {
external
onlyLendingPoolManager
{
(, , address variableDebtToken) = pool.getReserveTokensAddresses(asset); (, , address variableDebtToken) = pool.getReserveTokensAddresses(asset);
_upgradeTokenImplementation(asset, variableDebtToken, implementation); _upgradeTokenImplementation(asset, variableDebtToken, implementation);
@ -302,7 +293,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
**/ **/
function enableBorrowingOnReserve(address asset, bool stableBorrowRateEnabled) function enableBorrowingOnReserve(address asset, bool stableBorrowRateEnabled)
external external
onlyLendingPoolManager onlyAaveAdmin
{ {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
@ -318,7 +309,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev disables borrowing on a reserve * @dev disables borrowing on a reserve
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function disableBorrowingOnReserve(address asset) external onlyLendingPoolManager { function disableBorrowingOnReserve(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(false); currentConfig.setBorrowingEnabled(false);
@ -339,7 +330,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
uint256 ltv, uint256 ltv,
uint256 liquidationThreshold, uint256 liquidationThreshold,
uint256 liquidationBonus uint256 liquidationBonus
) external onlyLendingPoolManager { ) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setLtv(ltv); currentConfig.setLtv(ltv);
@ -355,7 +346,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev disables a reserve as collateral * @dev disables a reserve as collateral
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function disableReserveAsCollateral(address asset) external onlyLendingPoolManager { function disableReserveAsCollateral(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setLtv(0); currentConfig.setLtv(0);
@ -369,7 +360,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev enable stable rate borrowing on a reserve * @dev enable stable rate borrowing on a reserve
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function enableReserveStableRate(address asset) external onlyLendingPoolManager { function enableReserveStableRate(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setStableRateBorrowingEnabled(true); currentConfig.setStableRateBorrowingEnabled(true);
@ -383,7 +374,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev disable stable rate borrowing on a reserve * @dev disable stable rate borrowing on a reserve
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function disableReserveStableRate(address asset) external onlyLendingPoolManager { function disableReserveStableRate(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setStableRateBorrowingEnabled(false); currentConfig.setStableRateBorrowingEnabled(false);
@ -397,7 +388,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev activates a reserve * @dev activates a reserve
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function activateReserve(address asset) external onlyLendingPoolManager { function activateReserve(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setActive(true); currentConfig.setActive(true);
@ -411,7 +402,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev deactivates a reserve * @dev deactivates a reserve
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function deactivateReserve(address asset) external onlyLendingPoolManager { function deactivateReserve(address asset) external onlyAaveAdmin {
( (
uint256 availableLiquidity, uint256 availableLiquidity,
uint256 totalBorrowsStable, uint256 totalBorrowsStable,
@ -442,7 +433,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev freezes a reserve. A freezed reserve doesn't accept any new deposit, borrow or rate swap, but can accept repayments, liquidations, rate rebalances and redeems * @dev freezes a reserve. A freezed reserve doesn't accept any new deposit, borrow or rate swap, but can accept repayments, liquidations, rate rebalances and redeems
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function freezeReserve(address asset) external onlyLendingPoolManager { function freezeReserve(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setFrozen(true); currentConfig.setFrozen(true);
@ -456,7 +447,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev unfreezes a reserve * @dev unfreezes a reserve
* @param asset the address of the reserve * @param asset the address of the reserve
**/ **/
function unfreezeReserve(address asset) external onlyLendingPoolManager { function unfreezeReserve(address asset) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setFrozen(false); currentConfig.setFrozen(false);
@ -471,7 +462,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve * @param asset the address of the reserve
* @param ltv the new value for the loan to value * @param ltv the new value for the loan to value
**/ **/
function setLtv(address asset, uint256 ltv) external onlyLendingPoolManager { function setLtv(address asset, uint256 ltv) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setLtv(ltv); currentConfig.setLtv(ltv);
@ -486,10 +477,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve * @param asset the address of the reserve
* @param threshold the new value for the liquidation threshold * @param threshold the new value for the liquidation threshold
**/ **/
function setLiquidationThreshold(address asset, uint256 threshold) function setLiquidationThreshold(address asset, uint256 threshold) external onlyAaveAdmin {
external
onlyLendingPoolManager
{
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setLiquidationThreshold(threshold); currentConfig.setLiquidationThreshold(threshold);
@ -504,7 +492,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve * @param asset the address of the reserve
* @param bonus the new value for the liquidation bonus * @param bonus the new value for the liquidation bonus
**/ **/
function setLiquidationBonus(address asset, uint256 bonus) external onlyLendingPoolManager { function setLiquidationBonus(address asset, uint256 bonus) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setLiquidationBonus(bonus); currentConfig.setLiquidationBonus(bonus);
@ -519,7 +507,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve * @param asset the address of the reserve
* @param decimals the new number of decimals * @param decimals the new number of decimals
**/ **/
function setReserveDecimals(address asset, uint256 decimals) external onlyLendingPoolManager { function setReserveDecimals(address asset, uint256 decimals) external onlyAaveAdmin {
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset); ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);
currentConfig.setDecimals(decimals); currentConfig.setDecimals(decimals);
@ -536,7 +524,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
**/ **/
function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress) function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
external external
onlyLendingPoolManager onlyAaveAdmin
{ {
pool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress); pool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress);
emit ReserveInterestRateStrategyChanged(asset, rateStrategyAddress); emit ReserveInterestRateStrategyChanged(asset, rateStrategyAddress);
@ -587,7 +575,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @dev pauses or unpauses LendingPool actions * @dev pauses or unpauses LendingPool actions
* @param val the boolean value to set the current pause state of LendingPool * @param val the boolean value to set the current pause state of LendingPool
**/ **/
function setPoolPause(bool val) external onlyLendingPoolManager { function setPoolPause(bool val) external onlyAaveAdmin {
pool.setPause(val); pool.setPause(val);
} }
} }

View File

@ -59,13 +59,13 @@ library Errors {
string public constant STABLE_BORROW_RATE_OVERFLOW = '51'; // Stable borrow rate overflows uint128 string public constant STABLE_BORROW_RATE_OVERFLOW = '51'; // Stable borrow rate overflows uint128
//require error messages - LendingPoolConfiguration //require error messages - LendingPoolConfiguration
string public constant CALLER_NOT_LENDING_POOL_MANAGER = '35'; // 'The caller must be a lending pool manager' string public constant CALLER_NOT_AAVE_ADMIN = '35'; // 'The caller must be the aave admin'
string public constant RESERVE_LIQUIDITY_NOT_0 = '36'; // 'The liquidity of the reserve needs to be 0' string public constant RESERVE_LIQUIDITY_NOT_0 = '36'; // 'The liquidity of the reserve needs to be 0'
//require error messages - LendingPoolAddressesProviderRegistry //require error messages - LendingPoolAddressesProviderRegistry
string public constant PROVIDER_NOT_REGISTERED = '37'; // 'Provider is not registered' string public constant PROVIDER_NOT_REGISTERED = '37'; // 'Provider is not registered'
//return error messages - LendingPoolLiquidationManager //return error messages - LendingPoolCollateralManager
string public constant HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38'; // 'Health factor is not below the threshold' string public constant HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38'; // 'Health factor is not below the threshold'
string public constant COLLATERAL_CANNOT_BE_LIQUIDATED = '39'; // 'The collateral chosen cannot be liquidated' string public constant COLLATERAL_CANNOT_BE_LIQUIDATED = '39'; // 'The collateral chosen cannot be liquidated'
string public constant SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '40'; // 'User did not borrow the specified currency' string public constant SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '40'; // 'User did not borrow the specified currency'
@ -79,7 +79,7 @@ library Errors {
// pausable error message // pausable error message
string public constant IS_PAUSED = '58'; // 'Pool is paused' string public constant IS_PAUSED = '58'; // 'Pool is paused'
enum LiquidationErrors { enum CollateralManagerErrors {
NO_ERROR, NO_ERROR,
NO_COLLATERAL_AVAILABLE, NO_COLLATERAL_AVAILABLE,
COLLATERAL_CANNOT_BE_LIQUIDATED, COLLATERAL_CANNOT_BE_LIQUIDATED,

View File

@ -351,12 +351,12 @@ library ValidationLogic {
if ( if (
!collateralReserve.configuration.getActive() || !principalReserve.configuration.getActive() !collateralReserve.configuration.getActive() || !principalReserve.configuration.getActive()
) { ) {
return (uint256(Errors.LiquidationErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE); return (uint256(Errors.CollateralManagerErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE);
} }
if (userHealthFactor >= GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD) { if (userHealthFactor >= GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD) {
return ( return (
uint256(Errors.LiquidationErrors.HEALTH_FACTOR_ABOVE_THRESHOLD), uint256(Errors.CollateralManagerErrors.HEALTH_FACTOR_ABOVE_THRESHOLD),
Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD
); );
} }
@ -367,19 +367,19 @@ library ValidationLogic {
//if collateral isn't enabled as collateral by user, it cannot be liquidated //if collateral isn't enabled as collateral by user, it cannot be liquidated
if (!isCollateralEnabled) { if (!isCollateralEnabled) {
return ( return (
uint256(Errors.LiquidationErrors.COLLATERAL_CANNOT_BE_LIQUIDATED), uint256(Errors.CollateralManagerErrors.COLLATERAL_CANNOT_BE_LIQUIDATED),
Errors.COLLATERAL_CANNOT_BE_LIQUIDATED Errors.COLLATERAL_CANNOT_BE_LIQUIDATED
); );
} }
if (userStableDebt == 0 && userVariableDebt == 0) { if (userStableDebt == 0 && userVariableDebt == 0) {
return ( return (
uint256(Errors.LiquidationErrors.CURRRENCY_NOT_BORROWED), uint256(Errors.CollateralManagerErrors.CURRRENCY_NOT_BORROWED),
Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER
); );
} }
return (uint256(Errors.LiquidationErrors.NO_ERROR), Errors.NO_ERRORS); return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
} }
/** /**
@ -404,14 +404,14 @@ library ValidationLogic {
if ( if (
!collateralReserve.configuration.getActive() || !principalReserve.configuration.getActive() !collateralReserve.configuration.getActive() || !principalReserve.configuration.getActive()
) { ) {
return (uint256(Errors.LiquidationErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE); return (uint256(Errors.CollateralManagerErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE);
} }
if ( if (
msg.sender != user && userHealthFactor >= GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD msg.sender != user && userHealthFactor >= GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD
) { ) {
return ( return (
uint256(Errors.LiquidationErrors.HEALTH_FACTOR_ABOVE_THRESHOLD), uint256(Errors.CollateralManagerErrors.HEALTH_FACTOR_ABOVE_THRESHOLD),
Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD
); );
} }
@ -423,7 +423,7 @@ library ValidationLogic {
//if collateral isn't enabled as collateral by user, it cannot be liquidated //if collateral isn't enabled as collateral by user, it cannot be liquidated
if (!isCollateralEnabled) { if (!isCollateralEnabled) {
return ( return (
uint256(Errors.LiquidationErrors.COLLATERAL_CANNOT_BE_LIQUIDATED), uint256(Errors.CollateralManagerErrors.COLLATERAL_CANNOT_BE_LIQUIDATED),
Errors.COLLATERAL_CANNOT_BE_LIQUIDATED Errors.COLLATERAL_CANNOT_BE_LIQUIDATED
); );
} }
@ -431,12 +431,12 @@ library ValidationLogic {
if (userStableDebt == 0 && userVariableDebt == 0) { if (userStableDebt == 0 && userVariableDebt == 0) {
return ( return (
uint256(Errors.LiquidationErrors.CURRRENCY_NOT_BORROWED), uint256(Errors.CollateralManagerErrors.CURRRENCY_NOT_BORROWED),
Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER
); );
} }
return (uint256(Errors.LiquidationErrors.NO_ERROR), Errors.NO_ERRORS); return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
} }
/** /**
@ -454,18 +454,22 @@ library ValidationLogic {
) internal view returns (uint256, string memory) { ) internal view returns (uint256, string memory) {
if (fromAsset == toAsset) { if (fromAsset == toAsset) {
return ( return (
uint256(Errors.LiquidationErrors.INVALID_EQUAL_ASSETS_TO_SWAP), uint256(Errors.CollateralManagerErrors.INVALID_EQUAL_ASSETS_TO_SWAP),
Errors.INVALID_EQUAL_ASSETS_TO_SWAP Errors.INVALID_EQUAL_ASSETS_TO_SWAP
); );
} }
(bool isToActive, bool isToFreezed, , ) = toReserve.configuration.getFlags(); (bool isToActive, bool isToFreezed, , ) = toReserve.configuration.getFlags();
if (!fromReserve.configuration.getActive() || !isToActive) { if (!fromReserve.configuration.getActive() || !isToActive) {
return (uint256(Errors.LiquidationErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE); return (uint256(Errors.CollateralManagerErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE);
} }
if (isToFreezed) { if (isToFreezed) {
return (uint256(Errors.LiquidationErrors.NO_UNFREEZED_RESERVE), Errors.NO_UNFREEZED_RESERVE); return (
uint256(Errors.CollateralManagerErrors.NO_UNFREEZED_RESERVE),
Errors.NO_UNFREEZED_RESERVE
);
} }
return (uint256(Errors.LiquidationErrors.NO_ERROR), Errors.NO_ERRORS); return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
} }
} }

View File

@ -21,7 +21,7 @@ import {PriceOracle} from '../types/PriceOracle';
import {MockAggregator} from '../types/MockAggregator'; import {MockAggregator} from '../types/MockAggregator';
import {LendingRateOracle} from '../types/LendingRateOracle'; import {LendingRateOracle} from '../types/LendingRateOracle';
import {DefaultReserveInterestRateStrategy} from '../types/DefaultReserveInterestRateStrategy'; import {DefaultReserveInterestRateStrategy} from '../types/DefaultReserveInterestRateStrategy';
import {LendingPoolLiquidationManager} from '../types/LendingPoolLiquidationManager'; import {LendingPoolCollateralManager} from '../types/LendingPoolCollateralManager';
import {InitializableAdminUpgradeabilityProxy} from '../types/InitializableAdminUpgradeabilityProxy'; import {InitializableAdminUpgradeabilityProxy} from '../types/InitializableAdminUpgradeabilityProxy';
import {MockFlashLoanReceiver} from '../types/MockFlashLoanReceiver'; import {MockFlashLoanReceiver} from '../types/MockFlashLoanReceiver';
import {WalletBalanceProvider} from '../types/WalletBalanceProvider'; import {WalletBalanceProvider} from '../types/WalletBalanceProvider';
@ -192,16 +192,16 @@ export const deployChainlinkProxyPriceProvider = async ([
export const deployLendingRateOracle = async () => export const deployLendingRateOracle = async () =>
await deployContract<LendingRateOracle>(eContractid.LendingRateOracle, []); await deployContract<LendingRateOracle>(eContractid.LendingRateOracle, []);
export const deployLendingPoolLiquidationManager = async () => { export const deployLendingPoolCollateralManager = async () => {
const liquidationManagerArtifact = await readArtifact( const collateralManagerArtifact = await readArtifact(
BRE.config.paths.artifacts, BRE.config.paths.artifacts,
eContractid.LendingPoolLiquidationManager eContractid.LendingPoolCollateralManager
); );
const factory = await linkLibrariesToArtifact(liquidationManagerArtifact); const factory = await linkLibrariesToArtifact(collateralManagerArtifact);
const liquidationManager = await factory.deploy(); const collateralManager = await factory.deploy();
return (await liquidationManager.deployed()) as LendingPoolLiquidationManager; return (await collateralManager.deployed()) as LendingPoolCollateralManager;
}; };
export const deployInitializableAdminUpgradeabilityProxy = async () => export const deployInitializableAdminUpgradeabilityProxy = async () =>

View File

@ -30,7 +30,7 @@ export enum eContractid {
LendingRateOracle = 'LendingRateOracle', LendingRateOracle = 'LendingRateOracle',
ChainlinkProxyPriceProvider = 'ChainlinkProxyPriceProvider', ChainlinkProxyPriceProvider = 'ChainlinkProxyPriceProvider',
DefaultReserveInterestRateStrategy = 'DefaultReserveInterestRateStrategy', DefaultReserveInterestRateStrategy = 'DefaultReserveInterestRateStrategy',
LendingPoolLiquidationManager = 'LendingPoolLiquidationManager', LendingPoolCollateralManager = 'LendingPoolCollateralManager',
InitializableAdminUpgradeabilityProxy = 'InitializableAdminUpgradeabilityProxy', InitializableAdminUpgradeabilityProxy = 'InitializableAdminUpgradeabilityProxy',
MockFlashLoanReceiver = 'MockFlashLoanReceiver', MockFlashLoanReceiver = 'MockFlashLoanReceiver',
MockSwapAdapter = 'MockSwapAdapter', MockSwapAdapter = 'MockSwapAdapter',
@ -87,13 +87,13 @@ export enum ProtocolErrors {
RESERVE_ALREADY_INITIALIZED = '34', // 'Reserve has already been initialized' RESERVE_ALREADY_INITIALIZED = '34', // 'Reserve has already been initialized'
//require error messages - LendingPoolConfiguration //require error messages - LendingPoolConfiguration
CALLER_NOT_LENDING_POOL_MANAGER = '35', // 'The caller must be a lending pool manager' CALLER_NOT_AAVE_ADMIN = '35', // 'The caller must be the aave admin'
RESERVE_LIQUIDITY_NOT_0 = '36', // 'The liquidity of the reserve needs to be 0' RESERVE_LIQUIDITY_NOT_0 = '36', // 'The liquidity of the reserve needs to be 0'
//require error messages - LendingPoolAddressesProviderRegistry //require error messages - LendingPoolAddressesProviderRegistry
PROVIDER_NOT_REGISTERED = '37', // 'Provider is not registered' PROVIDER_NOT_REGISTERED = '37', // 'Provider is not registered'
//return error messages - LendingPoolLiquidationManager //return error messages - LendingPoolCollateralManager
HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38', // 'Health factor is not below the threshold' HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38', // 'Health factor is not below the threshold'
COLLATERAL_CANNOT_BE_LIQUIDATED = '39', // 'The collateral chosen cannot be liquidated' COLLATERAL_CANNOT_BE_LIQUIDATED = '39', // 'The collateral chosen cannot be liquidated'
SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '40', // 'User did not borrow the specified currency' SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '40', // 'User did not borrow the specified currency'

View File

@ -12,7 +12,7 @@ import {
deployChainlinkProxyPriceProvider, deployChainlinkProxyPriceProvider,
deployLendingRateOracle, deployLendingRateOracle,
deployDefaultReserveInterestRateStrategy, deployDefaultReserveInterestRateStrategy,
deployLendingPoolLiquidationManager, deployLendingPoolCollateralManager,
deployMockFlashLoanReceiver, deployMockFlashLoanReceiver,
deployWalletBalancerProvider, deployWalletBalancerProvider,
getLendingPool, getLendingPool,
@ -353,12 +353,12 @@ export const waitForTx = async (tx: ContractTransaction) => await tx.wait();
const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => { const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
console.time('setup'); console.time('setup');
const lendingPoolManager = await deployer.getAddress(); const aaveAdmin = await deployer.getAddress();
const mockTokens = await deployAllMockTokens(deployer); const mockTokens = await deployAllMockTokens(deployer);
const addressesProvider = await deployLendingPoolAddressesProvider(); const addressesProvider = await deployLendingPoolAddressesProvider();
await waitForTx(await addressesProvider.setLendingPoolManager(lendingPoolManager)); await waitForTx(await addressesProvider.setAaveAdmin(aaveAdmin));
const addressesProviderRegistry = await deployLendingPoolAddressesProviderRegistry(); const addressesProviderRegistry = await deployLendingPoolAddressesProviderRegistry();
await waitForTx( await waitForTx(
@ -501,9 +501,9 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
lendingPoolConfiguratorProxy lendingPoolConfiguratorProxy
); );
const liquidationManager = await deployLendingPoolLiquidationManager(); const collateralManager = await deployLendingPoolCollateralManager();
await waitForTx( await waitForTx(
await addressesProvider.setLendingPoolLiquidationManager(liquidationManager.address) await addressesProvider.setLendingPoolCollateralManager(collateralManager.address)
); );
const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address); const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address);

View File

@ -6,7 +6,7 @@ import {ProtocolErrors} from '../helpers/types';
const {expect} = require('chai'); const {expect} = require('chai');
makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => { makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
const {CALLER_NOT_LENDING_POOL_MANAGER, RESERVE_LIQUIDITY_NOT_0} = ProtocolErrors; const {CALLER_NOT_AAVE_ADMIN, RESERVE_LIQUIDITY_NOT_0} = ProtocolErrors;
it('Deactivates the ETH reserve', async () => { it('Deactivates the ETH reserve', async () => {
const {configurator, pool, weth} = testEnv; const {configurator, pool, weth} = testEnv;
@ -23,20 +23,20 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
expect(isActive).to.be.equal(true); expect(isActive).to.be.equal(true);
}); });
it('Check the onlyLendingPoolManager on deactivateReserve ', async () => { it('Check the onlyAaveAdmin on deactivateReserve ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).deactivateReserve(weth.address), configurator.connect(users[2].signer).deactivateReserve(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on activateReserve ', async () => { it('Check the onlyAaveAdmin on activateReserve ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).activateReserve(weth.address), configurator.connect(users[2].signer).activateReserve(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Freezes the ETH reserve', async () => { it('Freezes the ETH reserve', async () => {
@ -54,20 +54,20 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
expect(isFreezed).to.be.equal(false); expect(isFreezed).to.be.equal(false);
}); });
it('Check the onlyLendingPoolManager on freezeReserve ', async () => { it('Check the onlyAaveAdmin on freezeReserve ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).freezeReserve(weth.address), configurator.connect(users[2].signer).freezeReserve(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on unfreezeReserve ', async () => { it('Check the onlyAaveAdmin on unfreezeReserve ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).unfreezeReserve(weth.address), configurator.connect(users[2].signer).unfreezeReserve(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Deactivates the ETH reserve for borrowing', async () => { it('Deactivates the ETH reserve for borrowing', async () => {
@ -86,20 +86,20 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
expect(variableBorrowIndex.toString()).to.be.equal(RAY); expect(variableBorrowIndex.toString()).to.be.equal(RAY);
}); });
it('Check the onlyLendingPoolManager on disableBorrowingOnReserve ', async () => { it('Check the onlyAaveAdmin on disableBorrowingOnReserve ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).disableBorrowingOnReserve(weth.address), configurator.connect(users[2].signer).disableBorrowingOnReserve(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on enableBorrowingOnReserve ', async () => { it('Check the onlyAaveAdmin on enableBorrowingOnReserve ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).enableBorrowingOnReserve(weth.address, true), configurator.connect(users[2].signer).enableBorrowingOnReserve(weth.address, true),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Deactivates the ETH reserve as collateral', async () => { it('Deactivates the ETH reserve as collateral', async () => {
@ -117,22 +117,22 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
expect(usageAsCollateralEnabled).to.be.equal(true); expect(usageAsCollateralEnabled).to.be.equal(true);
}); });
it('Check the onlyLendingPoolManager on disableReserveAsCollateral ', async () => { it('Check the onlyAaveAdmin on disableReserveAsCollateral ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).disableReserveAsCollateral(weth.address), configurator.connect(users[2].signer).disableReserveAsCollateral(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on enableReserveAsCollateral ', async () => { it('Check the onlyAaveAdmin on enableReserveAsCollateral ', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator configurator
.connect(users[2].signer) .connect(users[2].signer)
.enableReserveAsCollateral(weth.address, '75', '80', '105'), .enableReserveAsCollateral(weth.address, '75', '80', '105'),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Disable stable borrow rate on the ETH reserve', async () => { it('Disable stable borrow rate on the ETH reserve', async () => {
@ -149,20 +149,20 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
expect(stableBorrowRateEnabled).to.be.equal(true); expect(stableBorrowRateEnabled).to.be.equal(true);
}); });
it('Check the onlyLendingPoolManager on disableReserveStableRate', async () => { it('Check the onlyAaveAdmin on disableReserveStableRate', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).disableReserveStableRate(weth.address), configurator.connect(users[2].signer).disableReserveStableRate(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on enableReserveStableRate', async () => { it('Check the onlyAaveAdmin on enableReserveStableRate', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).enableReserveStableRate(weth.address), configurator.connect(users[2].signer).enableReserveStableRate(weth.address),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Changes LTV of the reserve', async () => { it('Changes LTV of the reserve', async () => {
@ -172,12 +172,12 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
expect(ltv.toString()).to.be.bignumber.equal('60', 'Invalid LTV'); expect(ltv.toString()).to.be.bignumber.equal('60', 'Invalid LTV');
}); });
it('Check the onlyLendingPoolManager on setLtv', async () => { it('Check the onlyAaveAdmin on setLtv', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).setLtv(weth.address, '75'), configurator.connect(users[2].signer).setLtv(weth.address, '75'),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Changes liquidation threshold of the reserve', async () => { it('Changes liquidation threshold of the reserve', async () => {
@ -190,12 +190,12 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
); );
}); });
it('Check the onlyLendingPoolManager on setLiquidationThreshold', async () => { it('Check the onlyAaveAdmin on setLiquidationThreshold', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).setLiquidationThreshold(weth.address, '80'), configurator.connect(users[2].signer).setLiquidationThreshold(weth.address, '80'),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Changes liquidation bonus of the reserve', async () => { it('Changes liquidation bonus of the reserve', async () => {
@ -208,28 +208,28 @@ makeSuite('LendingPoolConfigurator', (testEnv: TestEnv) => {
); );
}); });
it('Check the onlyLendingPoolManager on setLiquidationBonus', async () => { it('Check the onlyAaveAdmin on setLiquidationBonus', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).setLiquidationBonus(weth.address, '80'), configurator.connect(users[2].signer).setLiquidationBonus(weth.address, '80'),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on setReserveDecimals', async () => { it('Check the onlyAaveAdmin on setReserveDecimals', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).setReserveDecimals(weth.address, '80'), configurator.connect(users[2].signer).setReserveDecimals(weth.address, '80'),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Check the onlyLendingPoolManager on setLiquidationBonus', async () => { it('Check the onlyAaveAdmin on setLiquidationBonus', async () => {
const {configurator, users, weth} = testEnv; const {configurator, users, weth} = testEnv;
await expect( await expect(
configurator.connect(users[2].signer).setLiquidationBonus(weth.address, '80'), configurator.connect(users[2].signer).setLiquidationBonus(weth.address, '80'),
CALLER_NOT_LENDING_POOL_MANAGER CALLER_NOT_AAVE_ADMIN
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Reverts when trying to disable the DAI reserve with liquidity on it', async () => { it('Reverts when trying to disable the DAI reserve with liquidity on it', async () => {

View File

@ -14,8 +14,8 @@ makeSuite('LendingPoolAddressesProvider', (testEnv: TestEnv) => {
for (const contractFunction of [ for (const contractFunction of [
addressesProvider.setLendingPoolImpl, addressesProvider.setLendingPoolImpl,
addressesProvider.setLendingPoolConfiguratorImpl, addressesProvider.setLendingPoolConfiguratorImpl,
addressesProvider.setLendingPoolLiquidationManager, addressesProvider.setLendingPoolCollateralManager,
addressesProvider.setLendingPoolManager, addressesProvider.setAaveAdmin,
addressesProvider.setPriceOracle, addressesProvider.setPriceOracle,
addressesProvider.setLendingRateOracle, addressesProvider.setLendingRateOracle,
]) { ]) {

View File

@ -13,7 +13,7 @@ import {MockVariableDebtToken} from '../types/MockVariableDebtToken';
import {ZERO_ADDRESS} from '../helpers/constants'; import {ZERO_ADDRESS} from '../helpers/constants';
makeSuite('Upgradeability', (testEnv: TestEnv) => { makeSuite('Upgradeability', (testEnv: TestEnv) => {
const {CALLER_NOT_LENDING_POOL_MANAGER} = ProtocolErrors; const {CALLER_NOT_AAVE_ADMIN} = ProtocolErrors;
let newATokenAddress: string; let newATokenAddress: string;
let newStableTokenAddress: string; let newStableTokenAddress: string;
let newVariableTokenAddress: string; let newVariableTokenAddress: string;
@ -60,7 +60,7 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
await expect( await expect(
configurator.connect(users[1].signer).updateAToken(dai.address, newATokenAddress) configurator.connect(users[1].signer).updateAToken(dai.address, newATokenAddress)
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Upgrades the DAI Atoken implementation ', async () => { it('Upgrades the DAI Atoken implementation ', async () => {
@ -82,7 +82,7 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
configurator configurator
.connect(users[1].signer) .connect(users[1].signer)
.updateStableDebtToken(dai.address, newStableTokenAddress) .updateStableDebtToken(dai.address, newStableTokenAddress)
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Upgrades the DAI stable debt token implementation ', async () => { it('Upgrades the DAI stable debt token implementation ', async () => {
@ -111,7 +111,7 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => {
configurator configurator
.connect(users[1].signer) .connect(users[1].signer)
.updateVariableDebtToken(dai.address, newVariableTokenAddress) .updateVariableDebtToken(dai.address, newVariableTokenAddress)
).to.be.revertedWith(CALLER_NOT_LENDING_POOL_MANAGER); ).to.be.revertedWith(CALLER_NOT_AAVE_ADMIN);
}); });
it('Upgrades the DAI variable debt token implementation ', async () => { it('Upgrades the DAI variable debt token implementation ', async () => {