Module Mavryk_alpha_test_helpers.Account_helpers

Account_helpers defines a type abstracting the information of an account in the protocol. This includes its pkh, delegate, any funds, staking parameters, etc...

A type balance is also defined, as an observed state of funds for a given account, i.e balance information that one might get from calling RPCs.

val fail_account_not_found : string -> string -> 'a
module CycleMap : sig ... end
type account_state = {
  1. pkh : Mavryk_base.TzPervasives.Signature.Public_key_hash.t;
  2. contract : Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t;
  3. delegate : string option;
  4. parameters : Adaptive_issuance_helpers.staking_parameters;
  5. liquid : Tez_staking_helpers.Tez.t;
  6. bonds : Tez_staking_helpers.Tez.t;
  7. frozen_deposits : Tez_staking_helpers.Frozen_tez.t;
  8. unstaked_frozen : Tez_staking_helpers.Unstaked_frozen.t;
  9. unstaked_finalizable : Tez_staking_helpers.Unstaked_finalizable.t;
  10. staking_delegator_numerator : Z.t;
  11. staking_delegate_denominator : Z.t;
  12. frozen_rights : Tez_staking_helpers.Tez.t CycleMap.t;
    (*

    The portion of rights that comes from staking, used for baking/attesting during the specified cycle.

    At the end of cycle c, the current frozen deposits of the delegate (own + co-staked, taking limit_of_staking_over_baking into account) are added to this table for cycle c + consensus_rights_delay + 1. The table is unmodified if at that time, the account is not a delegate or is a deactivated delegate.

    *)
  13. slashed_cycles : Mavryk_alpha_test_helpers.Tez_staking_helpers.Cycle.t list;
  14. last_active_cycle : Mavryk_alpha_test_helpers.Tez_staking_helpers.Cycle.t;
}

Abstract information of accounts

val init_account : ?delegate:string -> pkh:Mavryk_base.TzPervasives.Signature.Public_key_hash.t -> contract:Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t -> parameters:Adaptive_issuance_helpers.staking_parameters -> ?liquid:Tez_staking_helpers.Tez.t -> ?bonds:Tez_staking_helpers.Tez.t -> ?frozen_deposits:Tez_staking_helpers.Frozen_tez.t -> ?unstaked_frozen:Tez_staking_helpers.Unstaked_frozen.t -> ?unstaked_finalizable:Tez_staking_helpers.Unstaked_finalizable.t -> ?staking_delegator_numerator:Z.t -> ?staking_delegate_denominator:Z.t -> ?frozen_rights:Tez_staking_helpers.Tez.t CycleMap.t -> ?slashed_cycles:Mavryk_alpha_test_helpers.Tez_staking_helpers.Cycle.t list -> ?last_active_cycle:Mavryk_alpha_test_helpers.Tez_staking_helpers.Cycle.cycle -> unit -> account_state
type balance = {
  1. liquid_b : Tez_staking_helpers.Tez.t;
  2. bonds_b : Tez_staking_helpers.Tez.t;
  3. staked_b : Tez_staking_helpers.Partial_tez.t;
  4. unstaked_frozen_b : Tez_staking_helpers.Tez.t;
  5. unstaked_finalizable_b : Tez_staking_helpers.Tez.t;
  6. staking_delegator_numerator_b : Z.t;
  7. staking_delegate_denominator_b : Z.t;
}

Balance returned by RPCs. Partial tez are rounded down

val balance_zero : balance
val balance_pp : Stdlib.Format.formatter -> balance -> unit
val balance_update_pp : Stdlib.Format.formatter -> (balance * balance) -> unit
val assert_balance_equal : loc:string -> string -> balance -> balance -> (unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t
val assert_pseudotokens_consistency : loc:string -> balance -> account_state -> string -> account_state Mavryk_base.TzPervasives.String.Map.t -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
val get_balance_from_context : Mavryk_alpha_test_helpers__Context.t -> Mavryk_protocol_alpha.Protocol.Alpha_context.Contract.t -> (balance * Mavryk_protocol_alpha.Protocol.Alpha_context.Tez.t, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t
val assert_balance_check : loc:string -> Mavryk_alpha_test_helpers__Context.t -> Mavryk_base.TzPervasives.String.Map.key -> account_state Mavryk_base.TzPervasives.String.Map.t -> (unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t
val log_debug_balance : Mavryk_base.TzPervasives.String.Map.key -> account_map -> unit
val log_debug_balance_update : Mavryk_base.TzPervasives.String.Map.key -> account_map -> account_map -> unit
val current_total_frozen_deposits_with_limits : account_state -> Mavryk_protocol_alpha.Protocol.Alpha_context.Tez.t