Overview
This guide will help you quickly build, test, and understand the Flash-Loan Router. You’ll compile the contracts, run the test suite, and learn the basic commands you’ll use during development.Make sure you’ve completed the installation steps before proceeding.
Building the Project
Running Tests
Run the full test suite
Execute all tests with Forge:This runs all tests in the
test/ directory and generates gas snapshots.Run tests without internet connection
If you want to skip end-to-end tests that require RPC access:
E2E tests interact with live networks to test flash-loan integrations with Aave and ERC-3156 compatible lenders.
Run tests with verbosity
For detailed output including console logs:Verbosity levels:
-v: Show test results-vv: Show console logs-vvv: Show execution traces-vvvv: Show execution traces with stack
Understanding Test Isolation
The project uses Foundry’sisolate feature:
Gas Benchmarking
The repository includes gas benchmarking for different flash-loan providers:snapshots/ directory, allowing you to:
- Compare gas costs between different flash-loan providers
- Track gas changes between code modifications
- Optimize contract performance
Code Formatting
Key Contracts
Now that you can build and test, here are the main contracts you’ll work with:| Contract | Location | Purpose |
|---|---|---|
FlashLoanRouter | src/FlashLoanRouter.sol | Main entry point for executing settlements with flash loans |
AaveBorrower | src/AaveBorrower.sol | Adapter for Aave flash-loan protocol |
ERC3156Borrower | src/ERC3156Borrower.sol | Adapter for ERC-3156 compatible lenders (e.g., Maker) |