Project

Configuration related to the project in general.

src
  • Type: string
  • Default: src
  • Environment: FOUNDRY_SRC or DAPP_SRC

The path to the contract sources relative to the root of the project.

test
  • Type: string
  • Default: test
  • Environment: FOUNDRY_TEST or DAPP_TEST

The path to the test contract sources relative to the root of the project.

script
  • Type: string
  • Default: script
  • Environment: FOUNDRY_SCRIPT or DAPP_SCRIPT

The path to the script contract sources relative to the root of the project.

out
  • Type: string
  • Default: out
  • Environment: FOUNDRY_OUT or DAPP_OUT

The path to put contract artifacts in, relative to the root of the project.

libs
  • Type: array of strings (paths)
  • Default: lib
  • Environment: FOUNDRY_LIBS or DAPP_LIBS

An array of paths that contain libraries, relative to the root of the project.

cache
  • Type: boolean
  • Default: true
  • Environment: FOUNDRY_CACHE or DAPP_CACHE

Whether or not to enable caching. If enabled, the result of compiling sources, tests, and dependencies, are cached in cache.

cache_path
  • Type: string
  • Default: cache
  • Environment: FOUNDRY_CACHE_PATH or DAPP_CACHE_PATH

The path to the cache, relative to the root of the project.

broadcast
  • Type: string
  • Default: broadcast

The path to the broadcast transaction logs, relative to the root of the project.

force
  • Type: boolean
  • Default: false
  • Environment: FOUNDRY_FORCE or DAPP_FORCE

Whether or not to perform a clean build, discarding the cache.

ZKsync Settings

Additional zksync settings can be defined on the profile of choice by specifying profile.<name>.zksync section.

For example to define the settings on profile.default:

[profile.default]
# ...Normal foundry settings...

[profile.default.zksync]
# ...ZKSync specific settings...
compile
  • Type: boolean
  • Default: false

Compile contracts for zkEVM.

startup
  • Type: boolean
  • Default: true (will only have effect if compile = true)

Requires compile = true to have an effect.
Enable ZKsync context on startup. This applies to tests, scripts, and any other commands that need to switch immediately to zkEVM on startup.

zksolc
  • Type: string
  • Default:

The zksolc version to use for compilation.

solc_path
  • Type: string
  • Default:

The solc path to use during zksolc compilation.

bytecode_hash
  • Type: boolean
  • Default: “none”

Whether to include the metadata hash for zksolc compiled bytecode.

fallback_oz
  • Type: boolean
  • Default: false

Allow compiler to recompile using optimizer_mode = 'z' if contracts won’t fit in the EraVM bytecode size limitations.

enable_eravm_extensions
  • Type: boolean
  • Default: false

Enable EraVM extensions (e.g. system-mode). This allows compilation of ZKsync-specific simulations.

force_evmla
  • Type: boolean
  • Default: false

Force compilation via EVMLA instead of Yul codegen pipeline.

avoid_contracts
  • Type: array of strings
  • Default: []

List of glob patterns to avoid compiling with zksolc.

optimizer
  • Type: boolean
  • Default: true

Enable optimizer on zksolc.

optimizer_mode
  • Type: string
  • Default: ‘3’

The zksolc optimizer mode (0 | 1 | 2 | 3 | s | z).

optimizer_details
  • Type: object
  • Default: {}

Allows specifying additional zksolc Optimizer Details.