refactor: LendingPool: flash loan borrowers authorization functions merged into one

This commit is contained in:
Hadrien Charlanes 2021-06-04 09:55:36 +02:00
parent a0c92d47d0
commit b03710b9dc
3 changed files with 5 additions and 15 deletions

View File

@ -459,9 +459,7 @@ interface ILendingPool {
function paused() external view returns (bool); function paused() external view returns (bool);
function authorizeFlashBorrower(address flashBorrower) external; function updateFlashBorrowerAuthorization(address flashBorrower, bool authorized) external;
function unauthorizeFlashBorrower(address flashBorrower) external;
function isFlashBorrowerAuthorized(address flashBorrower) external view returns (bool); function isFlashBorrowerAuthorized(address flashBorrower) external view returns (bool);
} }

View File

@ -822,20 +822,12 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
} }
} }
function authorizeFlashBorrower(address flashBorrower) function updateFlashBorrowerAuthorization(address flashBorrower, bool authorized)
external external
override override
onlyLendingPoolConfigurator onlyLendingPoolConfigurator
{ {
_authorizedFlashBorrowers[flashBorrower] = true; _authorizedFlashBorrowers[flashBorrower] = authorized;
}
function unauthorizeFlashBorrower(address flashBorrower)
external
override
onlyLendingPoolConfigurator
{
_authorizedFlashBorrowers[flashBorrower] = false;
} }
function isFlashBorrowerAuthorized(address flashBorrower) external view override returns (bool) { function isFlashBorrowerAuthorized(address flashBorrower) external view override returns (bool) {

View File

@ -487,13 +487,13 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
/// @inheritdoc ILendingPoolConfigurator /// @inheritdoc ILendingPoolConfigurator
function authorizeFlashBorrower(address flashBorrower) external override onlyPoolAdmin { function authorizeFlashBorrower(address flashBorrower) external override onlyPoolAdmin {
_pool.authorizeFlashBorrower(flashBorrower); _pool.updateFlashBorrowerAuthorization(flashBorrower, true);
emit FlashBorrowerAuthorized(flashBorrower); emit FlashBorrowerAuthorized(flashBorrower);
} }
/// @inheritdoc ILendingPoolConfigurator /// @inheritdoc ILendingPoolConfigurator
function unauthorizeFlashBorrower(address flashBorrower) external override onlyPoolAdmin { function unauthorizeFlashBorrower(address flashBorrower) external override onlyPoolAdmin {
_pool.unauthorizeFlashBorrower(flashBorrower); _pool.updateFlashBorrowerAuthorization(flashBorrower, false);
emit FlashBorrowerUnauthorized(flashBorrower); emit FlashBorrowerUnauthorized(flashBorrower);
} }