exchange

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

0002-denominations.sql (2033B)


      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 denominations
     18   (denominations_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
     19   ,denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
     20   ,denom_type INT4 NOT NULL DEFAULT (1) -- 1 == RSA (for now, remove default later!)
     21   ,age_mask INT4 NOT NULL DEFAULT (0)
     22   ,denom_pub BYTEA NOT NULL
     23   ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
     24   ,valid_from INT8 NOT NULL
     25   ,expire_withdraw INT8 NOT NULL
     26   ,expire_deposit INT8 NOT NULL
     27   ,expire_legal INT8 NOT NULL
     28   ,coin taler_amount NOT NULL
     29   ,fee_withdraw taler_amount NOT NULL
     30   ,fee_deposit taler_amount NOT NULL
     31   ,fee_refresh taler_amount NOT NULL
     32   ,fee_refund taler_amount NOT NULL
     33   );
     34 COMMENT ON TABLE denominations
     35   IS 'Main denominations table. All the valid denominations the exchange knows about.';
     36 COMMENT ON COLUMN denominations.denom_type
     37   IS 'determines cipher type for blind signatures used with this denomination; 0 is for RSA';
     38 COMMENT ON COLUMN denominations.age_mask
     39   IS 'bitmask with the age restrictions that are being used for this denomination; 0 if denomination does not support the use of age restrictions';
     40 COMMENT ON COLUMN denominations.denominations_serial
     41   IS 'needed for exchange-auditor replication logic';
     42 
     43 CREATE INDEX denominations_by_expire_legal_index
     44   ON denominations
     45   (expire_legal);