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

# Orders

> What an order is, what it can hold, every state it passes through, and who can move it.

An order is two things: **escrow** on Ethereum, and a **request** that says exactly what must happen on another chain for that escrow to be released.

![The details of a settled order](https://mintcdn.com/ambi/YFcg3UdfEoAyYkl8/images/app/order-details-light.webp?fit=max\&auto=format\&n=YFcg3UdfEoAyYkl8\&q=85\&s=b1b21b71345c7d824987b52fc5182101)

## What you can lock

The escrow is either native ETH or any ERC-20.

* **ETH:** pass `token = address(0)` and send the amount as `msg.value`.
* **ERC-20:** the token must be a contract, and the market's balance must rise by exactly the amount transferred. Tokens that take a fee on transfer fail this check and are rejected.

There is no token list. Any ERC-20 that moves exact amounts can be escrowed. The market checks exact amounts again on withdrawal, so a token that charges on the way out cannot be withdrawn either. Rebasing tokens change balance without a transfer, so use their wrapped form (wstETH, not stETH).

## The request

| Field | Meaning | Checked by |
| - | - | - |
| `chain` | Destination chain, as `eip155:<chainId>` on EVM routes | Market (non-empty), verifier (matches its route) |
| `asset` | `native` or `erc20:<address>` on the destination | Market (non-empty), verifier |
| `recipient` | Who receives the payment | Market (non-empty), verifier (20 bytes, non-zero) |
| `routeData` | Router and token address, packed (40 bytes) | Verifier (router is the route's) |
| `amount` | Amount to pay, in the destination token's base units | Market (non-zero) |
| `verifier` | The inbox on Ethereum that judges the outcome | Registry (approved, code unchanged) |
| `payBy` | Payment deadline, on the destination chain's clock | Market (at least 30 minutes away) |
| `proveBy` | Unused on canonical routes; must be `0` | Verifier |

The market stores the hash of the request, not the request itself. The full request is in the `Listed` event and the API.

## The rate

The rate is implied: requested amount ÷ escrowed amount. 50,000 DAI for 854.57 MORPHO is 0.017091 MORPHO per DAI. Makers set it; fillers decide whether to take it.

## States

```mermaid theme={null}
stateDiagram-v2
    [*] --> Listed: list (maker)
    Listed --> Listed: requestFill / withdrawInterest (fillers)
    Listed --> Refunded: refund (maker, or anyone after payBy)
    Listed --> Matched: matchOffer (maker)
    Matched --> Filled: fulfill (anyone, after Paid)
    Matched --> Refunded: refundExpired (anyone, after ExpiredUnpaid)
    Matched --> Canceled: proposeCancel + acceptCancel (both parties)
    Filled --> [*]
    Refunded --> [*]
    Canceled --> [*]
```

![Matched: the filler is paying](https://mintcdn.com/ambi/YFcg3UdfEoAyYkl8/images/app/progress-matched-light.webp?fit=max\&auto=format\&n=YFcg3UdfEoAyYkl8\&q=85\&s=80519cf4f6a527ffa8bf81f1c2776c84)

An order mid-flight, as shown on its order page

## Transitions

| Call | Who | Requires | Effect |
| - | - | - | - |
| `list` | Anyone | Approved verifier, accepted terms, 30+ minutes to `payBy` | Escrow in; order **Listed** |
| `requestFill` | Anyone but the maker | Listed, before `payBy`, exact bond, fewer than 64 requests | Bond in |
| `withdrawInterest` | A requester | Still listed | Bond credited back |
| `matchOffer` | Maker | Filler requested, 30+ minutes to `payBy`, verifier code unchanged | **Matched**; other bonds credited back; statement fixed |
| `refund` | Maker; anyone once `payBy` passes | Listed | **Refunded**; escrow to maker, all bonds back |
| `fulfill` | Anyone | Matched; inbox recorded Paid | **Filled**; filler gets escrow − 0.30% − any integrator fee + bond |
| `refundExpired` | Anyone | Matched; inbox recorded ExpiredUnpaid | **Refunded**; maker gets escrow + bond |
| `proposeCancel` | Maker or filler | Matched, no open proposal | Proposal recorded |
| `acceptCancel` | The other party | Open proposal; inbox has not recorded Paid | **Canceled**; escrow to maker, bond to filler |

Every amount that leaves an order becomes a [credit](https://docs.ambichain.org/concepts/fees-and-credits.md). Nothing is sent during settlement.

## Where orders live

On-chain in `offers(id)`, indexed by the API at `GET /offers`, and on the app at `/order/<id>`.

![The live book on the Offers page](https://mintcdn.com/ambi/YFcg3UdfEoAyYkl8/images/app/offers-light.webp?fit=max\&auto=format\&n=YFcg3UdfEoAyYkl8\&q=85\&s=4dcd2c94768cbb5bdec3f7481d0e5796)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.