Skip to Content
DevelopersVault ManagersQuickstart: Create and Run a Vault

Quickstart: Create and Run a Vault

This walks through creating a vault, updating its parameters, onboarding depositors, and handling day-to-day manager operations via the vaults-sdk CLI. For a conceptual overview of roles and fee constraints, see Vault Managers.

Decide vault parameters

ParameterDescription
market-index / spotMarketIndexDeposit token (e.g. 0 = USDT on mainnet-beta, dUSDT on devnet).
redeem-periodWithdrawal cooldown in seconds (often 3–7 days).
max-tokensCapacity / risk control.
management-feeAnnualized management fee.
profit-sharePerformance fee on realized gains.
permissioned + min-deposit-amountOptional onboarding controls.

Initialize the vault

Vault initialization is permissionless. From the @velocity-exchange/vaults-sdk CLI (packages/vaults-sdk in the velocity-v1 monorepo):

git clone https://github.com/velocity-exchange/velocity-v1.git cd velocity-v1 bun install # once, at the repo root cd packages/vaults-sdk bun run cli -- init-vault \ --name "MyVault" \ --market-index 0 \ --redeem-period 604800 \ --max-tokens 0 \ --management-fee 2 \ --profit-share 20

--management-fee/--profit-share take a plain percentage number (2 = 2%, not basis points): the CLI scales it against the on-chain PERCENTAGE_PRECISION (1e6 = 100%), and initialize_vault rejects any value ≥ 100%.

The CLI reads -u/--url (or RPC_URL) and -k/--keypair (or KEYPAIR_PATH) for the RPC endpoint and signer; --env selects devnet or mainnet-beta (default mainnet-beta).

Add --permissioned and --min-deposit-amount <amount> if you want whitelisted depositors and a minimum deposit size. Vault name must be unique.

Update parameters and enable trading

After creation you can lower fees, shorten the redeem period, or adjust caps immediately (within the one-way constraints described in Vault Managers):

bun run cli -- manager-update-vault \ --vault-address <VAULT_ADDRESS> \ --redeem-period 1000 \ --max-tokens 200000 \ --management-fee 0 \ --profit-share 0

To raise the management fee or profit share, or lower the hurdle rate, queue the change instead. It takes effect only after a timelock of at least max(7 days, 2x redeem period):

bun run cli -- admin-init-fee-update \ --vault-address <VAULT_ADDRESS> bun run cli -- manager-update-fees \ --vault-address <VAULT_ADDRESS> \ --management-fee 3 \ --timelock-duration 604800

admin-init-fee-update creates the FeeUpdate account the queue is stored in (an admin action); manager-update-fees then queues the new fee, and calling it again after the timelock matures installs it. Use admin-delete-fee-update to cancel a pending queue.

To enable margin trading on the vault:

bun run cli -- manager-update-margin-trading-enabled \ --vault-address <VAULT_ADDRESS> \ --enabled true

View vault state anytime:

bun run cli -- view-vault --vault-address <VAULT_ADDRESS>

Permissioned vaults (allowing depositors)

For permissioned vaults, the manager must initialize each depositor:

bun run cli -- init-vault-depositor \ --vault-address <VAULT_ADDRESS> \ --deposit-authority <AUTHORITY_TO_ALLOW_DEPOSIT>

Deposits and withdrawals are otherwise as in the standard flow: request withdrawal → wait redeem period → complete withdrawal.

Manager operations

Common manager actions:

  • Manager deposit and withdraw: manager-deposit, manager-request-withdraw, manager-withdraw, manager-cancel-withdraw
  • Apply profit share: manager-apply-profit-share for one depositor, apply-profit-share-all for every depositor
  • View state: view-vault, view-vault-depositor, list-vault-depositors
  • Change the trading delegate or the manager: manager-update-delegate, manager-update-vault-manager

Run bun run cli -- --help from packages/vaults-sdk for the full command list and flags. The SDK-level equivalents, plus borrow/repay, rebases, the queued fee update, and the vault’s own insurance-fund stake, are in Manager operations.

Next steps

  • Want the full manager surface beyond the CLI basics? See Manager operations.
  • Need manager borrowing or margin beyond the base vault? See Trusted vaults.
  • Want a multisig (e.g. Squads) as vault manager instead of a single keypair? See Multisig manager.
  • Building a depositor-facing app on top of the vault? See Vault Depositors.
Last updated on