# T+0 Instant Rebalancing

This is the core innovation of Foundation. We solve the problem of **Rebalancing Drag**—the time and money lost when moving capital between yield silos.

***

## The Problem: Traditional Rebalancing

In traditional DeFi, moving $1M from an RWA Vault to a delta-neutral strategy is painful:

| Step | Action                    | Time     | Cost           |
| ---- | ------------------------- | -------- | -------------- |
| 1    | Unstake from source       | 2-7 days | Gas            |
| 2    | Withdraw to wallet        | —        | Gas            |
| 3    | Swap assets on DEX        | —        | Slippage + Gas |
| 4    | Re-deposit to destination | —        | Gas            |

**Result:** 5+ days of lost yield and high operational friction.

***

## The Solution: Atomic Share Swaps

Foundation allows users to swap strategy shares (e.g., `ApolloUSD` → `OrdUSD`) in a **single atomic transaction**.

| Metric           | Traditional | Foundation        |
| ---------------- | ----------- | ----------------- |
| Settlement Time  | 2-7 days    | **1 block (T+0)** |
| Slippage         | 0.1-2%      | **0%**            |
| Gas Transactions | 4+          | **1**             |
| Lost Yield       | 5+ days     | **None**          |

***

## How It Works: The Rebalance Router

We utilize the **Rebalance Router** smart contract to perform "Virtual Settlement" using `USD'`.

### Step-by-Step Flow

| Step | Action                         | Description                                    |
| ---- | ------------------------------ | ---------------------------------------------- |
| 1    | User calls `swapStrategies()`  | Specify source shares and minimum output       |
| 2    | Router redeems source shares   | Burns ApolloUSD shares, receives USD' credit   |
| 3    | Vault updates ledger           | Internal accounting update (no token transfer) |
| 4    | Router deposits to destination | Uses USD' credit to mint OrdUSD shares         |
| 5    | User receives new shares       | OrdUSD shares minted to user wallet            |

**All steps execute atomically in a single transaction.**

### The Key Insight

**Virtual Settlement:** Instead of physically moving collateral, the Vault simply updates its internal ledger—crediting one strategy and debiting another. The collateral often stays in the same custody, making the "swap" a low-cost accounting operation.

***

## Liquidity Buffers

To support T+0 swaps on illiquid underlying assets (like RWAs with multi-day settlement), each strategy maintains a **Liquidity Buffer**.

| Component         | Description                                                                                 |
| ----------------- | ------------------------------------------------------------------------------------------- |
| **Buffer Size**   | 5-10% of strategy TVL in liquid stablecoins                                                 |
| **Swap Source**   | When you swap out, you're paid from the buffer                                              |
| **Replenishment** | Protocol queues an RWA redemption to replenish the buffer over standard settlement timeline |

This design ensures:

* **Users get instant liquidity** — No waiting for RWA settlement
* **Strategies stay fully invested** — Only a small buffer is held idle
* **System remains solvent** — Buffer replenishment is automatic and continuous

***

## Use Cases

| Scenario                         | Traditional Approach             | With Foundation                 |
| -------------------------------- | -------------------------------- | ------------------------------- |
| Risk-off during volatility       | Wait 7 days to exit RWA position | Instant swap to PrimeUSD        |
| Capitalize on high funding rates | Complex multi-step migration     | One-click swap to OrdUSD        |
| Rebalance portfolio allocation   | Days of operational overhead     | Atomic multi-strategy rebalance |
