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. Forge Overview
  11. Overview of Forge
  12. Tests
    ❱
    1. Writing Tests
    2. Cheatcodes
    3. Forge Standard Library Overview
    4. Understanding Traces
    5. Fork Testing
  13. Advanced Testing
    ❱
    1. Fuzz Testing
    2. Invariant Testing
    3. Differential Testing
  14. Deploying and Verifying
  15. Gas Tracking
    ❱
    1. Gas Reports
    2. Gas Snapshots
  16. Debugger
  17. Cast Overview
  18. Overview of Cast
  19. Anvil Overview
  20. Overview of Anvil
  21. Chisel Overview
  22. Overview of Chisel
  23. Configuration
  24. Configuring with foundry.toml
  25. Continuous Integration
  26. Integrating with VSCode
  27. Shell Autocompletion
  28. Static Analyzers
  29. Integrating with Hardhat
  30. Tutorials
  31. Best Practices
  32. Creating an NFT with Solmate
  33. Docker and Foundry
  34. Testing EIP-712 Signatures
  35. Solidity Scripting
  36. Forking Mainnet with Cast and Anvil
  37. Learning Foundry Videos
  38. Appendix
  39. FAQ
  40. Help us improve Foundry
  41. References
    ❱
    1. 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
    2. 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-decode
        2. cast abi-encode
        3. cast 4byte
        4. cast 4byte-decode
        5. cast 4byte-event
        6. cast calldata
        7. cast calldata-decode
        8. cast pretty-calldata
        9. cast upload-signature
      9. Conversion Commands
        ❱
        1. cast format-bytes32-string
        2. cast from-bin
        3. cast from-fixed-point
        4. cast from-rlp
        5. cast from-utf8
        6. cast from-wei
        7. cast parse-bytes32-address
        8. cast parse-bytes32-string
        9. cast to-ascii
        10. cast to-base
        11. cast to-bytes32
        12. cast to-dec
        13. cast to-fixed-point
        14. cast to-hex
        15. cast to-hexdata
        16. cast to-int256
        17. cast to-rlp
        18. cast to-uint256
        19. cast to-unit
        20. cast to-wei
        21. cast shl
        22. 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-check-sum-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
    3. anvil Reference
    4. chisel Reference
    5. Config Reference
      ❱
      1. Overview
      2. Project
      3. Solidity Compiler
      4. Testing
      5. In-line Configuration Testing
      6. Formatter
      7. Documentation Generator
      8. Etherscan
    6. 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. keyExists
        16. parseJsonKeys
        17. serializeJson
        18. 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
        15. createWallet
      7. Snapshots
      8. RPC
      9. Files
    7. 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
    8. DSTest Reference
  42. Miscellaneous
    ❱
    1. Struct encoding
    2. Precompile Registry

Foundry Book

Forking

  • createFork
  • selectFork
  • createSelectFork
  • activeFork
  • rollFork
  • makePersistent
  • revokePersistent
  • isPersistent
  • allowCheatcodes
  • transact