- Modified FlashLoanReceiverBase

This commit is contained in:
eboado 2020-11-30 12:02:34 +01:00
parent e25594ca7d
commit 9d1c021945
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);