What are Flash Loans?
Flash loans are uncollateralized loans that must be borrowed and repaid within a single transaction. They enable solvers to access large amounts of capital without upfront collateral, provided the loan is fully repaid by the end of the transaction execution. The Flash-Loan Router allows CoW Protocol solvers to execute settlements with the ability to use funds from one or more flash loans, enabling more capital-efficient trading strategies.Supported Providers
The router currently supports two types of flash loan providers:ERC-3156
Any lender compatible with the ERC-3156 standard interface, including Maker’s Flash Mint Module.
Aave
Aave Protocol flash loans with native integration.
Provider Addresses
All contracts are deployed deterministically with CREATE2 and share the same addresses across supported networks:| Contract | Address |
|---|---|
| FlashLoanRouter | 0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69 |
| AaveBorrower | 0x7d9C4DeE56933151Bc5C909cfe09DEf0d315CB4A |
| ERC3156Borrower | 0x47d71b4B3336AB2729436186C216955F3C27cD04 |
How Flash Loans Work
The flash loan lifecycle follows this sequence:- Request: Solver calls
flashLoanAndSettle()with loan specifications - Borrow: Router requests loans from specified providers via borrower adapters
- Execute: Settlement executes with access to borrowed funds
- Repay: Settlement returns borrowed funds plus fees to lenders
- Verify: Transaction reverts if any loan cannot be repaid
Example: Settlement with Two Loans (Aave + Maker)
Example: Settlement with Two Loans (Aave + Maker)
Each flash loan is processed sequentially, with the settlement executing only after all loans are obtained.
Loan Specification
Each flash loan request requires the following parameters:The amount of tokens to borrow
The ERC-20 token contract address to borrow
The flash loan provider contract (e.g., Balancer, Aave, Maker)
The adapter contract that makes the specific lender implementation compatible with the router
Fund Management
Accessing Loaned Funds
The only way to move funds out of a borrower is through ERC-20 approvals:Best Practice: Set unlimited approvals once for the settlement contract and reuse them across multiple settlements to save gas.
Repayment Process
Repayment mechanisms vary by provider:- Transfer: Settlement transfers borrowed funds back to the borrower
- Approve: Settlement sets an approval for the lender to spend borrower’s funds
- Pull: Lender pulls funds back using
transferFromafter settlement completes