Skip to main content

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:
ContractAddress
FlashLoanRouter0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69
AaveBorrower0x7d9C4DeE56933151Bc5C909cfe09DEf0d315CB4A
ERC3156Borrower0x47d71b4B3336AB2729436186C216955F3C27cD04
See the networks.json file for deployment details.

How Flash Loans Work

The flash loan lifecycle follows this sequence:
  1. Request: Solver calls flashLoanAndSettle() with loan specifications
  2. Borrow: Router requests loans from specified providers via borrower adapters
  3. Execute: Settlement executes with access to borrowed funds
  4. Repay: Settlement returns borrowed funds plus fees to lenders
  5. Verify: Transaction reverts if any loan cannot be repaid
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:
amount
uint256
required
The amount of tokens to borrow
token
address
required
The ERC-20 token contract address to borrow
lender
address
required
The flash loan provider contract (e.g., Balancer, Aave, Maker)
borrower
address
required
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:
// Called during settlement to approve fund transfers
borrower.approve(token, spender, amount);
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:
  1. Transfer: Settlement transfers borrowed funds back to the borrower
  2. Approve: Settlement sets an approval for the lender to spend borrower’s funds
  3. Pull: Lender pulls funds back using transferFrom after settlement completes
Inability to repay a flash loan will cause the entire transaction to revert. Ensure your settlement logic accounts for:
  • Loan principal amounts
  • Provider-specific fees
  • Sufficient token balances in borrower contracts

Adding New Providers

Support for additional flash loan providers can be added by implementing a new borrower adapter. See Borrower Adapters for implementation details.

Next Steps

Last modified on March 4, 2026