The program
| Address | 7AY437YN1dupEhyahmKAQ6KTRm4nVx52BdyVzTcJbuRZ (devnet) |
| Source | github.com/solatorxyz/xyz-engine, Apache-2.0 |
| Framework | pinocchio, no Anchor |
Accounts
| Account | Bytes | What it holds |
|---|---|---|
| Market | 896 | Parameters, price, funding index, caps, pending changes |
| Insurance | 56 | One market's insurance balance |
| User | 2,048 | Cash, up to 16 positions, up to 4 triggers; bound to one vault |
| Shard | 10,096 | Up to 64 resting orders of one side and price range, and fills waiting to be booked |
| Fast book | 2,192 | The makers quoting a market |
| Slab | 41,056 | One maker's quotes for many markets |
| Feed | 160 | One publisher's price |
| Rank | 696 | Who is reduced first in auto-deleveraging |
| Pool | 168 | A vault shared by several markets |
Every instruction is one byte of tag followed by its data, little-endian.
Instructions used on this site
| Tag | Name | Who may send it |
|---|---|---|
| 1 | place | The account's owner, or its one-click key |
| 2 | cancel | The same |
| 4 | update_oracle | Anyone |
| 6 | backstop | Anyone: auto-deleveraging of an account worth less than nothing |
| 10 | init_market | Anyone, for a market on its own; a pool's admin, for a pooled one |
| 11 | init_shard | The market's admin |
| 12 | init_user | Anyone, for themselves |
| 13 | deposit | The account's owner |
| 14 | withdraw | The account's owner |
| 16 | aggregate | Anyone |
| 22 | admin | The market's admin: pause and caps |
| 24 | crank_claim | Anyone |
| 26 | init_rank | The market's admin |
| 28 | admin_propose | The market's admin |
| 29 | admin_execute | Anyone, after the wait |
| 34 | liquidate_book | Anyone |
| 40 | agg_init | Anyone, for a feed of their own |
| 41 | agg_post | The feed's key |
| 61 | fast_init | The market's admin |
| 66 | take_fast | The account's owner, or its one-click key |
| 70 | liquidate_fast | Anyone |
| 89 | agg_post_signed | Anyone, carrying the feed key's signature |
| 90 | ins_fund | Anyone |
| 91 | fee_claim | The 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.