# Settlement Paths

When the off-chain operator submits a matched order pair to the on-chain settlement program, the program executes one of three settlement paths. The correct path depends on the nature of the matched orders.

## The three paths

### NORMAL

Used when a buy order on one outcome is matched against a sell order on the same outcome. Shares and USDC transfer directly between the two parties.

Example: Alice holds 100 YES shares and wants to exit. Bob wants to buy 100 YES shares. The operator matches their orders. At settlement, Alice's 100 YES shares transfer to Bob, and Bob's USDC transfers to Alice.

No new shares are minted or burned.

### MINT

Used when two buy orders on complementary outcomes are matched against each other. Neither party holds the shares the other wants, so the protocol mints them.

Example: Alice wants to buy 100 YES shares and Bob wants to buy 100 NO shares at prices that together sum to $1.00 (for example, YES at $0.60 and NO at $0.40). The operator matches their orders. At settlement, the program collects USDC from both Alice and Bob, mints 100 YES/NO pairs, and distributes the appropriate shares.

Net effect: 100 USDC enters the market and 100 new YES/NO pairs are created.

### MERGE

Used when two sell orders on complementary outcomes are matched against each other. Both parties want to exit, and their combined YES/NO shares can be merged back into USDC.

Example: Alice holds 100 YES shares and wants to sell. Bob holds 100 NO shares and wants to sell. The operator matches their orders. At settlement, the program takes Alice's YES shares and Bob's NO shares, merges them into USDC, and distributes the proceeds.

Net effect: 100 YES/NO pairs are destroyed and 100 USDC exits the market.

## Summary

| Path       | Trigger                             | Net market effect               |
| ---------- | ----------------------------------- | ------------------------------- |
| **NORMAL** | Buy matched with sell, same outcome | No change in outstanding shares |
| **MINT**   | Two buys on complementary outcomes  | USDC in, new shares out         |
| **MERGE**  | Two sells on complementary outcomes | Shares in, USDC out             |

## Atomicity

All three settlement paths execute as a single atomic Solana transaction. Either the full settlement succeeds and all account state changes apply, or the transaction fails and nothing changes. There is no partial settlement state.

This atomicity guarantee is a property of the Solana runtime and does not require any additional logic in the settlement program.

{% hint style="info" %}
The settlement program verifies both order signatures before executing any path. An order cannot be settled unless the user who placed it signed it with their wallet. The operator coordinates settlement but cannot fabricate or modify orders.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pitchcast.xyz/trading/settlement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
