rename LendingPoolLiquidationManager -> LendingPoolCollateralManager

This commit is contained in:
andyk 2020-09-16 13:41:12 +03:00
parent 6177af3a70
commit 66113d64a2
11 changed files with 35 additions and 35 deletions

View File

@ -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);
}
/**

View File

@ -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);
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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'

View File

@ -495,4 +495,4 @@
"address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
}
}
}
}

View File

@ -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<LendingRateOracle>(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 () =>

View File

@ -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'

View File

@ -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);

View File

@ -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,