exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

0002-profit_drains.sql (2124B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2014--2022 Taler Systems SA
      4 --
      5 -- TALER is free software; you can redistribute it and/or modify it under the
      6 -- terms of the GNU General Public License as published by the Free Software
      7 -- Foundation; either version 3, or (at your option) any later version.
      8 --
      9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11 -- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 --
     13 -- You should have received a copy of the GNU General Public License along with
     14 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 --
     16 
     17 CREATE TABLE profit_drains
     18   (profit_drain_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
     19   ,wtid BYTEA PRIMARY KEY CHECK (LENGTH(wtid)=32)
     20   ,account_section TEXT NOT NULL
     21   ,payto_uri TEXT NOT NULL
     22   ,trigger_date INT8 NOT NULL
     23   ,amount taler_amount NOT NULL
     24   ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
     25   ,executed BOOLEAN NOT NULL DEFAULT FALSE
     26   );
     27 COMMENT ON TABLE profit_drains
     28   IS 'transactions to be performed to move profits from the escrow account of the exchange to a regular account';
     29 COMMENT ON COLUMN profit_drains.wtid
     30   IS 'randomly chosen nonce, unique to prevent double-submission';
     31 COMMENT ON COLUMN profit_drains.account_section
     32   IS 'specifies the configuration section in the taler-exchange-drain configuration with the wire account to drain';
     33 COMMENT ON COLUMN profit_drains.payto_uri
     34   IS 'specifies the account to be credited';
     35 COMMENT ON COLUMN profit_drains.trigger_date
     36   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';
     37 COMMENT ON COLUMN profit_drains.amount
     38   IS 'amount to be transferred';
     39 COMMENT ON COLUMN profit_drains.master_sig
     40   IS 'EdDSA signature of type TALER_SIGNATURE_MASTER_DRAIN_PROFIT';
     41 COMMENT ON COLUMN profit_drains.executed
     42   IS 'set to TRUE by taler-exchange-drain on execution of the transaction, not replicated to auditor';