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

# Liquidity & Settlement

> What happens when your quote wins — DvP mechanics, P&L, risk, and liquidity management.

When your quote is accepted, Musubi executes an atomic Delivery-vs-Payment (DvP) swap. You deliver USDCx; you receive JPYSC0. Both legs settle in a single transaction — there is never a moment where you've delivered one side but not received the other.

## How Settlement Works for You

<Steps>
  <Step title="Your Quote Wins">
    The institution selects your quote. Your quote status moves to **ACCEPTED**. Settlement preparation begins automatically.
  </Step>

  <Step title="You Co-Sign the Settlement">
    Musubi creates a settlement proposal. Four parties must approve before execution:

    1. **Network operator** (Musubi)
    2. **Sender's custodian** (holds the JPYSC0)
    3. **You** (committing USDCx)
    4. **Receiver's custodian** (receiving USDCx)

    Your approval is collected automatically through the settlement protocol. No manual action is required if your system is connected.
  </Step>

  <Step title="Atomic DvP Executes">
    All four legs execute in a single transaction:

    | Leg | Movement                              | Your Role   |
    | --- | ------------------------------------- | ----------- |
    | 1   | JPYSC0: Sender's custodian -> Musubi  | —           |
    | 2   | USDCx: **You -> Musubi**              | You deliver |
    | 3   | USDCx: Musubi -> Receiver's custodian | —           |
    | 4   | JPYSC0: **Musubi -> You**             | You receive |

    All four succeed atomically, or all four roll back. Settlement takes \~4 seconds.
  </Step>

  <Step title="Settlement Confirmation">
    You receive a settlement record with a single `transaction_hash` covering all four legs. This is your definitive proof of execution.
  </Step>
</Steps>

**How this differs from CEX/DEX settlement**: On a CEX, settlement is internal ledger entries — you trust the exchange. On a DEX, settlement is atomic within one smart contract call — you trust the code. On Musubi, settlement is atomic across four independent parties via Canton DvP — no exchange custody risk, no smart contract risk. Your assets stay in your own custody until the atomic swap executes.

## Your Settlement Record

After settlement, you can retrieve the details:

| Field                        | Description                    | Example      |
| ---------------------------- | ------------------------------ | ------------ |
| `intent_id`                  | Order reference                | UUID         |
| `source_currency`            | What the sender exchanged      | `JPYSC0`     |
| `target_amount`              | Sender's amount                | `"10000000"` |
| `target_currency`            | What you delivered             | `USDCx`      |
| `source_amount_actual`       | Final delivered amount         | `"11200000"` |
| `fx_rate`                    | Executed rate                  | `"112.0"`    |
| `mm_delivered_target_amount` | USDCx you delivered            | `"11200000"` |
| `mm_delivered_target_amount` | JPYSC0 you received            | `"10000000"` |
| `transaction_hash`           | Cryptographic settlement proof | Hex string   |
| `settled_at`                 | Settlement timestamp           | ISO 8601     |

**P\&L calculation**: Your profit is the spread between your offered rate and your cost of acquiring USDCx. The settlement record gives you exact amounts for reconciliation.

## Risk Profile

| Risk                        | Status        | Why                                                                  |
| --------------------------- | ------------- | -------------------------------------------------------------------- |
| **Counterparty risk**       | Eliminated    | Atomic DvP — both legs or neither                                    |
| **Settlement risk**         | Eliminated    | Single transaction, no intermediate state                            |
| **Herstatt risk**           | Eliminated    | No time gap between legs                                             |
| **Identity exposure**       | None          | Anonymized RFQs, no sender/receiver identity even post-settlement    |
| **Pre-funding requirement** | None          | No intraday liquidity commitment window                              |
| **Failed settlement**       | Full rollback | If any leg fails, all four revert. Your USDCx stays in your account. |

<Info>
  The only risk you carry is **market risk** during the validity window of your quote. If the market moves against you between quoting and settlement (\~15 seconds total), your committed rate stands. Manage this by setting appropriate `valid_until` windows.
</Info>

## Liquidity Management

### What You Need

Deposit USDCx with sufficient balance to cover your expected quoting activity. Your USDCx is committed only when a quote is accepted and settlement executes — pending quotes do not lock funds.

### Monitoring

Track your performance via the dashboard:

| Metric                  | Description                          |
| ----------------------- | ------------------------------------ |
| `quotes_submitted`      | Total quotes you've submitted        |
| `quotes_accepted`       | Quotes that won                      |
| `quotes_rejected`       | Quotes where another MM won          |
| `quotes_expired`        | Quotes that expired unselected       |
| `win_rate`              | Accepted / submitted ratio           |
| `total_source_traded`   | Total JPYSC0 received from won swaps |
| `total_target_traded`   | Total USDCx delivered in won swaps   |
| `active_quote_requests` | Currently quotable requests          |

### Liquidity Strategy

* **Deposit sizing**: Based on your expected daily volume and win rate
* **Rate management**: Tighter spreads win more flow but reduce per-trade P\&L
* **Validity tuning**: Shorter `valid_until` reduces market risk; longer windows increase win probability
* **Volume monitoring**: Track `active_quote_requests` to gauge current demand
