Introduction
Getting Started
1.
Installation
2.
First Steps with Foundry
Projects
3.
Creating a New Project
4.
Clone a Verified Contract on Chain
5.
Dependencies
6.
Soldeer
7.
Project Layout
Forge Overview
8.
Forge
9.
Tests
❱
9.1.
Writing Tests
9.2.
Cheatcodes
9.3.
Forge Standard Library Overview
9.4.
Understanding Traces
9.5.
Fork Testing
9.6.
Replaying Failures
10.
Advanced Testing
❱
10.1.
Fuzz Testing
10.2.
Invariant Testing
10.3.
Differential Testing
11.
Deploying and Verifying
12.
Gas Tracking
❱
12.1.
Gas Reports
12.2.
Gas Function Snapshots
12.3.
Gas Section Snapshots
13.
Debugger
Cast Overview
14.
Cast
Anvil Overview
15.
Anvil
Chisel Overview
16.
Chisel
Configuration
17.
Configuring with foundry.toml
18.
Continuous Integration
19.
Integrating with VSCode
20.
Shell Autocompletion
21.
Static Analyzers
22.
Integrating with Hardhat
23.
Vyper support
Guides
24.
Foundry v1.0 migration guide
25.
Best Practices
26.
Scripting with Solidity
27.
Deterministic deployments using CREATE2
28.
Forking Mainnet with Cast and Anvil
29.
Running Foundry inside of Docker
30.
Video tutorials
Appendix
31.
Announcements
32.
FAQ
33.
Help us improve Foundry
34.
References
❱
34.1.
CLI Reference
❱
34.1.1.
forge
❱
34.1.1.1.
forge bind
34.1.1.2.
forge bind-json
34.1.1.3.
forge build
34.1.1.4.
forge cache
❱
34.1.1.4.1.
forge cache clean
34.1.1.4.2.
forge cache ls
34.1.1.5.
forge clean
34.1.1.6.
forge clone
34.1.1.7.
forge compiler
❱
34.1.1.7.1.
forge compiler resolve
34.1.1.8.
forge completions
34.1.1.9.
forge config
34.1.1.10.
forge coverage
34.1.1.11.
forge create
34.1.1.12.
forge doc
34.1.1.13.
forge eip712
34.1.1.14.
forge flatten
34.1.1.15.
forge fmt
34.1.1.16.
forge geiger
34.1.1.17.
forge generate
❱
34.1.1.17.1.
forge generate test
34.1.1.18.
forge generate-fig-spec
34.1.1.19.
forge init
34.1.1.20.
forge inspect
34.1.1.21.
forge install
34.1.1.22.
forge remappings
34.1.1.23.
forge remove
34.1.1.24.
forge script
34.1.1.25.
forge selectors
❱
34.1.1.25.1.
forge selectors collision
34.1.1.25.2.
forge selectors upload
34.1.1.25.3.
forge selectors list
34.1.1.25.4.
forge selectors find
34.1.1.25.5.
forge selectors cache
34.1.1.26.
forge snapshot
34.1.1.27.
forge soldeer
❱
34.1.1.27.1.
forge soldeer init
34.1.1.27.2.
forge soldeer install
34.1.1.27.3.
forge soldeer update
34.1.1.27.4.
forge soldeer login
34.1.1.27.5.
forge soldeer push
34.1.1.27.6.
forge soldeer uninstall
34.1.1.27.7.
forge soldeer version
34.1.1.28.
forge test
34.1.1.29.
forge tree
34.1.1.30.
forge update
34.1.1.31.
forge verify-bytecode
34.1.1.32.
forge verify-check
34.1.1.33.
forge verify-contract
34.1.2.
cast
❱
34.1.2.1.
cast 4byte
34.1.2.2.
cast 4byte-decode
34.1.2.3.
cast 4byte-event
34.1.2.4.
cast abi-encode
34.1.2.5.
cast access-list
34.1.2.6.
cast address-zero
34.1.2.7.
cast admin
34.1.2.8.
cast age
34.1.2.9.
cast artifact
34.1.2.10.
cast balance
34.1.2.11.
cast base-fee
34.1.2.12.
cast bind
34.1.2.13.
cast block
34.1.2.14.
cast block-number
34.1.2.15.
cast call
❱
34.1.2.15.1.
cast call --create
34.1.2.16.
cast calldata
34.1.2.17.
cast chain
34.1.2.18.
cast chain-id
34.1.2.19.
cast client
34.1.2.20.
cast code
34.1.2.21.
cast codehash
34.1.2.22.
cast codesize
34.1.2.23.
cast completions
34.1.2.24.
cast compute-address
34.1.2.25.
cast concat-hex
34.1.2.26.
cast constructor-args
34.1.2.27.
cast create2
34.1.2.28.
cast creation-code
34.1.2.29.
cast decode-abi
34.1.2.30.
cast decode-calldata
34.1.2.31.
cast decode-eof
34.1.2.32.
cast decode-error
34.1.2.33.
cast decode-event
34.1.2.34.
cast decode-string
34.1.2.35.
cast decode-transaction
34.1.2.36.
cast disassemble
34.1.2.37.
cast estimate
❱
34.1.2.37.1.
cast estimate --create
34.1.2.38.
cast find-block
34.1.2.39.
cast format-bytes32-string
34.1.2.40.
cast format-units
34.1.2.41.
cast from-bin
34.1.2.42.
cast from-fixed-point
34.1.2.43.
cast from-rlp
34.1.2.44.
cast from-utf8
34.1.2.45.
cast from-wei
34.1.2.46.
cast gas-price
34.1.2.47.
cast generate-fig-spec
34.1.2.48.
cast hash-message
34.1.2.49.
cast hash-zero
34.1.2.50.
cast implementation
34.1.2.51.
cast index
34.1.2.52.
cast index-erc7201
34.1.2.53.
cast interface
34.1.2.54.
cast keccak
34.1.2.55.
cast logs
34.1.2.56.
cast lookup-address
34.1.2.57.
cast max-int
34.1.2.58.
cast max-uint
34.1.2.59.
cast min-int
34.1.2.60.
cast mktx
❱
34.1.2.60.1.
cast mktx --create
34.1.2.61.
cast namehash
34.1.2.62.
cast nonce
34.1.2.63.
cast parse-bytes32-address
34.1.2.64.
cast parse-bytes32-string
34.1.2.65.
cast parse-units
34.1.2.66.
cast pretty-calldata
34.1.2.67.
cast proof
34.1.2.68.
cast publish
34.1.2.69.
cast receipt
34.1.2.70.
cast resolve-name
34.1.2.71.
cast rpc
34.1.2.72.
cast run
34.1.2.73.
cast selectors
34.1.2.74.
cast send
❱
34.1.2.74.1.
cast send --create
34.1.2.75.
cast shl
34.1.2.76.
cast shr
34.1.2.77.
cast sig
34.1.2.78.
cast sig-event
34.1.2.79.
cast source
34.1.2.80.
cast storage
34.1.2.81.
cast storage-root
34.1.2.82.
cast to-ascii
34.1.2.83.
cast to-base
34.1.2.84.
cast to-bytes32
34.1.2.85.
cast to-check-sum-address
34.1.2.86.
cast to-dec
34.1.2.87.
cast to-fixed-point
34.1.2.88.
cast to-hex
34.1.2.89.
cast to-hexdata
34.1.2.90.
cast to-int256
34.1.2.91.
cast to-rlp
34.1.2.92.
cast to-uint256
34.1.2.93.
cast to-unit
34.1.2.94.
cast to-utf8
34.1.2.95.
cast to-wei
34.1.2.96.
cast tx
34.1.2.97.
cast upload-signature
34.1.2.98.
cast wallet
❱
34.1.2.98.1.
cast wallet new
34.1.2.98.2.
cast wallet new-mnemonic
34.1.2.98.3.
cast wallet vanity
34.1.2.98.4.
cast wallet address
34.1.2.98.5.
cast wallet sign
34.1.2.98.6.
cast wallet sign-auth
34.1.2.98.7.
cast wallet verify
34.1.2.98.8.
cast wallet import
34.1.2.98.9.
cast wallet list
34.1.2.98.10.
cast wallet private-key
34.1.2.98.11.
cast wallet decrypt-keystore
34.1.3.
anvil
❱
34.1.3.1.
anvil completions
34.1.3.2.
anvil generate-fig-spec
34.1.4.
chisel
❱
34.1.4.1.
chisel list
34.1.4.2.
chisel load
34.1.4.3.
chisel view
34.1.4.4.
chisel clear-cache
34.1.4.5.
chisel eval
34.2.
forge Commands
❱
34.2.1.
General Commands
❱
34.2.1.1.
forge
34.2.1.2.
forge help
34.2.1.3.
forge completions
34.2.2.
Project Commands
❱
34.2.2.1.
forge init
34.2.2.2.
forge clone
34.2.2.3.
forge install
34.2.2.4.
forge update
34.2.2.5.
forge remove
34.2.2.6.
forge config
34.2.2.7.
forge remappings
34.2.2.8.
forge tree
34.2.2.9.
forge geiger
34.2.3.
Build Commands
❱
34.2.3.1.
forge build
34.2.3.2.
forge clean
34.2.3.3.
forge inspect
34.2.4.
Test Commands
❱
34.2.4.1.
forge test
34.2.4.2.
forge snapshot
34.2.4.3.
forge coverage
34.2.5.
Deploy Commands
❱
34.2.5.1.
forge create
34.2.5.2.
forge verify-contract
34.2.5.3.
forge verify-check
34.2.5.4.
forge flatten
34.2.6.
Utility Commands
❱
34.2.6.1.
forge bind
34.2.6.2.
forge cache
34.2.6.3.
forge cache clean
34.2.6.4.
forge cache ls
34.2.6.5.
forge script
34.2.6.6.
forge upload-selectors
34.2.6.7.
forge doc
34.3.
cast Commands
❱
34.3.1.
General Commands
❱
34.3.1.1.
cast
34.3.1.2.
cast help
34.3.1.3.
cast completions
34.3.2.
Chain Commands
❱
34.3.2.1.
cast chain-id
34.3.2.2.
cast chain
34.3.2.3.
cast client
34.3.3.
Transaction Commands
❱
34.3.3.1.
cast publish
34.3.3.2.
cast receipt
34.3.3.3.
cast send
34.3.3.4.
cast mktx
34.3.3.5.
cast call
34.3.3.6.
cast rpc
34.3.3.7.
cast tx
34.3.3.8.
cast run
34.3.3.9.
cast estimate
34.3.3.10.
cast access-list
34.3.3.11.
cast logs
34.3.4.
Block Commands
❱
34.3.4.1.
cast find-block
34.3.4.2.
cast gas-price
34.3.4.3.
cast block-number
34.3.4.4.
cast basefee
34.3.4.5.
cast block
34.3.4.6.
cast age
34.3.5.
Account Commands
❱
34.3.5.1.
cast balance
34.3.5.2.
cast storage
34.3.5.3.
cast proof
34.3.5.4.
cast nonce
34.3.5.5.
cast code
34.3.5.6.
cast codesize
34.3.6.
ENS Commands
❱
34.3.6.1.
cast lookup-address
34.3.6.2.
cast resolve-name
34.3.6.3.
cast namehash
34.3.7.
Etherscan Commands
❱
34.3.7.1.
cast etherscan-source
34.3.8.
ABI Commands
❱
34.3.8.1.
cast abi-decode
34.3.8.2.
cast abi-encode
34.3.8.3.
cast 4byte
34.3.8.4.
cast 4byte-decode
34.3.8.5.
cast 4byte-event
34.3.8.6.
cast calldata
34.3.8.7.
cast calldata-decode
34.3.8.8.
cast pretty-calldata
34.3.8.9.
cast selectors
34.3.8.10.
cast upload-signature
34.3.9.
Conversion Commands
❱
34.3.9.1.
cast format-bytes32-string
34.3.9.2.
cast from-bin
34.3.9.3.
cast from-fixed-point
34.3.9.4.
cast from-rlp
34.3.9.5.
cast from-utf8
34.3.9.6.
cast from-wei
34.3.9.7.
cast parse-bytes32-address
34.3.9.8.
cast parse-bytes32-string
34.3.9.9.
cast to-ascii
34.3.9.10.
cast to-base
34.3.9.11.
cast to-bytes32
34.3.9.12.
cast to-dec
34.3.9.13.
cast to-fixed-point
34.3.9.14.
cast to-hex
34.3.9.15.
cast to-hexdata
34.3.9.16.
cast to-int256
34.3.9.17.
cast to-rlp
34.3.9.18.
cast to-uint256
34.3.9.19.
cast to-unit
34.3.9.20.
cast to-wei
34.3.9.21.
cast shl
34.3.9.22.
cast shr
34.3.10.
Utility Commands
❱
34.3.10.1.
cast address-zero
34.3.10.2.
cast sig
34.3.10.3.
cast sig-event
34.3.10.4.
cast keccak
34.3.10.5.
cast compute-address
34.3.10.6.
cast create2
34.3.10.7.
cast interface
34.3.10.8.
cast index
34.3.10.9.
cast concat-hex
34.3.10.10.
cast max-int
34.3.10.11.
cast min-int
34.3.10.12.
cast max-uint
34.3.10.13.
cast to-check-sum-address
34.3.11.
Wallet Commands
❱
34.3.11.1.
cast wallet
34.3.11.2.
cast wallet new
34.3.11.3.
cast wallet new-mnemonic
34.3.11.4.
cast wallet address
34.3.11.5.
cast wallet sign
34.3.11.6.
cast wallet vanity
34.3.11.7.
cast wallet verify
34.3.11.8.
cast wallet import
34.3.11.9.
cast wallet list
34.4.
anvil Reference
34.5.
chisel Reference
34.6.
Config Reference
❱
34.6.1.
Overview
34.6.2.
Project
34.6.3.
Solidity Compiler
34.6.4.
Testing
34.6.5.
In-line Configuration Testing
34.6.6.
Formatter
34.6.7.
Documentation Generator
34.6.8.
Etherscan
34.7.
Cheatcodes Reference
❱
34.7.1.
Environment
❱
34.7.1.1.
warp
34.7.1.2.
roll
34.7.1.3.
fee
34.7.1.4.
getBlockTimestamp
34.7.1.5.
getBlockNumber
34.7.1.6.
difficulty
34.7.1.7.
prevrandao
34.7.1.8.
chainId
34.7.1.9.
store
34.7.1.10.
load
34.7.1.11.
etch
34.7.1.12.
deal
34.7.1.13.
prank
34.7.1.14.
startPrank
34.7.1.15.
stopPrank
34.7.1.16.
readCallers
34.7.1.17.
record
34.7.1.18.
accesses
34.7.1.19.
recordLogs
34.7.1.20.
getRecordedLogs
34.7.1.21.
setNonce
34.7.1.22.
getNonce
34.7.1.23.
mockCall
34.7.1.24.
mockCalls
34.7.1.25.
mockCallRevert
34.7.1.26.
mockFunction
34.7.1.27.
clearMockedCalls
34.7.1.28.
coinbase
34.7.1.29.
broadcast
34.7.1.30.
startBroadcast
34.7.1.31.
stopBroadcast
34.7.1.32.
pauseGasMetering
34.7.1.33.
resetGasMetering
34.7.1.34.
resumeGasMetering
34.7.1.35.
txGasPrice
34.7.1.36.
startStateDiffRecording
34.7.1.37.
stopAndReturnStateDiff
34.7.1.38.
snapshotState
34.7.1.39.
snapshotGas
34.7.1.40.
isContext
34.7.2.
Assertions
❱
34.7.2.1.
expectRevert
34.7.2.2.
expectEmit
34.7.2.3.
expectCall
34.7.3.
Fuzzer
❱
34.7.3.1.
assume
34.7.3.2.
assumeNoRevert
34.7.4.
Forking
❱
34.7.4.1.
createFork
34.7.4.2.
selectFork
34.7.4.3.
createSelectFork
34.7.4.4.
activeFork
34.7.4.5.
rollFork
34.7.4.6.
makePersistent
34.7.4.7.
revokePersistent
34.7.4.8.
isPersistent
34.7.4.9.
allowCheatcodes
34.7.4.10.
transact
34.7.5.
External
❱
34.7.5.1.
ffi
34.7.5.2.
prompt
34.7.5.3.
projectRoot
34.7.5.4.
getCode
34.7.5.5.
getDeployedCode
34.7.5.6.
sleep
34.7.5.7.
unixTime
34.7.5.8.
setEnv
34.7.5.9.
envOr
34.7.5.10.
envBool
34.7.5.11.
envUint
34.7.5.12.
envInt
34.7.5.13.
envAddress
34.7.5.14.
envBytes32
34.7.5.15.
envString
34.7.5.16.
envBytes
34.7.5.17.
keyExists
34.7.5.18.
keyExistsJson
34.7.5.19.
keyExistsToml
34.7.5.20.
parseJson
34.7.5.21.
parseToml
34.7.5.22.
parseJsonKeys
34.7.5.23.
parseTomlKeys
34.7.5.24.
serializeJson
34.7.5.25.
writeJson
34.7.5.26.
writeToml
34.7.6.
Signing
❱
34.7.6.1.
sign
34.7.6.2.
signDelegation
34.7.7.
Utilities
❱
34.7.7.1.
addr
34.7.7.2.
skip
34.7.7.3.
label
34.7.7.4.
getLabel
34.7.7.5.
deriveKey
34.7.7.6.
parseBytes
34.7.7.7.
parseAddress
34.7.7.8.
parseUint
34.7.7.9.
parseInt
34.7.7.10.
parseBytes32
34.7.7.11.
parseBool
34.7.7.12.
rememberKey
34.7.7.13.
toString
34.7.7.14.
breakpoint
34.7.7.15.
createWallet
34.7.7.16.
copyStorage
34.7.7.17.
setArbitraryStorage
34.7.8.
RPC
34.7.9.
Files
34.8.
Forge Standard Library Reference
❱
34.8.1.
Std Logs
34.8.2.
Std Assertions
❱
34.8.2.1.
fail
34.8.2.2.
assertTrue
34.8.2.3.
assertFalse
34.8.2.4.
assertEq
34.8.2.5.
assertEqDecimal
34.8.2.6.
assertNotEq
34.8.2.7.
assertNotEqDecimal
34.8.2.8.
assertLt
34.8.2.9.
assertLtDecimal
34.8.2.10.
assertGt
34.8.2.11.
assertGtDecimal
34.8.2.12.
assertLe
34.8.2.13.
assertLeDecimal
34.8.2.14.
assertGe
34.8.2.15.
assertGeDecimal
34.8.2.16.
assertApproxEqAbs
34.8.2.17.
assertApproxEqAbsDecimal
34.8.2.18.
assertApproxEqRel
34.8.2.19.
assertApproxEqRelDecimal
34.8.3.
Std Cheats
❱
34.8.3.1.
skip
34.8.3.2.
rewind
34.8.3.3.
hoax
34.8.3.4.
startHoax
34.8.3.5.
deal
34.8.3.6.
deployCode
34.8.3.7.
deployCodeTo
34.8.3.8.
bound
34.8.3.9.
changePrank
34.8.3.10.
makeAddr
34.8.3.11.
makeAddrAndKey
34.8.3.12.
noGasMetering
34.8.3.13.
assumeNoPrecompiles
34.8.3.14.
assumePayable
34.8.4.
Std Errors
❱
34.8.4.1.
assertionError
34.8.4.2.
arithmeticError
34.8.4.3.
divisionError
34.8.4.4.
enumConversionError
34.8.4.5.
encodeStorageError
34.8.4.6.
popError
34.8.4.7.
indexOOBError
34.8.4.8.
memOverflowError
34.8.4.9.
zeroVarError
34.8.5.
Std Storage
❱
34.8.5.1.
target
34.8.5.2.
sig
34.8.5.3.
with_key
34.8.5.4.
depth
34.8.5.5.
checked_write
34.8.5.6.
find
34.8.5.7.
read
34.8.6.
Std Math
❱
34.8.6.1.
abs
34.8.6.2.
delta
34.8.6.3.
percentDelta
34.8.7.
Script Utils
❱
34.8.7.1.
computeCreateAddress
34.8.7.2.
deriveRememberKey
34.8.8.
Console Logging
34.9.
DSTest Reference
35.
Miscellaneous
❱
35.1.
Struct encoding
Light
Rust
Coal
Navy
Ayu
Foundry Book
Project Commands
forge init
forge clone
forge install
forge update
forge remove
forge config
forge remappings
forge tree
forge geiger