> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kimia.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Delta-Neutral Vault

> How delta-vault turns USDC into funding-rate yield without price exposure.

<style>
  {`
    .katex-display {
      overflow-x: auto;
      overflow-y: hidden;
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    .katex-display::-webkit-scrollbar {
      display: none;
      height: 0;
      width: 0;
    }
    `}
</style>

The `delta-vault` program is the yield engine of Kimia. It takes USDC from
depositors, holds half of it, and sells the other half into a SOL-PERP short, so
the vault's value stays flat as SOL price moves, but accrues the funding rate.

## The insight

In crypto, longs pay shorts funding whenever perp price > spot. Historically this has
averaged **positive, double-digit APY** on major assets. A delta-neutral vault
earns that funding without betting on price direction.

```
 +1 SOL spot exposure  (wSOL held by the vault)
 -1 SOL perp exposure  (short on kimia-perp)
 ───────────────────
  0  net SOL exposure   → pure funding-rate yield
```

## How a deposit works

<Steps>
  <Step title="User calls deposit(amount, open_perp=true, size_amount)">
    USDC is transferred from the user into `vault.usdc_vault`. Vault shares are
    minted proportional to existing NAV.
  </Step>

  <Step title="Vault buys wSOL on the spot leg">
    Via CPI to `kimia-perp::spot_swap`, half the USDC is swapped for wSOL at the
    oracle price (plus a small spread).
  </Step>

  <Step title="Vault opens a SOL-PERP short">
    Via CPI to `kimia-perp::deposit_collateral` and `kimia-perp::place_order`, the
    other half of the USDC is posted as collateral and a market short is opened.
  </Step>

  <Step title="Rebalance threshold kicks in">
    If spot and perp legs diverge by more than `rebalance_threshold_bps`, anyone
    can call `rebalance` to close the gap.
  </Step>
</Steps>

## Vault share price

$$
\text{sharePrice} = \frac{\text{NAV}}{\text{totalShares}}
$$

$$
\text{sharesOut} = \frac{\text{amount} \times \text{totalShares}}{\text{NAV}}
$$

Both use 9-decimal fixed point. The first depositor receives `shares = amount`
since `totalShares` starts at zero.

NAV only moves when `claim_funding` is called. Between cranks, share price is
constant, deposits/withdrawals are atomic and fair.

## Funding accrual

`claim_funding` is the heart of the vault:

<Steps>
  <Step title="Snapshot realized_pnl">
    Read `perps_user_account.realized_pnl` before settlement.
  </Step>

  <Step title="CPI settle_funding">
    The vault PDA signs `kimia-perp::settle_funding`, which accrues the funding
    delta into the perp user account's collateral.
  </Step>

  <Step title="Delta = post - pre">
    Any increase is positive funding yield.
  </Step>

  <Step title="Skim + distribute">
    `insurance_skim_bps` (configurable per vault, e.g. 30%) is kept in the insurance fund. The rest is
    added to `nav`, raising share price.
  </Step>
</Steps>

If the delta is **negative**, the insurance fund absorbs the loss first. Only if
the insurance fund is depleted does NAV fall, and if that lasts 24 hours, the
vault auto-pauses until an admin intervenes.

## States

| State    | Meaning               | Allowed ops                                  |
| -------- | --------------------- | -------------------------------------------- |
| `Active` | Normal operation      | deposit, withdraw, rebalance, claim\_funding |
| `Paused` | Auto- or admin-paused | withdraw only (after unwind)                 |
| `Closed` | Terminal              |                                              |

## Interaction with split-engine

Vault shares are fungible SPL tokens. The `split-engine` wraps them into PT + YT,
so vault depositors can:

* **Hold shares** → earn funding directly
* **Split them** → sell YT now (fixed rate) or sell PT now (leverage on YT)

Both flows live on top of the same vault, the split is pure bookkeeping.

## Read next

<CardGroup cols={2}>
  <Card title="PT / YT tokenization" icon="scissors" href="/concepts/pt-yt-tokenization">
    How the yield is split into two tradable tokens.
  </Card>

  <Card title="delta-vault reference" icon="book" href="/programs/delta-vault">
    Accounts, instructions, CPIs.
  </Card>

  <Card title="Deposit into the vault" icon="down-to-bracket" href="/guides/deposit-vault">
    End-to-end walkthrough.
  </Card>
</CardGroup>
