Tezos has so-called tickets, which are authenticated quantities issued by contracts. A ticket of type
sp.ticket[t] has three elements:
Its ticketer, indicating the contract that issued the ticket.
Its contents of type
Its amount of type
- sp.ticket(contents: t, amount: sp.nat) → sp.ticket[t]
Create a ticket with the given contents and amount. The ticketer is the address of
- sp.read_ticket(ticket: sp.ticket[t]) → sp.pair[sp.record(ticketer=sp.address, contents=t, amount=sp.nat), sp.ticket[t]]
Reads the contents of a ticket. Returns a pair of:
The ticket data, itself a record of the ticket's ticketer, contents, and amount.
A copy of the original ticket that can still be used.
Note that mentioning a ticket consumes it, i.e. the argument to
sp.read_ticketcannot be used again. Instead the returned copy can still be used.
- sp.join_tickets(t1: sp.ticket[t], t2: sp.ticket[t]) → sp.ticket[t]
Makes two tickets into one by adding up their quantities. Fails if the tickets differ in their ticketer or contents.