Reference
Complete reference for all build system configuration options, CLI flags, and contract settings
This page provides a complete reference for all configuration options available in Acton's build system.
Path Resolution Rules
Acton uses two different path-resolution models:
- Relative paths from
Acton.tomlare resolved from project root. - Relative CLI path flags stay relative to the current working directory unless absolute.
--manifest-pathonly chooses which manifest to load. It does not rebase unrelated CLI path flags to the manifest directory.
Examples:
[build].out-dir = "artifacts"resolves to<project-root>/artifacts.acton build --out-dir artifactsresolves to<cwd>/artifacts.[wrappers.tolk].output-dir = "wrappers"is project-root-relative, whileacton wrapper Counter --output-dir wrappersis cwd-relative.
acton build
Compile all contracts defined in Acton.toml or a specific contract with its dependencies.
For each compiled contract, Acton generates a JSON artifact in the output directory (default: build/) containing the compiled base64-encoded code and its hash. For .tolk contracts, Acton writes compiler ABI JSON files to the ABI output directory (default: build/abi/).
acton build [OPTIONS] [CONTRACT]Arguments
| Argument | Description |
|---|---|
[CONTRACT] | Optional contract name to build. If specified, only this contract and its dependencies will be compiled. |
Options
| Flag | Description |
|---|---|
--clear-cache | Clear the compilation cache before building. Forces recompilation of all contracts regardless of cache state |
--graph <PATH> | Generate a dependency graph in DOT format at the specified path. |
--out-dir [DIR] | Directory to save build artifacts. Defaults to build/ |
--gen-dir [DIR] | Directory to save generated dependency files (<dependency>.code.tolk). Defaults to gen/ |
--output-abi [DIR] | Directory to save contract ABI JSON files (<contract>.json). Defaults to build/abi/ |
--output-fift [DIR] | Directory to save compiled Fift files (<contract>.fif) for .tolk sources. Precompiled .boc entries are skipped. If omitted, no Fift files are written. |
Examples
# Build all contracts
acton build
# Build only the Counter contract and its dependencies
acton build Counter
# Clear cache and rebuild everything
acton build --clear-cache
# Build with custom graph path
acton build --graph diagrams/dependencies.dot
# Build with custom output directory for JSON artifacts
acton build --out-dir artifacts/
# Build with custom output directory for generated dependency files
acton build --gen-dir generated/
# Build with custom output directory for ABI JSON files
acton build --output-abi build/abi
# Build and save compiled Fift files for each contract
acton build --output-fift build/fiftActon.toml Configuration
Build Section
Use [build] to configure default outputs for acton build:
[build]
out-dir = "build"
gen-dir = "gen"
output-abi = "build/abi"
output-fift = "build/fift"out-dir controls where JSON artifacts are written (<out-dir>/<contract>.json).
gen-dir controls where dependency code is generated by default (<gen-dir>/<dependency>.code.tolk).
output-abi controls where compiler ABI JSON files are written (<output-abi>/<contract>.json).
When output-fift is set, Acton writes one file per compiled .tolk contract: <output-fift>/<contract-name>.fif.
Contracts with src = "*.boc" are not recompiled, so no .fif file is produced for them.
CLI flags have priority over config values. Example:
acton build --out-dir artifacts
acton build --gen-dir artifacts/gen
acton build --output-abi artifacts/abi
acton build --output-fift artifacts/fiftConfig values in [build] are project-root-relative. CLI paths such as --out-dir, --gen-dir, --output-abi, --output-fift, and --graph remain cwd-relative unless absolute.
Wrappers Section
Use [wrappers] to configure default output locations for acton wrapper:
[wrappers.tolk]
output-dir = "wrappers"
generate-test = true
test-output-dir = "tests"
[wrappers.typescript]
output-dir = "app/src/wrappers-ts"Available fields:
| Field | Type | Default | Description |
|---|---|---|---|
[wrappers.tolk].output-dir | string | - | Default directory for generated Tolk wrappers |
[wrappers.tolk].generate-test | boolean | false | Generate a Tolk test stub by default for non-TypeScript wrapper runs |
[wrappers.tolk].test-output-dir | string | - | Default directory for generated Tolk test stubs |
[wrappers.typescript].output-dir | string | - | Default directory for generated TypeScript wrappers |
Override rules:
- Tolk wrapper path:
--output->--output-dir->[wrappers.tolk].output-dir->@wrappersmapping -> wrapper command built-in default. - TypeScript wrapper path:
--output->--output-dir->[wrappers.typescript].output-dir-> wrapper command built-in default. - Test stub path:
--test-output->--test-output-dir->[wrappers.tolk].test-output-dir-> wrapper command built-in default. [wrappers.tolk].generate-testonly affects non-TypeScript runs.acton wrapper --tsstill rejects test-stub options.
Configured wrapper paths are project-root-relative. CLI paths such as --output, --output-dir, --test-output, and --test-output-dir remain cwd-relative unless absolute.
Contracts Section
Contracts are defined using [contracts.*] sections where * is the contract name.
[contracts.MyContract]
display-name = "MyContract"
src = "contracts/MyContract.tolk"
output = "build/MyContract.boc"
depends = []Contract Fields
| Field | Type | Required | Description |
|---|---|---|---|
display-name | string | No | Overrides full name (e.g. Wallet instead of JettonWallet) in console messages and UI. |
src | string | Yes | Path to the contract source file. Can be a .tolk file for compilation or a .boc file for precompiled contracts |
output | string | No | Path where the compiled .boc file should be saved. If omitted, the compiled contract is only cached |
depends | array | No | Array of contract dependencies. Can be simple strings or detailed dependency objects |
Contract Names
The contract name ([contracts.NAME] in Acton.toml, e.g., Counter) is used:
- As a contract entrypoint
contracts/Counter.tolk(withonInternalMessage, get methods, etc.) - As a filename for generated wrappers (e.g.,
wrappers/Counter.gen.tolk,wrappers-ts/Counter.gen.ts) - As the dependency name when referencing this contract
- To generate the output file name in the dependency output directory (default:
gen/, e.g.,Counter→gen/Counter.code.tolk) - To generate the function name (e.g.,
Counter→counterCompiledCode()) - In console messages and web UI, unless overridden by optional
display-nameinActon.toml
Names should use PascalCase (e.g., JettonWallet, NftCollection).
Dependencies Configuration
Dependencies can be specified in two formats:
Simple Format
depends = ["ChildContract", "AnotherContract"]Uses default settings:
kind = "embed_code"- Generated file:
{gen-dir}/{contract-name}.code.tolk(gen-dirdefaults togen) - Generated function: auto-derived from the dependency key using the normalization rules below
Detailed Format
depends = [
{ name = "ChildContract", kind = "library_ref", function = "getChildCode", path = "contracts/gen/child.code.tolk" }
]| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | - | Contract name to depend on. Must match a [contracts.*] name |
kind | string | No | "embed_code" | Dependency type: "embed_code" or "library_ref". Omitting it in the detailed form still means "embed_code" |
function | string | No | Auto-generated | Custom name for the generated function. If omitted, Acton derives it from the dependency key using the rules below |
path | string | No | {gen-dir}/{name}.code.tolk | Custom output path for the generated file. Relative manifest paths are resolved from the project root |
Dependency Helper Generation Rules
Acton generates one helper file per direct dependency of the parent contract.
Those helper paths and function names are derived from the dependency name
(the [contracts.<name>] key), not from display-name.
Helper file placement uses this precedence:
depends[].pathacton build --gen-dir[build].gen-dir<project-root>/gen
Path resolution follows the normal config-vs-CLI rules:
depends[].pathand[build].gen-dirare project-root-relative unless absolute--gen-diris cwd-relative unless absolute- if
depends[].pathis set, it fully replaces the default helper location
Default helper filenames use the raw dependency key:
Wallet->gen/Wallet.code.tolkchild.lib->gen/child.lib.code.tolk123contract->gen/123contract.code.tolk
Default helper function names are normalized separately:
- Replace
-,., and spaces with_ - If the first character is not alphabetic, prefix
contract_ - Convert the result to lowerCamelCase
- Append
CompiledCode
Examples:
Wallet->walletCompiledCode()child.lib->childLibCompiledCode()123contract->contract123contractCompiledCode()
Custom function overrides only the function name. Custom path overrides only
the output file location.
Dependency Kinds
embed_code (default)
Embeds the full compiled contract code directly into the parent contract.
depends = ["Wallet"]
# or
depends = [{ name = "Wallet", kind = "embed_code" }]Generated assembly:
@pure
fun walletCompiledCode(): cell asm """
"<base64_boc_data>" base64>B B>boc PUSHREF
"""library_ref
Generates a library reference instead of embedding full code. The library must be deployed separately.
depends = [{ name = "Wallet", kind = "library_ref" }]Generated assembly:
@pure
fun walletCompiledCode(): cell asm """
"<base64_boc_data>" base64>B B>boc hashu <b 2 8 u, swap 256 u, b>spec PUSHREF
"""Using Precompiled Contracts
You can use precompiled .boc files instead of .tolk sources:
[contracts.Precompiled]
display-name = "PrecompiledContract"
src = "contracts/Precompiled.boc"
depends = []When using .boc files:
- No compilation is performed
- The BoC is loaded and cached directly
- Dependencies can still reference this contract
- Useful for third-party contracts or cross-platform builds
Path Mappings
You can define path aliases for the Tolk compiler in the [import-mappings] section. These are useful for importing library code without using complex relative paths.
[import-mappings]
core = "./libs/core"
utils = "./libs/utils"In Tolk code:
import "@core/math.tolk"Built-in project mappings commonly used in Acton projects:
| Mapping | Default path | Common use |
|---|---|---|
@acton | .acton | Standard library imports such as @acton/testing/expect |
@contracts | contracts or contracts/src | Local contract-side modules such as @contracts/types |
@tests | tests or contracts/tests | Shared test helpers and fixtures |
@wrappers | wrappers or contracts/wrappers | Generated wrappers such as @wrappers/Counter |
@gen | gen | Generated dependency helper files |
These defaults are usually written into Acton.toml by acton new and
acton init. Standard scaffolds use contracts / tests / wrappers, while
--app scaffolds use contracts/src / contracts/tests /
contracts/wrappers. If you remove them manually, Acton does not recreate them
during normal compilation.
Mappings follow these rules:
- Normalization: Any mapping key missing the
@prefix will have it added automatically. - Resolution: Mappings are resolved relative to project root for the current invocation.
- Exact Match: When importing, the first part of the path (before the first slash) is used to look up the mapping. For example,
import "@core/math.tolk"will look for a mapping named@core.
Dependency Graph Visualization
Generate a DOT representation of contract dependencies:
acton build --graph deps.dotTo render DOT into SVG manually (optional), use Graphviz:
# macOS
brew install graphviz
# Ubuntu/Debian
sudo apt-get install graphviz
# Windows
# Download from https://graphviz.org/download/The generated DOT contains:
- Contract boxes labeled with contract names
- Arrows indicating dependencies
- Edge labels showing dependency kind (
embed codeorlibrary ref)
Last updated on