package tezos-protocol-alpha

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

This module is an abstraction on top of int64 to build positive (or zero) quantities within the int64 bounds. It comes with a compact encoding to be used in the transaction rollup batches.

type t

Type of postive quantities. Quantities are bounded by Int64.max_int.

val zero : t

The zero quantity.

val one : t

One quantity.

val of_int64 : int64 -> t option

Build a quantity from an int64. Returns None if the argument is negative.

val of_int64_exn : int64 -> t

Build a quantity from an int64 and raise Invalid_argument on negative quantities.

val to_int64 : t -> int64

Convert a quantity to int64.

Convert a quantity to z.

val to_string : t -> string

Returns a string representation of a quantity.

val of_string : string -> t option

Parse a quantity from a string. Returns None if the string is not a valid quantity representation.

Pretty-printer for quantities.

Compact encoding for quantities

Encoding for quantities

val sub : t -> t -> t option

Substract two quantities. Returns None on subtraction underflow.

val add : t -> t -> t option

Add two quantities. Returns None on addition overflow.

val succ : t -> t option

Return the t successor. Returns None on overflow.

val (-) : t -> t -> t option

Quantities substraction.

val (+) : t -> t -> t option

Quantities addition.

include Tezos_protocol_environment_alpha.Compare.S with type t := t
val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>=) : t -> t -> bool
val (>) : t -> t -> bool
val compare : t -> t -> int
val equal : t -> t -> bool
val max : t -> t -> t
val min : t -> t -> t
OCaml

Innovation. Community. Security.