12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364(*****************************************************************************)(* *)(* SPDX-License-Identifier: MIT *)(* Copyright (c) 2023 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(*****************************************************************************)typet=|SingleofContract_repr.t*Signature.public_key_hash|SharedofSignature.public_key_hashletencoding=letopenData_encodinginletsingle_tag=0inletsingle_encoding=obj2(req"contract"Contract_repr.encoding)(req"delegate"Signature.Public_key_hash.encoding)inletshared_tag=1inletshared_encoding=obj1(req"delegate"Signature.Public_key_hash.encoding)indef~title:"unstaked_frozen_staker"~description:"Abstract notion of staker used in operation receipts for unstaked \
frozen deposits, either a single staker or all the stakers delegating \
to some delegate.""staker"@@matching(function|Single(contract,delegate)->matchedsingle_tagsingle_encoding(contract,delegate)|Shareddelegate->matchedshared_tagshared_encodingdelegate)[case~title:"Single"(Tagsingle_tag)single_encoding(function|Single(contract,delegate)->Some(contract,delegate)|_->None)(fun(contract,delegate)->Single(contract,delegate));case~title:"Shared"(Tagshared_tag)shared_encoding(functionShareddelegate->Somedelegate|_->None)(fundelegate->Shareddelegate);]letcomparesasb=match(sa,sb)with|Single(ca,da),Single(cb,db)->Compare.or_else(Contract_repr.comparecacb)(fun()->Signature.Public_key_hash.comparedadb)|Sharedda,Shareddb->Signature.Public_key_hash.comparedadb|Single_,Shared_->-1|Shared_,Single_->1letdelegate=function|Single(_contract,delegate)->delegate|Shareddelegate->delegate