Skip to main content

The flow

1

Read the deployment

GET /config returns the chain, the order protocol address (contracts.lop) and the tokens with their decimals. Read it at startup; it is cacheable for 60 seconds.
2

Ask for a quote

GET /quote prices sellToken to buyToken for exactly one of sellAmount (exact-in) or buyAmount (exact-out). Pass as taker the address that will send the transaction. The answer is an order signed by a market maker plus the calldata that fills it.
3

Approve

From the taker address, approve fill.allowanceTarget (the order protocol) for the token you sell. Once is enough if you approve a large amount.
4

Fill

Send fill.to, fill.data and fill.value from the taker address before expiresAt. Send them exactly as returned.
5

Read the receipt

The transaction delivers exactly buyAmount of the bought token to the taker, or reverts. The Transfer logs in the receipt are your confirmation; GET /orders/{hash} shows the same fill once indexed.

What a quote is

A quote is an ordinary order on the order protocol that a market maker signs for you: maxFirmSize in every quote is the largest amount the maker can pay right now at this rate, in both tokens. It is a fact about the present, not a promise about the future. To see it before asking, read GET /levels.

Who does what

The fill is sent by your wallet straight to the order protocol. No Aile server is in that path, and no Aile server can block, delay or alter a fill once the quote is signed.

What the chain enforces, and what it does not

On chain, the order protocol checks that the signature recovers to the maker, that msg.sender is the pinned taker, that the order has not expired and that its nonce is unspent, then transfers both tokens at the signed amounts. If any step fails, the whole transaction reverts and nothing moves. The chain does not check the price. The rate is whatever the maker signed; that is what “firm” means. The maker prices off chain from a Chainlink FX feed (CAD, EUR, SGD, IDR, GBP, TRY against USD) plus its spread, and referenceRate in the quote tells you the mid it used, so you can judge the rate before you send.

Pause

The owner of the order protocol can pause it. A paused protocol refuses every new fill and GET /quote answers 503 kill-switch. Pausing never moves funds and cannot change an order; it only stops new fills while an incident is handled.

Reading the result

A fill emits OrderFilled(orderHash, remainingAmount) with remainingAmount 0. The gateway’s indexer reads it within a few seconds and marks the quote filled; your receipt’s Transfer logs tell you the same sooner. If the fill reverts with OrderExpired, the 30 seconds passed: request a new quote. BitInvalidatedOrder means this quote was already filled.