Merge branch 'feat/179-flash-receiver-base' into 'master'

- Modified FlashLoanReceiverBase

Closes #179

See merge request aave-tech/protocol-v2!202
This commit is contained in:
Andrey Ko 2020-11-30 11:09:56 +00:00
commit 51d0604122
3 changed files with 7 additions and 17 deletions

View File

@ -12,21 +12,11 @@ abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
using SafeERC20 for IERC20;
using SafeMath for uint256;
ILendingPoolAddressesProvider internal _addressesProvider;
ILendingPool internal _lendingPool;
ILendingPoolAddressesProvider public immutable override ADDRESSES_PROVIDER;
ILendingPool public immutable override LENDING_POOL;
constructor(ILendingPoolAddressesProvider provider) public {
_addressesProvider = provider;
_lendingPool = ILendingPool(provider.getLendingPool());
ADDRESSES_PROVIDER = provider;
LENDING_POOL = ILendingPool(provider.getLendingPool());
}
function getAddressesProvider() external view override returns (ILendingPoolAddressesProvider) {
return _addressesProvider;
}
function getLendingPool() external view override returns (ILendingPool) {
return _lendingPool;
}
receive() external payable {}
}

View File

@ -19,7 +19,7 @@ interface IFlashLoanReceiver {
bytes calldata params
) external returns (bool);
function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);
function ADDRESSES_PROVIDER() external view returns (ILendingPoolAddressesProvider);
function getLendingPool() external view returns (ILendingPool);
function LENDING_POOL() external view returns (ILendingPool);
}

View File

@ -75,7 +75,7 @@ contract MockFlashLoanReceiver is FlashLoanReceiverBase {
token.mint(premiums[i]);
IERC20(assets[i]).approve(_addressesProvider.getLendingPool(), amountToReturn);
IERC20(assets[i]).approve(address(LENDING_POOL), amountToReturn);
}
emit ExecutedWithSuccess(assets, amounts, premiums);