I am attempting to compile a flash loan contract. I am having issues with the external payable function. I've tried adding fallback or receive as the error message suggests but I still receive the same error. Is there a particular way this line of code needs to be written? All help appreciated. Thanks.
contract FlashLoanReceiverBase is IFlashLoanReceiver {
using SafeMath for uint256;
address constant ETHADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
ILendingPoolAddressesProvider public addressesProvider = ILendingPoolAddressesProvider(
0x24a42fD28C976A61Df5D00D0599C34c4f90748c8
);
function() external payable {}
function transferFundsBackToPoolInternal(address _reserve, uint256 _amount)
internal
{
address payable core = addressesProvider.getLendingPoolCore();
transferInternal(core, _reserve, _amount);
}
function transferInternal(
address payable _destination,
address _reserve,
uint256 _amount
) internal {
if (_reserve == ETHADDRESS) {
//solium-disable-next-line
_destination.call.value(_amount)("");
return;
}
IERC20(_reserve).transfer(_destination, _amount);
}
function getBalanceInternal(address _target, address _reserve)
internal
view
returns (uint256)
{
if (_reserve == ETHADDRESS) {
return _target.balance;
}
return IERC20(_reserve).balanceOf(_target);
}
}
function() external payable {}
? Do you simply want to be able to receive Ethers in the contract?