walt/program/instructions
instructions
everything the program can do, and what has to happen first.
definition
trade lands open_ticket needs a trade signature with no ticket fund_ticket needs an open ticket settle_ticket needs a paid ticket and two hashes advance_root needs a settled ticket not yet counted row requested sell_row needs a settled payment for price(n)
what it is
nothing in the program reads a clock. each instruction has a condition that is either true on chain or not, and anyone may send the instruction once it is true. if no trade lands, nothing can be called.
open_ticket, fund_ticket and advance_root are open to any signer. settle_ticket needs walt's key because it carries the hashes. sell_row needs proof that the stated price was paid.
an instruction that would leave value in the meter fails. each one ends by sending what remains to a burn.
instructions
| instruction | signer | effect |
|---|---|---|
| open_ticket | anyone | create the ticket for one trade |
| fund_ticket | anyone | convert that trade's fee to usdc, set class and budget |
| settle_ticket | walt | write receipt and thought hashes, burn the leftover |
| void_ticket | walt | close a ticket with no thought, burn its budget |
| advance_root | anyone | add the new leaves, raise the sequence |
| open_channel | walt | deposit usdc for one provider |
| claim_channel | provider or facilitator | raise the watermark to the newest voucher |
| close_channel | walt or facilitator | pay to the watermark, burn the rest |
| sell_row | walt | count the sale, swap the payment, burn it |
notes
the order inside one trade is fixed: open, fund, pay off chain, settle, advance. a step cannot be skipped because each checks the state the one before it left.
figure
the two paths through the program.
what each step checks
| instruction | must be true first |
|---|---|
| open_ticket | no ticket exists for this trade signature |
| fund_ticket | ticket status is open |
| settle_ticket | ticket status is paid |
| void_ticket | ticket status is open or paid |
| advance_root | ticket is settled and not yet counted |
| claim_channel | voucher total is above the watermark |
| close_channel | channel status is open |
| sell_row | payment for price(n) has settled |