From 7ff58c3d8f2351c57142b4b65ab75304f355fc4f Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Sat, 5 Mar 2022 14:36:49 +0100
Subject: refactor /wire to include logic to return the wad fee (for W2W
 payments)

---
 src/exchangedb/exchange-0001.sql | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

(limited to 'src/exchangedb/exchange-0001.sql')

diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql
index 3331eada2..a3996d120 100644
--- a/src/exchangedb/exchange-0001.sql
+++ b/src/exchangedb/exchange-0001.sql
@@ -835,6 +835,8 @@ CREATE TABLE IF NOT EXISTS wire_fee
   ,wire_fee_frac INT4 NOT NULL
   ,closing_fee_val INT8 NOT NULL
   ,closing_fee_frac INT4 NOT NULL
+  ,wad_fee_val INT8 NOT NULL
+  ,wad_fee_frac INT4 NOT NULL
   ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
   ,PRIMARY KEY (wire_method, start_date)
   );
@@ -848,6 +850,27 @@ CREATE INDEX IF NOT EXISTS wire_fee_by_end_date_index
   (end_date);
 
 
+CREATE TABLE IF NOT EXISTS global_fee
+  (global_fee_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
+  ,start_date INT8 NOT NULL
+  ,end_date INT8 NOT NULL
+  ,history_fee_val INT8 NOT NULL
+  ,history_fee_frac INT4 NOT NULL
+  ,kyc_fee_val INT8 NOT NULL
+  ,kyc_fee_frac INT4 NOT NULL
+  ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
+  ,PRIMARY KEY (start_date)
+  );
+COMMENT ON TABLE global_fee
+  IS 'list of the global fees of this exchange, by date';
+COMMENT ON COLUMN global_fee.global_fee_serial
+  IS 'needed for exchange-auditor replication logic';
+
+CREATE INDEX IF NOT EXISTS global_fee_by_end_date_index
+  ON global_fee
+  (end_date);
+
+
 CREATE TABLE IF NOT EXISTS recoup
   (recoup_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE
   ,known_coin_id INT8 NOT NULL -- REFERENCES known_coins (known_coin_id)
-- 
cgit v1.2.3

