Skip to main content

Vault Lifecycle

1. Bootstrap the vault

Use:
node --experimental-strip-types services/ranger/src/vault-bootstrap.ts
This script:
  • derives or reads the vault address
  • initializes the vault if it does not exist
  • registers every allowed strategy from the sample registry

Bootstrap requirements

  • VAULT_PROGRAM_ID must point to a real deployed executable
  • VAULT_AUTHORITY_KEYPAIR_PATH must be valid
  • VAULT_SHARE_MINT_KEYPAIR_PATH must exist if the vault is not initialized yet
  • VAULT_TREASURY_KEYPAIR_PATH must exist if the vault is not initialized yet
  • the authority wallet must have SOL

2. Inspect the result

Use:
node --experimental-strip-types services/ranger/src/vault-status.ts
This reads:
  • vault state
  • strategy state
  • allocation state
  • optional withdrawal request state

3. Run admin actions

Use:
node --experimental-strip-types services/ranger/src/vault-admin.ts
Supported VAULT_ADMIN_ACTION values:
  • pause-vault
  • resume-vault
  • pause-strategy
  • activate-strategy
  • exit-only-strategy
  • disable-strategy

4. Run user actions

Use:
node --experimental-strip-types services/ranger/src/vault-user.ts
Supported VAULT_USER_ACTION values:
  • deposit
  • request-withdrawal
  • finalize-withdrawal

5. Rebalance after the vault exists

Only after the vault and strategies are present on-chain should you move on to:
node --experimental-strip-types services/ranger/src/demo.ts
That is the point where the full rebalance lifecycle becomes meaningful.