Agora Docs

Orders

An order is an EIP-712 message signed by the trader and held off-chain in a book. A relayer matches a long against a short and submits both signatures in one transaction, which opens the pair.

Field Meaning
trader signer
market market id
side 0 long, 1 short
margin USDG to post
leverage up to 25
tp, sl optional trigger levels, 0 for none
limitPrice worst acceptable fill; 0 for market
nonce replay protection
expiry unix seconds

Limit price

limitPrice is part of the signed payload and is checked on-chain against the fill price: a long's fill must be at or below its limit, a short's at or above.

Without a signed price, a signature authorising "open a long with 1,000 margin at 10×" is valid at any price, and a relayer could hold it and submit at the worst moment — a free option against the signer. With the limit signed, an order fills only at a price its signer agreed to. Two orders that cross with no mutually acceptable price do not match and both rest.

Smart-account signatures are supported via ERC-1271.

Cancellation

An order may be cancelled from the book at any time before a match, by its signer only. An expired order cannot be matched.

Matching is a transaction, so a cancel arriving while a match is in flight may lose the race. The book reports fills only after the transaction is mined and re-queues an order if the transaction reverted.

A position opened by a limit order closes the same way as any other, through closePair() or a trigger.