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/maxFlashLoanrevert there: Aave V3’s Pool (flashLoanSimple/flashLoan, receiver callbackexecuteOperation, premiumFLASHLOAN_PREMIUM_TOTALin basis points), Balancer V2’s Vault (flashLoan(recipient, tokens, amounts, userData), callbackreceiveFlashLoan) and Uniswap V3 pools (flash, callbackuniswapV3FlashCallback). 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
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
