Mavryk_raw_protocol_alpha.Stake_storageThis module provides basic operations (accessors and setters) on staking tokens.
It is responsible for maintaining the following tables:
val initialize_delegate :
Raw_context.t ->
Mavryk_protocol_environment_alpha.Signature.public_key_hash ->
delegated:Tez_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval remove_frozen_stake_only_call_from_token :
Raw_context.t ->
Frozen_staker_repr.t ->
Tez_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval add_frozen_stake_only_call_from_token :
Raw_context.t ->
Frozen_staker_repr.t ->
Tez_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval fold_on_active_delegates_with_minimal_stake_es :
Raw_context.t ->
f:
(Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t ->
'a ->
'a Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.t) ->
order:[ `Sorted | `Undefined ] ->
init:'a ->
'a Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tfold ctxt ~f ~order init folds f on the list of active delegates having the minimal required stake. The folding process starts with init. Each element of the list is the public key hash of a delegate.
val set_selected_distribution_for_cycle :
Raw_context.t ->
Cycle_repr.t ->
(Mavryk_protocol_environment_alpha.Signature.public_key_hash * Stake_repr.t)
list ->
Stake_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tset_selected_distribution_for_cycle ctxt cycle distrib total_stake saves the selected distribution distrib of the total_stake for the given cycle.
val clear_at_cycle_end :
Raw_context.t ->
new_cycle:Cycle_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval fold_on_active_delegates_with_minimal_stake_s :
Raw_context.t ->
order:[ `Sorted | `Undefined ] ->
init:'a ->
f:
(Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t ->
'a ->
'a Mavryk_protocol_environment_alpha.Lwt.t) ->
'a Mavryk_protocol_environment_alpha.Lwt.tval get_selected_distribution :
Raw_context.t ->
Cycle_repr.t ->
(Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t * Stake_repr.t)
list
Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval find_selected_distribution :
Raw_context.t ->
Cycle_repr.t ->
(Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t * Stake_repr.t)
list
option
Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval get_selected_distribution_as_map :
Raw_context.t ->
Cycle_repr.t ->
Stake_repr.t
Mavryk_protocol_environment_alpha.Signature.Public_key_hash.Map.t
Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tval prepare_stake_distribution :
Raw_context.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tCopy the stake distribution for the current cycle (from Storage.Stake.Selected_distribution_for_cycle) in the raw context.
val get_total_active_stake :
Raw_context.t ->
Cycle_repr.t ->
Stake_repr.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tget_total_active_stake ctxt cycle retrieves the amount in Tez of the active stake at cycle from ctxt.
val add_contract_delegated_stake :
Raw_context.t ->
Contract_repr.t ->
Tez_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tadd_contract_delegated_stake ctxt contract amount calls Stake_storage.add_delegated_stake ctxt delegate amount if contract has a delegate. Otherwise this function does nothing.
val remove_contract_delegated_stake :
Raw_context.t ->
Contract_repr.t ->
Tez_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tremove_contract_delegated_stake ctxt contract amount calls Stake_storage.remove_delegated_stake ctxt delegate amount if contract has a delegate. Otherwise this function does nothing.
val cleanup_values_for_protocol_b :
Raw_context.t ->
preserved_cycles:int ->
consensus_rights_delay:int ->
new_cycle:Cycle_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.tmodule For_RPC : sig ... endmodule Internal_for_tests : sig ... end