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

# Capital Recall

> Instant recall of deployed capital for order matching

## Overview

Capital Recall is the mechanism that instantly retrieves deployed capital from yield protocols when needed for order matching, withdrawals, or other operations.

<Info>
  **Key Feature**: Recall happens atomically within the same transaction as your order match. Zero delay, zero user action required.
</Info>

## How Recall Works

### Atomic Execution

All steps happen in a single transaction:

```
Transaction Flow:
├── 1. Borrower submits order that matches yours
├── 2. System detects your capital is deployed
├── 3. Withdraw from yield protocol (e.g., Aave)
├── 4. Transfer to order book
├── 5. Execute match
├── 6. Issue CBT to you
└── 7. Transaction complete

Total time: ~12 seconds (1 block)
All or nothing: If any step fails, entire tx reverts
```

### Technical Implementation

```solidity theme={null}
// Simplified recall flow
function executeMatchWithRecall(
    Order memory lendOrder,
    Order memory borrowOrder
) external {
    // Check if lender's capital is deployed
    Deployment memory dep = yieldRouter.getDeployment(lendOrder.lender);

    if (dep.amount > 0) {
        // Recall from yield protocol
        yieldRouter.recall(
            dep.protocol,
            lendOrder.amount
        );
    }

    // Execute the match
    orderBook.executeMatch(lendOrder, borrowOrder);

    // All happens atomically
}
```

## Recall Triggers

| Trigger           | Action                           |
| ----------------- | -------------------------------- |
| Order match       | Recall capital to complete match |
| User cancellation | Recall and return to user        |
| Vault withdrawal  | Recall to satisfy withdrawal     |
| Emergency         | Protocol-wide recall if needed   |

## Recall Speed

### Same-Block Execution

Recall completes in the same block as the triggering action:

| Network  | Block Time | Recall Time      |
| -------- | ---------- | ---------------- |
| Arbitrum | \~0.25s    | Under 1 second   |
| Ethereum | \~12s      | Under 12 seconds |

### No Withdrawal Queue

Unlike manual withdrawals from lending protocols, recall uses:

* Flash loan mechanisms for instant liquidity
* Protocol reserves for immediate withdrawal
* Pre-approved withdrawal allowances

## Yield Protocol Requirements

To be eligible for Idle Yield Router, protocols must support instant recall:

| Requirement          | Why                          |
| -------------------- | ---------------------------- |
| No withdrawal queue  | Instant access to funds      |
| No withdrawal fees   | User doesn't bear cost       |
| Sufficient liquidity | Always able to withdraw      |
| Atomic withdrawals   | Single-transaction execution |

### Approved Protocols

| Protocol     | Withdrawal Speed | Max Recall |
| ------------ | ---------------- | ---------- |
| Aave V3      | Instant          | \$50M      |
| Compound V3  | Instant          | \$30M      |
| MakerDAO DSR | Instant          | Unlimited  |
| Spark        | Instant          | \$25M      |

## Edge Cases

### Large Recalls

For very large amounts that exceed single-protocol liquidity:

<Steps>
  <Step title="Multi-Protocol Recall">
    If $10M needed and only $5M available in Aave, recall from multiple protocols simultaneously
  </Step>

  <Step title="Reserve Backup">
    Protocol reserve fund can bridge temporary gaps
  </Step>

  <Step title="Partial Fill">
    In extreme cases, order partially filled with remainder queued
  </Step>
</Steps>

### Protocol Pause

If a yield protocol is paused (upgrade, emergency):

1. **Detection**: System detects protocol unavailable
2. **Fallback**: Use reserve fund to complete match
3. **Recovery**: Once protocol resumes, funds recovered
4. **User Impact**: None, match completes normally

### Gas Spikes

If gas prices spike during recall:

| Scenario            | Handling                       |
| ------------------- | ------------------------------ |
| Normal spike (2-3x) | Protocol absorbs cost          |
| Extreme spike (>5x) | May delay non-urgent recalls   |
| User-initiated      | Always executes, protocol pays |

## Yield Preservation

### You Keep Interim Yield

Yield earned while deployed is preserved:

```
Example:
  Deployed: $10,000 USDC for 5 days
  Protocol: DSR @ 4.0% APY
  Yield earned: $5.48

  At Recall:
  - Principal: $10,000
  - Yield: $5.48
  - Total transferred to match: $10,005.48

  Your CBT position reflects: $10,005.48 principal
```

### Yield Claiming

No separate claim needed. Yield is automatically:

1. Accrued while deployed
2. Claimed during recall
3. Added to your principal

## Monitoring Recalls

### Transaction Details

Each recall is logged:

```
Recall Event:
├── Timestamp: 2025-03-15 14:32:15 UTC
├── Amount: 10,000 USDC
├── Protocol: Aave V3
├── Yield Claimed: $5.48
├── Trigger: Order Match
├── Duration Deployed: 5 days
└── Transaction: 0x1234...abcd
```

### Dashboard View

```
Recent Recalls:
┌─────────────┬──────────┬──────────┬────────┬──────────┐
│ Date        │ Amount   │ Protocol │ Yield  │ Trigger  │
├─────────────┼──────────┼──────────┼────────┼──────────┤
│ Mar 15      │ $10,000  │ Aave     │ $5.48  │ Match    │
│ Mar 12      │ $25,000  │ DSR      │ $8.22  │ Cancel   │
│ Mar 08      │ $15,000  │ Compound │ $3.15  │ Match    │
└─────────────┴──────────┴──────────┴────────┴──────────┘
```

## Reserve Fund

Protocol maintains a reserve fund for recall edge cases:

| Purpose           | Coverage                              |
| ----------------- | ------------------------------------- |
| Flash liquidity   | Bridge temporary protocol illiquidity |
| Gas spikes        | Cover extreme gas situations          |
| Protocol failures | Make users whole if protocol fails    |

### Reserve Metrics

| Metric       | Value                  |
| ------------ | ---------------------- |
| Target Size  | 5% of deployed capital |
| Current Size | \$X.XM                 |
| Utilization  | \< 1% typical          |

## FAQs

<AccordionGroup>
  <Accordion title="What if recall fails?">
    The entire transaction reverts, including the match. Your order remains in the book, and a retry happens on the next match attempt. You're never left in a partial state.
  </Accordion>

  <Accordion title="Do I pay for recall gas?">
    No. All gas costs are covered by the protocol as part of the gasless experience.
  </Accordion>

  <Accordion title="Can recall be slower than expected?">
    In normal conditions, recall is instant (same block). Only in extreme circumstances (protocol pause, chain congestion) might there be brief delays, and the protocol communicates these.
  </Accordion>

  <Accordion title="What if I want to keep earning yield instead of matching?">
    Your order has priority. Once a match is found at your rate, the match executes. If you want to continue earning variable yield, cancel your order.
  </Accordion>
</AccordionGroup>

<Card title="Back to Idle Yield Router" icon="arrow-left" href="./overview">
  Return to Idle Yield Router overview
</Card>
