A maker supplies one venue from a pool and prices it for the others with quote lines. What a take asks of the maker depends on the pool venue’s settlement in GET /v1/venues. Steps over HTTP: maker quickstart. In TypeScript: SDK.

What to follow

Where a pool’s funds are: held and held_in (balances).

Passive market making

  1. Fund a pool.
  2. Publish quote lines and keep the lease alive.
  3. For each fill, the operator waits for the taker’s payment to be final, pays the taker from your pool, then claims the payment for you (deadlines).
  • GMX’s escrow on Arbitrum acts at the chain’s head, without waiting for Ethereum finality: a payment the sequencer later reorders away is not undone. Price that risk in your GMX quotes.
  • A taker paying from Lighter or Aster pays your linked account there; the server reads that transfer before the delivery. On Lighter it accepts transfers the sequencer executed before Ethereum proves them; the deployment’s fill cap bounds that risk.
  • Your pool pays deliveries the operator vouches for, under your signed quotes: the escrow cannot see the payment on the other chain (trust model).
  • Once a fill is delivered (maker_leg CLAIMED), its secret is in your fills (GET /v1/fills). It lets you claim the payment yourself (recovery).
  • Release capital through the API (releasing capital), or on chain after a one-day notice (recovery).

Active market making

The maker delivers each fill itself, by a transfer inside Lighter or Aster:
  1. The taker signs. Each fill delivered on Lighter or Aster gets maker_accept_by, at most 15 seconds later.
  2. The maker accepts it with POST /v1/fills/{id}/accept. The taker’s payment waits for every fill of the take to be accepted; one missed deadline expires the whole take unpaid.
  3. The operator reserves the fills (RESERVED) and sends the payment. Once it is locked and verified, the fill is PAID with payment_verified_at set.
  4. The maker transfers amount_out to delivery_to, executed by deliver_by.
  5. The maker reports the transfer with POST /v1/fills/{id}/delivery before report_by.
  6. The operator claims the payment for the maker. The fill’s secret lets the maker claim it too (recovery).
An accepted fill is owed, even if you cancel your quotes or close the pool afterwards: accept only what the bot can deliver. A fill whose quotes you cancelled before accepting cannot be accepted (409) and expires unpaid. A retried acceptance of an accepted fill answers 204.

Before quoting

  1. Sign in once with your master address, then ask LaMarge on Telegram or Discord to approve it (and to grant access while access is by invitation). Unapproved, a pool or line preparation answers MAKER_NOT_APPROVED.
  2. On each escrow venue you buy on, link an account and complete its setup. It is the recipient of your quotes there.
  3. Hold the inventory in an account owned by a dedicated address. Its key signs every delivery from the bot’s host, where the master key never goes. It can withdraw the whole account: keep there only what the bot may deliver.
  4. On Lighter, register an API key for that account with Lighter’s ChangePubKey, signed by the owner, at an unused index from 4 to 252 (253 and 254 are LaMarge’s). Read the account’s fee per transfer (how): 0 or 1 USDC so far; the order’s delivery_fee shows the fee the server last read. A Standard account allows 60 requests a minute.
  5. Open the pool with POST /v1/maker/{venue}/prepare, "funding_source":"venue". Nothing is signed: the preparation is complete and the pool live at once. One account backs one pool.
  6. Publish quote lines: the pool’s venue with sell and stock, and a buy price on each escrow venue you receive on.
amount is a cap that deliveries consume. Within it, the pool offers what the account could transfer at the last balance read, less delivery_fee for each reserved fill and the next one; nothing once that read is two minutes old.

Bot loop

  1. Renew the lease and publish lines. A pool whose identity’s lease was last renewed over two minutes ago leaves the book; back, the bot signs its quotes again.
  2. Follow the identity’s fills over the stream, from a snapshot.
  3. Accept each fill with maker_accept_by set and maker_accepted_at null, before maker_accept_by, while it can deliver.
  4. Deliver each PAID fill with payment_verified_at set, the earliest deliver_by first: one transfer of amount_out to delivery_to, never a second for the same fill (Lighter, Aster).
  5. Report each executed transfer (on Aster, its transferId).
  6. When it cannot deliver, stop accepting and stop quoting first.
  7. To stop: stop accepting, cancel quotes, then keep delivering and reporting until no accepted fill is owed anything.
The SDK’s AsterDeliverer and LighterDeliverer do steps 3 to 5 and accept only while their journal saves and no delivery’s outcome is unknown. A fill to accept, then deliver, as GET /v1/fills returns it (fields the bot reads):

Deadlines

Each fill carries its deadlines: read them, never compute them. settlement.delivery in /v1/info gives the deployment’s offsets and min_status, the Lighter status a delivery needs. A report is accepted until report_by, also once the leg is ABANDONED. Consenting to an early refund (refundPayment) gives up the payment, and no report is accepted after it: check your journal and the venue first. With Lighter’s Python or WebAssembly signer, which cannot set the expiry at deliver_by, send nothing within a minute of deliver_by. A refused report with 425 or 502 is sent again with the same hash; 400 and 409 are final, except not_due before the payment locks (reasons).

Retiring a pool

  1. Close it with POST /v1/closes; sign close_orders unless its held is 0.
  2. It closes at once when held is 0, otherwise once no fill awaits delivery. Accepted fills stay owed; reports are accepted until each fill’s report_by.
A later preparation adds its amount to a live pool’s cap and keeps its quotes. On a closed pool it reopens it without quotes, with a cap of what it delivered plus that amount. LaMarge can withdraw an approval: the maker’s pools leave the books at once; fills already reserved stay owed.