Mavryk_raw_protocol_alpha.Unstake_requests_storage
Simple abstraction from low-level storage to handle unstake requests.
This module is responsible for maintaining the Storage.Contract.Unstake_requests
table.
type finalizable =
(Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t
* Cycle_repr.t
* Tez_repr.t)
list
type stored_requests = Storage.Unstake_request.t = {
delegate : Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t;
requests : (Cycle_repr.t * Tez_repr.t) list;
}
val prepared_finalize_unstake_encoding :
prepared_finalize_unstake
Mavryk_protocol_environment_alpha.Data_encoding.encoding
val prepare_finalize_unstake :
Raw_context.t ->
for_next_cycle_use_only_after_slashing:bool ->
Contract_repr.t ->
prepared_finalize_unstake option
Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.t
prepare_finalize_unstake ctxt ~for_next_cycle_use_only_after_slashing contract
preprocesses a finalize_unstake
for contract
. It returns a list of transfers (d, c, a)
to do from delegate's d
unstaked frozen deposits for cycle c
of amount a
in the finalizable_field
as well as the remaining unfinalizable requests that should be kept in the storage in unfinalizable
.
It returns None
if there are no unstake requests.
If for_next_cycle_use_only_after_slashing
is true, the finalisation is done for the next cycle. It is meant to be used only at cycle end after the application of the slashing.
val update :
Raw_context.t ->
Contract_repr.t ->
stored_requests ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.t
update ctxt contract requests
updates unstake requests for contract
.
val add :
Raw_context.t ->
contract:Contract_repr.t ->
delegate:Mavryk_protocol_environment_alpha.Signature.Public_key_hash.t ->
Cycle_repr.t ->
Tez_repr.t ->
Raw_context.t Mavryk_protocol_environment_alpha.Error_monad.tzresult
Mavryk_protocol_environment_alpha.Lwt.t
add ctxt ~contract ~delegate cycle amount
adds a request from contract
to unstake amount
from delegate
at cycle cycle
.
module For_RPC : sig ... end
Slow functions only used for RPCs