JJ: Description from the destination commit:

offline tool: add global-fees cmd

JJ: Description from source commit:
.
This commit is contained in:
swrup 2026-02-03 15:56:05 +01:00
parent 4754517d8f
commit 370b634283
11 changed files with 207 additions and 19 deletions

View file

@ -433,13 +433,10 @@ module Global_fees = struct
purse_timeout;
master_sig;
} =
(* TODO what is kyc_timeout, kyc_fee ? *)
let dummy_amount =
Amount.make ~sign:None ~currency:"EUR" ~value:0_L ~fraction:0_l
|> Result.get_ok
in
(* TODO KYC
what is kyc_timeout, kyc_fee ? *)
let kyc_timeout = None in
let kyc_fee = dummy_amount in
let kyc_fee = Amount.dummy_value in
(* * *)
let open Bin_sig.GlobalFees in
verify_f ~f:Sm.verify_with_master_key master_sig
@ -465,12 +462,28 @@ module Global_fees = struct
in
match global_fees with
| [] ->
let+ () = Pg.insert_global_fee db_conn v |> unwrap_err_caqti in
let+ () = Pg.insert_global_fees db_conn v |> unwrap_err_caqti in
Logs.info (fun m -> m "added global fees");
()
| _l -> Error "global-fees already setup"
| [ vv ] -> (
match v.master_sig = vv.master_sig with
| false ->
Error
"a different global-fees was already setup for this time frame"
| true ->
Logs.info (fun m -> m "an identical global-fees was already setup");
Ok ())
| _ ->
Error
"invalid database state, multiple global-fees found in database for \
this time frame"
let jsont = GlobalFees.jsont
(* TODO global_fees
ensure it is defined for the current time.
there should be only one global_fees for each moment in time
and once set for a timeframe, it should not change. *)
let f req server _env =
Logs.info (fun m -> m "POST /management/global-fees/");
let sm = Vif.Server.device Devices.secmod server in