Skip to main content

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

1

Navigate to the project directory

2

Compile the contracts

Build all smart contracts using Forge:
This command:
  • Compiles all Solidity files in the src/ directory
  • Generates artifacts in the out/ directory
  • Uses the configuration from foundry.toml
Expected output:

Running Tests

1

Run the full test suite

Execute all tests with Forge:
This runs all tests in the test/ directory and generates gas snapshots.
2

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.
3

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
4

Run specific tests

Test a specific contract or function:

Understanding Test Isolation

The project uses Foundry’s isolate feature:
This ensures transient storage is cleared between each call in a test function, providing better control over state management.

Gas Benchmarking

The repository includes gas benchmarking for different flash-loan providers:
Gas snapshots are automatically generated in the snapshots/ directory, allowing you to:
  • Compare gas costs between different flash-loan providers
  • Track gas changes between code modifications
  • Optimize contract performance

Code Formatting

1

Check code formatting

Verify that your code follows the project’s style:
2

Format code automatically

Auto-format all Solidity files:
Some files (like FlashLoanRouter.sol) are excluded from formatting due to Foundry’s lack of support for the transient keyword.

Key Contracts

Now that you can build and test, here are the main contracts you’ll work with:

Common Development Commands

Quick Verification

Run this command to verify your setup is working correctly:
If both commands succeed, you’re ready to start developing!

Next Steps

Deploy Contracts

Learn how to deploy the Flash-Loan Router to a network

Architecture

Understand the design and security model

Router Design

Learn how to integrate flash loans into settlements

Contract Reference

Explore the contract API documentation
Last modified on March 4, 2026