Overview
TheIFlashLoanRouter interface defines the contract API for coordinating flash loans with CoW Protocol settlements. It acts as a solver for CoW Protocol, enabling solvers to request flash loans and execute settlements in a single transaction.
Contract Details
- Source:
src/interfaces/IFlashLoanRouter.sol - License: GPL-3.0-or-later
- Solidity: ^0.8.28
Functions
flashLoanAndSettle
loans: Array of flash loan specifications, each containing:amount(uint256): Amount of tokens to borrowtoken(IERC20): Token contract addresslender(address): Flash loan provider contractborrower(IBorrower): Adapter contract for the lender
settlement: ABI-encodedsettle()call data for the CoW Settlement contract
- Caller must be a registered CoW Protocol solver
- No concurrent settlement in progress
- Settlement data must encode a valid
settle()call
borrowerCallBack
loansWithSettlement: Encoded remaining loans and settlement data
- Caller must be the expected pending borrower
- Data must match the stored hash
settlementContract
settlementAuthentication
Events
Settlement
Data Types
Loan.Data
Execution Flow
- Solver calls
flashLoanAndSettle()with loan array and settlement data - Router requests each loan sequentially through borrower adapters
- Each borrower receives funds and calls
borrowerCallBack() - After all loans are obtained, the router executes the settlement
- Settlement repays loans through borrower approvals
Key Constraints
- Only one settlement execution per call
- Settlement data cannot be modified during execution
- Only the
settle()function can be called during execution - Callback data must be passed through unmodified
Next Steps
IBorrower
Borrower interface reference
FlashLoanRouter
Full contract reference