package tezos-protocol-012-Psithaca
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ad9e08819871c75ba6f4530b125f7d157799398e4d77a1e6bfea9d91ff37ff55
sha512=c5dc4d40cc09bc6980fbbdb5c2e105bf4252cf9cfcb2b49660b0ebe4dc789f6709ec3b3bf2f87d81580d3eed9521eeb1c960f24d9b14eb0285aaba1f84d10a9b
doc/tezos-protocol-012-Psithaca.raw/Tezos_raw_protocol_012_Psithaca/Ticket_storage/index.html
Module Tezos_raw_protocol_012_Psithaca.Ticket_storageSource
A value of type key_hash is a hashed combination of:
- Ticketer
- Content type
- Content
- Owner
script_expr_hash_of_key_hash key_hash returns a Script_expr_hash.t value representation of the given key_hash. This is useful for comparing and pretty-printing key-hash values.
val make_key_hash :
Raw_context.t ->
ticketer:Script_repr.node ->
typ:Script_repr.node ->
contents:Script_repr.node ->
owner:Script_repr.node ->
(key_hash * Raw_context.t)
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresultmake_key_hash ctxt ~ticketer ~typ ~contents ~owner creates a hashed representation of the given ticketer, typ, contents and owner.
val get_balance :
Raw_context.t ->
key_hash ->
(Tezos_protocol_environment_012_Psithaca.Z.t option * Raw_context.t)
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.tget_balance ctxt key receives the ticket balance for the given key in the context ctxt. The key represents a ticket content and a ticket creator pair. In case there exists no value for the given key, None is returned.
val adjust_balance :
Raw_context.t ->
key_hash ->
delta:Tezos_protocol_environment_012_Psithaca.Z.t ->
(Tezos_protocol_environment_012_Psithaca.Z.t * Raw_context.t)
Tezos_protocol_environment_012_Psithaca.Error_monad.tzresult
Tezos_protocol_environment_012_Psithaca.Lwt.tadjust_balance ctxt key ~delta adjusts the balance of the given key (representing a ticket content, creator and owner pair) and delta. The value of delta can be positive as well as negative. If there is no pre-exising balance for the given ticket type and owner, it is assumed to be 0 and the new balance is delta. The function also returns the difference between the old and the new size of the storage. Note that the difference may be negative. For example, because when setting the balance to zero, an entry is removed.
The function fails with a Negative_ticket_balance error in case the resulting balance is negative.