tickets
one ticket per trade. the address comes from the trade's signature, so a trade can only pay once.
definition
ticket_address = find_program_address( ["ticket", coin_mint, sha256(trade_signature)], walt_program )
what it is
a ticket is a small account that follows one trade from the moment it lands to the moment its thought is paid for. it holds the hash of the trade's signature, the wallet that traded, the class, the budget, and later the hashes of the receipt and the thought.
because the address is derived from the signature, opening a second ticket for the same trade fails. the account already exists. no counter and no list is needed to stop a trade from being used twice.
a ticket moves through four states and never goes back. open: the account exists and has no budget yet. paid: the fee has been converted and the payment for the thought has settled. settled: both hashes are written and the leftover has been burned. void: the trade could not be confirmed and the budget went straight to the burn.
seeds of the loaded trades
| signature | sha256(signature) | size usd | class |
|---|
notes
the seed column is the real hash of each real signature. the full ticket address also needs the program id, so it is not shown here.
a ticket is 178 bytes. the byte layout is drawn on the accounts page.
figure
a ticket only moves forward.
columns
| column | type | meaning |
|---|---|---|
| trade_sig_hash | [u8; 32] | sha256 of the trade signature |
| payer | pubkey | wallet that made the trade |
| size_usd_micros | u64 | trade size in millionths of a dollar |
| class | u8 | 0 to 3, from the size |
| budget_usdc | u64 | usdc set aside for this thought |
| status | u8 | 0 open, 1 paid, 2 settled, 3 void |
| receipt_hash | [u8; 32] | hash of the payment receipt |
| thought_hash | [u8; 32] | hash of the thought text |
| read_cost | u64 | usdc spent on chain reads |
| opened_slot | u64 | slot the ticket was opened |
| settled_slot | u64 | slot the ticket was settled |