Introduction
Getting Started
1.
Installation
2.
First Steps with Foundry
Projects
3.
Creating a New Project
4.
Working on an Existing Project
5.
Dependencies
6.
Project Layout
Forge Overview
7.
Overview of Forge
8.
Tests
❱
8.1.
Writing Tests
8.2.
Cheatcodes
8.3.
Forge Standard Library Overview
8.4.
Understanding Traces
8.5.
Fork Testing
9.
Advanced Testing
❱
9.1.
Fuzz Testing
9.2.
Invariant Testing
9.3.
Differential Testing
10.
Deploying and Verifying
11.
Gas Tracking
❱
11.1.
Gas Reports
11.2.
Gas Snapshots
12.
Debugger
Cast Overview
13.
Overview of Cast
Anvil Overview
14.
Overview of Anvil
Chisel Overview
15.
Overview of Chisel
Configuration
16.
Configuring with foundry.toml
17.
Continuous Integration
18.
Integrating with VSCode
19.
Shell Autocompletion
20.
Static Analyzers
21.
Integrating with Hardhat
Tutorials
22.
Best Practices
23.
Creating an NFT with Solmate
24.
Docker and Foundry
25.
Testing EIP-712 Signatures
26.
Solidity Scripting
27.
Deterministic deployment using CREATE2
28.
Forking Mainnet with Cast and Anvil
29.
Learning Foundry Videos
Appendix
30.
FAQ
31.
Help us improve Foundry
32.
References
❱
32.1.
forge Commands
❱
32.1.1.
General Commands
❱
32.1.1.1.
forge
32.1.1.2.
forge help
32.1.1.3.
forge completions
32.1.2.
Project Commands
❱
32.1.2.1.
forge init
32.1.2.2.
forge install
32.1.2.3.
forge update
32.1.2.4.
forge remove
32.1.2.5.
forge config
32.1.2.6.
forge remappings
32.1.2.7.
forge tree
32.1.2.8.
forge geiger
32.1.3.
Build Commands
❱
32.1.3.1.
forge build
32.1.3.2.
forge clean
32.1.3.3.
forge inspect
32.1.4.
Test Commands
❱
32.1.4.1.
forge test
32.1.4.2.
forge snapshot
32.1.4.3.
forge coverage
32.1.5.
Deploy Commands
❱
32.1.5.1.
forge create
32.1.5.2.
forge verify-contract
32.1.5.3.
forge verify-check
32.1.5.4.
forge flatten
32.1.6.
Utility Commands
❱
32.1.6.1.
forge debug
32.1.6.2.
forge bind
32.1.6.3.
forge cache
32.1.6.4.
forge cache clean
32.1.6.5.
forge cache ls
32.1.6.6.
forge script
32.1.6.7.
forge upload-selectors
32.1.6.8.
forge doc
32.2.
cast Commands
❱
32.2.1.
General Commands
❱
32.2.1.1.
cast
32.2.1.2.
cast help
32.2.1.3.
cast completions
32.2.2.
Chain Commands
❱
32.2.2.1.
cast chain-id
32.2.2.2.
cast chain
32.2.2.3.
cast client
32.2.3.
Transaction Commands
❱
32.2.3.1.
cast publish
32.2.3.2.
cast receipt
32.2.3.3.
cast send
32.2.3.4.
cast call
32.2.3.5.
cast rpc
32.2.3.6.
cast tx
32.2.3.7.
cast run
32.2.3.8.
cast estimate
32.2.3.9.
cast access-list
32.2.3.10.
cast logs
32.2.4.
Block Commands
❱
32.2.4.1.
cast find-block
32.2.4.2.
cast gas-price
32.2.4.3.
cast block-number
32.2.4.4.
cast basefee
32.2.4.5.
cast block
32.2.4.6.
cast age
32.2.5.
Account Commands
❱
32.2.5.1.
cast balance
32.2.5.2.
cast storage
32.2.5.3.
cast proof
32.2.5.4.
cast nonce
32.2.5.5.
cast code
32.2.5.6.
cast codesize
32.2.6.
ENS Commands
❱
32.2.6.1.
cast lookup-address
32.2.6.2.
cast resolve-name
32.2.6.3.
cast namehash
32.2.7.
Etherscan Commands
❱
32.2.7.1.
cast etherscan-source
32.2.8.
ABI Commands
❱
32.2.8.1.
cast abi-decode
32.2.8.2.
cast abi-encode
32.2.8.3.
cast 4byte
32.2.8.4.
cast 4byte-decode
32.2.8.5.
cast 4byte-event
32.2.8.6.
cast calldata
32.2.8.7.
cast calldata-decode
32.2.8.8.
cast pretty-calldata
32.2.8.9.
cast upload-signature
32.2.9.
Conversion Commands
❱
32.2.9.1.
cast format-bytes32-string
32.2.9.2.
cast from-bin
32.2.9.3.
cast from-fixed-point
32.2.9.4.
cast from-rlp
32.2.9.5.
cast from-utf8
32.2.9.6.
cast from-wei
32.2.9.7.
cast parse-bytes32-address
32.2.9.8.
cast parse-bytes32-string
32.2.9.9.
cast to-ascii
32.2.9.10.
cast to-base
32.2.9.11.
cast to-bytes32
32.2.9.12.
cast to-dec
32.2.9.13.
cast to-fixed-point
32.2.9.14.
cast to-hex
32.2.9.15.
cast to-hexdata
32.2.9.16.
cast to-int256
32.2.9.17.
cast to-rlp
32.2.9.18.
cast to-uint256
32.2.9.19.
cast to-unit
32.2.9.20.
cast to-wei
32.2.9.21.
cast shl
32.2.9.22.
cast shr
32.2.10.
Utility Commands
❱
32.2.10.1.
cast sig
32.2.10.2.
cast sig-event
32.2.10.3.
cast keccak
32.2.10.4.
cast compute-address
32.2.10.5.
cast create2
32.2.10.6.
cast interface
32.2.10.7.
cast index
32.2.10.8.
cast concat-hex
32.2.10.9.
cast max-int
32.2.10.10.
cast min-int
32.2.10.11.
cast max-uint
32.2.10.12.
cast to-check-sum-address
32.2.10.13.
cast new-mnemonic
32.2.11.
Wallet Commands
❱
32.2.11.1.
cast wallet
32.2.11.2.
cast wallet new
32.2.11.3.
cast wallet address
32.2.11.4.
cast wallet sign
32.2.11.5.
cast wallet vanity
32.2.11.6.
cast wallet verify
32.2.11.7.
cast wallet import
32.2.11.8.
cast wallet list
32.3.
anvil Reference
32.4.
chisel Reference
32.5.
Config Reference
❱
32.5.1.
Overview
32.5.2.
Project
32.5.3.
Solidity Compiler
32.5.4.
Testing
32.5.5.
In-line Configuration Testing
32.5.6.
Formatter
32.5.7.
Documentation Generator
32.5.8.
Etherscan
32.6.
Cheatcodes Reference
❱
32.6.1.
Environment
❱
32.6.1.1.
warp
32.6.1.2.
roll
32.6.1.3.
fee
32.6.1.4.
difficulty
32.6.1.5.
prevrandao
32.6.1.6.
chainId
32.6.1.7.
store
32.6.1.8.
load
32.6.1.9.
etch
32.6.1.10.
deal
32.6.1.11.
prank
32.6.1.12.
startPrank
32.6.1.13.
stopPrank
32.6.1.14.
readCallers
32.6.1.15.
record
32.6.1.16.
accesses
32.6.1.17.
recordLogs
32.6.1.18.
getRecordedLogs
32.6.1.19.
setNonce
32.6.1.20.
getNonce
32.6.1.21.
mockCall
32.6.1.22.
mockCallRevert
32.6.1.23.
clearMockedCalls
32.6.1.24.
coinbase
32.6.1.25.
broadcast
32.6.1.26.
startBroadcast
32.6.1.27.
stopBroadcast
32.6.1.28.
pauseGasMetering
32.6.1.29.
resumeGasMetering
32.6.1.30.
txGasPrice
32.6.2.
Assertions
❱
32.6.2.1.
expectRevert
32.6.2.2.
expectEmit
32.6.2.3.
expectCall
32.6.3.
Fuzzer
❱
32.6.3.1.
assume
32.6.4.
Forking
❱
32.6.4.1.
createFork
32.6.4.2.
selectFork
32.6.4.3.
createSelectFork
32.6.4.4.
activeFork
32.6.4.5.
rollFork
32.6.4.6.
makePersistent
32.6.4.7.
revokePersistent
32.6.4.8.
isPersistent
32.6.4.9.
allowCheatcodes
32.6.4.10.
transact
32.6.5.
External
❱
32.6.5.1.
ffi
32.6.5.2.
projectRoot
32.6.5.3.
getCode
32.6.5.4.
getDeployedCode
32.6.5.5.
sleep
32.6.5.6.
unixTime
32.6.5.7.
setEnv
32.6.5.8.
envOr
32.6.5.9.
envBool
32.6.5.10.
envUint
32.6.5.11.
envInt
32.6.5.12.
envAddress
32.6.5.13.
envBytes32
32.6.5.14.
envString
32.6.5.15.
envBytes
32.6.5.16.
parseJson
32.6.5.17.
keyExists
32.6.5.18.
parseJsonKeys
32.6.5.19.
serializeJson
32.6.5.20.
writeJson
32.6.6.
Utilities
❱
32.6.6.1.
addr
32.6.6.2.
sign
32.6.6.3.
skip
32.6.6.4.
label
32.6.6.5.
deriveKey
32.6.6.6.
parseBytes
32.6.6.7.
parseAddress
32.6.6.8.
parseUint
32.6.6.9.
parseInt
32.6.6.10.
parseBytes32
32.6.6.11.
parseBool
32.6.6.12.
rememberKey
32.6.6.13.
toString
32.6.6.14.
breakpoint
32.6.6.15.
createWallet
32.6.7.
Snapshots
32.6.8.
RPC
32.6.9.
Files
32.7.
Forge Standard Library Reference
❱
32.7.1.
Std Logs
32.7.2.
Std Assertions
❱
32.7.2.1.
fail
32.7.2.2.
assertFalse
32.7.2.3.
assertEq
32.7.2.4.
assertApproxEqAbs
32.7.2.5.
assertApproxEqRel
32.7.3.
Std Cheats
❱
32.7.3.1.
skip
32.7.3.2.
rewind
32.7.3.3.
hoax
32.7.3.4.
startHoax
32.7.3.5.
deal
32.7.3.6.
deployCode
32.7.3.7.
deployCodeTo
32.7.3.8.
bound
32.7.3.9.
changePrank
32.7.3.10.
makeAddr
32.7.3.11.
makeAddrAndKey
32.7.3.12.
noGasMetering
32.7.3.13.
assumeNoPrecompiles
32.7.3.14.
assumePayable
32.7.4.
Std Errors
❱
32.7.4.1.
assertionError
32.7.4.2.
arithmeticError
32.7.4.3.
divisionError
32.7.4.4.
enumConversionError
32.7.4.5.
encodeStorageError
32.7.4.6.
popError
32.7.4.7.
indexOOBError
32.7.4.8.
memOverflowError
32.7.4.9.
zeroVarError
32.7.5.
Std Storage
❱
32.7.5.1.
target
32.7.5.2.
sig
32.7.5.3.
with_key
32.7.5.4.
depth
32.7.5.5.
checked_write
32.7.5.6.
find
32.7.5.7.
read
32.7.6.
Std Math
❱
32.7.6.1.
abs
32.7.6.2.
delta
32.7.6.3.
percentDelta
32.7.7.
Script Utils
❱
32.7.7.1.
computeCreateAddress
32.7.7.2.
deriveRememberKey
32.7.8.
Console Logging
32.8.
DSTest Reference
33.
Miscellaneous
❱
33.1.
Struct encoding
33.2.
Precompile Registry
Light
Rust
Coal
Navy
Ayu (default)
Foundry Book
Block Commands
cast find-block
cast gas-price
cast block-number
cast basefee
cast block
cast age