Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file receipt_repr.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* Copyright (c) 2020 Metastate AG <hello@metastate.dev> *)(* *)(* 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. *)(* *)(*****************************************************************************)typebalance=|ContractofContract_repr.t|RewardsofSignature.Public_key_hash.t*Cycle_repr.t|FeesofSignature.Public_key_hash.t*Cycle_repr.t|DepositsofSignature.Public_key_hash.t*Cycle_repr.tletbalance_encoding=letopenData_encodingindef"operation_metadata.alpha.balance"@@union[case(Tag0)~title:"Contract"(obj2(req"kind"(constant"contract"))(req"contract"Contract_repr.encoding))(functionContractc->Some((),c)|_->None)(fun((),c)->Contractc);case(Tag1)~title:"Rewards"(obj4(req"kind"(constant"freezer"))(req"category"(constant"rewards"))(req"delegate"Signature.Public_key_hash.encoding)(req"cycle"Cycle_repr.encoding))(functionRewards(d,l)->Some((),(),d,l)|_->None)(fun((),(),d,l)->Rewards(d,l));case(Tag2)~title:"Fees"(obj4(req"kind"(constant"freezer"))(req"category"(constant"fees"))(req"delegate"Signature.Public_key_hash.encoding)(req"cycle"Cycle_repr.encoding))(functionFees(d,l)->Some((),(),d,l)|_->None)(fun((),(),d,l)->Fees(d,l));case(Tag3)~title:"Deposits"(obj4(req"kind"(constant"freezer"))(req"category"(constant"deposits"))(req"delegate"Signature.Public_key_hash.encoding)(req"cycle"Cycle_repr.encoding))(functionDeposits(d,l)->Some((),(),d,l)|_->None)(fun((),(),d,l)->Deposits(d,l))]typebalance_update=DebitedofTez_repr.t|CreditedofTez_repr.tletbalance_update_encoding=letopenData_encodingindef"operation_metadata.alpha.balance_update"@@obj1(req"change"(conv(function|Creditedv->Tez_repr.to_mutezv|Debitedv->Int64.neg(Tez_repr.to_mutezv))(Json.wrap_error@@funv->ifCompare.Int64.(v<0L)thenmatchTez_repr.of_mutez(Int64.negv)with|Somev->Debitedv|None->failwith"Qty.of_mutez"elsematchTez_repr.of_mutezvwith|Somev->Creditedv|None->failwith"Qty.of_mutez")int64))typeupdate_origin=Block_application|Protocol_migration|Subsidyletupdate_origin_encoding=letopenData_encodingindef"operation_metadata.alpha.update_origin"@@obj1@@req"origin"@@union[case(Tag0)~title:"Block_application"(constant"block")(functionBlock_application->Some()|_->None)(fun()->Block_application);case(Tag1)~title:"Protocol_migration"(constant"migration")(functionProtocol_migration->Some()|_->None)(fun()->Protocol_migration);case(Tag2)~title:"Subsidy"(constant"subsidy")(functionSubsidy->Some()|_->None)(fun()->Subsidy)]typebalance_updates=(balance*balance_update*update_origin)listletbalance_updates_encoding=letopenData_encodingindef"operation_metadata.alpha.balance_updates"@@list(conv(function|(balance,balance_update,update_origin)->((balance,balance_update),update_origin))(fun((balance,balance_update),update_origin)->(balance,balance_update,update_origin))(merge_objs(merge_objsbalance_encodingbalance_update_encoding)update_origin_encoding))letcleanup_balance_updatesbalance_updates=List.filter(fun(_,(Creditedupdate|Debitedupdate),_)->not(Tez_repr.equalupdateTez_repr.zero))balance_updates