- Added initialization of _lendingPool to FlashLoanReceiverBase and getters.

This commit is contained in:
eboado 2020-11-27 15:15:05 +01:00
parent 578f3171bf
commit ae94f8ba49
2 changed files with 19 additions and 1 deletions

View File

@ -3,18 +3,29 @@ pragma solidity 0.6.12;
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import {IFlashLoanReceiver} from '../interfaces/IFlashLoanReceiver.sol';
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
using SafeERC20 for IERC20;
using SafeMath for uint256;
ILendingPoolAddressesProvider internal _addressesProvider;
ILendingPool internal _lendingPool;
constructor(ILendingPoolAddressesProvider provider) public {
_addressesProvider = provider;
_lendingPool = 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

@ -1,6 +1,9 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
/**
* @title IFlashLoanReceiver interface
* @notice Interface for the Aave fee IFlashLoanReceiver.
@ -15,4 +18,8 @@ interface IFlashLoanReceiver {
address initiator,
bytes calldata params
) external returns (bool);
function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);
function getLendingPool() external view returns (ILendingPool);
}