CLI Commands¶
One binary, seven commands. Every command accepts the global --json flag for
machine-readable output. This page summarizes each; the deeper guides are linked
per command.
| Command | What it does |
|---|---|
sun init |
Scaffold a Foundry-like project from embedded templates |
sun compile |
Incremental, deterministic compilation with a pinned solc-tron |
sun test |
Solidity-native tests on the local TVM (optionally over a fork) |
sun estimate |
Exact Energy / Bandwidth / TRX-burn for a contract call |
sun script |
Plan (and optionally broadcast) a deployment as real transactions |
sun audit |
Aderyn static analysis with a TVM-aware post-filter |
sun sonar |
Offline utilities: addresses, selectors, CREATE2 |
sun init¶
Scaffold a new project from the embedded templates. With no NAME it initializes
the current directory; with a NAME it creates that subdirectory. A non-empty
destination is refused unless --force is given (which is additive — it writes
templates alongside existing files, e.g. it keeps your .env).
sun compile¶
Compile every Solidity unit under src/, test/, and script/ with the pinned,
checksum-verified solc-tron. Unchanged units are served from the depfile cache and
never invoke solc. → Compilation guide
sun test¶
Compile the project and execute every test* / testFail* function in
test/**/*.t.sol on a fresh in-memory state, with cheatcodes (sail.sol) and
source-mapped traces. Repeat -v for more detail. → Testing guide,
Forking guide
sun test [flags]
--fork-block int solidified block height to pin (default: current solidified head)
--fork-url string run over the pinned live state of a network declared in sail.toml
-v, --verbose count increase verbosity (-v results, -vv events, -vvv call tree)
Without --fork-url there is no network access at all.
sun estimate¶
Estimate the cost of calling <contract>.<signature> with the given arguments
against live network state. Uses the node's EstimateEnergy endpoint when
available, with an automatic fallback to TriggerConstantContract (capability is
detected at runtime, never assumed from the version). → RPC guide
sun estimate <contract> "<signature>" [args...] [flags]
--fee-limit int fee limit of the eventual transaction, in sun (default 150000000)
--from string caller address (default: the zero address)
--network string network from sail.toml (e.g. mainnet, nile)
--value int TRX sent with the call, in sun
The signature and arguments are positional:
sun script¶
Compile the project, execute the script contract's run() on a pinned fork of the
target network, and build the real transaction sequence: tx N's txid feeds tx
N+1's CREATE addresses, with exact Energy / Bandwidth / TRX-burn per transaction.
→ Scripting & Deployment guide
sun script <path> [flags]
--broadcast broadcast the plan (default: print it and exit)
--expiration duration transaction expiration window (default 60s)
--fee-limit int fee limit per transaction, in sun (default 150000000)
--network string network declared in sail.toml (required)
--policy string confirmation policy: none|included|solidified (default "solidified")
--tx-timeout duration per-transaction confirmation timeout (default 1m30s)
Without --broadcast the full plan is printed and nothing touches the network. The
signing key comes from the PRIVATE_KEY environment variable (the project's .env
is loaded when the variable is unset) and never appears in any output.
sun audit¶
Analyze every contract under src/ with the pinned, checksum-verified Aderyn
binary — one invocation per file, so a file Aderyn cannot parse (TVM syntax such as
trcToken) degrades to SKIPPED without aborting the rest. Findings from
detectors with EVM-only premises are suppressed but never silenced. By default
audit reports and exits 0 — the failure policy belongs to CI via --fail-on.
→ Auditing guide
sun audit [flags]
--fail-on string exit non-zero if any unsuppressed finding has severity ≥ threshold (low|medium|high)
--report string also write aderyn's native markdown report to this path
--show-suppressed list findings filtered by the TVM post-filter
sun sonar¶
Offline TRON utilities. No network access. → Cryptography guide
sun sonar address <addr> # Base58Check ⇄ hex (auto-detected), plus the EIP-55 evm form
sun sonar selector "<signature>" # keccak256(sig)[:4]
sun sonar create2 [flags] # derive a CREATE2 address
sun sonar create2 supports two conventions via --mode:
native(default) — the0x41opcode preimage, what TRON uses for both syntactic paths (inline assembly andnew C{salt}).evm— the0xffconvention, for EVM-chain cross-parity only.
sun sonar create2 [flags]
--init-code string full init code (hex); hashed with keccak256
--init-code-hash string precomputed keccak256(initCode) (32-byte hex)
--mode string derivation convention: native (0x41) or evm (0xff) (default "native")
--salt string 32-byte salt (hex)
--sender string deploying contract address (Base58 or hex)