Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Forc Contract Id

Icon LinkDetermine

Usage: forc contract-id [OPTIONS]

Options:

-p, --path <PATH>

Path to the project.

If not specified, current working directory will be used.

--offline

Offline mode.

Prevents Forc from using the network when managing dependencies. Meaning it will only try to use previously downloaded dependencies.

-t, --terse

Terse mode.

Limited warning and error output.

--output-directory <OUTPUT_DIRECTORY>

The directory in which Forc output artifacts are placed.

By default, this is <project-root>/out.

--locked

Requires that the Forc.lock file is up-to-date.

If the lock file is missing, or it needs to be updated, Forc will exit with an error.

--ipfs-node <IPFS_NODE>

The IPFS node to use for fetching IPFS sources.

[possible values: PUBLIC, LOCAL, <GATEWAY_URL>]

--json-abi

Minify JSON ABI files.

By default the JSON for ABIs is formatted for human readability. By using this option JSON output will be "minified", i.e. all on one line without whitespace.

--json-storage-slots

Minify JSON storage slot files.

By default the JSON for initial storage slots is formatted for human readability. By using this option JSON output will be "minified", i.e. all on one line without whitespace.

--ast

Print the generated Sway AST (Abstract Syntax Tree)

--dca-graph <DCA_GRAPH>

Print the computed Sway DCA (Dead Code Analysis) graph.

DCA graph is printed to the specified path. If specified '' graph is printed to the stdout.

--dca-graph-url-format <DCA_GRAPH_URL_FORMAT>

URL format to be used in the generated DCA graph .dot file.

Variables {path}, {line}, and {col} can be used in the provided format. An example for vscode would be: "vscode://file/{path}:{line}:{col}"

--asm <ASM>..>

Print the generated ASM (assembler).

Values that can be combined:

  • virtual: initial ASM with virtual registers and abstract control flow.
  • allocated: ASM with registers allocated, but still with abstract control flow.
  • abstract: short for both virtual and allocated ASM.
  • final: final ASM that gets serialized to the target VM bytecode.
  • all: short for virtual, allocated, and final ASM.

[possible values: virtual, allocated, abstract, final, all]

--bytecode

Print the bytecode.

This is the final output of the compiler.

--ir <IR>..>

Print the generated Sway IR (Intermediate Representation).

Values that can be combined:

  • initial: initial IR prior to any optimization passes.
  • final: final IR after applying all optimization passes. : the name of an optimization pass. Prints the IR state after that pass.
  • all: short for initial, final, and all the optimization passes.
  • modified: print a requested optimization pass only if it has modified the IR.

[possible values: initial, final, all, modified, inline, simplify-cfg, sroa, dce, fn-dce, fn-dedup-release, fn-dedup-debug, mem2reg, memcpyopt, const-folding, arg-demotion, const-demotion, ret-demotion, misc-demotion]

--time-phases

Output the time elapsed over each part of the compilation process

-v, --verbose...

Use verbose output

--reverse-order

Output build errors and warnings in reverse order

-s, --silent

Silence all output

-L, --log-level <LOG_LEVEL>

Set the log level

--metrics-outfile <METRICS_OUTFILE>

Output compilation metrics into the specified file

-o, --output-bin <BIN_FILE>

Create a binary file at the provided path representing the final bytecode

-g, --output-debug <DEBUG_FILE>

Create a file at the provided path containing debug information.

If the file extension is .json, JSON format is used. Otherwise, an .elf file containing DWARF format is emitted.

--build-profile <BUILD_PROFILE>

The name of the build profile to use

[default: debug]

--release

Use the release build profile.

The release profile can be customized in the manifest file.

--error-on-warnings

Treat warnings as errors

--salt <SALT>

Added salt used to derive the contract ID.

By default, this is 0x0000000000000000000000000000000000000000000000000000000000000000.

--no-encoding-v1

Disable the "new encoding" feature

-h, --help

Print help (see a summary with '-h')

-V, --version

Print version

EXAMPLES:

Icon LinkGet contract id

forc contract-id

Icon LinkGet contract id from a different path

forc contract-id --path