# Edge Case Analysis

## Overview

This document analyzes edge cases in the Shadow Liquidity mechanism to demonstrate the mathematical guarantees of protocol solvency.

***

## Solvency Under Extreme Conditions

### Case 1: Unilateral YES Betting

All participants bet on YES outcome.

**Scenario:** $10,000 total volume, 100% on YES side

| Metric               | Value                       |
| -------------------- | --------------------------- |
| Total USDC deposited | $10,000                     |
| Fee collected (2%)   | $200                        |
| Net to curve         | $9,800                      |
| Final vYES           | 91,116                      |
| Final vNO            | 109,754                     |
| Shadow YES issued    | 8,884                       |
| Shadow NO issued     | 0                           |
| Vault balance        | $10,000                     |
| Maximum liability    | 8,884                       |
| **Solvency**         | 10,000 / 8,884 = **112.5%** |

**Result:** System remains solvent despite extreme one-sided betting.

***

### Case 2: Unilateral NO Betting

All participants bet on NO outcome.

**Scenario:** $10,000 total volume, 100% on NO side

| Metric               | Value                       |
| -------------------- | --------------------------- |
| Total USDC deposited | $10,000                     |
| Shadow NO issued     | 8,884                       |
| Shadow YES issued    | 0                           |
| Vault balance        | $10,000                     |
| Maximum liability    | 8,884                       |
| **Solvency**         | 10,000 / 8,884 = **112.5%** |

**Result:** Symmetric to Case 1. Solvency maintained.

***

### Case 3: Extreme Imbalance (95% YES / 5% NO)

**Scenario:** $10,000 volume with 95/5 split

| Metric            | Value                       |
| ----------------- | --------------------------- |
| YES purchases     | $9,500                      |
| NO purchases      | $500                        |
| Shadow YES issued | \~8,400                     |
| Shadow NO issued  | \~490                       |
| Vault balance     | $10,000                     |
| Maximum liability | 8,400                       |
| **Solvency**      | 10,000 / 8,400 = **119.0%** |

**Result:** Imbalanced markets achieve higher solvency due to premium prices on the popular side.

***

### Case 4: Bank Run Scenario

All participants attempt to exit simultaneously after market becomes one-sided.

**Initial State:**

* 5,000 Shadow YES shares outstanding
* Vault balance: $5,500
* vYES: 95,000
* vNO: 105,263

**Sequential Exit Process:**

| Exit Order | Shares Sold | Payout | Remaining Vault |
| ---------- | ----------- | ------ | --------------- |
| 1st 1,000  | 1,000       | $1,020 | $4,480          |
| 2nd 1,000  | 1,000       | $980   | $3,500          |
| 3rd 1,000  | 1,000       | $940   | $2,560          |
| 4th 1,000  | 1,000       | $900   | $1,660          |
| 5th 1,000  | 1,000       | $860   | $800            |

**Analysis:**

* Early exiters receive premium (\~$1.02/share)
* Late exiters receive discount (\~$0.86/share)
* Vault never depletes entirely
* Average recovery: \~94%

**Result:** First-mover advantage incentivizes orderly exit rather than panic.

***

## Solvency Guarantees

### Mathematical Proof

The CPMM guarantees solvency through three mechanisms:

**1. Slippage Premium**

As users buy one side, they pay increasingly higher prices:

```
shares = vOLD - k/vNEW

For large purchases, vNEW >> vOLD, so shares << amount spent
```

**2. Fee Accumulation**

Each trade adds to vault while issuing fractional shares:

```
vault_increase = amount (100%)
shares_issued < amount (due to fee + slippage)
```

**3. Bounded Liability**

Maximum liability is bounded by shares issued, which is bounded by initial reserve:

```
MAX(totalYES, totalNO) < INITIAL_VIRTUAL_RESERVE
```

***

## Failure Mode Analysis

### Scenario: Failed Graduation

If bonding deadline expires before 100% solvency:

| Solvency at Deadline | Recovery Rate |
| -------------------- | ------------- |
| 95-99%               | \~96%         |
| 90-94%               | \~92%         |
| 80-89%               | \~85%         |
| < 80%                | \~80%         |

### Root Causes of Failure

| Cause                            | Likelihood | Prevention                  |
| -------------------------------- | ---------- | --------------------------- |
| Insufficient interest            | Medium     | Market discovery, promotion |
| Extreme imbalance w/o arbitrage  | Low        | Arbitrage incentives        |
| Rapid sell-off before graduation | Low        | First-mover advantage       |

***

## Parameter Sensitivity

### Virtual Reserve Impact

| Initial Reserve | Max Solvency | Slippage Profile  |
| --------------- | ------------ | ----------------- |
| 10,000          | 150%+        | High slippage     |
| 100,000         | \~110%       | Moderate slippage |
| 1,000,000       | \~101%       | Low slippage      |

Current configuration (100,000) balances capital efficiency with solvency margin.

### Fee Impact

| Fee Rate | Solvency Impact | Trading Cost   |
| -------- | --------------- | -------------- |
| 1%       | Lower margin    | Lower barrier  |
| 2%       | Moderate margin | Moderate cost  |
| 3%       | Higher margin   | Higher barrier |

Current configuration (2%) provides sufficient margin without excessive trading friction.
