package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Manages all the voting related storage in Storage.Vote.

get_delegate_proposal_count ctxt proposer returns the number of proposals already made by proposer in the current voting cycle.

This number of proposals, aka count, has its own storage bucket.

  • returns

    0 if the count of the proposer was not initialized.

  • returns

    Error Storage_error if the deserialization of count fails.

set_delegate_proposal_count ctxt proposer count sets proposer's number of submitted proposals to count.

More precisely, the relevant storage bucket is allocated and initialized to count if it didn't exist; otherwise it is simply updated.

has_proposed ctxt proposer proposal indicates whether the proposer has already proposed the proposal.

add_proposal ctxt proposer proposal records the submission of proposal by proposer.

type ballots = {
  1. yay : int64;
  2. nay : int64;
  3. pass : int64;
}

Counts of the votes

val ballots_zero : ballots

All vote counts set to zero.

val equal_ballots : ballots -> ballots -> bool

Equality check for ballots.

Pretty printer for ballots.

Records a vote for a delegate, returns a Error (Storage_error Existing_key) if the vote was already registered

Computes the sum of the current ballots weighted by stake.

Populates !Storage.Vote.Listings using the currently existing staking power and sets `Voting_power_in_listings`. Inactive delegates or delegates without the minimal required stake are not included in the listings.

Verifies the presence of a delegate in the listing.

type delegate_info = {
  1. voting_power : Tezos_protocol_environment_alpha.Int64.t option;
  2. current_ballot : Vote_repr.ballot option;
  3. current_proposals : Tezos_protocol_environment_alpha.Protocol_hash.t list;
  4. remaining_proposals : int;
}

Returns the voting power of a delegate from the voting power listings. This function does not account for gas cost.

Same as get_voting_power_free but computes the voting power based on the current stake of the delegate instead of reading it from the vote listings.

Returns the sum of all voting power in the listings, without accounting for gas cost.

Returns the sum of all voting power in the listings.

val current_proposal_exists : Raw_context.t -> bool Tezos_protocol_environment_alpha.Lwt.t

Indicates whether there is a current proposal in the storage.

Retrieves the current proposal.

  • returns

    Error Storage_error if there is no current proposal, or if the deserialization fails.

Retrieves the current proposal.

  • returns

    None if there is no current proposal.

  • returns

    Error Storage_error if the deserialization fails.

Registers a current proposal.

  • returns

    Error (Storage_error Existing_key) if there was already a current proposal.

Removes the current proposal. Does nothing if there was no current proposal.

OCaml

Innovation. Community. Security.