Alpha: Minor style issue

This commit is contained in:
Grégoire Henry 2018-02-19 22:08:36 +01:00 committed by Benjamin Canou
parent 7fcc8fa7f9
commit 892acb0c72
4 changed files with 78 additions and 49 deletions

View File

@ -15,27 +15,34 @@ let nonce_length = 32
(* 10 tez *)
let seed_nonce_revelation_tip =
Tez_repr.(mul_exn one 10)
(* 1 tez *)
let origination_burn =
Tez_repr.one
(* 1 tez *)
let minimal_contract_balance =
Tez_repr.one
(* 1000 tez *)
let baking_bond_cost =
Tez_repr.(mul_exn one 1000)
(* 1000 tez *)
let endorsement_bond_cost =
Tez_repr.(mul_exn one 1000)
(* 150 tez *)
let baking_reward =
Tez_repr.(mul_exn one 150)
(* 150 tez *)
let endorsement_reward =
Tez_repr.(mul_exn one 150)
(* 100,000 tez *)
let faucet_credit =
Tez_repr.(mul_exn one 100_000)
(* 4,000,000 tez *)
let bootstrap_wealth =
Tez_repr.(mul_exn one 4_000_000)

View File

@ -185,7 +185,8 @@ let () =
let failwith msg = fail (Failure msg)
let create_base c contract ~balance ~manager ~delegate ?script ~spendable ~delegatable =
let create_base c contract
~balance ~manager ~delegate ?script ~spendable ~delegatable =
(match Contract_repr.is_default contract with
| None -> return 0l
| Some _ -> Storage.Contract.Global_counter.get c) >>=? fun counter ->
@ -303,10 +304,10 @@ let get_manager c contract =
let update_manager_key c contract = function
| Some public_key ->
begin Storage.Contract.Manager.get c contract >>=? function
| (Manager_repr.Public_key v) -> (* key revealed for the second time *)
| Public_key v -> (* key revealed for the second time *)
if Ed25519.Public_key.(v = public_key) then return (c,v)
else fail (Inconsistent_public_key (v,public_key))
| (Manager_repr.Hash v) ->
| Hash v ->
let actual_hash = Ed25519.Public_key.hash public_key in
if (Ed25519.Public_key_hash.equal actual_hash v) then
let v = (Manager_repr.Public_key public_key) in
@ -316,8 +317,8 @@ let update_manager_key c contract = function
end
| None ->
begin Storage.Contract.Manager.get c contract >>=? function
| (Manager_repr.Public_key v) -> return (c,v) (* already revealed *)
| (Manager_repr.Hash v) -> fail (Missing_public_key (v))
| Public_key v -> return (c,v) (* already revealed *)
| Hash v -> fail (Missing_public_key (v))
end
let get_delegate_opt = Roll_storage.get_contract_delegate
@ -447,7 +448,8 @@ let init c =
Storage.Contract.Global_counter.init c 0l
module Big_map = struct
let set handle key value = Storage.Contract.Big_map.init_set handle key value >>= return
let set handle key value =
Storage.Contract.Big_map.init_set handle key value >>= return
let remove = Storage.Contract.Big_map.delete
let mem = Storage.Contract.Big_map.mem
let get_opt = Storage.Contract.Big_map.get_option

View File

@ -28,23 +28,35 @@ val must_exist: 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: Raw_context.t -> Contract_repr.t -> int32 -> unit tzresult Lwt.t
val increment_counter: Raw_context.t -> Contract_repr.t -> Raw_context.t tzresult Lwt.t
val check_counter_increment:
Raw_context.t -> Contract_repr.t -> int32 -> unit tzresult Lwt.t
val increment_counter:
Raw_context.t -> Contract_repr.t -> Raw_context.t tzresult Lwt.t
val is_delegatable:
Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t
val is_delegatable : Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t
val is_spendable: Raw_context.t -> Contract_repr.t -> bool tzresult Lwt.t
val get_manager: Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t tzresult Lwt.t
val get_manager:
Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t tzresult Lwt.t
val update_manager_key:
Raw_context.t -> Contract_repr.t -> Ed25519.Public_key.t option ->
(Raw_context.t * Ed25519.Public_key.t) tzresult Lwt.t
val get_delegate_opt: Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option tzresult Lwt.t
val get_delegate_opt:
Raw_context.t -> Contract_repr.t ->
Ed25519.Public_key_hash.t option tzresult Lwt.t
val get_balance: Raw_context.t -> Contract_repr.t -> Tez_repr.t tzresult Lwt.t
val get_counter: Raw_context.t -> Contract_repr.t -> int32 tzresult Lwt.t
val get_script: Raw_context.t -> Contract_repr.t -> Script_repr.t option tzresult Lwt.t
val get_storage: Raw_context.t -> Contract_repr.t -> Script_repr.expr option tzresult Lwt.t
val get_script:
Raw_context.t -> Contract_repr.t -> Script_repr.t option tzresult Lwt.t
val get_storage:
Raw_context.t -> Contract_repr.t -> Script_repr.expr option tzresult Lwt.t
type big_map_diff = (string * Script_repr.expr option) list
@ -54,15 +66,23 @@ val update_script_storage_and_fees:
Raw_context.t tzresult Lwt.t
(** fails if the contract is not delegatable *)
val set_delegate : Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option -> Raw_context.t tzresult Lwt.t
val set_delegate:
Raw_context.t -> Contract_repr.t -> Ed25519.Public_key_hash.t option ->
Raw_context.t tzresult Lwt.t
val credit : Raw_context.t -> Contract_repr.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t
val credit:
Raw_context.t -> Contract_repr.t -> Tez_repr.t ->
Raw_context.t tzresult Lwt.t
(** checks that the contract is spendable and decrease_balance *)
val spend : Raw_context.t -> Contract_repr.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t
val spend:
Raw_context.t -> Contract_repr.t -> Tez_repr.t ->
Raw_context.t tzresult Lwt.t
(** decrease_balance even if the contract is not spendable *)
val spend_from_script : Raw_context.t -> Contract_repr.t -> Tez_repr.t -> Raw_context.t tzresult Lwt.t
val spend_from_script:
Raw_context.t -> Contract_repr.t -> Tez_repr.t ->
Raw_context.t tzresult Lwt.t
val originate:
Raw_context.t ->