IERC3156FlashLender.sol 1.4 KB

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