# On-chain overview

> How AGARA orders, fills, balances, funding, and withdrawals map to on-chain state.

AGARA matches orders off-chain and settles fills on-chain. Your collateral and
outcome tokens remain in your AGARA account contract while you trade.

If you only read market data and place orders, the API handles these details.
Read this section when you fund or withdraw, manage
[positions](/docs/on-chain/positions), or reconcile
[trading inventory](/docs/api-traders/inventory).

## What lives where [#what-lives-where]

| Where     | What                                                                  |
| --------- | --------------------------------------------------------------------- |
| Off-chain | Orderbook, matching, order controls, and fill notifications           |
| On-chain  | Collateral, binary outcome tokens, settlement, and resolution payouts |

Track an order with its [status](/docs/conventions#order-status). Do not treat a
match as settled until its trade reports confirmed settlement.

## Network and collateral [#network-and-collateral]

This deployment uses Base (chain ID `8453`) and
USD Coin (`USDC`). Verify the token and addresses in
[Collateral](/docs/tokens/collateral) and [CTF tokens](/docs/tokens/ctf) before
signing or moving funds.

| Contract | Production address |
| --- | --- |
| Agara Account Registry | [`0x92f14F46B636154F1358728A3755Ad0694371584`](https://basescan.org/address/0x92f14F46B636154F1358728A3755Ad0694371584) |
| Collateral | [`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`](https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) |
| Conditional Tokens | [`0xe12D566cE5Dd8d817488E85a81386878649e3A18`](https://basescan.org/address/0xe12D566cE5Dd8d817488E85a81386878649e3A18) |
| Standard CTF Exchange and order-signing contract | [`0xD06f3fA925D35077A11dB42c6614D684f10B2aD6`](https://basescan.org/address/0xD06f3fA925D35077A11dB42c6614D684f10B2aD6) |
| Automatic redemption | [`0xCDA8a1De44D489070294E9A6a535555523c29e63`](https://basescan.org/address/0xCDA8a1De44D489070294E9A6a535555523c29e63) |

You normally do not call these contracts directly. The API and web app build
the supported transactions.

Every AGARA market is binary. A neg-risk event can group several mutually
exclusive markets, but each member remains an ordinary binary condition.

## Trade settlement modes [#trade-settlement-modes]

When orders match, settlement uses one of three modes:

| Mode     | Match                             | Result                                                                                       |
| -------- | --------------------------------- | -------------------------------------------------------------------------------------------- |
| `NORMAL` | BUY and SELL for the same outcome | Outcome shares move to the buyer; collateral moves to the seller                             |
| `MINT`   | Complementary BUY orders          | Both buyers contribute collateral; a complete pair is minted and each buyer receives one leg |
| `MERGE`  | Complementary SELL orders         | A complete pair is burned and collateral returns to the sellers                              |

You do not select the mode. The fill's `settlement_mode` reports the chosen
path. Explicit [split and merge operations](/docs/on-chain/positions) use the same token
primitives without an orderbook match.

## Funding [#funding]

Use **Deposit** in the web app, or send `USDC` on
Base directly to the AGARA deposit-wallet address shown in
Settings. Unsupported tokens do not become trading collateral.

## Withdrawing [#withdrawing]

A same-chain withdrawal sends a chosen amount of `USDC` to an
address on Base. The standard web flow requires a current browser
session; a personal access token alone cannot authorize it. A self-custody
client with the owner key can submit a supported direct withdrawal in an
[owner-signed account batch](/docs/api-traders/account-batches).

The web app can also quote a supported destination token and network. Request
a fresh supported-assets response and quote before confirming because route
availability changes. A quoted route minimum can be higher than the standard
withdrawal minimum.

An accepted AGARA withdrawal returns a batch hash and settles asynchronously.
Wait for `SETTLED` before treating destination funds as final. The minimum is
`10000` micro units; the environment's batch ceiling can be higher. Batches
queue per account and settle in the order you started them.

## Authentication boundaries [#authentication-boundaries]

These operations require a current browser identity token:

* the standard web-app withdrawal;
* wallet registration, setup, and status.

Split and merge accept scoped personal access tokens. Owner-signed account
batches accept a PAT only alongside the account owner's valid signature.
