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

# Deposit capacity

> The vault has a finite, two-tier deposit capacity. Check it before staking so a deposit doesn't revert — over HTTP via GET /api/v1/capacity, or on-chain via RobinLens.

The vault can only absorb so much USDC at once. A deposit that would exceed capacity **reverts**, so check capacity before you build the batch — either over HTTP (`GET /api/v1/capacity`) or trustlessly on-chain (`RobinLens.checkBatchDepositCapacity`).

<Info>
  Capacity is **global** (vault-wide), not per-market. A deposit is a batch
  across markets, so always check the **whole batch together** — two batches
  that each fit on their own can exceed capacity when combined.
</Info>

## The two tiers

A deposit pairs opposing YES/NO tokens, merges each pair to USDC, and supplies that USDC to the external yield (ERC-4626) vault. Capacity is enforced at two points along that pipeline.

| Tier             | What it checks                                                                                                | Enforced          | Reverts            |
| ---------------- | ------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------ |
| **1 — internal** | Forward-looking: the worst-case USDC if **all** currently-unpaired tokens got paired must fit the vault caps. | Admin-disableable | `CapacityExceeded` |
| **2 — external** | Real-time: the **actually-paired** USDC must fit the live ERC-4626 vault's headroom right now.                | Always            | `SupplyOverflow`   |

<Note>
  Tier 1 is a conservative guard against a large, unbalanced deposit that
  *could* later need more USDC than the vault can hold. Tier 2 is the hard limit
  — paired USDC must fit the external vault's current `maxDeposit`. For a
  balanced (fully-matched) deposit, tier 2 is the binding constraint; a very
  one-sided deposit can hit tier 1 first.
</Note>

## Check via the API

`GET /api/v1/capacity` returns the global headroom and, when you pass a prospective batch, whether it fits. No wallet needed.

```bash theme={null}
# Headroom only
curl "https://app.robin.markets/api/v1/capacity"

# Will this batch fit? (amounts are 6-dec micro-units, aligned 1:1 with conditionIds)
curl "https://app.robin.markets/api/v1/capacity?conditionIds=0x1234…,0xabcd…&yesAmounts=1000000,0&noAmounts=0,2000000"
```

```jsonc theme={null}
{
  "fits": true, // would the supplied batch deposit without reverting
  "remainingUsdc": "1234000000" // USDC the vault can still absorb; null = uncapped
}
```

<Note>
  `remainingUsdc` already accounts for which tiers are active (a disabled
  internal guard simply drops out), so it's the single number to gate a UI on.
</Note>

## Read it on-chain

For a trustless pre-flight, call `RobinLens.checkBatchDepositCapacity` — it simulates **both** tiers for a prospective batch and returns a single bool. `GET /capacity` runs the same simulation, but additionally honors the internal-guard flag (the raw on-chain view does not — see the warning below).

```solidity theme={null}
function checkBatchDepositCapacity(
    bytes32[] conditionIds,
    uint256[] yesAmounts,
    uint256[] noAmounts
) external view returns (bool fits);
```

To read the raw headroom yourself, the vault exposes each tier (USDC, 6-dec; `type(uint256).max` = uncapped):

| Function                              | Returns                                                                                                          |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `getTotalAvailableCapacity()`         | Tier 2 — USDC that can be supplied to the external vaults right now.                                             |
| `getTotalAvailableInternalCapacity()` | Tier 1 — USDC the vault caps still allow.                                                                        |
| `getMaximumAdditionalMatchedTokens()` | Current global worst-case pairing total; tier 1 passes while this stays ≤ `getTotalAvailableInternalCapacity()`. |
| `isInternalCapacityCheckDisabled()`   | Whether tier 1 is currently disabled (then it never blocks a deposit).                                           |

<Warning>
  `checkBatchDepositCapacity` enforces the internal guard even when an admin has
  disabled it, so it can be slightly **stricter** than the live vault — it never
  returns a false "fits", only, rarely, a false "won't fit".
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Deposits" icon="arrow-down-to-bracket" href="/developers/deposits">
    Build the deposit batch once capacity confirms it fits.
  </Card>

  <Card title="Reading on-chain state" icon="magnifying-glass" href="/developers/reading-onchain-state">
    The rest of the `RobinLens` read surface.
  </Card>
</CardGroup>
