exchange

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

0002-auditor_historic_denomination_revenue.sql (2155B)


      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 auditor_historic_denomination_revenue
     18   (row_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
     19   ,denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
     20   ,revenue_timestamp BIGINT NOT NULL
     21   ,revenue_balance taler_amount NOT NULL
     22   ,loss_balance taler_amount NOT NULL
     23   );
     24 COMMENT ON TABLE auditor_historic_denomination_revenue
     25   IS 'Table with historic profits; basically, when a denom_pub has expired and everything associated with it is garbage collected, the final profits end up in here; note that the denom_pub here is not a foreign key, we just keep it as a reference point.';
     26 COMMENT ON COLUMN auditor_historic_denomination_revenue.denom_pub_hash
     27   IS 'hash of the denomination public key that created this revenue';
     28 COMMENT ON COLUMN auditor_historic_denomination_revenue.revenue_timestamp
     29   IS 'when was this revenue realized (by the denomination public key expiring)';
     30 COMMENT ON COLUMN auditor_historic_denomination_revenue.revenue_balance
     31   IS 'the sum of all of the profits we made on the denomination except for withdraw fees (which are in historic_reserve_revenue); so this includes the deposit, melt and refund fees';
     32 COMMENT ON COLUMN auditor_historic_denomination_revenue.loss_balance
     33   IS 'the sum of all of the losses we made on the denomination (for example, because the signing key was compromised and thus we redeemed coins we never issued); of course should be zero in practice in most cases';