Skip to main content
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.

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.

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