Deployment

Trilobyte contracts are deployed to Stellar using TypeScript scripts with the @stellar/stellar-sdk.

Full Protocol Deployment

The main deployment script is scripts/deploy-protocol.ts. It performs a 7-step deployment:

Step 1 — Deploy Globals

Globals(governor, treasury, security_admin, operations_admin)

The Globals contract is deployed first with the initial role assignments.

Step 2 — Deploy Timelock

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

The Timelock is deployed as self-administered (no external admin).

Step 3 — Upload Vault WASM

The compiled vault contract WASM is uploaded to the network. This returns a WASM hash used by the Factory to deploy vault instances.

Step 4 — Deploy Factory

Factory(governor, globals_address, vault_wasm_hash)

The Factory is deployed with a reference to Globals and the vault template hash.

Step 5 — Whitelist Assets

Supported lending tokens (e.g. USDC) are whitelisted on Globals:

circle-info

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

Step 6 — Approve Initial Managers

Initial Pool Managers are registered and approved:

Step 7 — Transfer Globals Admin to Timelock

The final step transfers Globals admin to the Timelock:

After this, all admin-gated operations on Globals must go through the Timelock's governance process.

circle-exclamation

Running the Deployment

Configuration

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

Variable
Description

STELLAR_NETWORK

Network to deploy to (testnet/mainnet)

STELLAR_RPC_URL

Soroban RPC endpoint

DEPLOYER_SECRET

Secret key for the deploying account

GOVERNOR_ADDRESS

Initial governor address

TREASURY_ADDRESS

Protocol treasury address

SECURITY_ADMIN

Security admin address

OPERATIONS_ADMIN

Operations admin address

TIMELOCK_MIN_DELAY

Minimum delay for timelocked operations

TIMELOCK_PROPOSERS

Comma-separated proposer addresses

TIMELOCK_EXECUTORS

Comma-separated executor addresses

INITIAL_ASSETS

Comma-separated asset addresses to whitelist

INITIAL_MANAGERS

Comma-separated manager addresses

Output

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

Last updated