package tezos-protocol-015-PtLimaPt
Tezos protocol 015-PtLimaPt package
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/tezos_raw_protocol_015_PtLimaPt/tx_rollup_message_repr.ml.html
Source file tx_rollup_message_repr.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2022 Marigold <contact@marigold.dev> *) (* Copyright (c) 2022 Nomadic Labs <contact@nomadic-labs.com> *) (* Copyright (c) 2022 Oxhead Alpha <info@oxhead-alpha.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type deposit = { sender : Signature.Public_key_hash.t; destination : Tx_rollup_l2_address.Indexable.value; ticket_hash : Ticket_hash_repr.t; amount : Tx_rollup_l2_qty.t; } let deposit_encoding = let open Data_encoding in conv (fun {sender; destination; ticket_hash; amount} -> (sender, destination, ticket_hash, amount)) (fun (sender, destination, ticket_hash, amount) -> {sender; destination; ticket_hash; amount}) @@ obj4 (req "sender" Signature.Public_key_hash.encoding) (req "destination" Tx_rollup_l2_address.Indexable.value_encoding) (req "ticket_hash" Ticket_hash_repr.encoding) (req "amount" Tx_rollup_l2_qty.encoding) let batch_encoding = let open Data_encoding in let json = conv Bytes.of_string Bytes.to_string bytes in splitted ~json ~binary:string type t = Batch of string | Deposit of deposit let encoding = let open Data_encoding in union ~tag_size:`Uint8 [ case (Tag 0) ~title:"Batch" (obj1 (req "batch" batch_encoding)) (function Batch batch -> Some batch | _ -> None) (fun batch -> Batch batch); case (Tag 1) ~title:"Deposit" (obj1 (req "deposit" deposit_encoding)) (function Deposit deposit -> Some deposit | _ -> None) (fun deposit -> Deposit deposit); ] let pp fmt = let open Format in function | Batch str -> let subsize = 10 in let str, ellipsis = if Compare.Int.(subsize < String.length str) then let substring = String.sub str 0 subsize in (substring, "...") else (str, "") in fprintf fmt "@[<hov 2>Batch:@ %s%s@]" (Hex.of_string str |> Hex.show) ellipsis | Deposit {sender; destination; ticket_hash; amount} -> fprintf fmt "@[<hov 2>Deposit:@ sender=%a,@ destination=%a,@ ticket_hash=%a,@ \ amount:%a@]" Signature.Public_key_hash.pp sender Tx_rollup_l2_address.Indexable.pp destination Ticket_hash_repr.pp ticket_hash Tx_rollup_l2_qty.pp amount let size = function | Batch batch -> String.length batch | Deposit {sender = _; destination = d; ticket_hash = _; amount = _} -> (* Size of a BLS public key, that is the underlying type of a l2 address. See [Tx_rollup_l2_address] *) let sender_size = Signature.Public_key_hash.size in (* Size of a BLS public key, that is the underlying type of a l2 address. See [Tx_rollup_l2_address] *) let destination_size = Tx_rollup_l2_address.Indexable.size d in (* Size of a [Script_expr_hash.t], that is the underlying type of [Ticket_hash_repr.t]. *) let key_hash_size = 32 in (* [int64] *) let amount_size = 8 in sender_size + destination_size + key_hash_size + amount_size
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>