chordDocs

Trading

Placing an order

Every field on the order ticket, and what happens after you sign.

An order on Chord is a message you sign, not a transaction you send. It says what you’ll give, the least you’ll take for it, and which batch it’s for. The collector holds it until the batch clears, and the settlement program checks your signature again before it moves anything.

#The ticket

FieldWhat it sets
Buy / SellWhich side of the pair you’re on. Buying means paying the quote token for the base token; selling is the reverse.
You payThe exact amount you’re selling. Your balance shows beside it, and Max fills it in.
Limit priceThe worst price you accept, in quote per base. When buying it’s the highest price you’ll pay; when selling it’s the lowest you’ll accept.
PresetsLast or Ref sets the limit to the last clearing price (or the market’s reference price before any batch has cleared). The percentage chips add room on the side that helps you fill.
Allow a partial fillLets a solver fill part of the order when the batch can’t take all of it. Off, the order fills completely or not at all.

The summary under the fields shows three numbers:

  • You receive at least is the minimum output your signature will commit to. It is computed from your amount and limit, and rounded so that a batch clearing exactly at your limit still fills you. See Prices and rounding.
  • If it clears at … is what you’d receive if this batch cleared exactly at the last clearing price. It says Wouldn’t fill when your limit is on the wrong side of that price.
  • Batch shows the batch your order will join and when its window closes.

#What you sign

Your wallet shows a 32-byte message. It is the SHA-256 digest of the order below, bound to Chord’s program, its config and the chain, so it can’t be replayed anywhere else.

FieldValue the app fills in
BatchThe batch currently collecting, if more than six seconds remain; otherwise the next one
OwnerYour wallet
SourceYour token account for what you sell
DestinationYour token account for what you buy, created first if it doesn’t exist
Sell amountWhat you entered in You pay
Minimum buy amountYou receive at least
NonceA fresh number, never used by your wallet before
Expiry slotThe batch’s settlement deadline
Allow partialThe switch on the ticket

The exact byte layout is on Signed orders.

#What happens next

  1. The collector checks the signature, the batch, your balance and your allowance against finalized chain state, and stores the order.
  2. When collection closes, solvers see your order and include it in their quotes if your limit can be met.
  3. If the winning price meets your limit, the collector submits your fill. Your input and output move in one instruction.
  4. If the batch clears outside your limit, your order isn’t filled. Your tokens never moved, and the order needs a new signature to try again.

#Limits and checks

  • Each batch takes a limited number of orders. The standard limit is 32; when a batch is full, the app moves you to the next one.
  • Your source account must hold the full sell amount when you sign, and still hold it when your fill lands.
  • Frozen token accounts can’t trade. Token-2022 tokens aren’t supported.