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.
Project Layout
Forge Overview
8.
Overview of Forge
9.
Tests
❱
9.1.
Writing Tests
9.2.
Cheatcodes
9.3.
Forge Standard Library Overview
9.4.
Understanding Traces
9.5.
Fork Testing
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 Snapshots
13.
Debugger
Cast Overview
14.
Overview of Cast
Anvil Overview
15.
Overview of Anvil
Chisel Overview
16.
Overview of Chisel
Configuration
17.
Configuring with foundry.toml
18.
Continuous Integration
19.
Integrating with VSCode
20.
Shell Autocompletion
21.
Static Analyzers
22.
Integrating with Hardhat
Tutorials
23.
Best Practices
24.
Creating an NFT with Solmate
25.
Docker and Foundry
26.
Testing EIP-712 Signatures
27.
Solidity Scripting
28.
Deterministic deployment using CREATE2
29.
Forking Mainnet with Cast and Anvil
30.
Learning Foundry Videos
Appendix
31.
FAQ
32.
Help us improve Foundry
33.
References
❱
33.1.
CLI Reference
❱
33.1.1.
forge
❱
33.1.1.1.
forge bind
33.1.1.2.
forge build
33.1.1.3.
forge cache
❱
33.1.1.3.1.
forge cache clean
33.1.1.3.2.
forge cache ls
33.1.1.4.
forge clean
33.1.1.5.
forge clone
33.1.1.6.
forge completions
33.1.1.7.
forge config
33.1.1.8.
forge coverage
33.1.1.9.
forge create
33.1.1.10.
forge debug
33.1.1.11.
forge doc
33.1.1.12.
forge flatten
33.1.1.13.
forge fmt
33.1.1.14.
forge geiger
33.1.1.15.
forge generate
❱
33.1.1.15.1.
forge generate test
33.1.1.16.
forge generate-fig-spec
33.1.1.17.
forge init
33.1.1.18.
forge inspect
33.1.1.19.
forge install
33.1.1.20.
forge remappings
33.1.1.21.
forge remove
33.1.1.22.
forge script
33.1.1.23.
forge selectors
❱
33.1.1.23.1.
forge selectors collision
33.1.1.23.2.
forge selectors upload
33.1.1.23.3.
forge selectors list
33.1.1.24.
forge snapshot
33.1.1.25.
forge test
33.1.1.26.
forge tree
33.1.1.27.
forge update
33.1.1.28.
forge verify-bytecode
33.1.1.29.
forge verify-check
33.1.1.30.
forge verify-contract
33.1.2.
cast
❱
33.1.2.1.
cast 4byte
33.1.2.2.
cast 4byte-decode
33.1.2.3.
cast 4byte-event
33.1.2.4.
cast abi-decode
33.1.2.5.
cast abi-encode
33.1.2.6.
cast access-list
33.1.2.7.
cast address-zero
33.1.2.8.
cast admin
33.1.2.9.
cast age
33.1.2.10.
cast balance
33.1.2.11.
cast base-fee
33.1.2.12.
cast bind
33.1.2.13.
cast block
33.1.2.14.
cast block-number
33.1.2.15.
cast call
❱
33.1.2.15.1.
cast call --create
33.1.2.16.
cast calldata
33.1.2.17.
cast calldata-decode
33.1.2.18.
cast chain
33.1.2.19.
cast chain-id
33.1.2.20.
cast client
33.1.2.21.
cast code
33.1.2.22.
cast codesize
33.1.2.23.
cast completions
33.1.2.24.
cast compute-address
33.1.2.25.
cast concat-hex
33.1.2.26.
cast create2
33.1.2.27.
cast decode-transaction
33.1.2.28.
cast disassemble
33.1.2.29.
cast estimate
❱
33.1.2.29.1.
cast estimate --create
33.1.2.30.
cast etherscan-source
33.1.2.31.
cast find-block
33.1.2.32.
cast format-bytes32-string
33.1.2.33.
cast from-bin
33.1.2.34.
cast from-fixed-point
33.1.2.35.
cast from-rlp
33.1.2.36.
cast from-utf8
33.1.2.37.
cast from-wei
33.1.2.38.
cast gas-price
33.1.2.39.
cast generate-fig-spec
33.1.2.40.
cast hash-zero
33.1.2.41.
cast implementation
33.1.2.42.
cast index
33.1.2.43.
cast interface
33.1.2.44.
cast keccak
33.1.2.45.
cast logs
33.1.2.46.
cast lookup-address
33.1.2.47.
cast max-int
33.1.2.48.
cast max-uint
33.1.2.49.
cast min-int
33.1.2.50.
cast mktx
❱
33.1.2.50.1.
cast mktx --create
33.1.2.51.
cast namehash
33.1.2.52.
cast nonce
33.1.2.53.
cast parse-bytes32-address
33.1.2.54.
cast parse-bytes32-string
33.1.2.55.
cast pretty-calldata
33.1.2.56.
cast proof
33.1.2.57.
cast publish
33.1.2.58.
cast receipt
33.1.2.59.
cast resolve-name
33.1.2.60.
cast rpc
33.1.2.61.
cast run
33.1.2.62.
cast selectors
33.1.2.63.
cast send
❱
33.1.2.63.1.
cast send --create
33.1.2.64.
cast shl
33.1.2.65.
cast shr
33.1.2.66.
cast sig
33.1.2.67.
cast sig-event
33.1.2.68.
cast storage
33.1.2.69.
cast to-ascii
33.1.2.70.
cast to-base
33.1.2.71.
cast to-bytes32
33.1.2.72.
cast to-check-sum-address
33.1.2.73.
cast to-dec
33.1.2.74.
cast to-fixed-point
33.1.2.75.
cast to-hex
33.1.2.76.
cast to-hexdata
33.1.2.77.
cast to-int256
33.1.2.78.
cast to-rlp
33.1.2.79.
cast to-uint256
33.1.2.80.
cast to-unit
33.1.2.81.
cast to-wei
33.1.2.82.
cast tx
33.1.2.83.
cast upload-signature
33.1.2.84.
cast wallet
❱
33.1.2.84.1.
cast wallet new
33.1.2.84.2.
cast wallet new-mnemonic
33.1.2.84.3.
cast wallet vanity
33.1.2.84.4.
cast wallet address
33.1.2.84.5.
cast wallet sign
33.1.2.84.6.
cast wallet verify
33.1.2.84.7.
cast wallet import
33.1.2.84.8.
cast wallet list
33.1.2.84.9.
cast wallet derive-private-key
33.1.3.
anvil
❱
33.1.3.1.
anvil completions
33.1.3.2.
anvil generate-fig-spec
33.1.4.
chisel
❱
33.1.4.1.
chisel list
33.1.4.2.
chisel load
33.1.4.3.
chisel view
33.1.4.4.
chisel clear-cache
33.2.
forge Commands
❱
33.2.1.
General Commands
❱
33.2.1.1.
forge
33.2.1.2.
forge help
33.2.1.3.
forge completions
33.2.2.
Project Commands
❱
33.2.2.1.
forge init
33.2.2.2.
forge clone
33.2.2.3.
forge install
33.2.2.4.
forge update
33.2.2.5.
forge remove
33.2.2.6.
forge config
33.2.2.7.
forge remappings
33.2.2.8.
forge tree
33.2.2.9.
forge geiger
33.2.3.
Build Commands
❱
33.2.3.1.
forge build
33.2.3.2.
forge clean
33.2.3.3.
forge inspect
33.2.4.
Test Commands
❱
33.2.4.1.
forge test
33.2.4.2.
forge snapshot
33.2.4.3.
forge coverage
33.2.5.
Deploy Commands
❱
33.2.5.1.
forge create
33.2.5.2.
forge verify-contract
33.2.5.3.
forge verify-check
33.2.5.4.
forge flatten
33.2.6.
Utility Commands
❱
33.2.6.1.
forge debug
33.2.6.2.
forge bind
33.2.6.3.
forge cache
33.2.6.4.
forge cache clean
33.2.6.5.
forge cache ls
33.2.6.6.
forge script
33.2.6.7.
forge upload-selectors
33.2.6.8.
forge doc
33.3.
cast Commands
❱
33.3.1.
General Commands
❱
33.3.1.1.
cast
33.3.1.2.
cast help
33.3.1.3.
cast completions
33.3.2.
Chain Commands
❱
33.3.2.1.
cast chain-id
33.3.2.2.
cast chain
33.3.2.3.
cast client
33.3.3.
Transaction Commands
❱
33.3.3.1.
cast publish
33.3.3.2.
cast receipt
33.3.3.3.
cast send
33.3.3.4.
cast mktx
33.3.3.5.
cast call
33.3.3.6.
cast rpc
33.3.3.7.
cast tx
33.3.3.8.
cast run
33.3.3.9.
cast estimate
33.3.3.10.
cast access-list
33.3.3.11.
cast logs
33.3.4.
Block Commands
❱
33.3.4.1.
cast find-block
33.3.4.2.
cast gas-price
33.3.4.3.
cast block-number
33.3.4.4.
cast basefee
33.3.4.5.
cast block
33.3.4.6.
cast age
33.3.5.
Account Commands
❱
33.3.5.1.
cast balance
33.3.5.2.
cast storage
33.3.5.3.
cast proof
33.3.5.4.
cast nonce
33.3.5.5.
cast code
33.3.5.6.
cast codesize
33.3.6.
ENS Commands
❱
33.3.6.1.
cast lookup-address
33.3.6.2.
cast resolve-name
33.3.6.3.
cast namehash
33.3.7.
Etherscan Commands
❱
33.3.7.1.
cast etherscan-source
33.3.8.
ABI Commands
❱
33.3.8.1.
cast abi-decode
33.3.8.2.
cast abi-encode
33.3.8.3.
cast 4byte
33.3.8.4.
cast 4byte-decode
33.3.8.5.
cast 4byte-event
33.3.8.6.
cast calldata
33.3.8.7.
cast calldata-decode
33.3.8.8.
cast pretty-calldata
33.3.8.9.
cast selectors
33.3.8.10.
cast upload-signature
33.3.9.
Conversion Commands
❱
33.3.9.1.
cast format-bytes32-string
33.3.9.2.
cast from-bin
33.3.9.3.
cast from-fixed-point
33.3.9.4.
cast from-rlp
33.3.9.5.
cast from-utf8
33.3.9.6.
cast from-wei
33.3.9.7.
cast parse-bytes32-address
33.3.9.8.
cast parse-bytes32-string
33.3.9.9.
cast to-ascii
33.3.9.10.
cast to-base
33.3.9.11.
cast to-bytes32
33.3.9.12.
cast to-dec
33.3.9.13.
cast to-fixed-point
33.3.9.14.
cast to-hex
33.3.9.15.
cast to-hexdata
33.3.9.16.
cast to-int256
33.3.9.17.
cast to-rlp
33.3.9.18.
cast to-uint256
33.3.9.19.
cast to-unit
33.3.9.20.
cast to-wei
33.3.9.21.
cast shl
33.3.9.22.
cast shr
33.3.10.
Utility Commands
❱
33.3.10.1.
cast sig
33.3.10.2.
cast sig-event
33.3.10.3.
cast keccak
33.3.10.4.
cast compute-address
33.3.10.5.
cast create2
33.3.10.6.
cast interface
33.3.10.7.
cast index
33.3.10.8.
cast concat-hex
33.3.10.9.
cast max-int
33.3.10.10.
cast min-int
33.3.10.11.
cast max-uint
33.3.10.12.
cast to-check-sum-address
33.3.11.
Wallet Commands
❱
33.3.11.1.
cast wallet
33.3.11.2.
cast wallet new
33.3.11.3.
cast wallet new-mnemonic
33.3.11.4.
cast wallet address
33.3.11.5.
cast wallet sign
33.3.11.6.
cast wallet vanity
33.3.11.7.
cast wallet verify
33.3.11.8.
cast wallet import
33.3.11.9.
cast wallet list
33.4.
anvil Reference
33.5.
chisel Reference
33.6.
Config Reference
❱
33.6.1.
Overview
33.6.2.
Project
33.6.3.
Solidity Compiler
33.6.4.
Testing
33.6.5.
In-line Configuration Testing
33.6.6.
Formatter
33.6.7.
Documentation Generator
33.6.8.
Etherscan
33.7.
Cheatcodes Reference
❱
33.7.1.
Environment
❱
33.7.1.1.
warp
33.7.1.2.
roll
33.7.1.3.
fee
33.7.1.4.
getBlockTimestamp
33.7.1.5.
getBlockNumber
33.7.1.6.
difficulty
33.7.1.7.
prevrandao
33.7.1.8.
chainId
33.7.1.9.
store
33.7.1.10.
load
33.7.1.11.
etch
33.7.1.12.
deal
33.7.1.13.
prank
33.7.1.14.
startPrank
33.7.1.15.
stopPrank
33.7.1.16.
readCallers
33.7.1.17.
record
33.7.1.18.
accesses
33.7.1.19.
recordLogs
33.7.1.20.
getRecordedLogs
33.7.1.21.
setNonce
33.7.1.22.
getNonce
33.7.1.23.
mockCall
33.7.1.24.
mockCallRevert
33.7.1.25.
clearMockedCalls
33.7.1.26.
coinbase
33.7.1.27.
broadcast
33.7.1.28.
startBroadcast
33.7.1.29.
stopBroadcast
33.7.1.30.
pauseGasMetering
33.7.1.31.
resumeGasMetering
33.7.1.32.
txGasPrice
33.7.1.33.
startStateDiffRecording
33.7.1.34.
stopAndReturnStateDiff
33.7.2.
Assertions
❱
33.7.2.1.
expectRevert
33.7.2.2.
expectEmit
33.7.2.3.
expectCall
33.7.3.
Fuzzer
❱
33.7.3.1.
assume
33.7.4.
Forking
❱
33.7.4.1.
createFork
33.7.4.2.
selectFork
33.7.4.3.
createSelectFork
33.7.4.4.
activeFork
33.7.4.5.
rollFork
33.7.4.6.
makePersistent
33.7.4.7.
revokePersistent
33.7.4.8.
isPersistent
33.7.4.9.
allowCheatcodes
33.7.4.10.
transact
33.7.5.
External
❱
33.7.5.1.
ffi
33.7.5.2.
prompt
33.7.5.3.
projectRoot
33.7.5.4.
getCode
33.7.5.5.
getDeployedCode
33.7.5.6.
sleep
33.7.5.7.
unixTime
33.7.5.8.
setEnv
33.7.5.9.
envOr
33.7.5.10.
envBool
33.7.5.11.
envUint
33.7.5.12.
envInt
33.7.5.13.
envAddress
33.7.5.14.
envBytes32
33.7.5.15.
envString
33.7.5.16.
envBytes
33.7.5.17.
keyExists
33.7.5.18.
keyExistsJson
33.7.5.19.
keyExistsToml
33.7.5.20.
parseJson
33.7.5.21.
parseToml
33.7.5.22.
parseJsonKeys
33.7.5.23.
parseTomlKeys
33.7.5.24.
serializeJson
33.7.5.25.
writeJson
33.7.5.26.
writeToml
33.7.6.
Utilities
❱
33.7.6.1.
addr
33.7.6.2.
sign
33.7.6.3.
skip
33.7.6.4.
label
33.7.6.5.
getLabel
33.7.6.6.
deriveKey
33.7.6.7.
parseBytes
33.7.6.8.
parseAddress
33.7.6.9.
parseUint
33.7.6.10.
parseInt
33.7.6.11.
parseBytes32
33.7.6.12.
parseBool
33.7.6.13.
rememberKey
33.7.6.14.
toString
33.7.6.15.
breakpoint
33.7.6.16.
createWallet
33.7.7.
Snapshots
33.7.8.
RPC
33.7.9.
Files
33.8.
Forge Standard Library Reference
❱
33.8.1.
Std Logs
33.8.2.
Std Assertions
❱
33.8.2.1.
fail
33.8.2.2.
assertTrue
33.8.2.3.
assertFalse
33.8.2.4.
assertEq
33.8.2.5.
assertEqDecimal
33.8.2.6.
assertNotEq
33.8.2.7.
assertNotEqDecimal
33.8.2.8.
assertLt
33.8.2.9.
assertLtDecimal
33.8.2.10.
assertGt
33.8.2.11.
assertGtDecimal
33.8.2.12.
assertLe
33.8.2.13.
assertLeDecimal
33.8.2.14.
assertGe
33.8.2.15.
assertGeDecimal
33.8.2.16.
assertApproxEqAbs
33.8.2.17.
assertApproxEqAbsDecimal
33.8.2.18.
assertApproxEqRel
33.8.2.19.
assertApproxEqRelDecimal
33.8.3.
Std Cheats
❱
33.8.3.1.
skip
33.8.3.2.
rewind
33.8.3.3.
hoax
33.8.3.4.
startHoax
33.8.3.5.
deal
33.8.3.6.
deployCode
33.8.3.7.
deployCodeTo
33.8.3.8.
bound
33.8.3.9.
changePrank
33.8.3.10.
makeAddr
33.8.3.11.
makeAddrAndKey
33.8.3.12.
noGasMetering
33.8.3.13.
assumeNoPrecompiles
33.8.3.14.
assumePayable
33.8.4.
Std Errors
❱
33.8.4.1.
assertionError
33.8.4.2.
arithmeticError
33.8.4.3.
divisionError
33.8.4.4.
enumConversionError
33.8.4.5.
encodeStorageError
33.8.4.6.
popError
33.8.4.7.
indexOOBError
33.8.4.8.
memOverflowError
33.8.4.9.
zeroVarError
33.8.5.
Std Storage
❱
33.8.5.1.
target
33.8.5.2.
sig
33.8.5.3.
with_key
33.8.5.4.
depth
33.8.5.5.
checked_write
33.8.5.6.
find
33.8.5.7.
read
33.8.6.
Std Math
❱
33.8.6.1.
abs
33.8.6.2.
delta
33.8.6.3.
percentDelta
33.8.7.
Script Utils
❱
33.8.7.1.
computeCreateAddress
33.8.7.2.
deriveRememberKey
33.8.8.
Console Logging
33.9.
DSTest Reference
34.
Miscellaneous
❱
34.1.
Struct encoding
34.2.
Precompile Registry
Light
Rust
Coal
Navy
Ayu
Foundry Book
Transaction Commands
cast publish
cast receipt
cast send
cast mktx
cast call
cast rpc
cast tx
cast run
cast estimate
cast access-list
cast logs