This commit is contained in:
swrup 2026-02-23 11:13:54 +01:00
parent b57e9cfa73
commit de4c3659cd
3 changed files with 16 additions and 31 deletions

View file

@ -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_abs = Config.stefan_abs in
let stefan_log = Config.stefan_log in let stefan_log = Config.stefan_log in
let stefan_lin = Config.stefan_lin in let stefan_lin = Config.stefan_lin in
(* todo asset_type (* type of the asset. "fiat", "crypto", "regional" or "stock". *)
Type of the asset. "fiat", "crypto", "regional" or "stock". *) let asset_type = "fiat" in
let asset_type = "xxx" in
let* accounts = Pg.get_wire_accounts db_conn () |> unwrap_err_caqti in let* accounts = Pg.get_wire_accounts db_conn () |> unwrap_err_caqti in
let* wire_fees = let* wire_fees =
(* todo (* wire_methods? *)
where does wire_methods comes from? *) let wire_method = "x-taler-bank" in
let wire_method = "xxx" in
let+ wire_fees = let+ wire_fees =
Pg.get_wire_fees db_conn ~wire_method |> unwrap_err_caqti Pg.get_wire_fees db_conn ~wire_method |> unwrap_err_caqti
in in
String_map.singleton wire_method wire_fees String_map.singleton wire_method wire_fees
in in
let wads = let wads = [] in
(* TODO wads *)
[]
in
let rewards_allowed = false in let rewards_allowed = false in
let kyc_enabled = 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 master_public_key = Config.master_public_key in
let reserve_closing_delay = Config.Exchangedb.idle_reserve_expiration_time in let reserve_closing_delay = Config.Exchangedb.idle_reserve_expiration_time in
(* todo *)
let wallet_balance_limit_without_kyc = None in let wallet_balance_limit_without_kyc = None in
let hard_limits = [] in let hard_limits = [] in
let zero_limits = [] in let zero_limits = [] in
let* denom_l = Keys.denominations () 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 = let list_issue_date =
match denom_l with List.fold_left
| [] -> Timestamp.zero (fun acc dn -> Timestamp.max acc dn.Denomination.stamp_start)
| dn :: _ -> dn.Denomination.stamp_start Timestamp.zero denom_l
in in
let denom_l = let denom_l =
(* if `?last_issue_date` query param does not exactly match the `stamp_start` (* 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* denominations = Denomination.make_denom_group_sorted denom_l in
let* signkeys = Keys.signkeys () in let* signkeys = Keys.signkeys () in
let signkeys = let signkeys = List.map Api.SignKey.of_signkey signkeys in
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
(* the eddsa pub key used to sign exchange_sig *) (* the eddsa pub key used to sign exchange_sig *)
let* exchange_pub = 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 } signf (Keys.sign exchange_pub) R.{ list_issue_date; hc }
in in
let recoup = (* TODO /recoup *) [] in let recoup = (* /recoup *) [] in
let* global_fees = let* global_fees =
Pg.get_global_fees db_conn ~start_date:Timestamp.zero |> unwrap_err_caqti Pg.get_global_fees db_conn ~start_date:Timestamp.zero |> unwrap_err_caqti
in in
let* auditors = let* auditors =
(* TODO /auditors/$AUDITOR_PUB/$H_DENOM_PUB *) (* /auditors/$AUDITOR_PUB/$H_DENOM_PUB *)
(* does not contains auditor_keys with empty denomination_keys *)
Pg.get_auditor_keys db_conn Pg.get_auditor_keys db_conn
in in
let extensions = None in let extensions = None in

View file

@ -99,6 +99,8 @@ module Timestamp = struct
let never = uint64_max let never = uint64_max
let zero = 0L let zero = 0L
let compare = Int64.unsigned_compare 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 *) (* zero if a >= b; never if b=never; otherwise b - a *)
let diff a b = let diff a b =

View file

@ -38,6 +38,8 @@ module Timestamp : sig
val never : t val never : t
val zero : t val zero : t
val compare : t -> t -> int val compare : t -> t -> int
val min : t -> t -> t
val max : t -> t -> t
val diff : t -> t -> Relative.t val diff : t -> t -> Relative.t
val of_s : int64 -> t val of_s : int64 -> t