123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022 Nomadic Labs, <contact@nomadic-labs.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. *)(* *)(*****************************************************************************)openProtocolopenAlpha_contextmoduleManager_operation=structtypet=packed_manager_operationletencoding:tData_encoding.t=letopenData_encodinginletopenOperation.Encoding.Manager_operationsinletmake(MCase{tag;name;encoding;select;proj;inj})=case(Tagtag)~title:name(merge_objs(obj1(req"kind"(constantname)))encoding)(funo->matchselectowithNone->None|Someo->Some((),projo))(fun((),x)->Manager(injx))indef"manager_operation"@@union[makereveal_case;maketransaction_case;makeorigination_case;makedelegation_case;makeset_deposits_limit_case;makeincrease_paid_storage_case;makeregister_global_constant_case;maketx_rollup_origination_case;maketx_rollup_submit_batch_case;maketx_rollup_commit_case;maketx_rollup_return_bond_case;maketx_rollup_finalize_commitment_case;maketx_rollup_remove_commitment_case;maketx_rollup_rejection_case;maketx_rollup_dispatch_tickets_case;maketransfer_ticket_case;makedal_publish_slot_header_case;makesc_rollup_originate_case;makesc_rollup_add_messages_case;makesc_rollup_cement_case;makesc_rollup_publish_case;makesc_rollup_refute_case;makesc_rollup_timeout_case;makesc_rollup_execute_outbox_message_case;makesc_rollup_recover_bond_case;makesc_rollup_dal_slot_subscribe_case;]letget_case:typekind.kindmanager_operation->kindOperation.Encoding.Manager_operations.case=letopenOperation.Encoding.Manager_operationsinfunction|Reveal_->reveal_case|Transaction_->transaction_case|Origination_->origination_case|Delegation_->delegation_case|Register_global_constant_->register_global_constant_case|Set_deposits_limit_->set_deposits_limit_case|Increase_paid_storage_->increase_paid_storage_case|Update_consensus_key_->update_consensus_key_case|Tx_rollup_origination->tx_rollup_origination_case|Tx_rollup_submit_batch_->tx_rollup_submit_batch_case|Tx_rollup_commit_->tx_rollup_commit_case|Tx_rollup_return_bond_->tx_rollup_return_bond_case|Tx_rollup_finalize_commitment_->tx_rollup_finalize_commitment_case|Tx_rollup_remove_commitment_->tx_rollup_remove_commitment_case|Tx_rollup_rejection_->tx_rollup_rejection_case|Tx_rollup_dispatch_tickets_->tx_rollup_dispatch_tickets_case|Transfer_ticket_->transfer_ticket_case|Dal_publish_slot_header_->dal_publish_slot_header_case|Sc_rollup_originate_->sc_rollup_originate_case|Sc_rollup_add_messages_->sc_rollup_add_messages_case|Sc_rollup_cement_->sc_rollup_cement_case|Sc_rollup_publish_->sc_rollup_publish_case|Sc_rollup_refute_->sc_rollup_refute_case|Sc_rollup_timeout_->sc_rollup_timeout_case|Sc_rollup_execute_outbox_message_->sc_rollup_execute_outbox_message_case|Sc_rollup_recover_bond_->sc_rollup_recover_bond_case|Sc_rollup_dal_slot_subscribe_->sc_rollup_dal_slot_subscribe_case|Zk_rollup_origination_->zk_rollup_origination_case|Zk_rollup_publish_->zk_rollup_publish_caseletpp_kindppfop=letopenOperation.Encoding.Manager_operationsinlet(MCase{name;_})=get_caseopinFormat.pp_print_stringppfnameletppppf(Managerop)=matchopwith|Tx_rollup_commit{commitment={level;_};_}->Format.fprintfppf"commitment for rollup level %a"Tx_rollup_level.pplevel|Tx_rollup_rejection{level;message_position;_}->Format.fprintfppf"rejection for commitment at level %a for message %d"Tx_rollup_level.pplevelmessage_position|Tx_rollup_dispatch_tickets{level;tickets_info;_}->letpp_rollup_revealppfTx_rollup_reveal.{contents;ty;amount;ticketer;claimer;_}=letpp_lazy_exprppfe=Michelson_v1_printer.print_expr_unwrappedppf(Result.value(Script_repr.force_decodee)~default:(Micheline.strip_locations(Micheline.Seq((),[]))))inFormat.fprintfppf"%a tickets (%a, %a, %a) to %a"Tx_rollup_l2_qty.ppamountContract.ppticketerpp_lazy_exprtypp_lazy_exprcontentsTezos_crypto.Signature.V0.Public_key_hash.ppclaimerinFormat.fprintfppf"@[<v 2>dispatch withdrawals at rollup level %a: %a@]"Tx_rollup_level.pplevel(Format.pp_print_listpp_rollup_reveal)tickets_info|Sc_rollup_add_messages{rollup;messages}->Format.fprintfppf"publishing %d messages to rollup %a inbox"(List.lengthmessages)Sc_rollup.Address.pprollup|Sc_rollup_cement{rollup;commitment}->Format.fprintfppf"cementing commitment %a of rollup %a"Sc_rollup.Commitment.Hash.ppcommitmentSc_rollup.Address.pprollup|Sc_rollup_publish{rollup;commitment=Sc_rollup.Commitment.{inbox_level;_}}->Format.fprintfppf"publish commitment for level %a of rollup %a"Raw_level.ppinbox_levelSc_rollup.Address.pprollup|_->pp_kindppfopendmoduleHash=Tezos_crypto.Blake2B.Make(Tezos_crypto.Base58)(structletname="manager_operation_hash"lettitle="A manager operation hash"letb58check_prefix="\068\160\013"(* mop(53) *)letsize=Noneend)let()=Tezos_crypto.Base58.check_encoded_prefixHash.b58check_encoding"mop"53typehash=Hash.ttypet={hash:hash;manager_operation:packed_manager_operation}lethash_manager_operationop=Hash.hash_bytes[Data_encoding.Binary.to_bytes_exnManager_operation.encodingop]letmakemanager_operation=letmanager_operation=Managermanager_operationinlethash=hash_manager_operationmanager_operationin{hash;manager_operation}letencoding=letopenData_encodinginconv(fun{hash;manager_operation}->(hash,manager_operation))(fun(hash,manager_operation)->{hash;manager_operation})@@obj2(req"hash"Hash.encoding)(req"manager_operation"Manager_operation.encoding)letppppf{hash;manager_operation}=Format.fprintfppf"%a (%a)"Manager_operation.ppmanager_operationHash.pphash