2020-05-29 16:45:37 +00:00
|
|
|
// SPDX-License-Identifier: agpl-3.0
|
|
|
|
pragma solidity ^0.6.8;
|
|
|
|
|
|
|
|
import "@openzeppelin/contracts/math/SafeMath.sol";
|
|
|
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
import "../interfaces/IFlashLoanReceiver.sol";
|
|
|
|
import "../../interfaces/ILendingPoolAddressesProvider.sol";
|
2020-06-02 13:49:24 +00:00
|
|
|
import "../../libraries/UniversalERC20.sol";
|
2020-05-29 16:45:37 +00:00
|
|
|
|
|
|
|
abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
|
|
|
|
|
2020-06-02 13:49:24 +00:00
|
|
|
using UniversalERC20 for IERC20;
|
2020-05-29 16:45:37 +00:00
|
|
|
using SafeMath for uint256;
|
|
|
|
|
|
|
|
ILendingPoolAddressesProvider public addressesProvider;
|
|
|
|
|
|
|
|
constructor(ILendingPoolAddressesProvider _provider) public {
|
|
|
|
addressesProvider = _provider;
|
|
|
|
}
|
|
|
|
|
|
|
|
receive() external payable {}
|
|
|
|
|
|
|
|
function transferFundsBackToPoolInternal(address _reserve, uint256 _amount) internal {
|
2020-06-03 11:02:18 +00:00
|
|
|
IERC20(_reserve).universalTransfer(
|
|
|
|
addressesProvider.getLendingPoolCore(), // lending-pool core address
|
|
|
|
_amount
|
|
|
|
);
|
2020-05-29 16:45:37 +00:00
|
|
|
}
|
2020-06-02 14:16:22 +00:00
|
|
|
}
|