You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
/**
|
|
* @dev Interface of the ERC3156 FlashBorrower, as defined in
|
|
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
|
|
*
|
|
* _Available since v4.1._
|
|
*/
|
|
interface IERC3156FlashBorrower {
|
|
/**
|
|
* @dev Receive a flash loan.
|
|
* @param initiator The initiator of the loan.
|
|
* @param token The loan currency.
|
|
* @param amount The amount of tokens lent.
|
|
* @param fee The additional amount of tokens to repay.
|
|
* @param data Arbitrary data structure, intended to contain user-defined parameters.
|
|
* @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan"
|
|
*/
|
|
function onFlashLoan(
|
|
address initiator,
|
|
address token,
|
|
uint256 amount,
|
|
uint256 fee,
|
|
bytes calldata data
|
|
) external returns (bytes32);
|
|
}
|
|
|
|
/**
|
|
* @dev Interface of the ERC3156 FlashLender, as defined in
|
|
* https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].
|
|
*/
|
|
interface IERC3156FlashLender {
|
|
/**
|
|
* @dev The amount of currency available to be lended.
|
|
* @param token The loan currency.
|
|
* @return The amount of `token` that can be borrowed.
|
|
*/
|
|
function maxFlashLoan(address token) external view returns (uint256);
|
|
|
|
/**
|
|
* @dev The fee to be charged for a given loan.
|
|
* @param token The loan currency.
|
|
* @param amount The amount of tokens lent.
|
|
* @return The amount of `token` to be charged for the loan, on top of the returned principal.
|
|
*/
|
|
function flashFee(address token, uint256 amount) external view returns (uint256);
|
|
|
|
/**
|
|
* @dev Initiate a flash loan.
|
|
* @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
|
|
* @param token The loan currency.
|
|
* @param amount The amount of tokens lent.
|
|
* @param data Arbitrary data structure, intended to contain user-defined parameters.
|
|
*/
|
|
function flashLoan(
|
|
IERC3156FlashBorrower receiver,
|
|
address token,
|
|
uint256 amount,
|
|
bytes calldata data
|
|
) external returns (bool);
|
|
}
|
|
|