From 5a1e87ae0999bb7cd06103e488e75993f9766f32 Mon Sep 17 00:00:00 2001 From: Hadrien Charlanes Date: Wed, 12 May 2021 13:45:40 +0200 Subject: [PATCH] rename: renamed flashloaner => flashBorrower --- contracts/interfaces/ILendingPool.sol | 6 ++--- .../interfaces/ILendingPoolConfigurator.sol | 8 +++---- .../protocol/lendingpool/LendingPool.sol | 22 +++++++++++-------- .../lendingpool/LendingPoolConfigurator.sol | 12 +++++----- .../lendingpool/LendingPoolStorage.sol | 2 +- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/contracts/interfaces/ILendingPool.sol b/contracts/interfaces/ILendingPool.sol index 8ecbd40a..c5801065 100644 --- a/contracts/interfaces/ILendingPool.sol +++ b/contracts/interfaces/ILendingPool.sol @@ -459,9 +459,9 @@ interface ILendingPool { function paused() external view returns (bool); - function authorizeFlashloaner(address flashloaner) external; + function authorizeFlashBorrower(address flashBorrower) external; - function unauthorizeFlashloaner(address flashloaner) external; + function unauthorizeFlashBorrower(address flashBorrower) external; - function isFlashloanerAuthorized(address flashloaner) external view returns (bool); + function isFlashBorrowerAuthorized(address flashBorrower) external view returns (bool); } diff --git a/contracts/interfaces/ILendingPoolConfigurator.sol b/contracts/interfaces/ILendingPoolConfigurator.sol index 40f30aee..26de950f 100644 --- a/contracts/interfaces/ILendingPoolConfigurator.sol +++ b/contracts/interfaces/ILendingPoolConfigurator.sol @@ -207,17 +207,17 @@ interface ILendingPoolConfigurator { event RiskAdminUnregistered(address indexed admin); - event FlashloanerAuthorized(address indexed flashloaner); + event FlashBorrowerAuthorized(address indexed flashBorrower); - event FlashloanerUnauthorized(address indexed flashloaner); + event FlashBorrowerUnauthorized(address indexed flashBorrower); function registerRiskAdmin(address admin) external; function unregisterRiskAdmin(address admin) external; - function authorizeFlashloaner(address flashloaner) external; + function authorizeFlashBorrower(address flashBorrower) external; - function unauthorizeFlashloaner(address flashloaner) external; + function unauthorizeFlashBorrower(address flashBorrower) external; function isRiskAdmin(address admin) external view returns (bool); } diff --git a/contracts/protocol/lendingpool/LendingPool.sol b/contracts/protocol/lendingpool/LendingPool.sol index 3b28776d..663c3efa 100644 --- a/contracts/protocol/lendingpool/LendingPool.sol +++ b/contracts/protocol/lendingpool/LendingPool.sol @@ -471,7 +471,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage address[] memory aTokenAddresses = new address[](assets.length); uint256[] memory premiums = new uint256[](assets.length); vars.receiver = IFlashLoanReceiver(receiverAddress); - vars.flashloanPremiumTotal = _authorizedFlashloaners[msg.sender] ? 0 : _flashLoanPremiumTotal; + vars.flashloanPremiumTotal = _authorizedFlashBorrowers[msg.sender] ? 0 : _flashLoanPremiumTotal; for (vars.i = 0; vars.i < assets.length; vars.i++) { aTokenAddresses[vars.i] = _reserves[assets[vars.i]].aTokenAddress; @@ -822,20 +822,24 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage } } - function authorizeFlashloaner(address flashloaner) external override onlyLendingPoolConfigurator { - _authorizedFlashloaners[flashloaner] = true; - } - - function unauthorizeFlashloaner(address flashloaner) + function authorizeFlashBorrower(address flashBorrower) external override onlyLendingPoolConfigurator { - _authorizedFlashloaners[flashloaner] = false; + _authorizedFlashBorrowers[flashBorrower] = true; } - function isFlashloanerAuthorized(address flashloaner) external view override returns (bool) { - return _authorizedFlashloaners[flashloaner]; + function unauthorizeFlashBorrower(address flashBorrower) + external + override + onlyLendingPoolConfigurator + { + _authorizedFlashBorrowers[flashBorrower] = false; + } + + function isFlashBorrowerAuthorized(address flashBorrower) external view override returns (bool) { + return _authorizedFlashBorrowers[flashBorrower]; } struct ExecuteBorrowParams { diff --git a/contracts/protocol/lendingpool/LendingPoolConfigurator.sol b/contracts/protocol/lendingpool/LendingPoolConfigurator.sol index 6fe55fc8..80ca2410 100644 --- a/contracts/protocol/lendingpool/LendingPoolConfigurator.sol +++ b/contracts/protocol/lendingpool/LendingPoolConfigurator.sol @@ -537,14 +537,14 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur emit RiskAdminUnregistered(admin); } - function authorizeFlashloaner(address flashloaner) external override onlyPoolAdmin { - pool.authorizeFlashloaner(flashloaner); - emit FlashloanerAuthorized(flashloaner); + function authorizeFlashBorrower(address flashBorrower) external override onlyPoolAdmin { + pool.authorizeFlashBorrower(flashBorrower); + emit FlashBorrowerAuthorized(flashBorrower); } - function unauthorizeFlashloaner(address flashloaner) external override onlyPoolAdmin { - pool.unauthorizeFlashloaner(flashloaner); - emit FlashloanerUnauthorized(flashloaner); + function unauthorizeFlashBorrower(address flashBorrower) external override onlyPoolAdmin { + pool.unauthorizeFlashBorrower(flashBorrower); + emit FlashBorrowerUnauthorized(flashBorrower); } function isRiskAdmin(address admin) external view override onlyPoolAdmin returns (bool) { diff --git a/contracts/protocol/lendingpool/LendingPoolStorage.sol b/contracts/protocol/lendingpool/LendingPoolStorage.sol index 8dcf1d9d..4f37e658 100644 --- a/contracts/protocol/lendingpool/LendingPoolStorage.sol +++ b/contracts/protocol/lendingpool/LendingPoolStorage.sol @@ -30,5 +30,5 @@ contract LendingPoolStorage { uint256 internal _maxNumberOfReserves; - mapping(address => bool) _authorizedFlashloaners; + mapping(address => bool) _authorizedFlashBorrowers; }