walt/program/accounts
accounts
the accounts the program owns and what each one holds.
definition
meter = pda(["meter", coin_mint]) ticket = pda(["ticket", coin_mint, sha256(trade_signature)]) channel = pda(["channel", coin_mint, provider]) root = pda(["root", coin_mint]) row = pda(["row", coin_mint, table_id, row_id])
what it is
every account is found from the coin's mint and a few fixed words. nothing is stored in a list that has to be searched. if you know the coin and the trade, you know where the ticket is.
the meter is the only account that touches money. the fee arrives there, is converted, and leaves through a ticket, a sale or a channel before the instruction ends.
the row account is a counter. it exists only for rows that have been sold at least once and holds how many times. the price follows from that count alone.
accounts
| account | one per | holds |
|---|---|---|
| meter | coin | fee vault, usdc vault, running totals, root sequence |
| ticket | trade | trade hash, payer, class, budget, status, two hashes |
| channel | provider | deposit, watermark, nonce, call count |
| root | coin | sequence, top root, nine table roots |
| row | sold row | sale count, last price |
notes
the drawing shows the ticket, the account that exists once per trade. each cell is one byte.
figure
the ticket account, 178 bytes. fields alternate shade in the order listed.
ticket fields
| field | bytes | size |
|---|---|---|
| discriminator | 0 to 8 | 8 |
| trade_sig_hash | 8 to 40 | 32 |
| payer | 40 to 72 | 32 |
| size_usd_micros | 72 to 80 | 8 |
| class | 80 to 81 | 1 |
| budget_usdc | 81 to 89 | 8 |
| status | 89 to 90 | 1 |
| receipt_hash | 90 to 122 | 32 |
| thought_hash | 122 to 154 | 32 |
| read_cost | 154 to 162 | 8 |
| opened_slot | 162 to 170 | 8 |
| settled_slot | 170 to 178 | 8 |