> ## Documentation Index
> Fetch the complete documentation index at: https://pessoal-86816071.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Vault Lifecycle

> How to bootstrap the vault, manage strategy state, and run user actions safely.

# Vault Lifecycle

## 1. Bootstrap the vault

Use:

```bash theme={null}
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:

```bash theme={null}
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:

```bash theme={null}
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:

```bash theme={null}
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:

```bash theme={null}
node --experimental-strip-types services/ranger/src/demo.ts
```

That is the point where the full rebalance lifecycle becomes meaningful.
