IERC3156FlashLender.sol 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.0-rc.0 (interfaces/IERC3156FlashLender.sol)
  3. pragma solidity ^0.8.0;
  4. import "./IERC3156FlashBorrower.sol";
  5. /**
  6. * @dev Interface of the ERC3156 FlashLender, as defined in
  7. * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
  8. *
  9. * _Available since v4.1._
  10. */
  11. interface IERC3156FlashLender {
  12. /**
  13. * @dev The amount of currency available to be lended.
  14. * @param token The loan currency.
  15. * @return The amount of `token` that can be borrowed.
  16. */
  17. function maxFlashLoan(address token) external view returns (uint256);
  18. /**
  19. * @dev The fee to be charged for a given loan.
  20. * @param token The loan currency.
  21. * @param amount The amount of tokens lent.
  22. * @return The amount of `token` to be charged for the loan, on top of the returned principal.
  23. */
  24. function flashFee(address token, uint256 amount) external view returns (uint256);
  25. /**
  26. * @dev Initiate a flash loan.
  27. * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
  28. * @param token The loan currency.
  29. * @param amount The amount of tokens lent.
  30. * @param data Arbitrary data structure, intended to contain user-defined parameters.
  31. */
  32. function flashLoan(
  33. IERC3156FlashBorrower receiver,
  34. address token,
  35. uint256 amount,
  36. bytes calldata data
  37. ) external returns (bool);
  38. }