# Quickstart: Create and Run a Vault

> Canonical: https://docs.velocity.exchange/developers/vault-managers/quickstart

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](/developers/vault-managers.md).

### Decide vault parameters

| Parameter | Description |
| --------- | ----------- |
| **`market-index`** / **`spotMarketIndex`** | Spot market index of the deposit token. Read the live spot market accounts to map an index to a token. |
| **`redeem-period`** | Withdrawal cooldown in seconds (often three to seven days; the CLI default is 604,800 seconds, seven days). |
| **`max-tokens`** | Capacity / risk control. |
| **`management-fee`** | Annualized management fee. |
| **`profit-share`** | Performance fee on realized gains. |
| **`permissioned`** + **`min-deposit-amount`** | Optional onboarding controls. |

### Initialize the vault

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

> **Warning:**
>
> The `velocity-v1` monorepo is not public yet. It will be published once the post-fork audit report is final. Until then, ask the team for access to run these commands.

```bash
git clone <velocity-v1>
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 onchain `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>` for whitelisted depositors and a minimum deposit size. Vault name must be unique.

### Update parameters and enable trading

After creation the manager can lower fees, shorten the redeem period, or adjust caps immediately (within the one-way constraints described in [Vault Managers](/developers/vault-managers.md)):

```bash
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)`:

```bash
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. To cancel, the CLI exposes only `admin-delete-fee-update`, which closes the account entirely. The manager can withdraw a queued update without an admin, but only through the SDK's `managerCancelFeeUpdate`; there is no CLI command for it.

To enable margin trading on the vault:

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

View vault state anytime:

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

### Permissioned vaults (allowing depositors)

For permissioned vaults, the manager must initialize each depositor:

```bash
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](/developers/vault-managers/manager-operations.md).

## Next steps

- Want the full manager surface beyond the CLI basics? See [Manager operations](/developers/vault-managers/manager-operations.md).
- Need manager borrowing or margin beyond the base vault? See [Trusted vaults](/developers/vault-managers/trusted-vaults.md).
- Want a multisig (e.g. Squads) as vault manager instead of a single keypair? See [Multisig manager](/developers/vault-managers/multisig-ops.md).
- Building a depositor-facing app on top of the vault? See [Vault Depositors](/developers/vault-depositors.md).
