# Vaults

`Vault` extends the [Smart Token](https://docs.bitbadges.io/standards/smart-tokens) 1:1 IBC-backed model with frozen collection permissions, disabled liquidity pool creation, and optional safety controls: per-initiator daily withdrawal caps, token-ownership 2FA gates, and an emergency migration recovery path.

A collection's `"Vault"` standard tag is a discovery hint. Inspect the actual backing invariant, withdrawal approvals, 2FA requirements, and recovery address before depositing funds.

## CLI Commands

Use `bb build vault` (or `bb vault build`) to create a Vault collection, and `bb vault` (alias `bb vaults`) to inspect and operate existing vaults:

```bash
bb build vault --backing-coin USDC --symbol vUSDC \
  --daily-withdraw-limit 100 --creator "$CREATOR" --uri "$METADATA_URI"

bb vault list
bb vault show "$COLLECTION_ID"
bb vault status "$COLLECTION_ID"

bb vault deposit "$COLLECTION_ID" --creator "$HOLDER" --amount 10
bb vault deposit "$COLLECTION_ID" --creator "$HOLDER" --amount 10000000 --base-units
bb vault withdraw "$COLLECTION_ID" --creator "$HOLDER" --amount 5
bb vault emergency-migrate "$COLLECTION_ID" --creator "$RECOVERY" --from "$HOLDER" --amount 10
```

All mutating commands emit unsigned `MsgTransferTokens` proposals by default. Pipe into `bb deploy` or pass `--browser` / `--with-keyring` explicitly.

| Command | Description | Emits |
| --- | --- | --- |
| `bb vault list` | Browse recognized Vault collections (including unsupported configurations with explanations) | Read-only |
| `bb vault show <id>` | Backing address, denom, deposit/withdraw tiers, 2FA gates, emergency recovery, standards | Read-only |
| `bb vault status <id>` | Compact status summary with withdrawal tiers, 2FA, and emergency recovery | Read-only |
| `bb vault deposit <id>` | Deposit backing coin and mint vault tokens (`--creator`, `--amount`, optional `--base-units`, `--approval-id`) | `MsgTransferTokens` |
| `bb vault withdraw <id>` | Burn vault tokens and release backing coin (`--creator`, `--amount`, optional `--base-units`, `--approval-id`) | `MsgTransferTokens` |
| `bb vault emergency-migrate <id>` | Move vault tokens to the configured recovery address (`--creator`, `--from`, `--amount`, optional `--base-units`) | `MsgTransferTokens` |
| `bb vault build` | Alias for `bb build vault` | `MsgCreateCollection` |

`--amount` accepts display units by default (using the backing coin's decimals) and raw integer base units with `--base-units`. When a vault configures multiple deposit or withdrawal approval tiers, pass `--approval-id` explicitly; the CLI never picks a tier implicitly.

## MCP Tools and SDK Functions

Shared MCP tools mirror every `bb vault` action without signing or broadcasting:

- `build_vault` — build an unsigned Vault creation proposal
- `standard_vault_list` — browse recognized Vault collections
- `standard_vault_show` — inspect a Vault collection's configuration
- `standard_vault_status` — compact Vault status summary
- `standard_vault_deposit` — build an unsigned deposit proposal
- `standard_vault_withdraw` — build an unsigned withdrawal proposal
- `standard_vault_emergency_migrate` — build an unsigned emergency migration proposal

Inspect exact input schemas with `bb dev capabilities standard_vault_withdraw` or the [Capability Catalog](https://docs.bitbadges.io/agents/capabilities).

SDK core functions (`bitbadges`): `buildVault`, `inspectVaultCollection`, `validateVaultCollection`, `doesCollectionFollowVaultProtocol`, `selectVaultApproval`, `buildVaultDepositMsg`, `buildVaultWithdrawMsg`, and `buildVaultEmergencyMigrateMsg`.

## Safety Controls and Caveats

- **Daily withdrawal limits** apply per initiating address (`perInitiatedByAddressApprovalAmount`) in 24-hour (`86400000` ms) reset intervals starting at the next UTC midnight. They are not global reserve limits.
- **2FA gates** (`--require-2fa <collection-id>`) require current ownership of token ID 1 in the specified [Custom-2FA](https://docs.bitbadges.io/standards/access#custom-2fa) collection at withdrawal time.
- **Emergency recovery** (`--emergency-recovery <address>`) installs the `vault-emergency-migration` approval allowing the designated recovery address to move holders' vault tokens to itself without holder approval. Treat this as a substantive custody trust decision, not a contact field.
- **Bounded inspection**: `show` and `status` report `recognized`, `configurationSupported`, `withdrawTiers`, `emergencyRecovery`, `issues`, `warnings`, and `eligibility: "not-checked"`. Supported configuration does not prove live balances, tracker capacity, 2FA token ownership, or execution eligibility.

## Related

- [Smart Tokens](https://docs.bitbadges.io/standards/smart-tokens)
- [Vault JSON recipe](https://docs.bitbadges.io/standards/smart-tokens#vault-json)
- [CLI Standards Commands](https://docs.bitbadges.io/cli/standards#vault)
- [Standards Tooling](https://docs.bitbadges.io/standards/tooling)
