Introduction
Getting Started
1.
Installation
2.
First Steps with Foundry
Projects
3.
Creating a New Project
4.
Working on an Existing Project
5.
Clone a Verified Contract on Chain
6.
Dependencies
7.
Soldeer
8.
Project Layout
Forge Overview
9.
Overview of Forge
10.
Tests
❱
10.1.
Writing Tests
10.2.
Cheatcodes
10.3.
Forge Standard Library Overview
10.4.
Understanding Traces
10.5.
Fork Testing
10.6.
Replaying Failures
11.
Advanced Testing
❱
11.1.
Fuzz Testing
11.2.
Invariant Testing
11.3.
Differential Testing
12.
Deploying and Verifying
13.
Gas Tracking
❱
13.1.
Gas Reports
13.2.
Gas Function Snapshots
13.3.
Gas Section Snapshots
14.
Debugger
Cast Overview
15.
Overview of Cast
Anvil Overview
16.
Overview of Anvil
Chisel Overview
17.
Overview of Chisel
Configuration
18.
Configuring with foundry.toml
19.
Continuous Integration
20.
Integrating with VSCode
21.
Shell Autocompletion
22.
Static Analyzers
23.
Integrating with Hardhat
24.
Vyper support
Tutorials
25.
Best Practices
26.
Creating an NFT with Solmate
27.
Docker and Foundry
28.
Testing EIP-712 Signatures
29.
Solidity Scripting
30.
Deterministic deployment using CREATE2
31.
Forking Mainnet with Cast and Anvil
32.
Learning Foundry Videos
Appendix
33.
FAQ
34.
Help us improve Foundry
35.
References
❱
35.1.
CLI Reference
❱
35.1.1.
forge
❱
35.1.1.1.
forge bind
35.1.1.2.
forge bind-json
35.1.1.3.
forge build
35.1.1.4.
forge cache
❱
35.1.1.4.1.
forge cache clean
35.1.1.4.2.
forge cache ls
35.1.1.5.
forge clean
35.1.1.6.
forge clone
35.1.1.7.
forge compiler
❱
35.1.1.7.1.
forge compiler resolve
35.1.1.8.
forge completions
35.1.1.9.
forge config
35.1.1.10.
forge coverage
35.1.1.11.
forge create
35.1.1.12.
forge debug
35.1.1.13.
forge doc
35.1.1.14.
forge eip712
35.1.1.15.
forge flatten
35.1.1.16.
forge fmt
35.1.1.17.
forge geiger
35.1.1.18.
forge generate
❱
35.1.1.18.1.
forge generate test
35.1.1.19.
forge generate-fig-spec
35.1.1.20.
forge init
35.1.1.21.
forge inspect
35.1.1.22.
forge install
35.1.1.23.
forge remappings
35.1.1.24.
forge remove
35.1.1.25.
forge script
35.1.1.26.
forge selectors
❱
35.1.1.26.1.
forge selectors collision
35.1.1.26.2.
forge selectors upload
35.1.1.26.3.
forge selectors list
35.1.1.26.4.
forge selectors find
35.1.1.26.5.
forge selectors cache
35.1.1.27.
forge snapshot
35.1.1.28.
forge soldeer
❱
35.1.1.28.1.
forge soldeer init
35.1.1.28.2.
forge soldeer install
35.1.1.28.3.
forge soldeer update
35.1.1.28.4.
forge soldeer login
35.1.1.28.5.
forge soldeer push
35.1.1.28.6.
forge soldeer uninstall
35.1.1.28.7.
forge soldeer version
35.1.1.29.
forge test
35.1.1.30.
forge tree
35.1.1.31.
forge update
35.1.1.32.
forge verify-bytecode
35.1.1.33.
forge verify-check
35.1.1.34.
forge verify-contract
35.1.2.
cast
❱
35.1.2.1.
cast 4byte
35.1.2.2.
cast 4byte-decode
35.1.2.3.
cast 4byte-event
35.1.2.4.
cast abi-encode
35.1.2.5.
cast access-list
35.1.2.6.
cast address-zero
35.1.2.7.
cast admin
35.1.2.8.
cast age
35.1.2.9.
cast artifact
35.1.2.10.
cast balance
35.1.2.11.
cast base-fee
35.1.2.12.
cast bind
35.1.2.13.
cast block
35.1.2.14.
cast block-number
35.1.2.15.
cast call
❱
35.1.2.15.1.
cast call --create
35.1.2.16.
cast calldata
35.1.2.17.
cast chain
35.1.2.18.
cast chain-id
35.1.2.19.
cast client
35.1.2.20.
cast code
35.1.2.21.
cast codehash
35.1.2.22.
cast codesize
35.1.2.23.
cast completions
35.1.2.24.
cast compute-address
35.1.2.25.
cast concat-hex
35.1.2.26.
cast constructor-args
35.1.2.27.
cast create2
35.1.2.28.
cast creation-code
35.1.2.29.
cast decode-abi
35.1.2.30.
cast decode-calldata
35.1.2.31.
cast decode-eof
35.1.2.32.
cast decode-error
35.1.2.33.
cast decode-event
35.1.2.34.
cast decode-string
35.1.2.35.
cast decode-transaction
35.1.2.36.
cast disassemble
35.1.2.37.
cast estimate
❱
35.1.2.37.1.
cast estimate --create
35.1.2.38.
cast etherscan-source
35.1.2.39.
cast find-block
35.1.2.40.
cast format-bytes32-string
35.1.2.41.
cast format-units
35.1.2.42.
cast from-bin
35.1.2.43.
cast from-fixed-point
35.1.2.44.
cast from-rlp
35.1.2.45.
cast from-utf8
35.1.2.46.
cast from-wei
35.1.2.47.
cast gas-price
35.1.2.48.
cast generate-fig-spec
35.1.2.49.
cast hash-message
35.1.2.50.
cast hash-zero
35.1.2.51.
cast implementation
35.1.2.52.
cast index
35.1.2.53.
cast index-erc7201
35.1.2.54.
cast interface
35.1.2.55.
cast keccak
35.1.2.56.
cast logs
35.1.2.57.
cast lookup-address
35.1.2.58.
cast max-int
35.1.2.59.
cast max-uint
35.1.2.60.
cast min-int
35.1.2.61.
cast mktx
❱
35.1.2.61.1.
cast mktx --create
35.1.2.62.
cast namehash
35.1.2.63.
cast nonce
35.1.2.64.
cast parse-bytes32-address
35.1.2.65.
cast parse-bytes32-string
35.1.2.66.
cast parse-units
35.1.2.67.
cast pretty-calldata
35.1.2.68.
cast proof
35.1.2.69.
cast publish
35.1.2.70.
cast receipt
35.1.2.71.
cast resolve-name
35.1.2.72.
cast rpc
35.1.2.73.
cast run
35.1.2.74.
cast selectors
35.1.2.75.
cast send
❱
35.1.2.75.1.
cast send --create
35.1.2.76.
cast shl
35.1.2.77.
cast shr
35.1.2.78.
cast sig
35.1.2.79.
cast sig-event
35.1.2.80.
cast storage
35.1.2.81.
cast storage-root
35.1.2.82.
cast to-ascii
35.1.2.83.
cast to-base
35.1.2.84.
cast to-bytes32
35.1.2.85.
cast to-check-sum-address
35.1.2.86.
cast to-dec
35.1.2.87.
cast to-fixed-point
35.1.2.88.
cast to-hex
35.1.2.89.
cast to-hexdata
35.1.2.90.
cast to-int256
35.1.2.91.
cast to-rlp
35.1.2.92.
cast to-uint256
35.1.2.93.
cast to-unit
35.1.2.94.
cast to-utf8
35.1.2.95.
cast to-wei
35.1.2.96.
cast tx
35.1.2.97.
cast upload-signature
35.1.2.98.
cast wallet
❱
35.1.2.98.1.
cast wallet new
35.1.2.98.2.
cast wallet new-mnemonic
35.1.2.98.3.
cast wallet vanity
35.1.2.98.4.
cast wallet address
35.1.2.98.5.
cast wallet sign
35.1.2.98.6.
cast wallet sign-auth
35.1.2.98.7.
cast wallet verify
35.1.2.98.8.
cast wallet import
35.1.2.98.9.
cast wallet list
35.1.2.98.10.
cast wallet private-key
35.1.2.98.11.
cast wallet decrypt-keystore
35.1.3.
anvil
❱
35.1.3.1.
anvil completions
35.1.3.2.
anvil generate-fig-spec
35.1.4.
chisel
❱
35.1.4.1.
chisel list
35.1.4.2.
chisel load
35.1.4.3.
chisel view
35.1.4.4.
chisel clear-cache
35.1.4.5.
chisel eval
35.2.
forge Commands
❱
35.2.1.
General Commands
❱
35.2.1.1.
forge
35.2.1.2.
forge help
35.2.1.3.
forge completions
35.2.2.
Project Commands
❱
35.2.2.1.
forge init
35.2.2.2.
forge clone
35.2.2.3.
forge install
35.2.2.4.
forge update
35.2.2.5.
forge remove
35.2.2.6.
forge config
35.2.2.7.
forge remappings
35.2.2.8.
forge tree
35.2.2.9.
forge geiger
35.2.3.
Build Commands
❱
35.2.3.1.
forge build
35.2.3.2.
forge clean
35.2.3.3.
forge inspect
35.2.4.
Test Commands
❱
35.2.4.1.
forge test
35.2.4.2.
forge snapshot
35.2.4.3.
forge coverage
35.2.5.
Deploy Commands
❱
35.2.5.1.
forge create
35.2.5.2.
forge verify-contract
35.2.5.3.
forge verify-check
35.2.5.4.
forge flatten
35.2.6.
Utility Commands
❱
35.2.6.1.
forge debug
35.2.6.2.
forge bind
35.2.6.3.
forge cache
35.2.6.4.
forge cache clean
35.2.6.5.
forge cache ls
35.2.6.6.
forge script
35.2.6.7.
forge upload-selectors
35.2.6.8.
forge doc
35.3.
cast Commands
❱
35.3.1.
General Commands
❱
35.3.1.1.
cast
35.3.1.2.
cast help
35.3.1.3.
cast completions
35.3.2.
Chain Commands
❱
35.3.2.1.
cast chain-id
35.3.2.2.
cast chain
35.3.2.3.
cast client
35.3.3.
Transaction Commands
❱
35.3.3.1.
cast publish
35.3.3.2.
cast receipt
35.3.3.3.
cast send
35.3.3.4.
cast mktx
35.3.3.5.
cast call
35.3.3.6.
cast rpc
35.3.3.7.
cast tx
35.3.3.8.
cast run
35.3.3.9.
cast estimate
35.3.3.10.
cast access-list
35.3.3.11.
cast logs
35.3.4.
Block Commands
❱
35.3.4.1.
cast find-block
35.3.4.2.
cast gas-price
35.3.4.3.
cast block-number
35.3.4.4.
cast basefee
35.3.4.5.
cast block
35.3.4.6.
cast age
35.3.5.
Account Commands
❱
35.3.5.1.
cast balance
35.3.5.2.
cast storage
35.3.5.3.
cast proof
35.3.5.4.
cast nonce
35.3.5.5.
cast code
35.3.5.6.
cast codesize
35.3.6.
ENS Commands
❱
35.3.6.1.
cast lookup-address
35.3.6.2.
cast resolve-name
35.3.6.3.
cast namehash
35.3.7.
Etherscan Commands
❱
35.3.7.1.
cast etherscan-source
35.3.8.
ABI Commands
❱
35.3.8.1.
cast abi-decode
35.3.8.2.
cast abi-encode
35.3.8.3.
cast 4byte
35.3.8.4.
cast 4byte-decode
35.3.8.5.
cast 4byte-event
35.3.8.6.
cast calldata
35.3.8.7.
cast calldata-decode
35.3.8.8.
cast pretty-calldata
35.3.8.9.
cast selectors
35.3.8.10.
cast upload-signature
35.3.9.
Conversion Commands
❱
35.3.9.1.
cast format-bytes32-string
35.3.9.2.
cast from-bin
35.3.9.3.
cast from-fixed-point
35.3.9.4.
cast from-rlp
35.3.9.5.
cast from-utf8
35.3.9.6.
cast from-wei
35.3.9.7.
cast parse-bytes32-address
35.3.9.8.
cast parse-bytes32-string
35.3.9.9.
cast to-ascii
35.3.9.10.
cast to-base
35.3.9.11.
cast to-bytes32
35.3.9.12.
cast to-dec
35.3.9.13.
cast to-fixed-point
35.3.9.14.
cast to-hex
35.3.9.15.
cast to-hexdata
35.3.9.16.
cast to-int256
35.3.9.17.
cast to-rlp
35.3.9.18.
cast to-uint256
35.3.9.19.
cast to-unit
35.3.9.20.
cast to-wei
35.3.9.21.
cast shl
35.3.9.22.
cast shr
35.3.10.
Utility Commands
❱
35.3.10.1.
cast address-zero
35.3.10.2.
cast sig
35.3.10.3.
cast sig-event
35.3.10.4.
cast keccak
35.3.10.5.
cast compute-address
35.3.10.6.
cast create2
35.3.10.7.
cast interface
35.3.10.8.
cast index
35.3.10.9.
cast concat-hex
35.3.10.10.
cast max-int
35.3.10.11.
cast min-int
35.3.10.12.
cast max-uint
35.3.10.13.
cast to-check-sum-address
35.3.11.
Wallet Commands
❱
35.3.11.1.
cast wallet
35.3.11.2.
cast wallet new
35.3.11.3.
cast wallet new-mnemonic
35.3.11.4.
cast wallet address
35.3.11.5.
cast wallet sign
35.3.11.6.
cast wallet vanity
35.3.11.7.
cast wallet verify
35.3.11.8.
cast wallet import
35.3.11.9.
cast wallet list
35.4.
anvil Reference
35.5.
chisel Reference
35.6.
Config Reference
❱
35.6.1.
Overview
35.6.2.
Project
35.6.3.
Solidity Compiler
35.6.4.
Testing
35.6.5.
In-line Configuration Testing
35.6.6.
Formatter
35.6.7.
Documentation Generator
35.6.8.
Etherscan
35.7.
Cheatcodes Reference
❱
35.7.1.
Environment
❱
35.7.1.1.
warp
35.7.1.2.
roll
35.7.1.3.
fee
35.7.1.4.
getBlockTimestamp
35.7.1.5.
getBlockNumber
35.7.1.6.
difficulty
35.7.1.7.
prevrandao
35.7.1.8.
chainId
35.7.1.9.
store
35.7.1.10.
load
35.7.1.11.
etch
35.7.1.12.
deal
35.7.1.13.
prank
35.7.1.14.
startPrank
35.7.1.15.
stopPrank
35.7.1.16.
readCallers
35.7.1.17.
record
35.7.1.18.
accesses
35.7.1.19.
recordLogs
35.7.1.20.
getRecordedLogs
35.7.1.21.
setNonce
35.7.1.22.
getNonce
35.7.1.23.
mockCall
35.7.1.24.
mockCalls
35.7.1.25.
mockCallRevert
35.7.1.26.
mockFunction
35.7.1.27.
clearMockedCalls
35.7.1.28.
coinbase
35.7.1.29.
broadcast
35.7.1.30.
startBroadcast
35.7.1.31.
stopBroadcast
35.7.1.32.
pauseGasMetering
35.7.1.33.
resetGasMetering
35.7.1.34.
resumeGasMetering
35.7.1.35.
txGasPrice
35.7.1.36.
startStateDiffRecording
35.7.1.37.
stopAndReturnStateDiff
35.7.1.38.
snapshotState
35.7.1.39.
snapshotGas
35.7.2.
Assertions
❱
35.7.2.1.
expectRevert
35.7.2.2.
expectEmit
35.7.2.3.
expectCall
35.7.3.
Fuzzer
❱
35.7.3.1.
assume
35.7.3.2.
assumeNoRevert
35.7.4.
Forking
❱
35.7.4.1.
createFork
35.7.4.2.
selectFork
35.7.4.3.
createSelectFork
35.7.4.4.
activeFork
35.7.4.5.
rollFork
35.7.4.6.
makePersistent
35.7.4.7.
revokePersistent
35.7.4.8.
isPersistent
35.7.4.9.
allowCheatcodes
35.7.4.10.
transact
35.7.5.
External
❱
35.7.5.1.
ffi
35.7.5.2.
prompt
35.7.5.3.
projectRoot
35.7.5.4.
getCode
35.7.5.5.
getDeployedCode
35.7.5.6.
sleep
35.7.5.7.
unixTime
35.7.5.8.
setEnv
35.7.5.9.
envOr
35.7.5.10.
envBool
35.7.5.11.
envUint
35.7.5.12.
envInt
35.7.5.13.
envAddress
35.7.5.14.
envBytes32
35.7.5.15.
envString
35.7.5.16.
envBytes
35.7.5.17.
keyExists
35.7.5.18.
keyExistsJson
35.7.5.19.
keyExistsToml
35.7.5.20.
parseJson
35.7.5.21.
parseToml
35.7.5.22.
parseJsonKeys
35.7.5.23.
parseTomlKeys
35.7.5.24.
serializeJson
35.7.5.25.
writeJson
35.7.5.26.
writeToml
35.7.6.
Utilities
❱
35.7.6.1.
addr
35.7.6.2.
sign
35.7.6.3.
skip
35.7.6.4.
label
35.7.6.5.
getLabel
35.7.6.6.
deriveKey
35.7.6.7.
parseBytes
35.7.6.8.
parseAddress
35.7.6.9.
parseUint
35.7.6.10.
parseInt
35.7.6.11.
parseBytes32
35.7.6.12.
parseBool
35.7.6.13.
rememberKey
35.7.6.14.
toString
35.7.6.15.
breakpoint
35.7.6.16.
createWallet
35.7.6.17.
copyStorage
35.7.6.18.
setArbitraryStorage
35.7.7.
RPC
35.7.8.
Files
35.8.
Forge Standard Library Reference
❱
35.8.1.
Std Logs
35.8.2.
Std Assertions
❱
35.8.2.1.
fail
35.8.2.2.
assertTrue
35.8.2.3.
assertFalse
35.8.2.4.
assertEq
35.8.2.5.
assertEqDecimal
35.8.2.6.
assertNotEq
35.8.2.7.
assertNotEqDecimal
35.8.2.8.
assertLt
35.8.2.9.
assertLtDecimal
35.8.2.10.
assertGt
35.8.2.11.
assertGtDecimal
35.8.2.12.
assertLe
35.8.2.13.
assertLeDecimal
35.8.2.14.
assertGe
35.8.2.15.
assertGeDecimal
35.8.2.16.
assertApproxEqAbs
35.8.2.17.
assertApproxEqAbsDecimal
35.8.2.18.
assertApproxEqRel
35.8.2.19.
assertApproxEqRelDecimal
35.8.3.
Std Cheats
❱
35.8.3.1.
skip
35.8.3.2.
rewind
35.8.3.3.
hoax
35.8.3.4.
startHoax
35.8.3.5.
deal
35.8.3.6.
deployCode
35.8.3.7.
deployCodeTo
35.8.3.8.
bound
35.8.3.9.
changePrank
35.8.3.10.
makeAddr
35.8.3.11.
makeAddrAndKey
35.8.3.12.
noGasMetering
35.8.3.13.
assumeNoPrecompiles
35.8.3.14.
assumePayable
35.8.4.
Std Errors
❱
35.8.4.1.
assertionError
35.8.4.2.
arithmeticError
35.8.4.3.
divisionError
35.8.4.4.
enumConversionError
35.8.4.5.
encodeStorageError
35.8.4.6.
popError
35.8.4.7.
indexOOBError
35.8.4.8.
memOverflowError
35.8.4.9.
zeroVarError
35.8.5.
Std Storage
❱
35.8.5.1.
target
35.8.5.2.
sig
35.8.5.3.
with_key
35.8.5.4.
depth
35.8.5.5.
checked_write
35.8.5.6.
find
35.8.5.7.
read
35.8.6.
Std Math
❱
35.8.6.1.
abs
35.8.6.2.
delta
35.8.6.3.
percentDelta
35.8.7.
Script Utils
❱
35.8.7.1.
computeCreateAddress
35.8.7.2.
deriveRememberKey
35.8.8.
Console Logging
35.9.
DSTest Reference
36.
Miscellaneous
❱
36.1.
Struct encoding
Light
Rust
Coal
Navy
Ayu
Foundry Book
Wallet Commands
cast wallet
cast wallet address
cast wallet new
cast wallet sign
cast wallet vanity
cast wallet verify
cast wallet import