2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
module type BASIC_DATA = sig
|
|
|
|
type t
|
|
|
|
include Compare.S with type t := t
|
|
|
|
val encoding: t Data_encoding.t
|
|
|
|
val pp: Format.formatter -> t -> unit
|
|
|
|
end
|
|
|
|
|
|
|
|
type t
|
|
|
|
type context = t
|
|
|
|
|
|
|
|
module Contract_hash = Tezos_hash.Contract_hash
|
|
|
|
|
|
|
|
module Nonce_hash = Tezos_hash.Nonce_hash
|
|
|
|
|
2017-02-28 05:56:40 +04:00
|
|
|
type public_key = Ed25519.Public_key.t
|
2016-11-14 18:54:21 +04:00
|
|
|
type public_key_hash = Ed25519.Public_key_hash.t
|
2017-02-28 05:56:40 +04:00
|
|
|
type secret_key = Ed25519.Secret_key.t
|
|
|
|
type signature = Ed25519.Signature.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
module Tez : sig
|
|
|
|
|
|
|
|
include BASIC_DATA
|
|
|
|
type tez = t
|
|
|
|
|
|
|
|
val zero: tez
|
2017-03-10 17:39:22 +04:00
|
|
|
val one_cent : tez
|
|
|
|
val fifty_cents : tez
|
|
|
|
val one : tez
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val ( -? ) : tez -> tez -> tez tzresult
|
|
|
|
val ( +? ) : tez -> tez -> tez tzresult
|
|
|
|
val ( *? ) : tez -> int64 -> tez tzresult
|
2017-03-10 17:39:22 +04:00
|
|
|
val ( /? ) : tez -> int64 -> tez tzresult
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val of_string: string -> tez option
|
|
|
|
val to_string: tez -> string
|
|
|
|
|
2017-11-29 21:06:17 +04:00
|
|
|
val of_mutez: int64 -> tez option
|
|
|
|
val to_mutez: tez -> int64
|
2017-11-07 20:38:11 +04:00
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
module Period : sig
|
|
|
|
|
|
|
|
include BASIC_DATA
|
|
|
|
type period = t
|
|
|
|
|
|
|
|
val of_seconds: int64 -> period tzresult
|
|
|
|
val mult: int32 -> period -> period tzresult
|
|
|
|
|
2017-03-10 18:26:56 +04:00
|
|
|
val one_second : period
|
|
|
|
val one_minute : period
|
|
|
|
val one_hour : period
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
module Timestamp : sig
|
|
|
|
|
|
|
|
include BASIC_DATA with type t = Time.t
|
|
|
|
type time = t
|
|
|
|
val (+?) : time -> Period.t -> time tzresult
|
|
|
|
|
|
|
|
val of_notation: string -> time option
|
|
|
|
val to_notation: time -> string
|
|
|
|
|
|
|
|
val of_seconds: string -> time option
|
2017-10-11 19:41:02 +04:00
|
|
|
val to_seconds_string: time -> string
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-10-11 19:41:02 +04:00
|
|
|
val current : context -> time
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Raw_level : sig
|
|
|
|
|
|
|
|
include BASIC_DATA
|
|
|
|
type raw_level = t
|
2017-12-09 06:51:58 +04:00
|
|
|
val arg: raw_level RPC_arg.arg
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-16 00:18:48 +04:00
|
|
|
val diff: raw_level -> raw_level -> int32
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val root: raw_level
|
|
|
|
val succ: raw_level -> raw_level
|
|
|
|
val pred: raw_level -> raw_level option
|
2017-03-30 16:32:46 +04:00
|
|
|
val to_int32: raw_level -> int32
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Cycle : sig
|
|
|
|
|
|
|
|
include BASIC_DATA
|
|
|
|
type cycle = t
|
2017-12-09 06:51:58 +04:00
|
|
|
val arg: cycle RPC_arg.arg
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val root: cycle
|
|
|
|
val succ: cycle -> cycle
|
|
|
|
val pred: cycle -> cycle option
|
2017-03-30 16:32:46 +04:00
|
|
|
val to_int32: cycle -> int32
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Script_int : module type of Script_int_repr
|
|
|
|
|
2017-10-11 19:41:02 +04:00
|
|
|
module Script_timestamp : sig
|
|
|
|
open Script_int
|
|
|
|
type t
|
|
|
|
val compare : t -> t -> int
|
|
|
|
val to_string : t -> string
|
|
|
|
val to_notation : t -> string option
|
|
|
|
val to_num_str : t -> string
|
|
|
|
val of_string : string -> t option
|
|
|
|
val diff : t -> t -> z num
|
|
|
|
val add_delta : t -> z num -> t
|
|
|
|
val sub_delta : t -> z num -> t
|
|
|
|
val now : context -> t
|
2017-11-06 18:22:58 +04:00
|
|
|
val to_zint : t -> Z.t
|
2017-10-11 19:41:02 +04:00
|
|
|
end
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
module Script : sig
|
|
|
|
|
2017-11-02 21:57:17 +04:00
|
|
|
type prim = Michelson_v1_primitives.prim =
|
|
|
|
| K_parameter
|
|
|
|
| K_return
|
|
|
|
| K_storage
|
|
|
|
| K_code
|
|
|
|
| D_False
|
2017-12-07 17:37:59 +04:00
|
|
|
| D_Elt
|
2017-11-02 21:57:17 +04:00
|
|
|
| D_Left
|
|
|
|
| D_None
|
|
|
|
| D_Pair
|
|
|
|
| D_Right
|
|
|
|
| D_Some
|
|
|
|
| D_True
|
|
|
|
| D_Unit
|
|
|
|
| I_H
|
|
|
|
| I_ABS
|
|
|
|
| I_ADD
|
|
|
|
| I_AMOUNT
|
|
|
|
| I_AND
|
|
|
|
| I_BALANCE
|
|
|
|
| I_CAR
|
|
|
|
| I_CDR
|
|
|
|
| I_CHECK_SIGNATURE
|
|
|
|
| I_COMPARE
|
|
|
|
| I_CONCAT
|
|
|
|
| I_CONS
|
|
|
|
| I_CREATE_ACCOUNT
|
|
|
|
| I_CREATE_CONTRACT
|
|
|
|
| I_DEFAULT_ACCOUNT
|
|
|
|
| I_DIP
|
|
|
|
| I_DROP
|
|
|
|
| I_DUP
|
|
|
|
| I_EDIV
|
|
|
|
| I_EMPTY_MAP
|
|
|
|
| I_EMPTY_SET
|
|
|
|
| I_EQ
|
|
|
|
| I_EXEC
|
|
|
|
| I_FAIL
|
|
|
|
| I_GE
|
|
|
|
| I_GET
|
|
|
|
| I_GT
|
|
|
|
| I_HASH_KEY
|
|
|
|
| I_IF
|
|
|
|
| I_IF_CONS
|
|
|
|
| I_IF_LEFT
|
|
|
|
| I_IF_NONE
|
|
|
|
| I_INT
|
|
|
|
| I_LAMBDA
|
|
|
|
| I_LE
|
|
|
|
| I_LEFT
|
|
|
|
| I_LOOP
|
|
|
|
| I_LSL
|
|
|
|
| I_LSR
|
|
|
|
| I_LT
|
|
|
|
| I_MANAGER
|
|
|
|
| I_MAP
|
|
|
|
| I_MEM
|
|
|
|
| I_MUL
|
|
|
|
| I_NEG
|
|
|
|
| I_NEQ
|
|
|
|
| I_NIL
|
|
|
|
| I_NONE
|
|
|
|
| I_NOT
|
|
|
|
| I_NOW
|
|
|
|
| I_OR
|
|
|
|
| I_PAIR
|
|
|
|
| I_PUSH
|
|
|
|
| I_REDUCE
|
|
|
|
| I_RIGHT
|
|
|
|
| I_SIZE
|
|
|
|
| I_SOME
|
|
|
|
| I_SOURCE
|
2018-01-11 20:15:35 +04:00
|
|
|
| I_SELF
|
2017-11-02 21:57:17 +04:00
|
|
|
| I_STEPS_TO_QUOTA
|
|
|
|
| I_SUB
|
|
|
|
| I_SWAP
|
|
|
|
| I_TRANSFER_TOKENS
|
|
|
|
| I_UNIT
|
|
|
|
| I_UPDATE
|
|
|
|
| I_XOR
|
2017-10-05 19:29:57 +04:00
|
|
|
| I_ITER
|
|
|
|
| I_LOOP_LEFT
|
2017-11-02 21:57:17 +04:00
|
|
|
| T_bool
|
|
|
|
| T_contract
|
|
|
|
| T_int
|
|
|
|
| T_key
|
|
|
|
| T_key_hash
|
|
|
|
| T_lambda
|
|
|
|
| T_list
|
|
|
|
| T_map
|
|
|
|
| T_nat
|
|
|
|
| T_option
|
|
|
|
| T_or
|
|
|
|
| T_pair
|
|
|
|
| T_set
|
|
|
|
| T_signature
|
|
|
|
| T_string
|
|
|
|
| T_tez
|
|
|
|
| T_timestamp
|
|
|
|
| T_unit
|
|
|
|
|
|
|
|
type location = Micheline.canonical_location
|
|
|
|
|
|
|
|
type expr = prim Micheline.canonical
|
|
|
|
|
|
|
|
type node = (location, prim) Micheline.node
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
type t =
|
2017-11-02 21:57:17 +04:00
|
|
|
{ code : expr ;
|
|
|
|
storage : expr }
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val location_encoding: location Data_encoding.t
|
|
|
|
val expr_encoding: expr Data_encoding.t
|
2017-11-02 21:57:17 +04:00
|
|
|
val prim_encoding: prim Data_encoding.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val encoding: t Data_encoding.t
|
|
|
|
end
|
|
|
|
|
|
|
|
module Bootstrap : sig
|
|
|
|
type account = {
|
|
|
|
public_key_hash: public_key_hash ;
|
|
|
|
public_key: public_key ;
|
|
|
|
}
|
2017-02-28 05:56:40 +04:00
|
|
|
val accounts: context -> account list
|
2016-09-08 21:13:10 +04:00
|
|
|
val account_encoding: account Data_encoding.t
|
2017-02-10 18:43:04 +04:00
|
|
|
val refill: context -> context tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
module Constants : sig
|
|
|
|
|
|
|
|
val proof_of_work_nonce_size: int
|
2017-11-01 15:07:33 +04:00
|
|
|
val baking_reward: Tez.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val endorsement_reward: Tez.t
|
|
|
|
val nonce_length: int
|
|
|
|
val seed_nonce_revelation_tip: Tez.t
|
|
|
|
val origination_burn: Tez.t
|
2017-11-01 15:07:33 +04:00
|
|
|
val baking_bond_cost: Tez.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val endorsement_bond_cost: Tez.t
|
2017-02-28 05:48:51 +04:00
|
|
|
val faucet_credit: Tez.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val cycle_length: context -> int32
|
|
|
|
val voting_period_length: context -> int32
|
|
|
|
val time_before_reward: context -> Period.t
|
2017-02-24 21:32:30 +04:00
|
|
|
val slot_durations: context -> Period.t list
|
2017-11-01 15:07:33 +04:00
|
|
|
val first_free_baking_slot: context -> int
|
2016-09-08 21:13:10 +04:00
|
|
|
val max_signing_slot: context -> int
|
2017-11-06 18:22:58 +04:00
|
|
|
val max_gas: context -> int
|
2016-11-17 05:08:19 +04:00
|
|
|
val proof_of_work_threshold: context -> int64
|
2017-02-27 21:24:26 +04:00
|
|
|
val dictator_pubkey: context -> Ed25519.Public_key.t
|
2017-11-19 17:38:36 +04:00
|
|
|
val max_number_of_operations: context -> int list
|
2017-11-19 18:15:03 +04:00
|
|
|
val max_operation_data_length: context -> int
|
2017-11-24 19:51:04 +04:00
|
|
|
val michelson_maximum_type_size: context -> int
|
2016-09-08 21:13:10 +04:00
|
|
|
end
|
|
|
|
|
2017-11-13 15:32:05 +04:00
|
|
|
(** Global storage for all delegates public keys *)
|
|
|
|
module Delegates_pubkey : sig
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val get:
|
|
|
|
context -> public_key_hash -> public_key tzresult Lwt.t
|
|
|
|
val get_option:
|
|
|
|
context -> public_key_hash -> public_key option tzresult Lwt.t
|
2017-03-15 21:00:27 +04:00
|
|
|
val reveal:
|
2016-09-08 21:13:10 +04:00
|
|
|
context -> public_key_hash -> public_key -> context tzresult Lwt.t
|
|
|
|
val remove:
|
|
|
|
context -> public_key_hash -> context Lwt.t
|
|
|
|
|
|
|
|
val list:
|
2017-11-16 19:45:22 +04:00
|
|
|
context -> (public_key_hash * public_key) list Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Voting_period : sig
|
|
|
|
|
|
|
|
include BASIC_DATA
|
|
|
|
type voting_period = t
|
2017-12-09 06:51:58 +04:00
|
|
|
val arg: voting_period RPC_arg.arg
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val root: voting_period
|
|
|
|
val succ: voting_period -> voting_period
|
|
|
|
|
|
|
|
type kind =
|
|
|
|
| Proposal
|
|
|
|
| Testing_vote
|
|
|
|
| Testing
|
|
|
|
| Promotion_vote
|
|
|
|
val kind_encoding: kind Data_encoding.encoding
|
2017-03-30 16:32:46 +04:00
|
|
|
val to_int32: voting_period -> int32
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Level : sig
|
|
|
|
|
|
|
|
type t = private {
|
|
|
|
level: Raw_level.t ;
|
2017-04-10 15:01:22 +04:00
|
|
|
level_position: int32 ;
|
2016-09-08 21:13:10 +04:00
|
|
|
cycle: Cycle.t ;
|
|
|
|
cycle_position: int32 ;
|
|
|
|
voting_period: Voting_period.t ;
|
|
|
|
voting_period_position: int32 ;
|
|
|
|
}
|
|
|
|
include BASIC_DATA with type t := t
|
2017-02-16 00:18:48 +04:00
|
|
|
val pp_full: Format.formatter -> t -> unit
|
2016-09-08 21:13:10 +04:00
|
|
|
type level = t
|
|
|
|
|
2017-04-10 15:01:22 +04:00
|
|
|
val root: context -> level
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val succ: context -> level -> level
|
|
|
|
val pred: context -> level -> level option
|
|
|
|
|
|
|
|
val from_raw: context -> ?offset:int32 -> Raw_level.t -> level
|
|
|
|
|
|
|
|
val diff: level -> level -> int32
|
|
|
|
|
2017-04-10 15:01:22 +04:00
|
|
|
val current: context -> level
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val last_level_in_cycle: context -> Cycle.t -> level
|
|
|
|
val levels_in_cycle: context -> Cycle.t -> level list
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Fitness : sig
|
|
|
|
|
|
|
|
include (module type of Fitness)
|
2017-04-19 21:21:23 +04:00
|
|
|
type fitness = t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-10 14:14:11 +04:00
|
|
|
val increase: context -> context
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-10 14:14:11 +04:00
|
|
|
val current: context -> int64
|
|
|
|
|
|
|
|
val to_int64: fitness -> int64 tzresult
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Nonce : sig
|
|
|
|
|
|
|
|
type t
|
|
|
|
type nonce = t
|
|
|
|
val encoding: nonce Data_encoding.t
|
|
|
|
|
|
|
|
val record_hash:
|
|
|
|
context -> public_key_hash -> Tez.t -> Nonce_hash.t ->
|
|
|
|
context tzresult Lwt.t
|
|
|
|
|
|
|
|
val reveal:
|
|
|
|
context -> Level.t -> nonce ->
|
|
|
|
(context * public_key_hash * Tez.t) tzresult Lwt.t
|
|
|
|
|
|
|
|
type status =
|
|
|
|
| Unrevealed of {
|
|
|
|
nonce_hash: Nonce_hash.t ;
|
|
|
|
delegate_to_reward: public_key_hash ;
|
|
|
|
reward_amount: Tez.t ;
|
|
|
|
}
|
|
|
|
| Revealed of nonce
|
|
|
|
|
|
|
|
val get: context -> Level.t -> status tzresult Lwt.t
|
|
|
|
|
|
|
|
val of_bytes: MBytes.t -> nonce tzresult
|
|
|
|
val hash: nonce -> Nonce_hash.t
|
|
|
|
val check_hash: nonce -> Nonce_hash.t -> bool
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Seed : sig
|
|
|
|
|
|
|
|
val compute_for_cycle: context -> Cycle.t -> context tzresult Lwt.t
|
|
|
|
val clear_cycle: context -> Cycle.t -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Contract : sig
|
|
|
|
|
|
|
|
include BASIC_DATA
|
|
|
|
type contract = t
|
2017-12-09 06:51:58 +04:00
|
|
|
val arg: contract RPC_arg.arg
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-19 21:22:32 +04:00
|
|
|
val to_b58check: contract -> string
|
|
|
|
val of_b58check: string -> contract tzresult
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val default_contract: public_key_hash -> contract
|
|
|
|
val is_default: contract -> public_key_hash option
|
|
|
|
|
|
|
|
val exists: context -> contract -> bool tzresult Lwt.t
|
2017-03-09 22:17:13 +04:00
|
|
|
val must_exist: context -> contract -> unit tzresult Lwt.t
|
|
|
|
|
2017-11-16 19:45:22 +04:00
|
|
|
val list: context -> contract list Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-16 22:01:35 +04:00
|
|
|
type origination_nonce
|
|
|
|
|
|
|
|
val origination_nonce_encoding : origination_nonce Data_encoding.t
|
|
|
|
val originated_contract : origination_nonce -> contract
|
|
|
|
val originated_contracts : origination_nonce -> contract list
|
|
|
|
|
|
|
|
val initial_origination_nonce : Operation_hash.t -> origination_nonce
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val get_manager:
|
|
|
|
context -> contract -> public_key_hash tzresult Lwt.t
|
2017-11-09 14:50:42 +04:00
|
|
|
val update_manager_key:
|
|
|
|
context -> contract -> public_key option -> (context * public_key) tzresult Lwt.t
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val get_delegate_opt:
|
|
|
|
context -> contract -> public_key_hash option tzresult Lwt.t
|
|
|
|
val is_delegatable:
|
|
|
|
context -> contract -> bool tzresult Lwt.t
|
|
|
|
val is_spendable:
|
|
|
|
context -> contract -> bool tzresult Lwt.t
|
|
|
|
val get_script:
|
2017-03-09 22:17:13 +04:00
|
|
|
context -> contract -> (Script.t option) tzresult Lwt.t
|
2017-07-13 13:53:59 +04:00
|
|
|
val get_storage:
|
2017-11-02 21:57:17 +04:00
|
|
|
context -> contract -> (Script.expr option) tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val get_counter: context -> contract -> int32 tzresult Lwt.t
|
|
|
|
val get_balance:
|
|
|
|
context -> contract -> Tez.t tzresult Lwt.t
|
|
|
|
|
|
|
|
val set_delegate:
|
|
|
|
context -> contract -> public_key_hash option -> context tzresult Lwt.t
|
|
|
|
|
2017-03-09 22:17:13 +04:00
|
|
|
type error += Initial_amount_too_low of contract * Tez.t * Tez.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val originate:
|
|
|
|
context ->
|
2017-02-16 22:01:35 +04:00
|
|
|
origination_nonce ->
|
2016-09-08 21:13:10 +04:00
|
|
|
balance: Tez.t ->
|
|
|
|
manager: public_key_hash ->
|
2017-03-09 22:17:13 +04:00
|
|
|
?script: (Script.t * (Tez.t * Tez.t)) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
delegate: public_key_hash option ->
|
|
|
|
spendable: bool ->
|
2017-02-16 22:01:35 +04:00
|
|
|
delegatable: bool -> (context * contract * origination_nonce) tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-03-02 21:16:19 +04:00
|
|
|
type error += Balance_too_low of contract * Tez.t * Tez.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val spend:
|
|
|
|
context -> contract -> Tez.t -> context tzresult Lwt.t
|
2017-03-09 22:17:13 +04:00
|
|
|
val spend_from_script:
|
2016-09-08 21:13:10 +04:00
|
|
|
context -> contract -> Tez.t -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val credit:
|
|
|
|
context -> contract -> Tez.t -> context tzresult Lwt.t
|
|
|
|
|
2017-03-09 22:17:13 +04:00
|
|
|
val update_script_storage_and_fees:
|
|
|
|
context -> contract -> Tez.t -> Script.expr -> context tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val increment_counter:
|
|
|
|
context -> contract -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val check_counter_increment:
|
|
|
|
context -> contract -> int32 -> unit tzresult Lwt.t
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Vote : sig
|
|
|
|
|
|
|
|
type proposal = Protocol_hash.t
|
|
|
|
|
|
|
|
val record_proposal:
|
|
|
|
context -> Protocol_hash.t -> public_key_hash ->
|
2017-11-16 19:45:22 +04:00
|
|
|
context Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val get_proposals:
|
2017-11-16 19:45:22 +04:00
|
|
|
context -> int32 Protocol_hash.Map.t Lwt.t
|
|
|
|
val clear_proposals: context -> context Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-10-26 19:02:10 +04:00
|
|
|
val freeze_listings: context -> context tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val clear_listings: context -> context tzresult Lwt.t
|
|
|
|
val listing_size: context -> int32 tzresult Lwt.t
|
|
|
|
val in_listings: context -> public_key_hash -> bool Lwt.t
|
|
|
|
|
|
|
|
type ballot = Yay | Nay | Pass
|
|
|
|
|
|
|
|
type ballots = {
|
|
|
|
yay: int32 ;
|
|
|
|
nay: int32 ;
|
|
|
|
pass: int32 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
val record_ballot:
|
2017-11-16 19:45:22 +04:00
|
|
|
context -> public_key_hash -> ballot -> context Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val get_ballots: context -> ballots tzresult Lwt.t
|
|
|
|
val clear_ballots: context -> context Lwt.t
|
|
|
|
|
|
|
|
val get_current_period_kind:
|
|
|
|
context -> Voting_period.kind tzresult Lwt.t
|
|
|
|
val set_current_period_kind:
|
|
|
|
context -> Voting_period.kind -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val get_current_quorum: context -> int32 tzresult Lwt.t
|
|
|
|
val set_current_quorum: context -> int32 -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val get_current_proposal:
|
|
|
|
context -> proposal tzresult Lwt.t
|
2017-04-14 18:25:01 +04:00
|
|
|
val init_current_proposal:
|
2016-09-08 21:13:10 +04:00
|
|
|
context -> proposal -> context tzresult Lwt.t
|
|
|
|
val clear_current_proposal:
|
|
|
|
context -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
type operation = {
|
|
|
|
hash: Operation_hash.t ;
|
2017-04-19 21:21:23 +04:00
|
|
|
shell: Operation.shell_header ;
|
2016-09-08 21:13:10 +04:00
|
|
|
contents: proto_operation ;
|
|
|
|
signature: signature option ;
|
|
|
|
}
|
|
|
|
|
|
|
|
and proto_operation =
|
|
|
|
| Anonymous_operations of anonymous_operation list
|
|
|
|
| Sourced_operations of sourced_operations
|
|
|
|
|
|
|
|
and anonymous_operation =
|
|
|
|
| Seed_nonce_revelation of {
|
|
|
|
level: Raw_level.t ;
|
|
|
|
nonce: Nonce.t ;
|
|
|
|
}
|
2017-02-28 05:48:51 +04:00
|
|
|
| Faucet of {
|
|
|
|
id: Ed25519.Public_key_hash.t ;
|
|
|
|
nonce: MBytes.t ;
|
|
|
|
}
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
and sourced_operations =
|
|
|
|
| Manager_operations of {
|
|
|
|
source: Contract.t ;
|
|
|
|
public_key: public_key option ;
|
|
|
|
fee: Tez.t ;
|
|
|
|
counter: counter ;
|
|
|
|
operations: manager_operation list ;
|
|
|
|
}
|
|
|
|
| Delegate_operations of {
|
|
|
|
source: public_key ;
|
|
|
|
operations: delegate_operation list ;
|
|
|
|
}
|
2017-02-27 21:24:26 +04:00
|
|
|
| Dictator_operation of dictator_operation
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
and manager_operation =
|
|
|
|
| Transaction of {
|
|
|
|
amount: Tez.t ;
|
|
|
|
parameters: Script.expr option ;
|
|
|
|
destination: Contract.contract ;
|
|
|
|
}
|
|
|
|
| Origination of {
|
|
|
|
manager: public_key_hash ;
|
|
|
|
delegate: public_key_hash option ;
|
2017-03-09 22:17:13 +04:00
|
|
|
script: Script.t option ;
|
2016-09-08 21:13:10 +04:00
|
|
|
spendable: bool ;
|
|
|
|
delegatable: bool ;
|
|
|
|
credit: Tez.t ;
|
|
|
|
}
|
|
|
|
| Delegation of public_key_hash option
|
|
|
|
|
|
|
|
and delegate_operation =
|
|
|
|
| Endorsement of {
|
|
|
|
block: Block_hash.t ;
|
|
|
|
slot: int ;
|
|
|
|
}
|
|
|
|
| Proposals of {
|
|
|
|
period: Voting_period.t ;
|
|
|
|
proposals: Protocol_hash.t list ;
|
|
|
|
}
|
|
|
|
| Ballot of {
|
|
|
|
period: Voting_period.t ;
|
|
|
|
proposal: Protocol_hash.t ;
|
|
|
|
ballot: Vote.ballot ;
|
|
|
|
}
|
|
|
|
|
2017-02-27 21:24:26 +04:00
|
|
|
and dictator_operation =
|
|
|
|
| Activate of Protocol_hash.t
|
|
|
|
| Activate_testnet of Protocol_hash.t
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
and counter = Int32.t
|
|
|
|
|
|
|
|
module Operation : sig
|
|
|
|
|
2017-04-19 21:21:23 +04:00
|
|
|
type raw = Operation.t = {
|
|
|
|
shell: Operation.shell_header ;
|
|
|
|
proto: MBytes.t ;
|
|
|
|
}
|
|
|
|
val raw_encoding: raw Data_encoding.t
|
|
|
|
|
|
|
|
type t = operation
|
2017-04-14 02:47:26 +04:00
|
|
|
val encoding: operation Data_encoding.t
|
|
|
|
|
2017-03-20 21:11:43 +04:00
|
|
|
type error += Cannot_parse_operation (* `Branch *)
|
2017-04-19 21:21:23 +04:00
|
|
|
val parse: Operation_hash.t -> Operation.t -> operation tzresult
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val parse_proto:
|
|
|
|
MBytes.t -> (proto_operation * signature option) tzresult Lwt.t
|
|
|
|
|
2017-03-20 21:11:43 +04:00
|
|
|
type error += Missing_signature (* `Permanent *)
|
|
|
|
type error += Invalid_signature (* `Permanent *)
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
val check_signature: public_key -> operation -> unit tzresult Lwt.t
|
|
|
|
|
2017-04-19 21:21:23 +04:00
|
|
|
val forge: Operation.shell_header -> proto_operation -> MBytes.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val proto_operation_encoding: proto_operation Data_encoding.t
|
|
|
|
|
|
|
|
val unsigned_operation_encoding:
|
2017-04-19 21:21:23 +04:00
|
|
|
(Operation.shell_header * proto_operation) Data_encoding.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
module Block_header : sig
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
type t = {
|
2017-04-19 21:21:23 +04:00
|
|
|
shell: Block_header.shell_header ;
|
2016-09-08 21:13:10 +04:00
|
|
|
proto: proto_header ;
|
2017-02-28 05:56:40 +04:00
|
|
|
signature: Ed25519.Signature.t ;
|
2016-09-08 21:13:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
and proto_header = {
|
2017-04-10 15:01:22 +04:00
|
|
|
priority: int ;
|
2016-09-08 21:13:10 +04:00
|
|
|
seed_nonce_hash: Nonce_hash.t ;
|
|
|
|
proof_of_work_nonce: MBytes.t ;
|
|
|
|
}
|
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
type block_header = t
|
|
|
|
|
|
|
|
type raw = Tezos_data.Block_header.t
|
|
|
|
type shell_header = Tezos_data.Block_header.shell_header
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
val hash: block_header -> Block_hash.t
|
|
|
|
val hash_raw: raw -> Block_hash.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
val encoding: block_header Data_encoding.encoding
|
|
|
|
val raw_encoding: raw Data_encoding.t
|
|
|
|
val proto_header_encoding: proto_header Data_encoding.encoding
|
|
|
|
val shell_header_encoding: shell_header Data_encoding.encoding
|
|
|
|
|
|
|
|
val max_header_length: int
|
|
|
|
(** The maximum size of block headers in bytes *)
|
2017-03-22 20:21:52 +04:00
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
val parse: Block_header.t -> block_header tzresult
|
|
|
|
(** Parse the protocol-specific part of a block header. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-26 17:01:39 +04:00
|
|
|
val parse_unsigned_proto_header: MBytes.t -> proto_header tzresult
|
|
|
|
(** Parse the (unsigned) protocol-specific part of a block header. *)
|
|
|
|
|
|
|
|
val forge_unsigned_proto_header: proto_header -> MBytes.t
|
|
|
|
(** [forge_header proto_hdr] is the binary serialization
|
|
|
|
(using [proto_header_encoding]) of the protocol-specific part
|
|
|
|
of a block header, without the signature. *)
|
|
|
|
|
2017-04-20 17:21:10 +04:00
|
|
|
val forge_unsigned:
|
2017-04-19 21:21:23 +04:00
|
|
|
Block_header.shell_header -> proto_header -> MBytes.t
|
2017-11-13 19:34:00 +04:00
|
|
|
(** [forge_header shell_hdr proto_hdr] is the binary serialization
|
|
|
|
(using [unsigned_header_encoding]) of a block header,
|
|
|
|
comprising both the shell and the protocol part of the header,
|
|
|
|
without the signature. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Roll : sig
|
|
|
|
|
2017-11-20 00:32:24 +04:00
|
|
|
val value: context -> Tez.t
|
|
|
|
val next: context -> Int32.t tzresult Lwt.t
|
|
|
|
|
2016-10-26 19:02:10 +04:00
|
|
|
val freeze_rolls_for_cycle: context -> Cycle.t -> context tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val clear_cycle: context -> Cycle.t -> context tzresult Lwt.t
|
|
|
|
|
2017-11-01 15:07:33 +04:00
|
|
|
val baking_rights_owner:
|
2017-04-10 14:50:15 +04:00
|
|
|
context -> Level.t -> priority:int -> public_key_hash tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val endorsement_rights_owner:
|
|
|
|
context -> Level.t -> slot:int -> public_key_hash tzresult Lwt.t
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
module Reward : sig
|
|
|
|
|
|
|
|
val record:
|
|
|
|
context -> public_key_hash -> Cycle.t -> Tez.t -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val discard:
|
|
|
|
context -> public_key_hash -> Cycle.t -> Tez.t -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val set_reward_time_for_cycle:
|
|
|
|
context -> Cycle.t -> Time.t -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
val pay_due_rewards: context -> context tzresult Lwt.t
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2017-04-10 14:14:11 +04:00
|
|
|
val init:
|
|
|
|
Context.t ->
|
2017-04-10 15:01:22 +04:00
|
|
|
level:Int32.t ->
|
2017-04-10 14:14:11 +04:00
|
|
|
timestamp:Time.t ->
|
|
|
|
fitness:Fitness.t ->
|
|
|
|
context tzresult Lwt.t
|
|
|
|
val finalize: ?commit_message:string -> context -> Updater.validation_result
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val configure_sandbox:
|
|
|
|
Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t
|
|
|
|
|
|
|
|
val activate: context -> Protocol_hash.t -> context Lwt.t
|
2017-04-10 23:14:17 +04:00
|
|
|
val fork_test_network: context -> Protocol_hash.t -> Time.t -> context Lwt.t
|
2017-11-20 02:06:32 +04:00
|
|
|
|
2017-12-07 14:34:14 +04:00
|
|
|
val endorsement_already_recorded: context -> int -> bool
|
|
|
|
val record_endorsement: context -> int -> context
|
|
|
|
|
2017-11-20 02:06:32 +04:00
|
|
|
(**/**)
|
|
|
|
|
|
|
|
(* HACK alphanet *)
|
|
|
|
val faucet_count: context -> int
|
|
|
|
val incr_faucet_count: context -> context
|