123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.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. *)(* *)(*****************************************************************************)openAlpha_contextmoduleS=structletpath=RPC_path.(open_root/"votes")letballots=RPC_service.get_service~description:"Sum of ballots casted so far during a voting period."~query:RPC_query.empty~output:Vote.ballots_encodingRPC_path.(path/"ballots")letballot_list=RPC_service.get_service~description:"Ballots casted so far during a voting period."~query:RPC_query.empty~output:Data_encoding.(list(obj2(req"pkh"Signature.Public_key_hash.encoding)(req"ballot"Vote.ballot_encoding)))RPC_path.(path/"ballot_list")letcurrent_period=RPC_service.get_service~description:"Returns the voting period (index, kind, starting position) and \
related information (position, remaining) of the interrogated block."~query:RPC_query.empty~output:Voting_period.info_encodingRPC_path.(path/"current_period")letsuccessor_period=RPC_service.get_service~description:"Returns the voting period (index, kind, starting position) and \
related information (position, remaining) of the next block.Useful to \
craft operations that will be valid in the next block."~query:RPC_query.empty~output:Voting_period.info_encodingRPC_path.(path/"successor_period")letcurrent_quorum=RPC_service.get_service~description:"Current expected quorum."~query:RPC_query.empty~output:Data_encoding.int32RPC_path.(path/"current_quorum")letlistings=RPC_service.get_service~description:"List of delegates with their voting weight, in number of rolls."~query:RPC_query.empty~output:Vote.listings_encodingRPC_path.(path/"listings")letproposals=RPC_service.get_service~description:"List of proposals with number of supporters."~query:RPC_query.empty~output:(Protocol_hash.Map.encodingData_encoding.int32)RPC_path.(path/"proposals")letcurrent_proposal=RPC_service.get_service~description:"Current proposal under evaluation."~query:RPC_query.empty~output:(Data_encoding.optionProtocol_hash.encoding)RPC_path.(path/"current_proposal")lettotal_voting_power=RPC_service.get_service~description:"Total number of rolls for the delegates in the voting listings."~query:RPC_query.empty~output:Data_encoding.int32RPC_path.(path/"total_voting_power")endletregister()=letopenServices_registrationinregister0~chunked:falseS.ballots(functxt()()->Vote.get_ballotsctxt);register0~chunked:trueS.ballot_list(functxt()()->Vote.get_ballot_listctxt>|=ok);register0~chunked:falseS.current_period(functxt()()->Voting_period.get_rpc_current_infoctxt);register0~chunked:falseS.successor_period(functxt()()->Voting_period.get_rpc_succ_infoctxt);register0~chunked:falseS.current_quorum(functxt()()->Vote.get_current_quorumctxt);register0~chunked:trueS.proposals(functxt()()->Vote.get_proposalsctxt);register0~chunked:trueS.listings(functxt()()->Vote.get_listingsctxt>|=ok);register0~chunked:falseS.current_proposal(functxt()()->Vote.find_current_proposalctxt);register0~chunked:falseS.total_voting_power(functxt()()->Vote.get_total_voting_power_freectxt)[@@coq_axiom_with_reason"disabled because we would need to re-create the error e in order to have \
different polymorphic variables"]letballotsctxtblock=RPC_context.make_call0S.ballotsctxtblock()()letballot_listctxtblock=RPC_context.make_call0S.ballot_listctxtblock()()letcurrent_periodctxtblock=RPC_context.make_call0S.current_periodctxtblock()()letsuccessor_periodctxtblock=RPC_context.make_call0S.successor_periodctxtblock()()letcurrent_quorumctxtblock=RPC_context.make_call0S.current_quorumctxtblock()()letlistingsctxtblock=RPC_context.make_call0S.listingsctxtblock()()letproposalsctxtblock=RPC_context.make_call0S.proposalsctxtblock()()letcurrent_proposalctxtblock=RPC_context.make_call0S.current_proposalctxtblock()()lettotal_voting_powerctxtblock=RPC_context.make_call0S.total_voting_powerctxtblock()()