forge flatten
NAME
forge-flatten - Flatten a source file and all of its imports into one file.
SYNOPSIS
forge 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
-
Flatten
src/Contract.sol:forge flatten src/Contract.sol -
Flatten
src/Contract.soland write the result tosrc/Contract.flattened.sol:forge flatten --output src/Contract.flattened.sol src/Contract.sol