DocsKernel ↗Trade
The program

The program

Address7AY437YN1dupEhyahmKAQ6KTRm4nVx52BdyVzTcJbuRZ (devnet)
Sourcegithub.com/solatorxyz/xyz-engine, Apache-2.0
Frameworkpinocchio, no Anchor

Accounts

AccountBytesWhat it holds
Market896Parameters, price, funding index, caps, pending changes
Insurance56One market's insurance balance
User2,048Cash, up to 16 positions, up to 4 triggers; bound to one vault
Shard10,096Up to 64 resting orders of one side and price range, and fills waiting to be booked
Fast book2,192The makers quoting a market
Slab41,056One maker's quotes for many markets
Feed160One publisher's price
Rank696Who is reduced first in auto-deleveraging
Pool168A vault shared by several markets

Every instruction is one byte of tag followed by its data, little-endian.

Instructions used on this site

TagNameWho may send it
1placeThe account's owner, or its one-click key
2cancelThe same
4update_oracleAnyone
6backstopAnyone: auto-deleveraging of an account worth less than nothing
10init_marketAnyone, for a market on its own; a pool's admin, for a pooled one
11init_shardThe market's admin
12init_userAnyone, for themselves
13depositThe account's owner
14withdrawThe account's owner
16aggregateAnyone
22adminThe market's admin: pause and caps
24crank_claimAnyone
26init_rankThe market's admin
28admin_proposeThe market's admin
29admin_executeAnyone, after the wait
34liquidate_bookAnyone
40agg_initAnyone, for a feed of their own
41agg_postThe feed's key
61fast_initThe market's admin
66take_fastThe account's owner, or its one-click key
70liquidate_fastAnyone
89agg_post_signedAnyone, carrying the feed key's signature
90ins_fundAnyone
91fee_claimThe admin of a market on its own

A market's name

The feed id a market is created with is 32 bytes. For a market opened with the CLI it is the ASCII text dex:TICKER/USD (the dex: part optional), zero-filled. Anyone can read a market's name back from offset 168 of its account.

Finding markets opened by anyone

Program accounts of 896 bytes whose 32 bytes at offset 576 (the pool) are zero. Their shards are program accounts of 10,096 bytes with the market's address at offset 8 and the side at offset 40.