Module Mavryk_raw_protocol_alpha.Per_block_votes_repr

Options available for per-block votes

type per_block_vote =
  1. | Per_block_vote_on
  2. | Per_block_vote_off
  3. | Per_block_vote_pass
type per_block_votes = {
  1. liquidity_baking_vote : per_block_vote;
  2. adaptive_issuance_vote : per_block_vote;
}
val compute_new_liquidity_baking_ema : per_block_vote:per_block_vote -> Liquidity_baking_toggle_EMA.t -> Liquidity_baking_toggle_EMA.t

compute_new_liquidity_baking_ema ~per_block_vote old_ema returns the value new_ema of the exponential moving average old_ema updated by the vote per_block_vote interpreted as a vote to deactivate the liquidity baking feature (Off increases the EMA).

The EMA is updated as follows:

  • if per_block_vote is Per_block_vote_pass then new_ema = old_ema,
  • if per_block_vote is Per_block_vote_off, then new_ema = (1999 * eman // 2000) + 1,000,000,
  • if per_block_vote is Per_block_vote_on, then new_ema = (1999 * eman // 2000).

The multiplication is performed in Z.t to avoid overflows, division is rounded toward 1,000,000,000 (the middle of the interval).

val compute_new_adaptive_issuance_ema : per_block_vote:per_block_vote -> Adaptive_issuance_launch_EMA.t -> Adaptive_issuance_launch_EMA.t

compute_new_adaptive_issuance_ema ~per_block_vote old_ema returns the value new_ema of the exponential moving average old_ema updated by the vote per_block_vote interpreted as a vote to activate the adaptive issuance feature (Off decreases the EMA).

The EMA is updated as follows:

  • if per_block_vote is Per_block_vote_pass then new_ema = old_ema,
  • if per_block_vote is Per_block_vote_off, then new_ema = (1999 * eman // 2000),
  • if per_block_vote is Per_block_vote_on, then new_ema = (1999 * eman // 2000) + 1,000,000.

The multiplication is performed in Z.t to avoid overflows, division is rounded toward 1,000,000,000 (the middle of the interval).

module Internal_for_tests : sig ... end