ligo/lib_embedded_protocol_alpha/src/manager_repr.ml
Grégoire Henry 9cb498eee6 Jbuilder: Move alpha/genesis/demo in their own two OPAM packages
One package for the embedded version. One for the functorized one.
2017-12-04 16:05:54 +01:00

41 lines
1.2 KiB
OCaml

(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2017. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
(* Tezos Protocol Implementation - Low level Repr. of Managers' keys *)
type manager_key =
| Hash of Ed25519.Public_key_hash.t
| Public_key of Ed25519.Public_key.t
type t = manager_key
open Data_encoding
let hash_case tag =
case ~tag Ed25519.Public_key_hash.encoding
(function
| Hash hash -> Some hash
| _ -> None)
(fun hash -> Hash hash)
let pubkey_case tag =
case ~tag Ed25519.Public_key.encoding
(function
| Public_key hash -> Some hash
| _ -> None)
(fun hash -> Public_key hash)
let encoding =
union [
hash_case 0 ;
pubkey_case 1 ;
]