OrderBookV3FlashLender

Git Source

Inherits: IERC3156FlashLender

Implements IERC3156FlashLender for OrderBook. Based on the reference implementation by Alberto Cuesta Cañada found at https://eips.ethereum.org/EIPS/eip-3156#flash-loan-reference-implementation

Functions

flashLoan

Initiate a flash loan.

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

Parameters

NameTypeDescription
receiverIERC3156FlashBorrowerThe receiver of the tokens in the loan, and the receiver of the callback.
tokenaddressThe loan currency.
amountuint256The amount of tokens lent.
databytesArbitrary data structure, intended to contain user-defined parameters.

flashFee

The fee to be charged for a given loan.

function flashFee(address, uint256) external pure override returns (uint256);

Parameters

NameTypeDescription
<none>address
<none>uint256

Returns

NameTypeDescription
<none>uint256The amount of token to be charged for the loan, on top of the returned principal.

maxFlashLoan

There's no limit to the size of a flash loan from Orderbook other than the current tokens deposited in Orderbook. If there is an active debt then loans are disabled so the max becomes 0 until after repayment.

The amount of currency available to be lent.

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

Parameters

NameTypeDescription
tokenaddressThe loan currency.

Returns

NameTypeDescription
<none>uint256The amount of token that can be borrowed.