Skip to content

Latest commit

 

History

History
260 lines (227 loc) · 8.05 KB

IERC3156FlashLender.md

File metadata and controls

260 lines (227 loc) · 8.05 KB

IERC3156FlashLender.sol

View Source: openzeppelin-solidity/contracts/interfaces/IERC3156FlashLender.sol

↘ Derived Contracts: WithFlashLoan

IERC3156FlashLender

Interface of the ERC3156 FlashLender, as defined in https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. Available since v4.1.

Functions

maxFlashLoan

The amount of currency available to be lended.

function maxFlashLoan(address token) external view
returns(uint256)

Arguments

Name Type Description
token address The loan currency.

Returns

The amount of token that can be borrowed.

Source Code
function maxFlashLoan(address token) external view returns (uint256);

flashFee

The fee to be charged for a given loan.

function flashFee(address token, uint256 amount) external view
returns(uint256)

Arguments

Name Type Description
token address The loan currency.
amount uint256 The amount of tokens lent.

Returns

The amount of token to be charged for the loan, on top of the returned principal.

Source Code
function flashFee(address token, uint256 amount) external view returns (uint256);

flashLoan

Initiate a flash loan.

function flashLoan(IERC3156FlashBorrower receiver, address token, uint256 amount, bytes data) external nonpayable
returns(bool)

Arguments

Name Type Description
receiver IERC3156FlashBorrower The receiver of the tokens in the loan, and the receiver of the callback.
token address The loan currency.
amount uint256 The amount of tokens lent.
data bytes Arbitrary data structure, intended to contain user-defined parameters.
Source Code
function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes calldata data
    ) external returns (bool);

Contracts