Skip to main content
Version: v. 1

Spark flatten

NAME

spark-flatten - Flatten a source file and all of its imports into one file.

SYNOPSIS

spark flatten [options] file

DESCRIPTION

Flatten a source file and all of its imports into one file.

If --output <FILE> is not set, then the flattened contract will be output to stdout.

OPTIONS

Flatten Options

-o file
--output file
The path to output the flattened contract. If not specified, the flattened contract will be output to stdout.

Project Options

--build-info
Generate build info files.

--build-info-path path
Output path to directory that build info files will be written to.

--root path
The project's root path. By default, this is the root directory of the current git repository, or the current working directory.

-C path
--contracts path
The contracts source directory.
Environment: DAPP_SRC

--lib-paths path
The path to the library folder.

-R remappings
--remappings remappings
The project's remappings.

The parameter is a comma-separated list of remappings in the format <source>=<dest>.

--cache-path path
The path to the compiler cache.

--config-path file
Path to the config file.

--hh
--hardhat
This is a convenience flag, and is the same as passing --contracts contracts --lib-paths node-modules.

Common Options

-h
--help
Prints help information.

EXAMPLES

  1. Flatten src/Contract.sol:

    spark flatten src/Contract.sol
  2. Flatten src/Contract.sol and write the result to src/Contract.flattened.sol:

    spark flatten --output src/Contract.flattened.sol src/Contract.sol

SEE ALSO

spark