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. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-02-25 21:01:27 +04:00
|
|
|
let get ctxt =
|
|
|
|
Storage.get_fitness ctxt >>= fun fitness ->
|
|
|
|
Fitness_repr.to_int64 fitness
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-25 21:01:27 +04:00
|
|
|
let set ctxt v =
|
|
|
|
Storage.set_fitness ctxt (Fitness_repr.from_int64 v) >>= fun ctxt ->
|
|
|
|
Lwt.return ctxt
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-25 21:01:27 +04:00
|
|
|
let increase ctxt =
|
|
|
|
get ctxt >>=? fun v ->
|
|
|
|
set ctxt (Int64.succ v) >>= fun ctxt ->
|
|
|
|
return ctxt
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-02-25 21:01:27 +04:00
|
|
|
let init ctxt = set ctxt 0L
|