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. Appendix
  38. FAQ
  39. 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
      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
      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. 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
    3. anvil Reference
    4. chisel Reference
    5. Config Reference
      ❱
      1. Overview
      2. Project
      3. Solidity Compiler
      4. Testing
      5. Formatter
      6. Documentation Generator
      7. Etherscan
    6. Cheatcodes Reference
      ❱
      1. Environment
        ❱
        1. warp
        2. roll
        3. fee
        4. difficulty
        5. chainId
        6. store
        7. load
        8. etch
        9. deal
        10. prank
        11. startPrank
        12. stopPrank
        13. record
        14. accesses
        15. recordLogs
        16. getRecordedLogs
        17. setNonce
        18. getNonce
        19. mockCall
        20. clearMockedCalls
        21. coinbase
        22. broadcast
        23. startBroadcast
        24. stopBroadcast
        25. pauseGasMetering
        26. resumeGasMetering
      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. label
        4. deriveKey
        5. parseBytes
        6. parseAddress
        7. parseUint
        8. parseInt
        9. parseBytes32
        10. parseBool
        11. rememberKey
        12. toString
      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. bound
        8. changePrank
        9. makeAddr
        10. makeAddrAndKey
        11. noGasMetering
      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
  40. Miscellaneous
    ❱
    1. Struct encoding

Foundry Book

Std Assertions

  • fail
  • assertFalse
  • assertEq
  • assertApproxEqAbs
  • assertApproxEqRel