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

instructionsignereffect
open_ticketanyonecreate the ticket for one trade
fund_ticketanyoneconvert that trade's fee to usdc, set class and budget
settle_ticketwaltwrite receipt and thought hashes, burn the leftover
void_ticketwaltclose a ticket with no thought, burn its budget
advance_rootanyoneadd the new leaves, raise the sequence
open_channelwaltdeposit usdc for one provider
claim_channelprovider or facilitatorraise the watermark to the newest voucher
close_channelwalt or facilitatorpay to the watermark, burn the rest
sell_rowwaltcount 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

instructionmust be true first
open_ticketno ticket exists for this trade signature
fund_ticketticket status is open
settle_ticketticket status is paid
void_ticketticket status is open or paid
advance_rootticket is settled and not yet counted
claim_channelvoucher total is above the watermark
close_channelchannel status is open
sell_rowpayment for price(n) has settled
walt/program/instructions: nine instructions, none of them on a timer.