summaryrefslogtreecommitdiff
path: root/src/exchangedb/exchange-0001-part.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-07-30 10:12:48 +0200
committerChristian Grothoff <christian@grothoff.org>2022-07-30 10:12:48 +0200
commit75888adff2549fc8fa9aec9b4e80a37a214345e6 (patch)
tree1f1a3347af6f11187a7f1143348cacbaea0a2caa /src/exchangedb/exchange-0001-part.sql
parentba0ab58cdd4bd767f3944dcde1dc16676220d136 (diff)
downloadexchange-75888adff2549fc8fa9aec9b4e80a37a214345e6.tar.gz
exchange-75888adff2549fc8fa9aec9b4e80a37a214345e6.tar.bz2
exchange-75888adff2549fc8fa9aec9b4e80a37a214345e6.zip
setup drain_profits table (#4960)
Diffstat (limited to 'src/exchangedb/exchange-0001-part.sql')
-rw-r--r--src/exchangedb/exchange-0001-part.sql31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/exchangedb/exchange-0001-part.sql b/src/exchangedb/exchange-0001-part.sql
index 60b45b440..97f5829e6 100644
--- a/src/exchangedb/exchange-0001-part.sql
+++ b/src/exchangedb/exchange-0001-part.sql
@@ -63,6 +63,37 @@ COMMENT ON TABLE denomination_revocations
IS 'remembering which denomination keys have been revoked';
+-- ------------------------------ profit drains ----------------------------------------
+
+CREATE TABLE IF NOT EXISTS profit_drains
+ (profit_drain_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
+ ,wtid BYTEA PRIMARY KEY CHECK (LENGTH(wtid)=32)
+ ,account_section VARCHAR NOT NULL
+ ,payto_uri VARCHAR NOT NULL
+ ,trigger_date INT8 NOT NULL
+ ,amount_val INT8 NOT NULL
+ ,amount_frac INT8 NOT NULL
+ ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
+ ,executed BOOLEAN NOT NULL DEFAULT FALSE
+ );
+COMMENT ON TABLE profit_drains
+ IS 'transactions to be performed to move profits from the escrow account of the exchange to a regular account';
+COMMENT ON COLUMN profit_drains.wtid
+ IS 'randomly chosen nonce, unique to prevent double-submission';
+COMMENT ON COLUMN profit_drains.account_section
+ IS 'specifies the configuration section in the taler-exchange-drain configuration with the wire account to drain';
+COMMENT ON COLUMN profit_drains.payto_uri
+ IS 'specifies the account to be credited';
+COMMENT ON COLUMN profit_drains.trigger_date
+ IS 'set by taler-exchange-offline at the time of making the signature; not necessarily the exact date of execution of the wire transfer, just for orientation';
+COMMENT ON COLUMN profit_drains.amount_val
+ IS 'amount to be transferred';
+COMMENT ON COLUMN profit_drains.master_sig
+ IS 'EdDSA signature of type TALER_SIGNATURE_MASTER_DRAIN_PROFIT';
+COMMENT ON COLUMN profit_drains.executed
+ IS 'set to TRUE by taler-exchange-drain on execution of the transaction, not replicated to auditor';
+
+
-- ------------------------------ wire_targets ----------------------------------------
SELECT create_table_wire_targets();