diff --git a/src/http_info.ml b/src/http_info.ml index 21a6943a..53039402 100644 --- a/src/http_info.ml +++ b/src/http_info.ml @@ -32,44 +32,32 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date = let stefan_abs = Config.stefan_abs in let stefan_log = Config.stefan_log in let stefan_lin = Config.stefan_lin in - (* todo asset_type - Type of the asset. "fiat", "crypto", "regional" or "stock". *) - let asset_type = "xxx" in + (* type of the asset. "fiat", "crypto", "regional" or "stock". *) + let asset_type = "fiat" in let* accounts = Pg.get_wire_accounts db_conn () |> unwrap_err_caqti in let* wire_fees = - (* todo - where does wire_methods comes from? *) - let wire_method = "xxx" in + (* wire_methods? *) + let wire_method = "x-taler-bank" in let+ wire_fees = Pg.get_wire_fees db_conn ~wire_method |> unwrap_err_caqti in String_map.singleton wire_method wire_fees in - let wads = - (* TODO wads *) - [] - in + let wads = [] in let rewards_allowed = false in let kyc_enabled = false in - let disable_direct_deposit = (* todo *) false in + let disable_direct_deposit = false in let master_public_key = Config.master_public_key in let reserve_closing_delay = Config.Exchangedb.idle_reserve_expiration_time in - (* todo *) let wallet_balance_limit_without_kyc = None in let hard_limits = [] in let zero_limits = [] in let* denom_l = Keys.denominations () in - let denom_l = - (* reverse chronological order *) - List.sort - (fun a b -> Stdlib.compare b.Denomination.stamp_start a.stamp_start) - denom_l - in let list_issue_date = - match denom_l with - | [] -> Timestamp.zero - | dn :: _ -> dn.Denomination.stamp_start + List.fold_left + (fun acc dn -> Timestamp.max acc dn.Denomination.stamp_start) + Timestamp.zero denom_l in let denom_l = (* if `?last_issue_date` query param does not exactly match the `stamp_start` @@ -95,13 +83,7 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date = let* denominations = Denomination.make_denom_group_sorted denom_l in let* signkeys = Keys.signkeys () in - let signkeys = - signkeys - |> List.sort (fun a b -> - let open Signkey in - Stdlib.compare b.stamp_start a.stamp_start) - |> List.map Api.SignKey.of_signkey - in + let signkeys = List.map Api.SignKey.of_signkey signkeys in (* the eddsa pub key used to sign exchange_sig *) let* exchange_pub = @@ -124,13 +106,12 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date = signf (Keys.sign exchange_pub) R.{ list_issue_date; hc } in - let recoup = (* TODO /recoup *) [] in + let recoup = (* /recoup *) [] in let* global_fees = Pg.get_global_fees db_conn ~start_date:Timestamp.zero |> unwrap_err_caqti in let* auditors = - (* TODO /auditors/$AUDITOR_PUB/$H_DENOM_PUB *) - (* does not contains auditor_keys with empty denomination_keys *) + (* /auditors/$AUDITOR_PUB/$H_DENOM_PUB *) Pg.get_auditor_keys db_conn in let extensions = None in diff --git a/src/time.ml b/src/time.ml index 3c5af371..b1789951 100644 --- a/src/time.ml +++ b/src/time.ml @@ -99,6 +99,8 @@ module Timestamp = struct let never = uint64_max let zero = 0L let compare = Int64.unsigned_compare + let min a b = if compare a b < 0 then a else b + let max a b = if compare a b > 0 then a else b (* zero if a >= b; never if b=never; otherwise b - a *) let diff a b = diff --git a/src/time.mli b/src/time.mli index 544e92f9..9430b8a1 100644 --- a/src/time.mli +++ b/src/time.mli @@ -38,6 +38,8 @@ module Timestamp : sig val never : t val zero : t val compare : t -> t -> int + val min : t -> t -> t + val max : t -> t -> t val diff : t -> t -> Relative.t val of_s : int64 -> t