verify
Validate a deployed contract on Etherscan (requires API key) or zkSync Explorer (no API key).
Instructions
Verify a deployed contract on a block explorer (forge verify-contract --zksync). Supports Etherscan (requires API key) and zkSync Explorer (no key needed).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Absolute path to the foundry project directory | |
| profile | No | Foundry profile to use (maps to FOUNDRY_PROFILE env var). Selects a [profile.<name>] section from foundry.toml, e.g. 'zksync', 'ci', 'production'. | |
| contractAddress | Yes | Deployed contract address to verify | |
| contractPath | Yes | Contract identifier, e.g. src/MyContract.sol:MyContract | |
| verifier | Yes | Verification backend. 'etherscan' requires an API key, 'zksync' uses the zkSync Explorer (no API key needed). | |
| verifierUrl | Yes | Verifier API URL. Etherscan mainnet: https://api-era.zksync.network/api, Etherscan testnet: https://api-sepolia-era.zksync.network/api, Explorer mainnet: https://explorer.zksync.io/contract_verification, Explorer testnet: https://sepolia.explorer.zksync.io/contract_verification | |
| etherscanApiKey | No | Etherscan API key (required when verifier is 'etherscan') | |
| constructorArgs | No | ABI-encoded constructor arguments (hex string, no 0x prefix) | |
| compilerVersion | No | Compiler version used for deployment, e.g. v0.8.26+commit.8a97fa7a | |
| numOptimizations | No | Number of optimization runs used during compilation | |
| retries | No | Number of verification retries (default: 2, max: 10). Minimum is 1. Forge retries on transient failures. | |
| extraArgs | No | Additional CLI flags |