Skip to content

crytic/crytic-compile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7ce1189 · Jan 17, 2025
Dec 30, 2024
Jan 15, 2025
Aug 6, 2021
Dec 30, 2024
Dec 30, 2024
Jun 2, 2023
Nov 22, 2019
Mar 10, 2023
Jun 29, 2023
Apr 8, 2019
Jun 2, 2023
Jul 27, 2023
Jun 29, 2021
Dec 5, 2022
Jan 17, 2025

Repository files navigation

Crytic-compile

Build Status Slack Status PyPI version

Library to help smart contract compilation. It includes support for:

To force compilation with a specific framework, use the --compile-force-framework flag. For example, to force compilation with Hardhat:

crytic-compile . --compile-force-framework hardhat

See the Configuration documentation for advanced usages.

The plugin is used in Trail of Bits tools, including:

Installation

pip3 install crytic-compile

Usage

In the root directory of your project e.g. same directory as hardhat.config.js or foundry.toml, run:

crytic-compile .

Crytic-compile will generate crytic-export/contracts.json containing the AST/ABI and bytecodes of the contracts.

Run crytic-compile --help for more options.

Library Linking

If your project uses libraries with external functions, they can be linked to their deployed address with the --compile-libraries flag. For example, if you have a library SafeMath deployed at 0xff, you can link it with:

crytic-compile . --compile-libraries "(SafeMath, 0xff)"

If you are fuzzing with Echidna or Medusa, follow this tutorial on linking libraries.

As a library

See the library documentation.