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

# Orderly Network

> Venue-aware verification for Orderly Network — pass the exact REST payload your agent is about to sign, get a verdict on the real market, size, and leverage, bound to those bytes.

Chance understands Orderly Network natively. Submit the **exact REST body** your agent is about to send — an order, a leverage update, a withdrawal — and the harness will classify it deterministically, **verify the symbol against Orderly's live market registry** (mark price, tick sizes, minimum notional, max leverage), and judge it against your mandate with Orderly's own documentation in the loop — returning a signed verdict whose `requestHash` binds to those exact bytes.

## What gets recognized

| Family       | Payloads                                                                                                                                                    |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `order`      | New orders (LIMIT, MARKET, IOC, FOK, POST\_ONLY, ASK, BID), batch orders, algo/trigger orders (STOP, TP/SL, brackets, trailing stops), edits, cancellations |
| `margin`     | Leverage updates (single-symbol and account-wide batch), margin-mode switches, isolated-position margin add/reduce                                          |
| `withdrawal` | EIP-712 signed withdrawal requests, including cross-chain withdrawals                                                                                       |
| `transfer`   | Internal transfers between Orderly accounts                                                                                                                 |
| `position`   | PnL settlement requests                                                                                                                                     |

For orders, the classifier decodes side, size, price, order type, reduce-only, and margin mode — and computes notional. Because Orderly MARKET orders carry no price at all, it re-estimates the dollar size from the live mark price. The judge reasons over:

```text theme={null}
Orderly ORDER: BUY 2.5 ETH on PERP_ETH_USDC @ 1700 (LIMIT) ≈ $4,250.00 notional
— resolved: PERP_ETH_USDC is ACTIVE, mark price $1,701.84, max leverage 100x.
```

That resolution step is what catches the classic perp failures: an agent whose mandate says *"max \$1,000 per position"* sending a MARKET order whose payload contains no dollar figure anywhere; a quantity typed in dollars instead of ETH (off by 1,700x); a leverage update that quietly omits the symbol and re-levers the **entire account**; a withdrawal whose `"1000000"` means one USDC — or a million, depending on who's reading. The classifier decodes the units, the enrichment prices the order, and the judge sees the real number. If a symbol can't be resolved, the verdict leans ESCALATE rather than trusting the agent's own description: fail closed, never allow on assumption.

## Use it from your bot

Wrap the request you were already going to sign:

```ts theme={null}
const order = {
  symbol: "PERP_ETH_USDC",
  order_type: "LIMIT",
  order_price: 1700,
  order_quantity: 0.5,
  side: "BUY",
  reduce_only: false,
};

const res = await fetch("https://harness.chance.cc/api/v1/intent", {
  method: "POST",
  headers: { "x-api-key": process.env.CHANCE_API_KEY!, "Content-Type": "application/json" },
  body: JSON.stringify({
    intent: "Swing-trade ETH and BTC perps only. Max $1,000 notional per order. Leverage stays at or below 5x. Never withdraw.",
    venue: "orderly",
    action: order, // the exact payload — the verdict binds to these bytes
  }),
});

const { verdict, reasoning, mode } = await res.json();
if (verdict !== "ALLOW") throw new Error(`Blocked: ${reasoning}`);
// only now sign the request with your Orderly key and POST it to /v1/order
```

`venue` is optional — Orderly payload shapes (the `PERP_*_USDC` symbol format, the EIP-712 withdrawal envelope) are auto-detected — and freeform `action` descriptions still work (`mode: "semantic"`).

## Use it from Claude or ChatGPT

Add the hosted connector (`https://harness.chance.cc/api/mcp`, see [Connectors](/connectors)) and give your agent one standing instruction:

> Before sending any Orderly Network request — orders, leverage changes, withdrawals, transfers — call `verify_intent` with my rules as the intent and the exact REST body as the action, with `venue: "orderly"`. Only proceed on ALLOW; on BLOCK or ESCALATE, stop and tell me why.

Agents with Orderly execution tools then get gated automatically; agents without them still give you provable pre-trade checks in chat.

## How the harness knows Orderly

The judge works from a **versioned snapshot of Orderly's own docs** — order creation and every order-type behavior, algo/trigger orders, order management, margin and leverage mechanics, withdrawals, internal transfers and PnL settlement, authentication, per-symbol order rules, and the full error-code table — plus a curated brief of the venue's footguns (base-unit vs dollar sizing, the account-wide batch leverage mode, raw-decimal withdrawal amounts, REDUCE margin being the risky direction, cancel-all's optional symbol filter). Static knowledge is never fetched at verdict time; the only live calls are the public symbol lookups that verify the market exists and price the order at mark, and what they resolve is recorded in the verdict's hash-chained transcript. Every documentation page the judge consults is chained with its content hash — the receipt proves exactly which knowledge, at which version, informed the decision. See [Architecture](/concepts/architecture).

## What the receipt adds for Orderly

On top of the standard proof bundle (transcript root, judge signature, onchain anchor), venue-aware verdicts carry `venue: "orderly"`, the `actionFamily`, the venue `actionType`, `mode: "structured"`, the knowledge-snapshot version — and the resolved symbol facts (status, mark price at verdict time, tick and notional rules, max leverage), all inside the hash-chained transcript.

<Note>
  **Roadmap:** escrowed execution — the same contract, but an ALLOW triggers submission by a Chance-held Orderly key and a BLOCK physically never reaches one. The payload-first contract above is forward-compatible with it.
</Note>
