Skip to content

Configuration

Maciej Domanski edited this page Jan 24, 2023 · 8 revisions

crytic-compile has specific options for each supported framework. Each option can be:

  • set through the command line --flag (cli usage)
  • set through the additional arguments given to CryticCompile (lib usage).

To view the supported platforms, run crytic-compile --supported-platforms.

General compilation options

  • --compile-force-framework: Force the compile to a given framework (solc, truffle, embark, dapp, etherlime, etherscan, vyper, waffle, brownie, solc-json, builder, hardhat, foundry, standard, archive) (compile_force_framework)
  • --compile-remove-metadata: Remove the metadata from the bytecodes (compile_remove_metadata)
  • --compile-custom-build: Replace platform specific build command (compile_custom_build)

Solc options

  • --solc: Specify a custom solc binary path (solc)
  • --solc-remaps: Add remapping (solc_remaps)
  • --solc-args: Add custom solc arguments. Example: --solc-args "--allow-path /tmp --evm-version byzantium" (solc_args)
  • --solc-disable-warnings: Disable solc warnings (solc_disable_warnings)
  • --solc-working-dir: Change the default working directory (solc_working_dir)

Truffle options

  • --truffle-ignore-compile: Do not run truffle compile (truffle_ignore_compile)
  • --truffle-build-directory: Use an alternative truffle build directory (truffle_build_directory)
  • --truffle-version: Use a local version of Truffle (npx) (truffle_version)

Embark options

  • --embark-ignore-compile: Do not run embark build (embark_ignore_compile)
  • --embark-overwrite-config: Install @trailofbits/embark-contract-export and add it to embark.json (embark_overwrite_config)

Embark needs the embark-contract-export plugin. You can install it manually, and add it to embark.json, or use --embark-overwrite-config to do it automatically.

Dapp options

  • --dapp-ignore-compile: Do not run dapp build (dapp_ignore_compile)

Etherlime options

  • --etherlime-ignore-compile: Do not run etherlime compile (etherlime_ignore_compile)
  • --etherlime-compile-arguments: Add arbitrary arguments to etherlime compile (note: [dir] is the directory provided to crytic-compile)' (etherlime_compile_arguments)

Etherscan options

Addresses can be provided on the form:

  • 0x... (mainnet)
  • network:0x..., where network can be mainnet, ropsten, kovan, rinkeby, goerli, tobalaba, arbi, testnet.arbi, poly, avax, testnet.avax, ftm, bsc, testnet.bsc

If the source code is not published on etherscan, crytic-compile will raise InvalidCompilation.

We recommend using solc-select to allow crytic-compile switching automatically to the correct solc version.

Default values

{
    'compile_force_framework': None,
    'compile_remove_metadata': False,
    'compile_custom_build': None,
    'solc': 'solc',
    'solc_remaps': None,
    'solc_args': None,
    'solc_disable_warnings': False,
    'solc_working_dir': None,
    'truffle_version': None,
    'truffle_ignore_compile': False,
    'truffle_build_directory': 'build/contracts',
    'embark_ignore_compile': False,
    'embark_overwrite_config': False,
    'dapp_ignore_compile': False,
    'etherlime_ignore_compile': False,
    'etherlime_compile_arguments': None,
}