> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ERC-3156 (erc3156)

> Standard interface for flash loans (EIP-3156). Provides flashLoan, flashFee, and maxFlashLoan functions for any conforming lender.

Standard interface for flash loans (EIP-3156). Provides flashLoan, flashFee, and maxFlashLoan functions for any conforming lender. Many protocols lend flash loans through an interface of their own instead, which this one does not call.

| Fact | Value |
| - | - |
| Category | Infrastructure and standards |
| Family | none |
| Namespace | none: import its ABI |
| Chains | none recorded |

## What it offers

* **flashFee**: Query the fee for a flash loan of a specific token and amount
* **maxFlashLoan**: Query the maximum flash loan amount for a token
* **flashLoan**: Execute a flash loan (borrow and repay in same transaction)

## Notes

* Standard interface (EIP-3156), not a specific deployment - no fixed addresses
* Conforming lenders implement all three functions: Maker's DssFlash (DAI) and Aave's GHO flash minter (GHO), for example, or an ERC-3156 adapter in front of another protocol's flash loans. `maxFlashLoan(token)` is non-zero for a token the lender lends
* Protocol-specific flash loans are not ERC-3156, and `flashFee`/`maxFlashLoan` revert there: Aave V3's Pool (`flashLoanSimple`/`flashLoan`, receiver callback `executeOperation`, premium `FLASHLOAN_PREMIUM_TOTAL` in basis points), Balancer V2's Vault (`flashLoan(recipient, tokens, amounts, userData)`, callback `receiveFlashLoan`) and Uniswap V3 pools (`flash`, callback `uniswapV3FlashCallback`). Call those through their own protocol's interface
* Receiver contract must implement `onFlashLoan(address,address,uint256,uint256,bytes)` callback
* Must approve lender to pull back amount + fee before callback returns
* Flash loan must be fully repaid within the same transaction (atomic)
* The fee is each lender's: read it with `flashFee(token, amount)` before borrowing

## Its names in a program

The registry records no deployment: `FlashLenderABI` is an interface, bound to an address the
program is given.

```ts theme={null}
import FlashLenderABI from "./protocols/erc3156/FlashLenderABI.json";

// The contract's address, a `main` argument.
function main(contract: Address) {
  const target = FlashLenderABI.at(contract);
}
```

## ABI

### `FlashLenderABI`

`import FlashLenderABI from "./protocols/erc3156/FlashLenderABI.json";`

* `flashLoan(address receiver, address token, uint256 amount, bytes data) returns (bool)`
* `flashFee(address token, uint256 amount) view returns (uint256)`
* `maxFlashLoan(address token) view returns (uint256)`

## Next steps

* [Protocols](https://docs.eco.com/sauce-sdk/reference/protocols.md): the other protocols, by what they do.
* [Protocols and tokens](https://docs.eco.com/sauce/names.md): calling a contract by its namespace, or through its ABI.
* [Glossary](https://docs.eco.com/sauce/glossary.md): the words these pages use, in plain terms.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.