IERC3156FlashLender.sol 1.3 KB

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