Canonical entry point for AI coding agents (and a quick orientation for humans). This file is the
router; the depth lives under docs/. Keep answers grounded in these files rather than
guessing, and prefer the deterministic building blocks (make targets and forge scripts) over ad-hoc calls.
A Foundry toolkit for deploying, registering, wiring, and governing Chainlink CCIP cross-chain tokens
(CCT). It ships composable, idempotent primitives (forge scripts) plus a make golden path over them.
Chains are data (config/chains/*.json, API-synced), deploy state is a project store (project/,
git-tracked once a fork un-gitignores it), and history is an append-only local ledger (history/).
npm ci # installs the Solidity dependencies (contracts) and dev tooling (solhint)
forge build # compileRequires Foundry, Node + npm, make, bash, curl, and jq. Signing uses a Foundry keystore
(--account <name>); never put a private key in .env. See
the signing decision record.
| Command | Purpose |
|---|---|
forge build --deny warnings |
Compile; zero compiler warnings required. |
forge test |
Full test suite (fork tests read RPCs from .env). |
forge fmt / forge fmt --check |
Format Solidity / check formatting. |
forge lint |
Foundry's native linter. |
npm run lint:sol |
solhint (chainlink-ccip ruleset; must be warning-free). |
npm run docs:catalog:check |
Fail if the primitives catalog is stale or a primitive lacks @notice. |
make help lists every target. The common flow:
make discover # search the CCIP API chain catalog
make add-chain CHAIN=<selectorName> SELECTOR=<sel> # generate config/chains/<name>.json from the API
make deploy-token CHAIN=<name> # deploy a token (params via env; keystore + RPC resolved from the chain file)
make deploy-pool CHAIN=<name> # deploy its BurnMint pool
make doctor CHAIN=<name> # layered verificationmake deploy-new-chain CHAIN=<name> SELECTOR=<sel> runs add-chain -> deploy-token -> deploy-pool -> doctor end to end. Every make target documents the raw forge script it wraps as the escape hatch.
- Machine-readable index:
docs/primitives/catalog.json- every user-facing script and make target, with modes, safety flags (read_only,writes_onchain,destructive), and inputs. Query this to pick the right primitive and wire its inputs. - Human pages:
docs/primitives/- one page per primitive, generated from the scripts so they cannot drift. Regenerate withnpm run docs:catalog.
- Signing: Foundry keystore only (
--account), or--ledger/--trezor. NoPRIVATE_KEYin.env. - Modes: most write primitives are mode-parameterized.
MODE=safeemits a Safe batch instead of broadcasting; the default is EOA. See governance modes. - Stores (one writer each):
config/chains/*.json(pure API facts, synced) vsproject/[<group>/]*.json(deploy addresses, lanes, roles) vshistory/(append-only, never tracked). - Token groups: thread
GROUP=<g>(PROJECT_GROUPfor rawforge script) to manage several tokens in one clone; unset is the flat default. - Script output: a write run reports itself with
SENDING (unconfirmed),NOT SENT (simulation only ...), orNOT SENT (Safe batch to sign). None of the three reports a landed transaction; read the state back to confirm. See reading a write script's outcome line. - Tolerant reads: a
tryaround a call to an address you do not control does NOT make it safe when the return type is dynamic (string,bytes, arrays, structs containing them). The decode runs in YOUR frame after the call succeeded, so a successful-but-undecodable answer reverts past the catch with no reason string. See the gotchas registry. - Redeploy guard: a deployed artifact is not redeployed unless
FORCE_REDEPLOY=true(which then leaves theTokenAdminRegistrypointing at the old pool until rewired). - Test scratch discipline: test write targets use
zz-scratch-*/zz-tt-*/local-*names only, never a real chain name; a green run leaves zero residue. - Comments and docs: concise, accurate, human-sounding. A comment earns its place by saying what
the code cannot - a why, a measured fact, a constraint, a hazard. If it narrates the next line,
delete it. One or two lines beats a paragraph; multi-paragraph natspec needs a reason. Same rule for
docs, commit messages,
make helptext and test names.
docs/index.md- the full documentation map.- Guides (how to accomplish an outcome), reference (schemas, version matrices, env vars), concepts (why it works), and the learnings layer (troubleshooting, gotchas, decisions) all hang off the index.