package tezos-protocol-013-PtJakart
Tezos/Protocol: economic-protocol definition
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-16.0.tar.gz
sha256=ad9e08819871c75ba6f4530b125f7d157799398e4d77a1e6bfea9d91ff37ff55
sha512=c5dc4d40cc09bc6980fbbdb5c2e105bf4252cf9cfcb2b49660b0ebe4dc789f6709ec3b3bf2f87d81580d3eed9521eeb1c960f24d9b14eb0285aaba1f84d10a9b
doc/src/tezos-protocol-013-PtJakart.raw/destination_repr.ml.html
Source file destination_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 119 120 121 122 123 124
(*****************************************************************************) (* *) (* 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@oxheadalpha.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 t = Contract of Contract_repr.t | Tx_rollup of Tx_rollup_repr.t (* If you add more cases to this type, please update the [test_compare_destination] test in [test/unit/test_destinatino_repr.ml] to ensure that the compare function keeps its expected behavior to distinguish between implicit accounts and smart contracts. *) include Compare.Make (struct type nonrec t = t let compare l1 l2 = match (l1, l2) with | (Contract k1, Contract k2) -> Contract_repr.compare k1 k2 | (Tx_rollup k1, Tx_rollup k2) -> Tx_rollup_repr.compare k1 k2 (* This function is used by the Michelson interpreter to compare addresses. It is of significant importance to remember that in Michelson, address comparison is used to distinguish between KT1 and tz1. As a consequence, we want to preserve that [tz1 < KT1 < others], which the two following lines ensure. The wildcards are therefore here for a reason, and should not be modified when new constructors are added to [t]. *) | (Contract _, _) -> -1 | (_, Contract _) -> 1 end) let to_b58check = function | Contract k -> Contract_repr.to_b58check k | Tx_rollup k -> Tx_rollup_repr.to_b58check k type error += Invalid_destination_b58check of string let () = let open Data_encoding in register_error_kind `Permanent ~id:"destination_repr.invalid_b58check" ~title:"Destination decoding failed" ~description: "Failed to read a valid destination from a b58check_encoding data" (obj1 (req "input" string)) (function Invalid_destination_b58check x -> Some x | _ -> None) (fun x -> Invalid_destination_b58check x) let of_b58check s = match Contract_repr.of_b58check s with | Ok s -> Ok (Contract s) | Error _ -> ( match Tx_rollup_repr.of_b58check s with | Ok s -> Ok (Tx_rollup s) | Error _ -> error (Invalid_destination_b58check s)) let encoding = let open Data_encoding in def "transaction_destination" ~title:"A destination of a transaction" ~description: "A destination notation compatible with the contract notation as given \ to an RPC or inside scripts. Can be a base58 implicit contract hash, a \ base58 originated contract hash, or a base58 originated transaction \ rollup." @@ splitted ~binary: (union ~tag_size:`Uint8 (Contract_repr.cases (function Contract x -> Some x | _ -> None) (fun x -> Contract x) @ [ case (Tag 2) (Fixed.add_padding Tx_rollup_repr.encoding 1) ~title:"Tx_rollup" (function Tx_rollup k -> Some k | _ -> None) (fun k -> Tx_rollup k); ])) ~json: (conv to_b58check (fun s -> match of_b58check s with | Ok s -> s | Error _ -> Data_encoding.Json.cannot_destruct "Invalid destination notation.") string) let pp : Format.formatter -> t -> unit = fun fmt -> function | Contract k -> Contract_repr.pp fmt k | Tx_rollup k -> Tx_rollup_repr.pp fmt k let in_memory_size = let open Cache_memory_helpers in function | Contract k -> h1w +! Contract_repr.in_memory_size k | Tx_rollup k -> h1w +! Tx_rollup_repr.in_memory_size k
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>