> For the complete documentation index, see [llms.txt](https://docs.afx.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.afx.xyz/vaults/user-vaults.md).

# User Vaults

User Vaults allow any trader to create and manage a strategy vault on AFX. Depositors allocate capital to a Vault leader's trading strategies, and the leader earns a profit share on depositors' gains.

## Creating a Vault

{% stepper %}
{% step %}

### Connect your wallet and open Vaults

Connect your wallet and navigate to the Vaults page.
{% endstep %}

{% step %}

### Create the vault

Click **Create Vault** and fill in the required fields:

* **Vault Name** (permanent, cannot be changed)
* **Vault Description** (permanent, cannot be changed)
* **Initial Deposit:** Minimum 100 USDC
  {% endstep %}

{% step %}

### Pay the creation fee

Pay the **100 USDC creation fee** (non-refundable, even if you later close the Vault).
{% endstep %}
{% endstepper %}

**Limits:** Each wallet can create up to **5 User Vaults**.

## Profit Share

User Vault leaders receive a **10% profit share** on depositors' gains at the time of withdrawal. The profit share is calculated as follows:

{% stepper %}
{% step %}

### Track average cost basis

The system tracks each depositor's average cost basis (total invested / total shares).
{% endstep %}

{% step %}

### Calculate gross profit

When a depositor withdraws, the system calculates their gross profit: Withdrawal Amount - (Shares Withdrawn × Average Cost).
{% endstep %}

{% step %}

### Deduct profit share if profit is positive

If the gross profit is positive, 10% is deducted as the leader's profit share.
{% endstep %}

{% step %}

### Send the net withdrawal amount

The net withdrawal amount is sent to the depositor's wallet; the profit share increases the leader's share balance.
{% endstep %}
{% endstepper %}

**Example:** A depositor invested $111 total for 110 shares (avg cost $1.0091/share). They withdraw 50 shares at NAV $1.21:

* Withdrawal = 50 × $1.21 = $60.50
* Cost = 50 × $1.0091 = $50.455
* Gross Profit = $60.50 - $50.455 = $10.045
* Profit Share (10%) = $1.0045 (transferred to leader)
* Depositor Receives = $60.50 - $1.0045 = $59.4955

## Leader Requirements

The Vault leader must maintain a **minimum of 5% of total vault shares** (and at least 100 USDC in value). If the leader's share drops below 5%, the following restrictions apply:

* Cannot withdraw funds
* Cannot increase position sizes (reducing/closing positions is still allowed)
* Cannot withdraw profit share
* Can still deposit additional funds

This requirement ensures the leader has meaningful skin in the game.

## Vault Operations

Leaders have access to a **Creator Operations** panel with the following controls:

* **Close Vault:** Initiates a 48-hour cooldown period. All open positions must be closed before initiating closure. During the cooldown, depositors can freely withdraw. After the cooldown, remaining funds are distributed proportionally by shares.
* **Trade for Vault:** Opens the trading interface in Vault context, where all trades are executed using the Vault's funds.
* **Disable Deposits:** Toggle to prevent new deposits from other users.
* **Enable Auto-Close on Withdrawal:** When enabled, if available balance is insufficient for a withdrawal, the system automatically closes positions to free up funds. When disabled, withdrawals that exceed available balance will simply fail.

## Deposits and Withdrawals

**Deposits:**

* No maximum deposit limit.
* Shares are minted at the current NAV.
* The initial 100 USDC creation deposit is usable as trading capital.

**Withdrawals:**

* Withdrawals are processed based on the current NAV.
* If the Vault has sufficient available balance, withdrawals are instant.
* NAV is updated in real-time. Funds are only transferred when the depositor initiates a withdrawal.

## Settlement

* NAV is calculated in real-time based on the Vault's total assets (balance + unrealized PNL).
* There is no periodic settlement — profits accumulate continuously in the NAV.
* Funds are only transferred to the depositor's wallet when they explicitly withdraw.

## Closing a Vault

When a leader closes a Vault:

{% stepper %}
{% step %}

### Close all positions

All positions must be fully closed (no open positions or orders).
{% endstep %}

{% step %}

### Start the cooldown

A 48-hour cooldown period begins.
{% endstep %}

{% step %}

### Restrict new activity

During the cooldown, no new deposits or new positions are allowed.
{% endstep %}

{% step %}

### Allow withdrawals

Depositors can withdraw freely during the cooldown.
{% endstep %}

{% step %}

### Distribute remaining funds

After the cooldown, remaining funds are distributed to all depositors proportionally by share count, with the 100 USDC creation fee deducted (or as much as remains if the balance is less than 100 USDC).
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.afx.xyz/vaults/user-vaults.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
