API Reference
The command surface a Solidity developer touches daily.
Path: api-reference
Third-party documentation. This is independently authored analysis of the public Foundry codebase — not the official docs, and not reviewed or endorsed by the Foundry team.
API Reference
Foundry's public surface is its CLI plus the cheatcode interface. The essentials:
Forge
forge build— compile; artifacts land inout/, caches incache/.forge test— run tests.--match-contract/--match-testfilter by regex;-vvvvadds full traces with decoded calls.forge script— simulate (default) or broadcast (--broadcast) a scripted flow.forge create/forge verify-contract— direct deployment and Etherscan-style verification.
Cast
cast call <addr> <sig> [args]— eth_call with inline-ABI decoding.cast send— state-changing transaction from a keystore or private key.cast wallet— keystore management, signatures, addresses.cast 4byte <selector>— selector lookup against signature databases.
Anvil
anvil— start a dev chain with deterministic funded accounts.anvil --fork-url <url>— fork a live network at latest or a pinned block.- Special methods:
anvil_setBalance,anvil_impersonateAccount,evm_snapshot/evm_revertfor stateful test orchestration over RPC.
Cheatcodes
The Vm interface (from forge-std) groups cheatcodes by domain: prank/startPrank, warp/roll, deal, expectCall/expectRevert, mockCall, ffi, snapshotState. Each is documented in the forge-std source, which doubles as the canonical reference.
Interface
Interface
text
forge build [--retries N] # compile the projectforge test [-vvv] [--match-test PAT] # run tests; -vvvv shows full tracesforge script Script --rpc-url URL # execute/broadcast a scripted flowcast call ADDR SIG [ARGS] [--rpc-url URL] # read-only RPC callcast send ADDR SIG [ARGS] [--private-key K] # state-changing transactioncast 4byte SELECTOR # resolve a function selectoranvil [--fork-url URL] [--block-time S] # local devnet / fork
STATUSinterface
