> For the complete documentation index, see [llms.txt](https://docs.fringe.fi/smart-contract-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fringe.fi/smart-contract-documentation/openzeppelin/contracts-upgradeable/interfaces/ierc3156flashlenderupgradeable.md).

# IERC 3156 Flash Lender Upgradeable

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

## Methods

### flashFee

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

*The fee to be charged for a given loan.*

#### Parameters

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

#### Returns

| Name | Type    | Description                                                                         |
| ---- | ------- | ----------------------------------------------------------------------------------- |
| \_0  | uint256 | The amount of `token` to be charged for the loan, on top of the returned principal. |

### flashLoan

```solidity
function flashLoan(contract IERC3156FlashBorrowerUpgradeable receiver, address token, uint256 amount, bytes data) external nonpayable returns (bool)
```

*Initiate a flash loan.*

#### Parameters

| Name     | Type                                      | Description                                                               |
| -------- | ----------------------------------------- | ------------------------------------------------------------------------- |
| receiver | contract IERC3156FlashBorrowerUpgradeable | 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.    |

#### Returns

| Name | Type | Description |
| ---- | ---- | ----------- |
| \_0  | bool | undefined   |

### maxFlashLoan

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

*The amount of currency available to be lended.*

#### Parameters

| Name  | Type    | Description        |
| ----- | ------- | ------------------ |
| token | address | The loan currency. |

#### Returns

| Name | Type    | Description                                 |
| ---- | ------- | ------------------------------------------- |
| \_0  | uint256 | The amount of `token` that can be borrowed. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fringe.fi/smart-contract-documentation/openzeppelin/contracts-upgradeable/interfaces/ierc3156flashlenderupgradeable.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
