For the complete documentation index, see llms.txt. This page is also available as Markdown.

Deployment

Trilobyte contracts are deployed to Stellar with a TypeScript script that drives the stellar CLI (@stellar/stellar-sdk is used for keypair/address handling).

Full Protocol Deployment

The main deployment script is scripts/deploy-protocol.ts. It deploys the four governance/registry contracts and runs post-deploy initialisation. (The CollateralEscrow is deployed separately, per RWA-collateral lender — it is not part of the core protocol deploy.)

Step 1 — Deploy Globals

Globals(governor, treasury, security_admin, operations_admin)

Globals is deployed first. governor becomes the OZ admin; security_admin and operations_admin are granted their roles in the constructor.

Step 2 — Deploy Timelock

Timelock(min_delay, proposers, executors, admin: None)

Self-administered. min_delay is in ledgers. Proposers are also granted the canceller role; an empty executor list means anyone can execute.

Step 3 — Upload Vault WASM

The compiled vault WASM is uploaded (stellar contract upload), returning a WASM hash used by the Factory to deploy vault instances.

Step 4 — Deploy Factory

Factory(governor, globals_address, vault_wasm_hash)

Step 5 — Register the Factory in Globals (MANDATORY)

Step 6 — Whitelist Assets

Must be done before transferring Globals admin to the Timelock, since it requires direct admin access.

Step 7 — Approve Initial Managers

A single call both registers and approves a manager (there is no separate add_pool_manager). caller must hold the ops_adm role.

Step 8 — Transfer Globals Admin to the Timelock

Globals uses the OZ two-step admin transfer:

live_until_ledger bounds when the pending transfer expires (0 cancels it). After acceptance, all admin-gated operations on Globals must go through the Timelock's governance process.

Running the Deployment

Configuration

All deployment parameters are configured via environment variables. See .env.example:

Variable
Description

SOROBAN_NETWORK

Network to deploy to (testnet / mainnet)

NETWORK_RPC_URL

Soroban RPC endpoint

NETWORK_PASSPHRASE

Network passphrase

NETWORK_HORIZON_URL

Horizon endpoint

WASM_TARGET_DIR

Build output dir (default target/wasm32v1-none/release)

SOURCE_SECRET_KEY

Secret key for the deploying account

GOVERNOR_ADDRESS

Initial governor (root admin of Globals)

TREASURY_ADDRESS

Protocol treasury address

SECURITY_ADMIN_ADDRESS

Security admin address

OPERATIONS_ADMIN_ADDRESS

Operations admin address

TIMELOCK_MIN_DELAY

Minimum delay for timelocked operations (ledgers)

TIMELOCK_PROPOSERS

Comma-separated proposer addresses (≥ 1 required)

TIMELOCK_EXECUTORS

Comma-separated executor addresses (empty ⇒ anyone)

WHITELIST_ASSETS

Comma-separated asset addresses to whitelist

INITIAL_MANAGERS

Comma-separated manager addresses to approve

MANAGER_CREDIT_LIMIT

Credit limit applied to initial managers (7-decimal)

STELLAR_CLI_PATH

(optional) Absolute path override for the stellar CLI

The deployer secret is passed to the CLI via the STELLAR_ACCOUNT / STELLAR_SIGN_WITH_KEY environment variables (never on argv), and the stellar CLI path is resolved on a sanitised PATH to prevent PATH-hijack.

Output

Deployment results are saved to .soroban/contract-ids.json:

Last updated