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.
Forking Mainnet with Cast and Anvil
28.
Learning Foundry Videos
Appendix
29.
FAQ
30.
Help us improve Foundry
31.
References
❱
31.1.
forge Commands
❱
31.1.1.
General Commands
❱
31.1.1.1.
forge
31.1.1.2.
forge help
31.1.1.3.
forge completions
31.1.2.
Project Commands
❱
31.1.2.1.
forge init
31.1.2.2.
forge install
31.1.2.3.
forge update
31.1.2.4.
forge remove
31.1.2.5.
forge config
31.1.2.6.
forge remappings
31.1.2.7.
forge tree
31.1.2.8.
forge geiger
31.1.3.
Build Commands
❱
31.1.3.1.
forge build
31.1.3.2.
forge clean
31.1.3.3.
forge inspect
31.1.4.
Test Commands
❱
31.1.4.1.
forge test
31.1.4.2.
forge snapshot
31.1.4.3.
forge coverage
31.1.5.
Deploy Commands
❱
31.1.5.1.
forge create
31.1.5.2.
forge verify-contract
31.1.5.3.
forge verify-check
31.1.5.4.
forge flatten
31.1.6.
Utility Commands
❱
31.1.6.1.
forge debug
31.1.6.2.
forge bind
31.1.6.3.
forge cache
31.1.6.4.
forge cache clean
31.1.6.5.
forge cache ls
31.1.6.6.
forge script
31.1.6.7.
forge upload-selectors
31.1.6.8.
forge doc
31.2.
cast Commands
❱
31.2.1.
General Commands
❱
31.2.1.1.
cast
31.2.1.2.
cast help
31.2.1.3.
cast completions
31.2.2.
Chain Commands
❱
31.2.2.1.
cast chain-id
31.2.2.2.
cast chain
31.2.2.3.
cast client
31.2.3.
Transaction Commands
❱
31.2.3.1.
cast publish
31.2.3.2.
cast receipt
31.2.3.3.
cast send
31.2.3.4.
cast call
31.2.3.5.
cast rpc
31.2.3.6.
cast tx
31.2.3.7.
cast run
31.2.3.8.
cast estimate
31.2.3.9.
cast access-list
31.2.3.10.
cast logs
31.2.4.
Block Commands
❱
31.2.4.1.
cast find-block
31.2.4.2.
cast gas-price
31.2.4.3.
cast block-number
31.2.4.4.
cast basefee
31.2.4.5.
cast block
31.2.4.6.
cast age
31.2.5.
Account Commands
❱
31.2.5.1.
cast balance
31.2.5.2.
cast storage
31.2.5.3.
cast proof
31.2.5.4.
cast nonce
31.2.5.5.
cast code
31.2.5.6.
cast codesize
31.2.6.
ENS Commands
❱
31.2.6.1.
cast lookup-address
31.2.6.2.
cast resolve-name
31.2.6.3.
cast namehash
31.2.7.
Etherscan Commands
❱
31.2.7.1.
cast etherscan-source
31.2.8.
ABI Commands
❱
31.2.8.1.
cast abi-decode
31.2.8.2.
cast abi-encode
31.2.8.3.
cast 4byte
31.2.8.4.
cast 4byte-decode
31.2.8.5.
cast 4byte-event
31.2.8.6.
cast calldata
31.2.8.7.
cast calldata-decode
31.2.8.8.
cast pretty-calldata
31.2.8.9.
cast upload-signature
31.2.9.
Conversion Commands
❱
31.2.9.1.
cast format-bytes32-string
31.2.9.2.
cast from-bin
31.2.9.3.
cast from-fixed-point
31.2.9.4.
cast from-rlp
31.2.9.5.
cast from-utf8
31.2.9.6.
cast from-wei
31.2.9.7.
cast parse-bytes32-address
31.2.9.8.
cast parse-bytes32-string
31.2.9.9.
cast to-ascii
31.2.9.10.
cast to-base
31.2.9.11.
cast to-bytes32
31.2.9.12.
cast to-dec
31.2.9.13.
cast to-fixed-point
31.2.9.14.
cast to-hex
31.2.9.15.
cast to-hexdata
31.2.9.16.
cast to-int256
31.2.9.17.
cast to-rlp
31.2.9.18.
cast to-uint256
31.2.9.19.
cast to-unit
31.2.9.20.
cast to-wei
31.2.9.21.
cast shl
31.2.9.22.
cast shr
31.2.10.
Utility Commands
❱
31.2.10.1.
cast sig
31.2.10.2.
cast sig-event
31.2.10.3.
cast keccak
31.2.10.4.
cast compute-address
31.2.10.5.
cast create2
31.2.10.6.
cast interface
31.2.10.7.
cast index
31.2.10.8.
cast concat-hex
31.2.10.9.
cast max-int
31.2.10.10.
cast min-int
31.2.10.11.
cast max-uint
31.2.10.12.
cast to-check-sum-address
31.2.11.
Wallet Commands
❱
31.2.11.1.
cast wallet
31.2.11.2.
cast wallet new
31.2.11.3.
cast wallet address
31.2.11.4.
cast wallet sign
31.2.11.5.
cast wallet vanity
31.2.11.6.
cast wallet verify
31.2.11.7.
cast wallet import
31.2.11.8.
cast wallet list
31.3.
anvil Reference
31.4.
chisel Reference
31.5.
Config Reference
❱
31.5.1.
Overview
31.5.2.
Project
31.5.3.
Solidity Compiler
31.5.4.
Testing
31.5.5.
In-line Configuration Testing
31.5.6.
Formatter
31.5.7.
Documentation Generator
31.5.8.
Etherscan
31.6.
Cheatcodes Reference
❱
31.6.1.
Environment
❱
31.6.1.1.
warp
31.6.1.2.
roll
31.6.1.3.
fee
31.6.1.4.
difficulty
31.6.1.5.
prevrandao
31.6.1.6.
chainId
31.6.1.7.
store
31.6.1.8.
load
31.6.1.9.
etch
31.6.1.10.
deal
31.6.1.11.
prank
31.6.1.12.
startPrank
31.6.1.13.
stopPrank
31.6.1.14.
readCallers
31.6.1.15.
record
31.6.1.16.
accesses
31.6.1.17.
recordLogs
31.6.1.18.
getRecordedLogs
31.6.1.19.
setNonce
31.6.1.20.
getNonce
31.6.1.21.
mockCall
31.6.1.22.
mockCallRevert
31.6.1.23.
clearMockedCalls
31.6.1.24.
coinbase
31.6.1.25.
broadcast
31.6.1.26.
startBroadcast
31.6.1.27.
stopBroadcast
31.6.1.28.
pauseGasMetering
31.6.1.29.
resumeGasMetering
31.6.1.30.
txGasPrice
31.6.2.
Assertions
❱
31.6.2.1.
expectRevert
31.6.2.2.
expectEmit
31.6.2.3.
expectCall
31.6.3.
Fuzzer
❱
31.6.3.1.
assume
31.6.4.
Forking
❱
31.6.4.1.
createFork
31.6.4.2.
selectFork
31.6.4.3.
createSelectFork
31.6.4.4.
activeFork
31.6.4.5.
rollFork
31.6.4.6.
makePersistent
31.6.4.7.
revokePersistent
31.6.4.8.
isPersistent
31.6.4.9.
allowCheatcodes
31.6.4.10.
transact
31.6.5.
External
❱
31.6.5.1.
ffi
31.6.5.2.
projectRoot
31.6.5.3.
getCode
31.6.5.4.
getDeployedCode
31.6.5.5.
sleep
31.6.5.6.
unixTime
31.6.5.7.
setEnv
31.6.5.8.
envOr
31.6.5.9.
envBool
31.6.5.10.
envUint
31.6.5.11.
envInt
31.6.5.12.
envAddress
31.6.5.13.
envBytes32
31.6.5.14.
envString
31.6.5.15.
envBytes
31.6.5.16.
parseJson
31.6.5.17.
keyExists
31.6.5.18.
parseJsonKeys
31.6.5.19.
serializeJson
31.6.5.20.
writeJson
31.6.6.
Utilities
❱
31.6.6.1.
addr
31.6.6.2.
sign
31.6.6.3.
skip
31.6.6.4.
label
31.6.6.5.
deriveKey
31.6.6.6.
parseBytes
31.6.6.7.
parseAddress
31.6.6.8.
parseUint
31.6.6.9.
parseInt
31.6.6.10.
parseBytes32
31.6.6.11.
parseBool
31.6.6.12.
rememberKey
31.6.6.13.
toString
31.6.6.14.
breakpoint
31.6.6.15.
createWallet
31.6.7.
Snapshots
31.6.8.
RPC
31.6.9.
Files
31.7.
Forge Standard Library Reference
❱
31.7.1.
Std Logs
31.7.2.
Std Assertions
❱
31.7.2.1.
fail
31.7.2.2.
assertFalse
31.7.2.3.
assertEq
31.7.2.4.
assertApproxEqAbs
31.7.2.5.
assertApproxEqRel
31.7.3.
Std Cheats
❱
31.7.3.1.
skip
31.7.3.2.
rewind
31.7.3.3.
hoax
31.7.3.4.
startHoax
31.7.3.5.
deal
31.7.3.6.
deployCode
31.7.3.7.
deployCodeTo
31.7.3.8.
bound
31.7.3.9.
changePrank
31.7.3.10.
makeAddr
31.7.3.11.
makeAddrAndKey
31.7.3.12.
noGasMetering
31.7.3.13.
assumeNoPrecompiles
31.7.3.14.
assumePayable
31.7.4.
Std Errors
❱
31.7.4.1.
assertionError
31.7.4.2.
arithmeticError
31.7.4.3.
divisionError
31.7.4.4.
enumConversionError
31.7.4.5.
encodeStorageError
31.7.4.6.
popError
31.7.4.7.
indexOOBError
31.7.4.8.
memOverflowError
31.7.4.9.
zeroVarError
31.7.5.
Std Storage
❱
31.7.5.1.
target
31.7.5.2.
sig
31.7.5.3.
with_key
31.7.5.4.
depth
31.7.5.5.
checked_write
31.7.5.6.
find
31.7.5.7.
read
31.7.6.
Std Math
❱
31.7.6.1.
abs
31.7.6.2.
delta
31.7.6.3.
percentDelta
31.7.7.
Script Utils
❱
31.7.7.1.
computeCreateAddress
31.7.7.2.
deriveRememberKey
31.7.8.
Console Logging
31.8.
DSTest Reference
32.
Miscellaneous
❱
32.1.
Struct encoding
32.2.
Precompile Registry
Light
Rust
Coal
Navy
Ayu (default)
Foundry Book
Project Commands
forge init
forge install
forge update
forge remove
forge config
forge remappings
forge tree
forge geiger