Skip to main content
Contract verification allows users and developers to view and interact with your contract source code on block explorers like Etherscan.

Automatic Verification

The easiest way to verify contracts is during deployment by adding the --verify flag to your Forge script command.

During Deployment

Ensure the ETHERSCAN_API_KEY environment variable is set before using the --verify flag.

Manual Verification

If automatic verification fails or you need to verify an already deployed contract, use the forge verify-contract command.

Prerequisites

1

Set environment variables

2

Identify contract addresses

Find the deployed contract addresses in networks.json or from your deployment output.

Verify FlashLoanRouter

The FlashLoanRouter is initialized with the CoW Settlement contract address (0x9008D19f58AAbD9eD0D60971565AA8510560ab41).
The constructor argument is the CoW Settlement contract address, which is consistent across all supported networks.

Verify AaveBorrower

The AaveBorrower is initialized with the FlashLoanRouter address.

Verify ERC3156Borrower

The ERC3156Borrower is also initialized with the FlashLoanRouter address.

Understanding Constructor Arguments

The cast abi-encode command encodes constructor arguments in the format expected by Etherscan.

Syntax

Examples

Network-Specific API Keys

Different networks require different API keys:
Most explorers use the same API key infrastructure. Register at the respective explorer website to obtain your API key.

Verification Status

After running the verification command, you’ll see one of these outputs:
The contract is successfully verified and visible on the explorer.
The contract was previously verified. No action needed.
Common causes:
  • Incorrect constructor arguments
  • Wrong compiler version or settings
  • Invalid API key
  • Network issues
See troubleshooting section below.

Troubleshooting

Ensure you’re using the correct addresses for constructor arguments:
  • FlashLoanRouter: Uses CoW Settlement address 0x9008D19f58AAbD9eD0D60971565AA8510560ab41
  • Borrower contracts: Use FlashLoanRouter address 0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69
Verify addresses in networks.json for the specific network.
The contracts are compiled with specific settings from foundry.toml:
Forge automatically uses these settings during verification.
Block explorer APIs have rate limits. If you encounter rate limiting:
  1. Wait a few minutes before retrying
  2. Verify contracts sequentially, not in parallel
  3. Check your API key tier for rate limit details
Verify your API key is:
  • Correctly set in environment variables
  • Valid and not expired
  • For the correct network (e.g., mainnet vs testnet)
  • Has verification permissions enabled

Verify Multiple Contracts

To verify all three contracts sequentially:
Make the script executable with chmod +x verify-all.sh before running.

Next Steps

Deployment Guide

Learn how to deploy contracts to new networks

Supported Networks

View verified contracts across all networks
Last modified on March 4, 2026