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
ZKsync Specifics
9.
Execution Overview
10.
Compilation Overview
11.
Limitations
❱
11.1.
General
11.2.
Compilation
11.3.
Broadcast
11.4.
Cheatcodes
12.
Additional Cheatcodes
❱
12.1.
zkVm
Forge Overview
13.
Overview of Forge
14.
Tests
❱
14.1.
Writing Tests
14.2.
Cheatcodes
14.3.
Forge Standard Library Overview
14.4.
Understanding Traces
14.5.
Fork Testing
14.6.
Replaying Failures
15.
Advanced Testing
❱
15.1.
Fuzz Testing
15.2.
Invariant Testing
15.3.
Differential Testing
16.
Deploying and Verifying
17.
Gas Tracking
❱
17.1.
Gas Reports
17.2.
Gas Snapshots
18.
Debugger
Cast Overview
19.
Overview of Cast
Anvil Overview
20.
Overview of Anvil
Chisel Overview
21.
Overview of Chisel
Configuration
22.
Configuring with foundry.toml
23.
Continuous Integration
24.
Integrating with VSCode
25.
Shell Autocompletion
26.
Static Analyzers
27.
Integrating with Hardhat
28.
Vyper support
Tutorials
29.
Best Practices
30.
Creating an NFT with Solmate
31.
Docker and Foundry
32.
Testing EIP-712 Signatures
33.
Solidity Scripting
34.
Deterministic deployment using CREATE2
35.
Forking Mainnet with Cast and Anvil
36.
Learning Foundry Videos
Appendix
37.
FAQ
38.
Help us improve Foundry
39.
References
❱
39.1.
CLI Reference
❱
39.1.1.
forge
❱
39.1.1.1.
forge bind
39.1.1.2.
forge bind-json
39.1.1.3.
forge build
39.1.1.4.
forge cache
❱
39.1.1.4.1.
forge cache clean
39.1.1.4.2.
forge cache ls
39.1.1.5.
forge clean
39.1.1.6.
forge clone
39.1.1.7.
forge completions
39.1.1.8.
forge config
39.1.1.9.
forge coverage
39.1.1.10.
forge create
39.1.1.11.
forge debug
39.1.1.12.
forge doc
39.1.1.13.
forge eip712
39.1.1.14.
forge flatten
39.1.1.15.
forge fmt
39.1.1.16.
forge geiger
39.1.1.17.
forge generate
❱
39.1.1.17.1.
forge generate test
39.1.1.18.
forge generate-fig-spec
39.1.1.19.
forge init
39.1.1.20.
forge inspect
39.1.1.21.
forge install
39.1.1.22.
forge remappings
39.1.1.23.
forge remove
39.1.1.24.
forge script
39.1.1.25.
forge selectors
❱
39.1.1.25.1.
forge selectors collision
39.1.1.25.2.
forge selectors upload
39.1.1.25.3.
forge selectors list
39.1.1.26.
forge snapshot
39.1.1.27.
forge soldeer
❱
39.1.1.27.1.
forge soldeer install
39.1.1.27.2.
forge soldeer update
39.1.1.27.3.
forge soldeer login
39.1.1.27.4.
forge soldeer push
39.1.1.27.5.
forge soldeer version-dry-run
39.1.1.28.
forge test
39.1.1.29.
forge tree
39.1.1.30.
forge update
39.1.1.31.
forge verify-bytecode
39.1.1.32.
forge verify-check
39.1.1.33.
forge verify-contract
39.1.2.
cast
❱
39.1.2.1.
cast 4byte
39.1.2.2.
cast 4byte-decode
39.1.2.3.
cast 4byte-event
39.1.2.4.
cast abi-decode
39.1.2.5.
cast abi-encode
39.1.2.6.
cast access-list
39.1.2.7.
cast address-zero
39.1.2.8.
cast admin
39.1.2.9.
cast age
39.1.2.10.
cast balance
39.1.2.11.
cast base-fee
39.1.2.12.
cast bind
39.1.2.13.
cast block
39.1.2.14.
cast block-number
39.1.2.15.
cast call
❱
39.1.2.15.1.
cast call --create
39.1.2.16.
cast calldata
39.1.2.17.
cast calldata-decode
39.1.2.18.
cast chain
39.1.2.19.
cast chain-id
39.1.2.20.
cast client
39.1.2.21.
cast code
39.1.2.22.
cast codesize
39.1.2.23.
cast completions
39.1.2.24.
cast compute-address
39.1.2.25.
cast concat-hex
39.1.2.26.
cast create2
39.1.2.27.
cast decode-eof
39.1.2.28.
cast decode-transaction
39.1.2.29.
cast disassemble
39.1.2.30.
cast estimate
❱
39.1.2.30.1.
cast estimate --create
39.1.2.31.
cast etherscan-source
39.1.2.32.
cast find-block
39.1.2.33.
cast format-bytes32-string
39.1.2.34.
cast from-bin
39.1.2.35.
cast from-fixed-point
39.1.2.36.
cast from-rlp
39.1.2.37.
cast from-utf8
39.1.2.38.
cast from-wei
39.1.2.39.
cast gas-price
39.1.2.40.
cast generate-fig-spec
39.1.2.41.
cast hash-zero
39.1.2.42.
cast implementation
39.1.2.43.
cast index
39.1.2.44.
cast index-erc7201
39.1.2.45.
cast interface
39.1.2.46.
cast keccak
39.1.2.47.
cast logs
39.1.2.48.
cast lookup-address
39.1.2.49.
cast max-int
39.1.2.50.
cast max-uint
39.1.2.51.
cast min-int
39.1.2.52.
cast mktx
❱
39.1.2.52.1.
cast mktx --create
39.1.2.53.
cast namehash
39.1.2.54.
cast nonce
39.1.2.55.
cast parse-bytes32-address
39.1.2.56.
cast parse-bytes32-string
39.1.2.57.
cast pretty-calldata
39.1.2.58.
cast proof
39.1.2.59.
cast publish
39.1.2.60.
cast receipt
39.1.2.61.
cast resolve-name
39.1.2.62.
cast rpc
39.1.2.63.
cast run
39.1.2.64.
cast selectors
39.1.2.65.
cast send
❱
39.1.2.65.1.
cast send --create
39.1.2.66.
cast shl
39.1.2.67.
cast shr
39.1.2.68.
cast sig
39.1.2.69.
cast sig-event
39.1.2.70.
cast storage
39.1.2.71.
cast to-ascii
39.1.2.72.
cast to-base
39.1.2.73.
cast to-bytes32
39.1.2.74.
cast to-check-sum-address
39.1.2.75.
cast to-dec
39.1.2.76.
cast to-fixed-point
39.1.2.77.
cast to-hex
39.1.2.78.
cast to-hexdata
39.1.2.79.
cast to-int256
39.1.2.80.
cast to-rlp
39.1.2.81.
cast to-uint256
39.1.2.82.
cast to-unit
39.1.2.83.
cast to-utf8
39.1.2.84.
cast to-wei
39.1.2.85.
cast tx
39.1.2.86.
cast upload-signature
39.1.2.87.
cast wallet
❱
39.1.2.87.1.
cast wallet new
39.1.2.87.2.
cast wallet new-mnemonic
39.1.2.87.3.
cast wallet vanity
39.1.2.87.4.
cast wallet address
39.1.2.87.5.
cast wallet sign
39.1.2.87.6.
cast wallet verify
39.1.2.87.7.
cast wallet import
39.1.2.87.8.
cast wallet list
39.1.2.87.9.
cast wallet private-key
39.1.2.87.10.
cast wallet decrypt-keystore
39.2.
forge Commands
❱
39.2.1.
General Commands
❱
39.2.1.1.
forge
39.2.1.2.
forge help
39.2.1.3.
forge completions
39.2.2.
Project Commands
❱
39.2.2.1.
forge init
39.2.2.2.
forge clone
39.2.2.3.
forge install
39.2.2.4.
forge update
39.2.2.5.
forge remove
39.2.2.6.
forge config
39.2.2.7.
forge remappings
39.2.2.8.
forge tree
39.2.2.9.
forge geiger
39.2.3.
Build Commands
❱
39.2.3.1.
forge build
39.2.3.2.
forge clean
39.2.3.3.
forge inspect
39.2.4.
Test Commands
❱
39.2.4.1.
forge test
39.2.4.2.
forge snapshot
39.2.4.3.
forge coverage
39.2.5.
Deploy Commands
❱
39.2.5.1.
forge create
39.2.5.2.
forge verify-contract
39.2.5.3.
forge verify-check
39.2.5.4.
forge flatten
39.2.6.
Utility Commands
❱
39.2.6.1.
forge debug
39.2.6.2.
forge bind
39.2.6.3.
forge cache
39.2.6.4.
forge cache clean
39.2.6.5.
forge cache ls
39.2.6.6.
forge script
39.2.6.7.
forge upload-selectors
39.2.6.8.
forge doc
39.3.
cast Commands
❱
39.3.1.
General Commands
❱
39.3.1.1.
cast
39.3.1.2.
cast help
39.3.1.3.
cast completions
39.3.2.
Chain Commands
❱
39.3.2.1.
cast chain-id
39.3.2.2.
cast chain
39.3.2.3.
cast client
39.3.3.
Transaction Commands
❱
39.3.3.1.
cast publish
39.3.3.2.
cast receipt
39.3.3.3.
cast send
39.3.3.4.
cast mktx
39.3.3.5.
cast call
39.3.3.6.
cast rpc
39.3.3.7.
cast tx
39.3.3.8.
cast run
39.3.3.9.
cast estimate
39.3.3.10.
cast access-list
39.3.3.11.
cast logs
39.3.4.
Block Commands
❱
39.3.4.1.
cast find-block
39.3.4.2.
cast gas-price
39.3.4.3.
cast block-number
39.3.4.4.
cast basefee
39.3.4.5.
cast block
39.3.4.6.
cast age
39.3.5.
Account Commands
❱
39.3.5.1.
cast balance
39.3.5.2.
cast storage
39.3.5.3.
cast proof
39.3.5.4.
cast nonce
39.3.5.5.
cast code
39.3.5.6.
cast codesize
39.3.6.
ENS Commands
❱
39.3.6.1.
cast lookup-address
39.3.6.2.
cast resolve-name
39.3.6.3.
cast namehash
39.3.7.
Etherscan Commands
❱
39.3.7.1.
cast etherscan-source
39.3.8.
ABI Commands
❱
39.3.8.1.
cast abi-decode
39.3.8.2.
cast abi-encode
39.3.8.3.
cast 4byte
39.3.8.4.
cast 4byte-decode
39.3.8.5.
cast 4byte-event
39.3.8.6.
cast calldata
39.3.8.7.
cast calldata-decode
39.3.8.8.
cast pretty-calldata
39.3.8.9.
cast selectors
39.3.8.10.
cast upload-signature
39.3.9.
Conversion Commands
❱
39.3.9.1.
cast format-bytes32-string
39.3.9.2.
cast from-bin
39.3.9.3.
cast from-fixed-point
39.3.9.4.
cast from-rlp
39.3.9.5.
cast from-utf8
39.3.9.6.
cast from-wei
39.3.9.7.
cast parse-bytes32-address
39.3.9.8.
cast parse-bytes32-string
39.3.9.9.
cast to-ascii
39.3.9.10.
cast to-base
39.3.9.11.
cast to-bytes32
39.3.9.12.
cast to-dec
39.3.9.13.
cast to-fixed-point
39.3.9.14.
cast to-hex
39.3.9.15.
cast to-hexdata
39.3.9.16.
cast to-int256
39.3.9.17.
cast to-rlp
39.3.9.18.
cast to-uint256
39.3.9.19.
cast to-unit
39.3.9.20.
cast to-wei
39.3.9.21.
cast shl
39.3.9.22.
cast shr
39.3.10.
Utility Commands
❱
39.3.10.1.
cast address-zero
39.3.10.2.
cast sig
39.3.10.3.
cast sig-event
39.3.10.4.
cast keccak
39.3.10.5.
cast compute-address
39.3.10.6.
cast create2
39.3.10.7.
cast interface
39.3.10.8.
cast index
39.3.10.9.
cast concat-hex
39.3.10.10.
cast max-int
39.3.10.11.
cast min-int
39.3.10.12.
cast max-uint
39.3.10.13.
cast to-check-sum-address
39.3.11.
Wallet Commands
❱
39.3.11.1.
cast wallet
39.3.11.2.
cast wallet new
39.3.11.3.
cast wallet new-mnemonic
39.3.11.4.
cast wallet address
39.3.11.5.
cast wallet sign
39.3.11.6.
cast wallet vanity
39.3.11.7.
cast wallet verify
39.3.11.8.
cast wallet import
39.3.11.9.
cast wallet list
39.4.
anvil Reference
39.5.
chisel Reference
39.6.
Config Reference
❱
39.6.1.
Overview
39.6.2.
Project
39.6.3.
Solidity Compiler
39.6.4.
Testing
39.6.5.
In-line Configuration Testing
39.6.6.
Formatter
39.6.7.
Documentation Generator
39.6.8.
Etherscan
39.7.
Cheatcodes Reference
❱
39.7.1.
Environment
❱
39.7.1.1.
warp
39.7.1.2.
roll
39.7.1.3.
fee
39.7.1.4.
getBlockTimestamp
39.7.1.5.
getBlockNumber
39.7.1.6.
difficulty
39.7.1.7.
prevrandao
39.7.1.8.
chainId
39.7.1.9.
store
39.7.1.10.
load
39.7.1.11.
etch
39.7.1.12.
deal
39.7.1.13.
prank
39.7.1.14.
startPrank
39.7.1.15.
stopPrank
39.7.1.16.
readCallers
39.7.1.17.
record
39.7.1.18.
accesses
39.7.1.19.
recordLogs
39.7.1.20.
getRecordedLogs
39.7.1.21.
setNonce
39.7.1.22.
getNonce
39.7.1.23.
mockCall
39.7.1.24.
mockCallRevert
39.7.1.25.
clearMockedCalls
39.7.1.26.
coinbase
39.7.1.27.
broadcast
39.7.1.28.
startBroadcast
39.7.1.29.
stopBroadcast
39.7.1.30.
pauseGasMetering
39.7.1.31.
resumeGasMetering
39.7.1.32.
txGasPrice
39.7.1.33.
startStateDiffRecording
39.7.1.34.
stopAndReturnStateDiff
39.7.2.
Assertions
❱
39.7.2.1.
expectRevert
39.7.2.2.
expectEmit
39.7.2.3.
expectCall
39.7.3.
Fuzzer
❱
39.7.3.1.
assume
39.7.4.
Forking
❱
39.7.4.1.
createFork
39.7.4.2.
selectFork
39.7.4.3.
createSelectFork
39.7.4.4.
activeFork
39.7.4.5.
rollFork
39.7.4.6.
makePersistent
39.7.4.7.
revokePersistent
39.7.4.8.
isPersistent
39.7.4.9.
allowCheatcodes
39.7.4.10.
transact
39.7.5.
External
❱
39.7.5.1.
ffi
39.7.5.2.
prompt
39.7.5.3.
projectRoot
39.7.5.4.
getCode
39.7.5.5.
getDeployedCode
39.7.5.6.
sleep
39.7.5.7.
unixTime
39.7.5.8.
setEnv
39.7.5.9.
envOr
39.7.5.10.
envBool
39.7.5.11.
envUint
39.7.5.12.
envInt
39.7.5.13.
envAddress
39.7.5.14.
envBytes32
39.7.5.15.
envString
39.7.5.16.
envBytes
39.7.5.17.
keyExists
39.7.5.18.
keyExistsJson
39.7.5.19.
keyExistsToml
39.7.5.20.
parseJson
39.7.5.21.
parseToml
39.7.5.22.
parseJsonKeys
39.7.5.23.
parseTomlKeys
39.7.5.24.
serializeJson
39.7.5.25.
writeJson
39.7.5.26.
writeToml
39.7.6.
Utilities
❱
39.7.6.1.
addr
39.7.6.2.
sign
39.7.6.3.
skip
39.7.6.4.
label
39.7.6.5.
getLabel
39.7.6.6.
deriveKey
39.7.6.7.
parseBytes
39.7.6.8.
parseAddress
39.7.6.9.
parseUint
39.7.6.10.
parseInt
39.7.6.11.
parseBytes32
39.7.6.12.
parseBool
39.7.6.13.
rememberKey
39.7.6.14.
toString
39.7.6.15.
breakpoint
39.7.6.16.
createWallet
39.7.7.
Snapshots
39.7.8.
RPC
39.7.9.
Files
39.8.
Forge Standard Library Reference
❱
39.8.1.
Std Logs
39.8.2.
Std Assertions
❱
39.8.2.1.
fail
39.8.2.2.
assertTrue
39.8.2.3.
assertFalse
39.8.2.4.
assertEq
39.8.2.5.
assertEqDecimal
39.8.2.6.
assertNotEq
39.8.2.7.
assertNotEqDecimal
39.8.2.8.
assertLt
39.8.2.9.
assertLtDecimal
39.8.2.10.
assertGt
39.8.2.11.
assertGtDecimal
39.8.2.12.
assertLe
39.8.2.13.
assertLeDecimal
39.8.2.14.
assertGe
39.8.2.15.
assertGeDecimal
39.8.2.16.
assertApproxEqAbs
39.8.2.17.
assertApproxEqAbsDecimal
39.8.2.18.
assertApproxEqRel
39.8.2.19.
assertApproxEqRelDecimal
39.8.3.
Std Cheats
❱
39.8.3.1.
skip
39.8.3.2.
rewind
39.8.3.3.
hoax
39.8.3.4.
startHoax
39.8.3.5.
deal
39.8.3.6.
deployCode
39.8.3.7.
deployCodeTo
39.8.3.8.
bound
39.8.3.9.
changePrank
39.8.3.10.
makeAddr
39.8.3.11.
makeAddrAndKey
39.8.3.12.
noGasMetering
39.8.3.13.
assumeNoPrecompiles
39.8.3.14.
assumePayable
39.8.4.
Std Errors
❱
39.8.4.1.
assertionError
39.8.4.2.
arithmeticError
39.8.4.3.
divisionError
39.8.4.4.
enumConversionError
39.8.4.5.
encodeStorageError
39.8.4.6.
popError
39.8.4.7.
indexOOBError
39.8.4.8.
memOverflowError
39.8.4.9.
zeroVarError
39.8.5.
Std Storage
❱
39.8.5.1.
target
39.8.5.2.
sig
39.8.5.3.
with_key
39.8.5.4.
depth
39.8.5.5.
checked_write
39.8.5.6.
find
39.8.5.7.
read
39.8.6.
Std Math
❱
39.8.6.1.
abs
39.8.6.2.
delta
39.8.6.3.
percentDelta
39.8.7.
Script Utils
❱
39.8.7.1.
computeCreateAddress
39.8.7.2.
deriveRememberKey
39.8.8.
Console Logging
39.9.
DSTest Reference
40.
Miscellaneous
❱
40.1.
Struct encoding
Light
Rust
Coal
Navy
Ayu
foundry-zksync book
Project Commands
forge init
forge clone
forge install
forge update
forge remove
forge config
forge remappings
forge tree
forge geiger