1. Introduction
  2. Getting Started
  3. Installation
  4. First Steps with Foundry
  5. Migrating to V1
  6. Introduction
  7. Upgrading to V1
  8. Deprecated Features
  9. V1 Changes
    ❱
    1. Non-breaking Changes
    2. Breaking Changes
  10. Projects
  11. Creating a New Project
  12. Working on an Existing Project
  13. Dependencies
  14. Project Layout
  15. Forge Overview
  16. Overview of Forge
  17. Tests
    ❱
    1. Writing Tests
    2. Cheatcodes
    3. Forge Standard Library Overview
    4. Understanding Traces
    5. Fork Testing
  18. Advanced Testing
    ❱
    1. Fuzz Testing
    2. Invariant Testing
    3. Differential Testing
  19. Deploying and Verifying
  20. Gas Tracking
    ❱
    1. Gas Reports
    2. Gas Snapshots
  21. Debugger
  22. Cast Overview
  23. Overview of Cast
  24. Anvil Overview
  25. Overview of Anvil
  26. Chisel Overview
  27. Overview of Chisel
  28. Configuration
  29. Configuring with foundry.toml
  30. Continuous Integration
  31. Integrating with VSCode
  32. Shell Autocompletion
  33. Static Analyzers
  34. Integrating with Hardhat
  35. Tutorials
  36. Best Practices
  37. Creating an NFT with Solmate
  38. Docker and Foundry
  39. Testing EIP-712 Signatures
  40. Solidity Scripting
  41. Forking Mainnet with Cast and Anvil
  42. Learning Foundry Videos
  43. Appendix
  44. FAQ
  45. Help us improve Foundry
  46. 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-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. 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. 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
    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
  47. Miscellaneous
    ❱
    1. Struct encoding
    2. Precompile Registry

Foundry Book

Std Assertions

  • fail
  • assertFalse
  • assertEq
  • assertApproxEqAbs
  • assertApproxEqRel