Tickets
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
t
.Its amount of type
sp.nat
.
- 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.self_address
.
- 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_ticket
cannot be used again. Instead the returned copy can still be used.