package tezos-protocol-013-PtJakart

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Low-level handlers of raw contexts for base operations on contracts.

allocated ctxt contract returns true if and only if the contract is stored in Storage.Contract.Balance.

exists ctxt contract returns true if and only if either the contract is originated or it is (implicit and) "allocated".

must_exist ctxt contract fails with the Non_existing_contract error if exists ctxt contract returns false. Even though this function is gas-free, it is always called in a context where some gas consumption is guaranteed whenever necessary. The first context is that of a transfer operation, and in that case the base cost of a manager operation (Micheclson_v1_gas.Cost_of.manager_operation) is consumed. The second context is that of an activation operation, and in that case no gas needs to be consumed since that operation is not a manager operation.

must_be_allocated ctxt contract fails when the contract is not allocated. It fails with Non_existing_contract if the contract is originated, and it fails with Empty_implicit_contract if the contract is implicit.

get_balance ctxt contract returns the balance of spendable tez owned by contract given raw context ctxt. This does not include the contract's frozen balances.

module Legacy_big_map_diff : sig ... end

raw_originate ctxt ~prepaid_bootstrap_storage contract ~script originates the contract parameter. The storage space allocated by this origination is considered to be free of charge or to have been already paid for by the user, if and only if prepaid_bootstrap_storage is true. In particular, the amount of space allocated by this origination will be part of the consumed space to pay for returned by the next call to Fees_storage.record_paid_storage_space ctxt contract, if and only if prepaid_bootstrap_storage is false.

Increases the balance of a contract. Calling this function directly may break important invariants. Consider calling credit instead.

Decreases the balance of a contract. Calling this function directly may break important invariants. Consider calling spend instead.

get_balance_and_frozen_bonds ctxt contract returns the sum of the (spendable) balance and the frozen bonds associated to contract.

This error is raised when spend_bond_only_call_from_token is called with an amount that is not equal to the deposit associated to the given contract and bond id.

bond_allocated ctxt contract bond_id returns a new context because of an access to carbonated data, and true if there is a bond associated to contract and bond_id, or false otherwise.

find_bond ctxt contract bond_id returns a new context because of an access to carbonated data, and the bond associated to (contract, bond_id) if there is one, or None otherwise.

spend_bond ctxt contract bond_id amount withdraws the given amount from the value of the bond associated to contract and bond_id.

The argument amount is required to be strictly positive.

  • raises a

    Storage_Error Missing_key error when there is no bond associated to contract and bond_id.

  • raises a

    Frozen_bonds_must_be_spent_at_once (contract, bond_id) error when the amount is different from the bond associated to contract and bond_id.

credit_bond ctxt contract bond_id amount adds the given amount to the bond associated to contract and bond_id. If no bond exists, one whose value is amount is created.

The argument amount is required to be strictly positive.

  • raises a

    Addition_overflow error when (find ctxt contract bond_id) + amount > Int64.max_int.

has_frozen_bonds ctxt contract returns true if there are frozen bonds associated to contract, and returns false otherwise.

get_frozen_bonds ctxt contract returns the total amount of bonds associated to contract.

val fold_on_bond_ids : Raw_context.t -> Contract_repr.t -> order:[ `Sorted | `Undefined ] -> init:'a -> f:(Bond_id_repr.t -> 'a -> 'a Tezos_protocol_environment_013_PtJakart.Lwt.t) -> 'a Tezos_protocol_environment_013_PtJakart.Lwt.t

fold_on_bond_ids ctxt contract order init f folds f on all bond identifiers associated to contract.

ensure_deallocated_if_empty ctxt contract de-allocates contract if its full balance is zero, and it does not delegate.

OCaml

Innovation. Community. Security.