2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
type error +=
|
2017-03-02 21:16:19 +04:00
|
|
|
| Balance_too_low of Contract_repr.contract * Tez_repr.t * Tez_repr.t
|
|
|
|
| Initial_amount_too_low of Tez_repr.t * Tez_repr.t
|
|
|
|
| Counter_in_the_past of Contract_repr.contract * int32 * int32
|
|
|
|
| Counter_in_the_future of Contract_repr.contract * int32 * int32
|
|
|
|
| Unspendable_contract of Contract_repr.contract
|
2016-09-08 21:13:10 +04:00
|
|
|
| Non_existing_contract
|
|
|
|
| No_delegate
|
|
|
|
| Undelagatable_contract
|
2017-03-02 21:16:19 +04:00
|
|
|
| Failure of string
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val delete : Storage.t -> Contract_repr.t -> Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
val exists: Storage.t -> Contract_repr.t -> bool tzresult Lwt.t
|
|
|
|
|
|
|
|
val list: Storage.t -> Contract_repr.t list tzresult Lwt.t
|
|
|
|
|
|
|
|
val check_counter_increment: Storage.t -> Contract_repr.t -> int32 -> unit tzresult Lwt.t
|
|
|
|
val increment_counter: Storage.t -> Contract_repr.t -> Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
val is_delegatable : Storage.t -> Contract_repr.t -> bool tzresult Lwt.t
|
|
|
|
val is_spendable : Storage.t -> Contract_repr.t -> bool tzresult Lwt.t
|
|
|
|
|
2016-11-14 18:54:21 +04:00
|
|
|
val get_manager: Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t tzresult Lwt.t
|
|
|
|
val get_delegate: Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t tzresult Lwt.t
|
|
|
|
val get_delegate_opt: Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
val get_balance: Storage.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t
|
|
|
|
val get_assets: Storage.t -> Contract_repr.t -> Asset_repr.Map.t tzresult Lwt.t
|
|
|
|
val get_counter: Storage.t -> Contract_repr.t -> int32 tzresult Lwt.t
|
|
|
|
|
|
|
|
val get_script: Storage.t -> Contract_repr.t -> Script_repr.t tzresult Lwt.t
|
|
|
|
|
|
|
|
(** Update_script_storage fails if the contract has not enouth tez to
|
|
|
|
store the new data.
|
|
|
|
It does not fail if the contract does not exists *)
|
|
|
|
val update_script_storage: Storage.t -> Contract_repr.t -> Script_repr.expr ->
|
|
|
|
Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
(** fails if the contract is not delegatable *)
|
2016-11-14 18:54:21 +04:00
|
|
|
val set_delegate : Storage.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option -> Storage.t tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val credit : Storage.t -> Contract_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
(** checks that the contract is spendable and decrease_balance *)
|
|
|
|
val spend : Storage.t -> Contract_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
(* decrease balance uncondionally *)
|
|
|
|
val unconditional_spend : Storage.t -> Contract_repr.t -> Tez_repr.t -> Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
val issue :
|
2016-11-14 18:54:21 +04:00
|
|
|
Storage.t -> Contract_repr.t -> Asset_repr.t -> Ed25519.Public_key_hash.t -> Tez_repr.t -> Storage.t tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val originate :
|
|
|
|
Storage.t ->
|
2017-02-16 22:01:35 +04:00
|
|
|
Contract_repr.origination_nonce ->
|
2016-09-08 21:13:10 +04:00
|
|
|
balance:Tez_repr.t ->
|
2016-11-14 18:54:21 +04:00
|
|
|
manager:Ed25519.Public_key_hash.t ->
|
2016-09-08 21:13:10 +04:00
|
|
|
script:Script_repr.t ->
|
2016-11-14 18:54:21 +04:00
|
|
|
delegate:Ed25519.Public_key_hash.t option ->
|
2016-09-08 21:13:10 +04:00
|
|
|
spendable:bool ->
|
|
|
|
delegatable:bool ->
|
2017-02-16 22:01:35 +04:00
|
|
|
(Storage.t * Contract_repr.t * Contract_repr.origination_nonce) tzresult Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
val init :
|
|
|
|
Storage.t -> Storage.t tzresult Lwt.t
|
|
|
|
|
|
|
|
val pp: Format.formatter -> Contract_repr.t -> unit
|