diff --git a/contracts/configuration/LendingPoolAddressesProvider.sol b/contracts/configuration/LendingPoolAddressesProvider.sol index c398f578..5b91d565 100644 --- a/contracts/configuration/LendingPoolAddressesProvider.sol +++ b/contracts/configuration/LendingPoolAddressesProvider.sol @@ -65,13 +65,13 @@ 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 * the addresses are changed directly. * @return the address of the Lending pool liquidation manager **/ - function getLendingPoolLiquidationManager() external override view returns (address) { + function getLendingPoolCollateralManager() external override view returns (address) { return _addresses[LENDING_POOL_LIQUIDATION_MANAGER]; } @@ -79,9 +79,9 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider * @dev updates the address of the Lending pool liquidation manager * @param manager the new lending pool liquidation manager address **/ - function setLendingPoolLiquidationManager(address manager) external override onlyOwner { + function setLendingPoolCollateralManager(address manager) external override onlyOwner { _addresses[LENDING_POOL_LIQUIDATION_MANAGER] = manager; - emit LendingPoolLiquidationManagerUpdated(manager); + emit LendingPoolCollateralManagerUpdated(manager); } /** diff --git a/contracts/interfaces/ILendingPool.sol b/contracts/interfaces/ILendingPool.sol index 85746888..d19f7ba1 100644 --- a/contracts/interfaces/ILendingPool.sol +++ b/contracts/interfaces/ILendingPool.sol @@ -111,7 +111,7 @@ interface ILendingPool { ); /** * @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(). * 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 */ - function paused() external view returns(bool); + function paused() external view returns (bool); } diff --git a/contracts/interfaces/ILendingPoolAddressesProvider.sol b/contracts/interfaces/ILendingPoolAddressesProvider.sol index 78e336f9..2d53b248 100644 --- a/contracts/interfaces/ILendingPoolAddressesProvider.sol +++ b/contracts/interfaces/ILendingPoolAddressesProvider.sol @@ -11,7 +11,7 @@ interface ILendingPoolAddressesProvider { event LendingPoolUpdated(address indexed newAddress); event LendingPoolManagerUpdated(address indexed newAddress); event LendingPoolConfiguratorUpdated(address indexed newAddress); - event LendingPoolLiquidationManagerUpdated(address indexed newAddress); + event LendingPoolCollateralManagerUpdated(address indexed newAddress); event EthereumAddressUpdated(address indexed newAddress); event PriceOracleUpdated(address indexed newAddress); event LendingRateOracleUpdated(address indexed newAddress); @@ -26,9 +26,9 @@ interface ILendingPoolAddressesProvider { 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); diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol index 69a92b6f..e6a3c059 100644 --- a/contracts/lendingpool/LendingPool.sol +++ b/contracts/lendingpool/LendingPool.sol @@ -21,7 +21,7 @@ import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol' import {IVariableDebtToken} from '../tokenization/interfaces/IVariableDebtToken.sol'; import {IFlashLoanReceiver} from '../flashloan/interfaces/IFlashLoanReceiver.sol'; import {ISwapAdapter} from '../interfaces/ISwapAdapter.sol'; -import {LendingPoolLiquidationManager} from './LendingPoolLiquidationManager.sol'; +import {LendingPoolCollateralManager} from './LendingPoolCollateralManager.sol'; import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {ILendingPool} from '../interfaces/ILendingPool.sol'; @@ -451,10 +451,10 @@ contract LendingPool is VersionedInitializable, ILendingPool { bool receiveAToken ) external override { whenNotPaused(); - address liquidationManager = _addressesProvider.getLendingPoolLiquidationManager(); + address collateralManager = _addressesProvider.getLendingPoolCollateralManager(); //solium-disable-next-line - (bool success, bytes memory result) = liquidationManager.delegatecall( + (bool success, bytes memory result) = collateralManager.delegatecall( abi.encodeWithSignature( 'liquidationCall(address,address,address,uint256,bool)', collateral, @@ -511,10 +511,10 @@ contract LendingPool is VersionedInitializable, ILendingPool { require(!_flashLiquidationLocked, Errors.REENTRANCY_NOT_ALLOWED); _flashLiquidationLocked = true; - address liquidationManager = _addressesProvider.getLendingPoolLiquidationManager(); + address collateralManager = _addressesProvider.getLendingPoolCollateralManager(); //solium-disable-next-line - (bool success, bytes memory result) = liquidationManager.delegatecall( + (bool success, bytes memory result) = collateralManager.delegatecall( abi.encodeWithSignature( 'repayWithCollateral(address,address,address,uint256,address,bytes)', collateral, @@ -618,10 +618,10 @@ contract LendingPool is VersionedInitializable, ILendingPool { bytes calldata params ) external override { whenNotPaused(); - address liquidationManager = _addressesProvider.getLendingPoolLiquidationManager(); + address collateralManager = _addressesProvider.getLendingPoolCollateralManager(); //solium-disable-next-line - (bool success, bytes memory result) = liquidationManager.delegatecall( + (bool success, bytes memory result) = collateralManager.delegatecall( abi.encodeWithSignature( 'swapLiquidity(address,address,address,uint256,bytes)', receiverAddress, @@ -1035,7 +1035,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { /** * @dev Returns if the LendingPool is paused */ - function paused() external view override returns(bool) { + function paused() external override view returns (bool) { return _paused; } } diff --git a/contracts/lendingpool/LendingPoolLiquidationManager.sol b/contracts/lendingpool/LendingPoolCollateralManager.sol similarity index 98% rename from contracts/lendingpool/LendingPoolLiquidationManager.sol rename to contracts/lendingpool/LendingPoolCollateralManager.sol index 6adc18d9..f94cf470 100644 --- a/contracts/lendingpool/LendingPoolLiquidationManager.sol +++ b/contracts/lendingpool/LendingPoolCollateralManager.sol @@ -24,12 +24,12 @@ import {Errors} from '../libraries/helpers/Errors.sol'; import {ValidationLogic} from '../libraries/logic/ValidationLogic.sol'; /** - * @title LendingPoolLiquidationManager contract + * @title LendingPoolCollateralManager contract * @author Aave * @notice Implements the liquidation function. - * @dev LendingPoolLiquidationManager inherits Pausable from OpenZeppelin to have the same storage layout as LendingPool + * @dev LendingPoolCollateralManager inherits Pausable from OpenZeppelin to have the same storage layout as LendingPool **/ -contract LendingPoolLiquidationManager is VersionedInitializable { +contract LendingPoolCollateralManager is VersionedInitializable { using SafeERC20 for IERC20; using SafeMath for uint256; using WadRayMath for uint256; diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol index 48c53ba6..d0cc1384 100644 --- a/contracts/libraries/helpers/Errors.sol +++ b/contracts/libraries/helpers/Errors.sol @@ -65,7 +65,7 @@ library Errors { //require error messages - LendingPoolAddressesProviderRegistry 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 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' diff --git a/deployed-contracts.json b/deployed-contracts.json index 9981b17c..00c4ef4f 100644 --- a/deployed-contracts.json +++ b/deployed-contracts.json @@ -495,4 +495,4 @@ "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2" } } -} +} \ No newline at end of file diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index 44e4fb5a..f2476e18 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -21,7 +21,7 @@ import {PriceOracle} from '../types/PriceOracle'; import {MockAggregator} from '../types/MockAggregator'; import {LendingRateOracle} from '../types/LendingRateOracle'; import {DefaultReserveInterestRateStrategy} from '../types/DefaultReserveInterestRateStrategy'; -import {LendingPoolLiquidationManager} from '../types/LendingPoolLiquidationManager'; +import {LendingPoolCollateralManager} from '../types/LendingPoolCollateralManager'; import {InitializableAdminUpgradeabilityProxy} from '../types/InitializableAdminUpgradeabilityProxy'; import {MockFlashLoanReceiver} from '../types/MockFlashLoanReceiver'; import {WalletBalanceProvider} from '../types/WalletBalanceProvider'; @@ -192,16 +192,16 @@ export const deployChainlinkProxyPriceProvider = async ([ export const deployLendingRateOracle = async () => await deployContract(eContractid.LendingRateOracle, []); -export const deployLendingPoolLiquidationManager = async () => { - const liquidationManagerArtifact = await readArtifact( +export const deployLendingPoolCollateralManager = async () => { + const collateralManagerArtifact = await readArtifact( BRE.config.paths.artifacts, - eContractid.LendingPoolLiquidationManager + eContractid.LendingPoolCollateralManager ); - const factory = await linkLibrariesToArtifact(liquidationManagerArtifact); + const factory = await linkLibrariesToArtifact(collateralManagerArtifact); - const liquidationManager = await factory.deploy(); - return (await liquidationManager.deployed()) as LendingPoolLiquidationManager; + const collateralManager = await factory.deploy(); + return (await collateralManager.deployed()) as LendingPoolCollateralManager; }; export const deployInitializableAdminUpgradeabilityProxy = async () => diff --git a/helpers/types.ts b/helpers/types.ts index 966180d4..6c38090a 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -30,7 +30,7 @@ export enum eContractid { LendingRateOracle = 'LendingRateOracle', ChainlinkProxyPriceProvider = 'ChainlinkProxyPriceProvider', DefaultReserveInterestRateStrategy = 'DefaultReserveInterestRateStrategy', - LendingPoolLiquidationManager = 'LendingPoolLiquidationManager', + LendingPoolCollateralManager = 'LendingPoolCollateralManager', InitializableAdminUpgradeabilityProxy = 'InitializableAdminUpgradeabilityProxy', MockFlashLoanReceiver = 'MockFlashLoanReceiver', MockSwapAdapter = 'MockSwapAdapter', @@ -92,7 +92,7 @@ export enum ProtocolErrors { //require error messages - LendingPoolAddressesProviderRegistry 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' 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' diff --git a/test/__setup.spec.ts b/test/__setup.spec.ts index e2db2752..37b72d99 100644 --- a/test/__setup.spec.ts +++ b/test/__setup.spec.ts @@ -12,7 +12,7 @@ import { deployChainlinkProxyPriceProvider, deployLendingRateOracle, deployDefaultReserveInterestRateStrategy, - deployLendingPoolLiquidationManager, + deployLendingPoolCollateralManager, deployMockFlashLoanReceiver, deployWalletBalancerProvider, getLendingPool, @@ -496,9 +496,9 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => { lendingPoolConfiguratorProxy ); - const liquidationManager = await deployLendingPoolLiquidationManager(); + const collateralManager = await deployLendingPoolCollateralManager(); await waitForTx( - await addressesProvider.setLendingPoolLiquidationManager(liquidationManager.address) + await addressesProvider.setLendingPoolCollateralManager(collateralManager.address) ); const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address); diff --git a/test/lending-pool-addresses-provider.spec.ts b/test/lending-pool-addresses-provider.spec.ts index 7be4de3e..8c36b32f 100644 --- a/test/lending-pool-addresses-provider.spec.ts +++ b/test/lending-pool-addresses-provider.spec.ts @@ -14,7 +14,7 @@ makeSuite('LendingPoolAddressesProvider', (testEnv: TestEnv) => { for (const contractFunction of [ addressesProvider.setLendingPoolImpl, addressesProvider.setLendingPoolConfiguratorImpl, - addressesProvider.setLendingPoolLiquidationManager, + addressesProvider.setLendingPoolCollateralManager, addressesProvider.setLendingPoolManager, addressesProvider.setPriceOracle, addressesProvider.setLendingRateOracle,