Module 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 prepared_finalize_unstake = {
  1. finalizable : finalizable;
  2. unfinalizable : stored_requests;
}

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.

update ctxt contract requests updates unstake requests for contract.

add ctxt ~contract ~delegate cycle amount adds a request from contract to unstake amount from delegate at cycle cycle.

  • raises Assert_failure

    if contract already has unstake requests from another delegate (broken invariant).

module For_RPC : sig ... end

Slow functions only used for RPCs