1. Introduction
  2. Getting Started
  3. Installation
  4. First Steps with Foundry
  5. Projects
  6. Creating a New Project
  7. Working on an Existing Project
  8. Dependencies
  9. Project Layout
  10. References
  11. forge Commands
    ❱
    1. General Commands
      ❱
      1. forge
      2. forge help
      3. forge completions
    2. Project Commands
      ❱
      1. forge init
      2. forge install
      3. forge update
      4. forge remove
      5. forge config
      6. forge remappings
      7. forge tree
      8. forge geiger
    3. Build Commands
      ❱
      1. forge build
      2. forge clean
      3. forge inspect
    4. Test Commands
      ❱
      1. forge test
      2. forge snapshot
      3. forge coverage
    5. Deploy Commands
      ❱
      1. forge create
      2. forge verify-contract
      3. forge verify-check
      4. forge flatten
    6. Utility Commands
      ❱
      1. forge debug
      2. forge bind
      3. forge cache
      4. forge cache clean
      5. forge cache ls
      6. forge script
      7. forge upload-selectors
      8. forge doc
  12. cast Commands
    ❱
    1. General Commands
      ❱
      1. cast
      2. cast help
      3. cast completions
    2. Chain Commands
      ❱
      1. cast chain-id
      2. cast chain
      3. cast client
    3. Transaction Commands
      ❱
      1. cast publish
      2. cast receipt
      3. cast send
      4. cast call
      5. cast rpc
      6. cast tx
      7. cast run
      8. cast estimate
      9. cast access-list
      10. cast logs
    4. Block Commands
      ❱
      1. cast find-block
      2. cast gas-price
      3. cast block-number
      4. cast basefee
      5. cast block
      6. cast age
    5. Account Commands
      ❱
      1. cast balance
      2. cast storage
      3. cast proof
      4. cast nonce
      5. cast code
      6. cast codesize
    6. ENS Commands
      ❱
      1. cast lookup-address
      2. cast resolve-name
      3. cast namehash
    7. Etherscan Commands
      ❱
      1. cast etherscan-source
    8. ABI Commands
      ❱
      1. cast abi-encode
      2. cast 4byte
      3. cast 4byte-decode
      4. cast 4byte-event
      5. cast calldata
      6. cast pretty-calldata
      7. cast --abi-decode
      8. cast --calldata-decode
      9. cast upload-signature
    9. Conversion Commands
      ❱
      1. cast --format-bytes32-string
      2. cast --from-bin
      3. cast --from-fix
      4. cast --from-rlp
      5. cast --from-utf8
      6. cast --parse-bytes32-string
      7. cast --to-ascii
      8. cast --to-base
      9. cast --to-bytes32
      10. cast --to-fix
      11. cast --to-hexdata
      12. cast --to-int256
      13. cast --to-rlp
      14. cast --to-uint256
      15. cast --to-unit
      16. cast --to-wei
      17. cast shl
      18. cast shr
    10. Utility Commands
      ❱
      1. cast sig
      2. cast sig-event
      3. cast keccak
      4. cast compute-address
      5. cast create2
      6. cast interface
      7. cast index
      8. cast --concat-hex
      9. cast --max-int
      10. cast --min-int
      11. cast --max-uint
      12. cast --to-checksum-address
    11. Wallet Commands
      ❱
      1. cast wallet
      2. cast wallet new
      3. cast wallet address
      4. cast wallet sign
      5. cast wallet vanity
      6. cast wallet verify
  13. anvil Reference
  14. chisel Reference
  15. Config Reference
    ❱
    1. Overview
    2. Project
    3. Solidity Compiler
    4. Testing
    5. In-line Configuration Testing
    6. Formatter
    7. Documentation Generator
    8. Etherscan
  16. Cheatcodes Reference
    ❱
    1. Environment
      ❱
      1. warp
      2. roll
      3. fee
      4. difficulty
      5. prevrandao
      6. chainId
      7. store
      8. load
      9. etch
      10. deal
      11. prank
      12. startPrank
      13. stopPrank
      14. readCallers
      15. record
      16. accesses
      17. recordLogs
      18. getRecordedLogs
      19. setNonce
      20. getNonce
      21. mockCall
      22. mockCallRevert
      23. clearMockedCalls
      24. coinbase
      25. broadcast
      26. startBroadcast
      27. stopBroadcast
      28. pauseGasMetering
      29. resumeGasMetering
      30. txGasPrice
    2. Assertions
      ❱
      1. expectRevert
      2. expectEmit
      3. expectCall
    3. Fuzzer
      ❱
      1. assume
    4. Forking
      ❱
      1. createFork
      2. selectFork
      3. createSelectFork
      4. activeFork
      5. rollFork
      6. makePersistent
      7. revokePersistent
      8. isPersistent
      9. allowCheatcodes
      10. transact
    5. External
      ❱
      1. ffi
      2. projectRoot
      3. getCode
      4. getDeployedCode
      5. setEnv
      6. envOr
      7. envBool
      8. envUint
      9. envInt
      10. envAddress
      11. envBytes32
      12. envString
      13. envBytes
      14. parseJson
      15. serializeJson
      16. writeJson
    6. Utilities
      ❱
      1. addr
      2. sign
      3. skip
      4. label
      5. deriveKey
      6. parseBytes
      7. parseAddress
      8. parseUint
      9. parseInt
      10. parseBytes32
      11. parseBool
      12. rememberKey
      13. toString
      14. breakpoint
    7. Snapshots
    8. RPC
    9. Files
  17. Forge Standard Library Reference
    ❱
    1. Std Logs
    2. Std Assertions
      ❱
      1. fail
      2. assertFalse
      3. assertEq
      4. assertApproxEqAbs
      5. assertApproxEqRel
    3. Std Cheats
      ❱
      1. skip
      2. rewind
      3. hoax
      4. startHoax
      5. deal
      6. deployCode
      7. deployCodeTo
      8. bound
      9. changePrank
      10. makeAddr
      11. makeAddrAndKey
      12. noGasMetering
      13. assumeNoPrecompiles
      14. assumePayable
    4. Std Errors
      ❱
      1. assertionError
      2. arithmeticError
      3. divisionError
      4. enumConversionError
      5. encodeStorageError
      6. popError
      7. indexOOBError
      8. memOverflowError
      9. zeroVarError
    5. Std Storage
      ❱
      1. target
      2. sig
      3. with_key
      4. depth
      5. checked_write
      6. find
      7. read
    6. Std Math
      ❱
      1. abs
      2. delta
      3. percentDelta
    7. Script Utils
      ❱
      1. computeCreateAddress
      2. deriveRememberKey
    8. Console Logging
  18. DSTest Reference
  19. Testing
  20. Tests
    ❱
    1. Writing Tests
    2. Cheatcodes
    3. Forge Standard Library Overview
    4. Understanding Traces
    5. Fork Testing
  21. Advanced Testing
    ❱
    1. Fuzz Testing
    2. Invariant Testing
    3. Differential Testing
  22. Forge Overview
  23. Overview of Forge
  24. Deploying and Verifying
  25. Gas Tracking
    ❱
    1. Gas Reports
    2. Gas Snapshots
  26. Debugger
  27. Cast Overview
  28. Overview of Cast
  29. Anvil Overview
  30. Overview of Anvil
  31. Chisel Overview
  32. Overview of Chisel
  33. Configuration
  34. Configuring with foundry.toml
  35. Continuous Integration
  36. Integrating with VSCode
  37. Shell Autocompletion
  38. Static Analyzers
  39. Integrating with Hardhat
  40. Tutorials
  41. Best Practices
  42. Creating an NFT with Solmate
  43. Docker and Foundry
  44. Testing EIP-712 Signatures
  45. Solidity Scripting
  46. Forking Mainnet with Cast and Anvil
  47. Learning Foundry Videos
  48. Appendix
  49. FAQ
  50. Help us improve Foundry
  51. Miscellaneous
    ❱
    1. Struct encoding
    2. Precompile Registry

Foundry Book

Block Commands

  • cast find-block
  • cast gas-price
  • cast block-number
  • cast basefee
  • cast block
  • cast age