ligo/vendors/ligo-utils/tezos-protocol-alpha/contract_storage.mli

176 lines
6.0 KiB
OCaml
Raw Permalink Normal View History

2019-09-05 17:21:01 +04:00
(*****************************************************************************)
(* *)
(* Open Source License *)
(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* Permission is hereby granted, free of charge, to any person obtaining a *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)
(* and/or sell copies of the Software, and to permit persons to whom the *)
(* Software is furnished to do so, subject to the following conditions: *)
(* *)
(* The above copyright notice and this permission notice shall be included *)
(* in all copies or substantial portions of the Software. *)
(* *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)
(* DEALINGS IN THE SOFTWARE. *)
(* *)
(*****************************************************************************)
2020-03-05 23:52:47 +04:00
val set_balance : Raw_context.t ->
Contract_repr.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t
2019-09-05 17:21:01 +04:00
type error +=
| Balance_too_low of Contract_repr.contract * Tez_repr.t * Tez_repr.t
| (* `Temporary *)
Counter_in_the_past of Contract_repr.contract * Z.t * Z.t
| (* `Branch *)
Counter_in_the_future of Contract_repr.contract * Z.t * Z.t
| (* `Temporary *)
Unspendable_contract of Contract_repr.contract
| (* `Permanent *)
Non_existing_contract of Contract_repr.contract
| (* `Temporary *)
Empty_implicit_contract of Signature.Public_key_hash.t
| (* `Temporary *)
Empty_implicit_delegated_contract of
Signature.Public_key_hash.t
| (* `Temporary *)
Empty_transaction of Contract_repr.t (* `Temporary *)
| Inconsistent_hash of
Signature.Public_key.t
* Signature.Public_key_hash.t
* Signature.Public_key_hash.t
| (* `Permanent *)
Inconsistent_public_key of
Signature.Public_key.t * Signature.Public_key.t
| (* `Permanent *)
Failure of string (* `Permanent *)
2019-09-05 17:21:01 +04:00
| Previously_revealed_key of Contract_repr.t (* `Permanent *)
| Unrevealed_manager_key of Contract_repr.t
2019-09-05 17:21:01 +04:00
(* `Permanent *)
2019-09-05 17:21:01 +04:00
val exists : Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val must_exist : Raw_context.t -> Contract_repr.t -> unit tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val allocated : Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val must_be_allocated : Raw_context.t -> Contract_repr.t -> unit tzresult Lwt.t
val list : Raw_context.t -> Contract_repr.t list Lwt.t
val check_counter_increment :
2019-10-17 13:45:27 +04:00
Raw_context.t -> Signature.Public_key_hash.t -> Z.t -> unit tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val increment_counter :
2019-10-17 13:45:27 +04:00
Raw_context.t -> Signature.Public_key_hash.t -> Raw_context.t tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val get_manager_key :
Raw_context.t ->
Signature.Public_key_hash.t ->
Signature.Public_key.t tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val is_manager_key_revealed :
2019-10-17 13:45:27 +04:00
Raw_context.t -> Signature.Public_key_hash.t -> bool tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val reveal_manager_key :
Raw_context.t ->
Signature.Public_key_hash.t ->
Signature.Public_key.t ->
2019-09-05 17:21:01 +04:00
Raw_context.t tzresult Lwt.t
val get_balance : Raw_context.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t
val get_counter :
Raw_context.t -> Signature.Public_key_hash.t -> Z.t tzresult Lwt.t
val get_script_code :
Raw_context.t ->
Contract_repr.t ->
(Raw_context.t * Script_repr.lazy_expr option) tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val get_script :
Raw_context.t ->
Contract_repr.t ->
(Raw_context.t * Script_repr.t option) tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val get_storage :
Raw_context.t ->
Contract_repr.t ->
(Raw_context.t * Script_repr.expr option) tzresult Lwt.t
2019-09-05 17:21:01 +04:00
2019-10-17 13:45:27 +04:00
type big_map_diff_item =
| Update of {
big_map : Z.t;
2019-10-17 13:45:27 +04:00
diff_key : Script_repr.expr;
diff_key_hash : Script_expr_hash.t;
diff_value : Script_repr.expr option;
}
| Clear of Z.t
| Copy of Z.t * Z.t
| Alloc of {
big_map : Z.t;
key_type : Script_repr.expr;
value_type : Script_repr.expr;
}
2019-09-05 17:21:01 +04:00
type big_map_diff = big_map_diff_item list
val big_map_diff_encoding : big_map_diff Data_encoding.t
val update_script_storage :
Raw_context.t ->
Contract_repr.t ->
Script_repr.expr ->
big_map_diff option ->
2019-09-05 17:21:01 +04:00
Raw_context.t tzresult Lwt.t
val credit :
Raw_context.t ->
Contract_repr.t ->
Tez_repr.t ->
2019-09-05 17:21:01 +04:00
Raw_context.t tzresult Lwt.t
val spend :
Raw_context.t ->
Contract_repr.t ->
Tez_repr.t ->
2019-09-05 17:21:01 +04:00
Raw_context.t tzresult Lwt.t
val originate :
2019-09-05 17:21:01 +04:00
Raw_context.t ->
?prepaid_bootstrap_storage:bool ->
Contract_repr.t ->
balance:Tez_repr.t ->
script:Script_repr.t * big_map_diff option ->
2019-09-05 17:21:01 +04:00
delegate:Signature.Public_key_hash.t option ->
Raw_context.t tzresult Lwt.t
val fresh_contract_from_current_nonce :
Raw_context.t -> (Raw_context.t * Contract_repr.t) tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val originated_from_current_nonce :
since:Raw_context.t ->
until:Raw_context.t ->
2019-09-05 17:21:01 +04:00
Contract_repr.t list tzresult Lwt.t
val init : Raw_context.t -> Raw_context.t tzresult Lwt.t
val used_storage_space : Raw_context.t -> Contract_repr.t -> Z.t tzresult Lwt.t
2019-09-05 17:21:01 +04:00
val paid_storage_space : Raw_context.t -> Contract_repr.t -> Z.t tzresult Lwt.t
val set_paid_storage_space_and_return_fees_to_pay :
Raw_context.t ->
Contract_repr.t ->
Z.t ->
(Z.t * Raw_context.t) tzresult Lwt.t