summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac5
-rw-r--r--contrib/auditor-report.tex.j214
m---------contrib/gana0
-rwxr-xr-xcontrib/gana-update.sh29
-rw-r--r--contrib/microhttpd.tag6
-rw-r--r--contrib/sigp/.gitignore3
-rw-r--r--contrib/sigp/Makefile21
-rw-r--r--contrib/sigp/README10
-rw-r--r--contrib/sigp/h.footer3
-rw-r--r--contrib/sigp/h.header32
-rw-r--r--contrib/sigp/h.template6
-rwxr-xr-xcontrib/taler-bank-manage-testing176
-rwxr-xr-xcontrib/taler-nexus-prepare233
-rw-r--r--contrib/tos/bfh.rst310
-rw-r--r--contrib/tos/en/0.epubbin17320 -> 24290 bytes
-rw-r--r--contrib/tos/en/0.html54
-rw-r--r--contrib/tos/en/0.pdfbin82060 -> 83662 bytes
-rw-r--r--contrib/tos/en/0.txt92
-rw-r--r--contrib/tos/en/0.xml56
-rw-r--r--debian/changelog6
-rw-r--r--debian/control22
-rw-r--r--debian/libtalerexchange.install1
-rwxr-xr-xdebian/rules4
-rw-r--r--debian/taler-exchange.postrm13
-rw-r--r--debian/taler-exchange.taler-exchange-aggregator.service1
-rw-r--r--debian/taler-exchange.taler-exchange-aggregator@.service16
-rw-r--r--debian/taler-exchange.taler-exchange-closer.service1
-rw-r--r--debian/taler-exchange.taler-exchange-expire.service16
-rw-r--r--debian/taler-exchange.taler-exchange-httpd.service1
-rw-r--r--debian/taler-exchange.taler-exchange-httpd@.service1
-rw-r--r--debian/taler-exchange.taler-exchange-secmod-cs.service2
-rw-r--r--debian/taler-exchange.taler-exchange-secmod-eddsa.service3
-rw-r--r--debian/taler-exchange.taler-exchange-secmod-rsa.service2
-rw-r--r--debian/taler-exchange.taler-exchange-transfer.service1
-rw-r--r--debian/taler-exchange.taler-exchange-wirewatch.service1
-rw-r--r--debian/taler-exchange.taler-exchange-wirewatch@.service1
-rw-r--r--debian/taler-exchange.taler-exchange.slice7
-rw-r--r--debian/taler-exchange.taler-exchange.target1
-rw-r--r--doc/Makefile.am3
-rw-r--r--doc/cs/ads/glossary.tex28
-rw-r--r--doc/cs/content/1_introduction.tex4
-rw-r--r--doc/cs/content/3_preliminaries.tex22
-rw-r--r--doc/cs/content/4_2_specification.tex16
-rw-r--r--doc/cs/content/4_3_implementation.tex14
-rw-r--r--doc/cs/content/5_discussion.tex12
-rw-r--r--doc/cs/content/6_conclusion.tex10
m---------doc/prebuilt0
-rw-r--r--src/Makefile.am1
-rw-r--r--src/auditor/.gitignore4
-rw-r--r--src/auditor/Makefile.am2
-rw-r--r--src/auditor/auditor-basedb-libeufin.sql138
-rw-r--r--src/auditor/auditor-basedb.age2
-rw-r--r--src/auditor/auditor-basedb.conf254
-rw-r--r--src/auditor/auditor-basedb.feesbin800 -> 0 bytes
-rw-r--r--src/auditor/auditor-basedb.mpub2
-rw-r--r--src/auditor/auditor-basedb.sql11610
-rw-r--r--src/auditor/batch.conf12
-rwxr-xr-xsrc/auditor/batch.sh2
-rw-r--r--src/auditor/generate-auditor-basedb.conf4
-rwxr-xr-xsrc/auditor/generate-auditor-basedb.sh106
-rwxr-xr-xsrc/auditor/generate-revoke-basedb.sh33
-rw-r--r--src/auditor/report-lib.c11
-rw-r--r--src/auditor/report-lib.h5
-rw-r--r--src/auditor/revoke-basedb-libeufin.sql163
-rw-r--r--src/auditor/revoke-basedb.age2
-rw-r--r--src/auditor/revoke-basedb.conf8
-rw-r--r--src/auditor/revoke-basedb.feesbin800 -> 0 bytes
-rw-r--r--src/auditor/revoke-basedb.mpub2
-rw-r--r--src/auditor/revoke-basedb.sql11638
-rw-r--r--src/auditor/taler-auditor-sync.c14
-rw-r--r--src/auditor/taler-auditor.in15
-rw-r--r--src/auditor/taler-helper-auditor-aggregation.c215
-rw-r--r--src/auditor/taler-helper-auditor-coins.c526
-rw-r--r--src/auditor/taler-helper-auditor-deposits.c2
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c797
-rw-r--r--src/auditor/taler-helper-auditor-wire.c277
-rwxr-xr-xsrc/auditor/test-auditor.sh488
-rwxr-xr-xsrc/auditor/test-revocation.sh115
-rwxr-xr-xsrc/auditor/test-sync.sh4
-rw-r--r--src/auditordb/Makefile.am6
-rw-r--r--src/auditordb/auditor-0001.sql21
-rw-r--r--src/auditordb/drop.sql26
-rw-r--r--src/auditordb/drop0001.sql50
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c173
-rw-r--r--src/auditordb/restart.sql (renamed from src/auditordb/restart0001.sql)2
-rw-r--r--src/auditordb/test_auditordb.c74
-rw-r--r--src/auditordb/versioning.sql (renamed from src/auditordb/auditor-0000.sql)0
-rw-r--r--src/bank-lib/bank_api_credit.c3
-rw-r--r--src/bank-lib/fakebank.c417
-rwxr-xr-xsrc/bank-lib/test_bank.sh7
-rw-r--r--src/benchmark/Makefile.am4
-rw-r--r--src/benchmark/taler-aggregator-benchmark.c3
-rw-r--r--src/benchmark/taler-bank-benchmark.c129
-rw-r--r--src/exchange-tools/Makefile.am1
-rw-r--r--src/exchange-tools/taler-crypto-worker.c49
-rw-r--r--src/exchange-tools/taler-exchange-dbinit.c95
-rw-r--r--src/exchange-tools/taler-exchange-offline.c285
-rw-r--r--src/exchange/Makefile.am20
-rw-r--r--src/exchange/taler-exchange-aggregator.c783
-rw-r--r--src/exchange/taler-exchange-drain.c431
-rw-r--r--src/exchange/taler-exchange-httpd.c69
-rw-r--r--src/exchange/taler-exchange-httpd.h7
-rw-r--r--src/exchange/taler-exchange-httpd_batch-deposit.c700
-rw-r--r--src/exchange/taler-exchange-httpd_batch-deposit.h49
-rw-r--r--src/exchange/taler-exchange-httpd_batch-withdraw.c167
-rw-r--r--src/exchange/taler-exchange-httpd_common_deposit.c310
-rw-r--r--src/exchange/taler-exchange-httpd_common_deposit.h130
-rw-r--r--src/exchange/taler-exchange-httpd_csr.c2
-rw-r--r--src/exchange/taler-exchange-httpd_db.c6
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c46
-rw-r--r--src/exchange/taler-exchange-httpd_deposits_get.c14
-rw-r--r--src/exchange/taler-exchange-httpd_extensions.c13
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c473
-rw-r--r--src/exchange/taler-exchange-httpd_keys.h18
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.c352
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.h2
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-proof.c671
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-proof.h2
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-wallet.c121
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-webhook.c347
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-webhook.h64
-rw-r--r--src/exchange/taler-exchange-httpd_management.h13
-rw-r--r--src/exchange/taler-exchange-httpd_management_drain.c195
-rw-r--r--src/exchange/taler-exchange-httpd_management_extensions.c12
-rw-r--r--src/exchange/taler-exchange-httpd_management_post_keys.c20
-rw-r--r--src/exchange/taler-exchange-httpd_melt.c2
-rw-r--r--src/exchange/taler-exchange-httpd_metrics.c35
-rw-r--r--src/exchange/taler-exchange-httpd_metrics.h31
-rw-r--r--src/exchange/taler-exchange-httpd_purses_create.c597
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c299
-rw-r--r--src/exchange/taler-exchange-httpd_purses_get.c8
-rw-r--r--src/exchange/taler-exchange-httpd_purses_merge.c208
-rw-r--r--src/exchange/taler-exchange-httpd_recoup-refresh.c2
-rw-r--r--src/exchange/taler-exchange-httpd_recoup.c2
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c57
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c14
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_get.c2
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_history.c60
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_purse.c331
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_purse.h2
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_status.c35
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c244
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h61
-rw-r--r--src/exchange/taler-exchange-httpd_wire.c1
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c180
-rw-r--r--src/exchange/taler-exchange-router.c4
-rw-r--r--src/exchange/taler-exchange-transfer.c4
-rw-r--r--src/exchange/taler-exchange-wirewatch.c541
-rw-r--r--src/exchangedb/Makefile.am49
-rw-r--r--src/exchangedb/common-0001.sql162
-rw-r--r--src/exchangedb/drop-common.sql95
-rw-r--r--src/exchangedb/drop.sql (renamed from src/exchangedb/drop0001-shard-part.sql)10
-rw-r--r--src/exchangedb/drop0001-exchange-part.sql107
-rw-r--r--src/exchangedb/exchange-0000.sql293
-rw-r--r--src/exchangedb/exchange-0001-part.sql2206
-rw-r--r--src/exchangedb/exchange-0001.sql.in33
-rw-r--r--src/exchangedb/exchangedb_transactions.c12
-rw-r--r--src/exchangedb/irbt_callbacks.c379
-rw-r--r--src/exchangedb/lrbt_callbacks.c726
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c25
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c4266
-rw-r--r--src/exchangedb/procedures.sql2130
-rw-r--r--src/exchangedb/shard-0001-part.sql169
-rw-r--r--src/exchangedb/shard-0001.sql.in33
-rw-r--r--src/exchangedb/test_exchangedb.c52
-rw-r--r--src/exchangedb/versioning.sql (renamed from src/exchangedb/benchmark-0000.sql)0
-rw-r--r--src/extensions/Makefile.am3
-rw-r--r--src/extensions/extension_age_restriction.c92
-rw-r--r--src/extensions/extensions.c6
-rw-r--r--src/include/.gitignore1
-rw-r--r--src/include/Makefile.am2
-rw-r--r--src/include/taler_auditordb_plugin.h79
-rw-r--r--src/include/taler_crypto_lib.h455
-rw-r--r--src/include/taler_exchange_service.h835
-rw-r--r--src/include/taler_exchangedb_lib.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h1226
-rw-r--r--src/include/taler_extensions.h93
-rw-r--r--src/include/taler_json_lib.h127
-rw-r--r--src/include/taler_kyclogic_lib.h254
-rw-r--r--src/include/taler_kyclogic_plugin.h367
-rw-r--r--src/include/taler_signatures.h393
-rw-r--r--src/include/taler_testing_lib.h94
-rw-r--r--src/include/taler_util.h36
-rw-r--r--src/json/json_helper.c386
-rw-r--r--src/json/json_pack.c75
-rw-r--r--src/kyclogic/Makefile.am76
-rw-r--r--src/kyclogic/kyclogic-oauth2.conf27
-rw-r--r--src/kyclogic/kyclogic.conf15
-rw-r--r--src/kyclogic/kyclogic_api.c1132
-rw-r--r--src/kyclogic/plugin_kyclogic_oauth2.c1265
-rw-r--r--src/kyclogic/plugin_kyclogic_template.c443
-rw-r--r--src/kyclogic/sample.conf33
-rw-r--r--src/kyclogic/taler-exchange-kyc-tester.c1493
-rw-r--r--src/lib/Makefile.am6
-rw-r--r--src/lib/auditor_api_deposit_confirmation.c1
-rw-r--r--src/lib/exchange_api_auditor_add_denomination.c13
-rw-r--r--src/lib/exchange_api_batch_deposit.c657
-rw-r--r--src/lib/exchange_api_batch_withdraw.c437
-rw-r--r--src/lib/exchange_api_batch_withdraw2.c561
-rw-r--r--src/lib/exchange_api_common.c2381
-rw-r--r--src/lib/exchange_api_common.h221
-rw-r--r--src/lib/exchange_api_deposit.c468
-rw-r--r--src/lib/exchange_api_deposits_get.c100
-rw-r--r--src/lib/exchange_api_handle.c338
-rw-r--r--src/lib/exchange_api_handle.h5
-rw-r--r--src/lib/exchange_api_kyc_check.c6
-rw-r--r--src/lib/exchange_api_kyc_proof.c18
-rw-r--r--src/lib/exchange_api_kyc_wallet.c7
-rw-r--r--src/lib/exchange_api_management_auditor_disable.c13
-rw-r--r--src/lib/exchange_api_management_auditor_enable.c13
-rw-r--r--src/lib/exchange_api_management_drain_profits.c213
-rw-r--r--src/lib/exchange_api_management_post_extensions.c25
-rw-r--r--src/lib/exchange_api_management_post_keys.c13
-rw-r--r--src/lib/exchange_api_management_revoke_denomination_key.c12
-rw-r--r--src/lib/exchange_api_management_revoke_signing_key.c13
-rw-r--r--src/lib/exchange_api_management_set_global_fee.c13
-rw-r--r--src/lib/exchange_api_management_set_wire_fee.c13
-rw-r--r--src/lib/exchange_api_management_wire_disable.c13
-rw-r--r--src/lib/exchange_api_management_wire_enable.c13
-rw-r--r--src/lib/exchange_api_melt.c188
-rw-r--r--src/lib/exchange_api_purse_create_with_deposit.c413
-rw-r--r--src/lib/exchange_api_purse_create_with_merge.c189
-rw-r--r--src/lib/exchange_api_purse_deposit.c247
-rw-r--r--src/lib/exchange_api_purse_merge.c160
-rw-r--r--src/lib/exchange_api_recoup.c107
-rw-r--r--src/lib/exchange_api_recoup_refresh.c118
-rw-r--r--src/lib/exchange_api_refund.c60
-rw-r--r--src/lib/exchange_api_reserves_get.c2
-rw-r--r--src/lib/exchange_api_reserves_history.c72
-rw-r--r--src/lib/exchange_api_reserves_status.c4
-rw-r--r--src/lib/exchange_api_wire.c1
-rw-r--r--src/lib/exchange_api_withdraw.c31
-rw-r--r--src/lib/exchange_api_withdraw2.c44
-rw-r--r--src/testing/Makefile.am46
-rw-r--r--src/testing/test-taler-exchange-aggregator-postgres.conf2
-rw-r--r--src/testing/test-taler-exchange-wirewatch-postgres.conf2
-rw-r--r--src/testing/test_auditor_api-cs.conf4
-rw-r--r--src/testing/test_auditor_api-rsa.conf4
-rw-r--r--src/testing/test_auditor_api.c2
-rw-r--r--src/testing/test_bank_api.c20
-rw-r--r--src/testing/test_bank_api_fakebank.conf2
-rw-r--r--src/testing/test_bank_api_fakebank_twisted.conf4
-rw-r--r--src/testing/test_bank_api_nexus.conf10
-rw-r--r--src/testing/test_bank_api_pybank.conf21
-rw-r--r--src/testing/test_bank_api_pybank_twisted.conf43
-rw-r--r--src/testing/test_exchange_api-cs.conf4
-rw-r--r--src/testing/test_exchange_api-rsa.conf4
-rw-r--r--src/testing/test_exchange_api.c90
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking-cs.conf4
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking-rsa.conf4
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking.c2
-rw-r--r--src/testing/test_exchange_api_overlapping_keys_bug.c2
-rw-r--r--src/testing/test_exchange_api_revocation.c2
-rw-r--r--src/testing/test_exchange_api_twisted-cs.conf4
-rw-r--r--src/testing/test_exchange_api_twisted-rsa.conf4
-rw-r--r--src/testing/test_exchange_api_twisted.c2
-rw-r--r--src/testing/test_exchange_management_api.c14
-rw-r--r--src/testing/test_exchange_p2p.c35
-rw-r--r--src/testing/test_kyc_api.c261
-rw-r--r--src/testing/test_kyc_api.conf48
-rw-r--r--src/testing/test_taler_exchange_aggregator.c6
-rw-r--r--src/testing/test_taler_exchange_wirewatch.c2
-rw-r--r--src/testing/testing_api_cmd_auditor_exec_auditor.c1
-rw-r--r--src/testing/testing_api_cmd_bank_admin_add_incoming.c29
-rw-r--r--src/testing/testing_api_cmd_bank_admin_check.c1
-rw-r--r--src/testing/testing_api_cmd_bank_check.c2
-rw-r--r--src/testing/testing_api_cmd_bank_history_credit.c54
-rw-r--r--src/testing/testing_api_cmd_bank_history_debit.c18
-rw-r--r--src/testing/testing_api_cmd_batch_deposit.c624
-rw-r--r--src/testing/testing_api_cmd_batch_withdraw.c537
-rw-r--r--src/testing/testing_api_cmd_common.c111
-rw-r--r--src/testing/testing_api_cmd_deposit.c71
-rw-r--r--src/testing/testing_api_cmd_deposits_get.c4
-rw-r--r--src/testing/testing_api_cmd_exec_closer.c3
-rw-r--r--src/testing/testing_api_cmd_insert_deposit.c21
-rw-r--r--src/testing/testing_api_cmd_kyc_check_get.c2
-rw-r--r--src/testing/testing_api_cmd_kyc_proof.c28
-rw-r--r--src/testing/testing_api_cmd_kyc_wallet_get.c16
-rw-r--r--src/testing/testing_api_cmd_purse_create_deposit.c13
-rw-r--r--src/testing/testing_api_cmd_purse_deposit.c132
-rw-r--r--src/testing/testing_api_cmd_purse_merge.c146
-rw-r--r--src/testing/testing_api_cmd_recoup.c3
-rw-r--r--src/testing/testing_api_cmd_refresh.c67
-rw-r--r--src/testing/testing_api_cmd_reserve_history.c229
-rw-r--r--src/testing/testing_api_cmd_reserve_purse.c61
-rw-r--r--src/testing/testing_api_cmd_reserve_status.c150
-rw-r--r--src/testing/testing_api_cmd_withdraw.c95
-rw-r--r--src/testing/testing_api_helpers_bank.c38
-rw-r--r--src/testing/testing_api_helpers_exchange.c1
-rw-r--r--src/testing/testing_api_loop.c10
-rw-r--r--src/util/age_restriction.c1
-rw-r--r--src/util/crypto.c2
-rw-r--r--src/util/crypto_helper_rsa.c24
-rw-r--r--src/util/exchange_signatures.c13
-rw-r--r--src/util/merchant_signatures.c12
-rw-r--r--src/util/offline_signatures.c84
-rw-r--r--src/util/payto.c92
-rw-r--r--src/util/taler-exchange-secmod-cs.c8
-rw-r--r--src/util/taler-exchange-secmod-eddsa.c4
-rw-r--r--src/util/taler-exchange-secmod-rsa.c615
-rw-r--r--src/util/taler-exchange-secmod-rsa.h27
-rw-r--r--src/util/test_helper_rsa.c64
-rw-r--r--src/util/tv_age_restriction.c14
-rw-r--r--src/util/wallet_signatures.c73
306 files changed, 45083 insertions, 22851 deletions
diff --git a/.gitignore b/.gitignore
index c19d3c4d..a27208ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -162,3 +162,5 @@ po/taler-exchange.pot
po/remove-potcdate.sed
src/include/taler_dbevents.h
src/bank-lib/taler-exchange-wire-gateway-client
+src/exchange/taler-exchange-drain
+src/kyclogic/taler-exchange-kyc-tester
diff --git a/Makefile.am b/Makefile.am
index 0bfe4ee0..83b761a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,11 +15,6 @@ else
endif
endif
-BUILT_SOURCES = src/include/taler_error_codes.h
-
-src/include/taler_error_codes.h: contrib/gana/gnu-taler-error-codes/registry.rec
- contrib/gana-update.sh
-
@DX_RULES@
ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 06f7b2ca..bbb0fabf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
#
#
AC_PREREQ([2.69])
-AC_INIT([taler-exchange], [0.8.5], [taler-bug@gnunet.org])
+AC_INIT([taler-exchange],[0.8.5],[taler-bug@gnunet.org])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/util/util.c])
AC_CONFIG_HEADERS([taler_config.h])
@@ -33,8 +33,6 @@ AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_AWK
AC_PROG_CC
-# FIXME: AC_PROG_CC_C99 is obsolete, remove for autoconf 2.70
-AC_PROG_CC_C99
AC_PROG_OBJC
AC_PROG_INSTALL
AC_PROG_LN_S
@@ -535,6 +533,7 @@ AC_CONFIG_FILES([Makefile
src/exchange-tools/Makefile
src/extensions/Makefile
src/lib/Makefile
+ src/kyclogic/Makefile
src/testing/Makefile
src/benchmark/Makefile
src/include/Makefile
diff --git a/contrib/auditor-report.tex.j2 b/contrib/auditor-report.tex.j2
index 38f44d4e..cfd613a0 100644
--- a/contrib/auditor-report.tex.j2
+++ b/contrib/auditor-report.tex.j2
@@ -139,6 +139,10 @@ In that time, the wire auditor processed the following table ranges:
{% endif %}
\end{center}
+The total credits to the exchange processed in
+this audit run was {\bf {{ wire.total_wire_in }}.
+The total debits initiated by the exchange processed in
+this audit run was {\bf {{ wire.total_wire_out }}.
\section{Operations}
@@ -147,6 +151,16 @@ be {\bf {{ coins.total_escrow_balance }}} (coins)
plus {\bf {{ reserves.total_escrow_balance }}} (reserves).
\noindent
+This should match the final balance computed from
+ingoing and outgoing wire transfers, which is
+{\bf {{ wire.final_balance}} }.
+
+\noindent
+A total of {\bf {{ wire.total_drained}} } in profits
+were transferred (over the lifetime of the exchange)
+to non-escrowed accounts.
+
+\noindent
The active operational risk stands at
{\bf {{ coins.total_active_risk }}}.
diff --git a/contrib/gana b/contrib/gana
-Subproject 99d8d9e0336bacebab5af4ae00c3f685ffd90f6
+Subproject 88f1513c159014a1cbc6d0745568770538d2b0a
diff --git a/contrib/gana-update.sh b/contrib/gana-update.sh
index db122b9a..b20bbaa1 100755
--- a/contrib/gana-update.sh
+++ b/contrib/gana-update.sh
@@ -5,8 +5,8 @@ set -eu
domake ()
{
- # $1 -- dir under contrib/gana/
- dir="contrib/gana/$1"
+ # $1 -- dir under contrib/
+ dir="contrib/$1"
make -C $dir
}
@@ -14,21 +14,26 @@ domake ()
ensure ()
{
# $1 -- filename
- # $2 -- src dir under contrib/gana/
+ # $2 -- src dir under contrib/
# $3 -- dst dir under ./
fn="$1"
- src="contrib/gana/$2"
- dst="./$3"
+ src="contrib/$2/$fn"
+ dst="./$3/$fn"
- if ! diff $src/$fn $dst/$fn > /dev/null
+ if ! diff $src $dst > /dev/null
then
- cp $src/$fn $dst/$fn
+ test ! -f $dst || chmod +w $dst
+ cp $src $dst
+ chmod -w $dst
fi
}
-domake gnu-taler-error-codes
-ensure taler_error_codes.c gnu-taler-error-codes src/util
-ensure taler_error_codes.h gnu-taler-error-codes src/include
+domake gana/gnu-taler-error-codes
+ensure taler_error_codes.c gana/gnu-taler-error-codes src/util
+ensure taler_error_codes.h gana/gnu-taler-error-codes src/include
-domake gnu-taler-db-events
-ensure taler_dbevents.h gnu-taler-db-events src/include
+domake gana/gnu-taler-db-events
+ensure taler_dbevents.h gana/gnu-taler-db-events src/include
+
+domake sigp
+ensure taler_signatures.h sigp src/include
diff --git a/contrib/microhttpd.tag b/contrib/microhttpd.tag
index 01872369..4780028d 100644
--- a/contrib/microhttpd.tag
+++ b/contrib/microhttpd.tag
@@ -24,6 +24,12 @@
</member>
<member kind="define">
<type>#define</type>
+ <name>MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS</name>
+ <anchorfile>microhttpd.h</anchorfile>
+ <arglist></arglist>
+ </member>
+ <member kind="define">
+ <type>#define</type>
<name>MHD_HTTP_BAD_REQUEST</name>
<anchorfile>microhttpd.h</anchorfile>
<arglist></arglist>
diff --git a/contrib/sigp/.gitignore b/contrib/sigp/.gitignore
new file mode 100644
index 00000000..e4937652
--- /dev/null
+++ b/contrib/sigp/.gitignore
@@ -0,0 +1,3 @@
+/registry.rec
+/taler_signatures.h
+/taler_signatures.h.tmp
diff --git a/contrib/sigp/Makefile b/contrib/sigp/Makefile
new file mode 100644
index 00000000..65797fcf
--- /dev/null
+++ b/contrib/sigp/Makefile
@@ -0,0 +1,21 @@
+FILES = taler_signatures.h
+
+gana = ../gana
+
+
+all: check $(FILES)
+check: registry.rec
+ recfix --check registry.rec
+registry.rec:
+ ln -s $(gana)/gnunet-signatures/registry.rec
+distclean:
+ rm -f *.tmp
+clean:
+ rm -f $(FILES) *.tmp registry.rec
+taler_signatures.h.tmp: registry.rec h.template
+ $(gana)/format.sh h.template 'Package = "GNU Taler"' < registry.rec > $@
+
+taler_signatures.h: h.header taler_signatures.h.tmp h.footer
+ cat h.header taler_signatures.h.tmp h.footer > $@
+
+.PHONY: check clean distclean
diff --git a/contrib/sigp/README b/contrib/sigp/README
new file mode 100644
index 00000000..1037bd44
--- /dev/null
+++ b/contrib/sigp/README
@@ -0,0 +1,10 @@
+This directory contains bootstrap code to extract info from the
+Signature Purposes database (registry) and format it in various ways.
+It is a peer of ${top_srcdir}/contrib/gana/ (q.v.).
+
+NB: New database entries MUST have field "Package: GNU Taler" if
+ you want them to be visible to the Makefile in this directory.
+
+Don't make changes to registry.rec here (it is a symlink, after all).
+Instead, make them in ../gana/gnunet-signatures/ or from a separate
+checkout of the GANA Git repo (commit from there, too).
diff --git a/contrib/sigp/h.footer b/contrib/sigp/h.footer
new file mode 100644
index 00000000..c0fbf697
--- /dev/null
+++ b/contrib/sigp/h.footer
@@ -0,0 +1,3 @@
+
+
+#endif
diff --git a/contrib/sigp/h.header b/contrib/sigp/h.header
new file mode 100644
index 00000000..a0e3c6ae
--- /dev/null
+++ b/contrib/sigp/h.header
@@ -0,0 +1,32 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2014-2022 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler_signatures.h
+ * @brief message formats and signature constants used to define
+ * the binary formats of signatures in Taler
+ * @author Florian Dold
+ * @author Benedikt Mueller
+ *
+ * This file should define the constants and C structs that one needs
+ * to know to implement Taler clients (wallets or merchants or
+ * auditor) that need to produce or verify Taler signatures.
+ */
+#ifndef TALER_SIGNATURES_H
+#define TALER_SIGNATURES_H
+
+#include <gnunet/gnunet_util_lib.h>
+#include "taler_amount_lib.h"
+#include "taler_crypto_lib.h"
diff --git a/contrib/sigp/h.template b/contrib/sigp/h.template
new file mode 100644
index 00000000..66b0317e
--- /dev/null
+++ b/contrib/sigp/h.template
@@ -0,0 +1,6 @@
+
+
+/**
+ * {{Comment}}
+ */
+#define TALER_SIGNATURE_{{Name}} {{Number}}
diff --git a/contrib/taler-bank-manage-testing b/contrib/taler-bank-manage-testing
index 4fa80b17..7e4da516 100755
--- a/contrib/taler-bank-manage-testing
+++ b/contrib/taler-bank-manage-testing
@@ -4,24 +4,178 @@
# testing accounts before launching the bank properly.
#
# Takes 3 arguments:
-# $1: the configuration file name
+# $1: the Nexus port (Sandbox port prepends 1 to it)
# $2: the database name
-# $3: serve-http or serve-uwsgi
+# $3: exchange base URL (used to specify the default exchange)
+# $4: config file (needs patch to specify exchange's PAYTO_URI)
set -eu
-if [ "$#" -ne 3 ];
+if [ "$#" -ne 4 ];
then
- echo "illegal number of parameters"
+ echo "illegal number of parameters. \
+Give: Nexus port number, SQLite file path, exchange base URL, config file path."
exit 1
fi
-# Ensure starting accounts exist
-taler-bank-manage -c $1 --with-db $2 django provide_accounts
-taler-bank-manage -c $1 --with-db $2 django add_bank_account 42
-taler-bank-manage -c $1 --with-db $2 django add_bank_account 43
+# Must not terminate jobs here, as they are needed
+# by the script _importing_ this one. Those script
+# will then manage the termination.
+# trap cleanup EXIT
-taler-bank-manage -c $1 --with-db $2 django changepassword_unsafe Exchange x
+export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:$2"
+# Create the default demobank.
+libeufin-sandbox config --currency TESTKUDOS default
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
+libeufin-sandbox serve --port "1$1" \
+ > libeufin-sandbox-stdout.log \
+ 2> libeufin-sandbox-stderr.log &
+echo $! > libeufin-sandbox.pid
+export LIBEUFIN_SANDBOX_URL="http://localhost:1$1/demobanks/default"
+set +e
+echo -n "Waiting for Sandbox.."
+for n in `seq 1 50`; do
+ echo -n "."
+ sleep 1
+ wget --timeout=1 \
+ --tries=3 --waitretry=0 \
+ -o /dev/null -O /dev/null \
+ $LIBEUFIN_SANDBOX_URL
+ break
+done
+sleep 1 #7293
+echo OK
-# Now run Django for good
-exec taler-bank-manage -c $1 --with-db $2 $3
+register_sandbox_account() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ libeufin-cli sandbox \
+ demobank \
+ register --name "$3"
+ unset LIBEUFIN_SANDBOX_USERNAME
+ unset LIBEUFIN_SANDBOX_PASSWORD
+}
+set -e
+echo -n "Register the 'fortytwo' Sandbox user.."
+register_sandbox_account fortytwo x "Forty Two"
+echo OK
+echo -n "Register the 'fortythree' Sandbox user.."
+register_sandbox_account fortythree x "Forty Three"
+echo OK
+echo -n "Register 'exchange' Sandbox user.."
+register_sandbox_account exchange x "Exchange Company"
+echo OK
+echo -n "Register 'tor' Sandbox user.."
+register_sandbox_account tor x "Tor Project"
+echo OK
+echo -n "Register 'gnunet' Sandbox user.."
+register_sandbox_account gnunet x "GNUnet"
+echo OK
+echo -n "Register 'tutorial' Sandbox user.."
+register_sandbox_account tutorial x "Tutorial"
+echo OK
+echo -n "Register 'survey' Sandbox user.."
+register_sandbox_account survey x "Survey"
+echo OK
+echo -n "Specify exchange's PAYTO_URI in the config ..."
+export LIBEUFIN_SANDBOX_USERNAME=exchange
+export LIBEUFIN_SANDBOX_PASSWORD=x
+PAYTO=`libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri'`
+taler-config -c $4 -s exchange-account-1 -o PAYTO_URI -V $PAYTO
+echo " OK"
+echo -n "Setting this exchange as the bank's default ..."
+EXCHANGE_PAYTO=`libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri'`
+libeufin-sandbox default-exchange "$3" "$EXCHANGE_PAYTO"
+echo " OK"
+# Prepare EBICS: create Ebics host and Exchange subscriber.
+# Shortly becoming admin to setup Ebics.
+export LIBEUFIN_SANDBOX_USERNAME=admin
+export LIBEUFIN_SANDBOX_PASSWORD=secret
+echo -n "Create EBICS host at Sandbox.."
+libeufin-cli sandbox \
+ --sandbox-url http://localhost:1$1 \
+ ebicshost create --host-id talerebics
+echo OK
+echo -n "Create exchange EBICS subscriber at Sandbox.."
+libeufin-cli sandbox \
+ demobank new-ebicssubscriber --host-id talerebics \
+ --user-id exchangeebics --partner-id talerpartner \
+ --bank-account exchange # that's a username _and_ a bank account name
+echo OK
+unset LIBEUFIN_SANDBOX_USERNAME
+unset LIBEUFIN_SANDBOX_PASSWORD
+# Prepare Nexus, which is the side actually talking
+# to the exchange.
+export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:$2"
+# For convenience, username and password are
+# identical to those used at the Sandbox.
+echo -n Create exchange Nexus user..
+libeufin-nexus superuser exchange --password x
+echo OK
+libeufin-nexus serve --port $1 \
+ 2> libeufin-nexus-stderr.log \
+ > libeufin-nexus-stdout.log &
+echo $! > libeufin-nexus.pid
+export LIBEUFIN_NEXUS_URL=http://localhost:$1
+echo -n Waiting for Nexus..
+set +e
+for n in `seq 1 50`; do
+ echo -n "."
+ sleep 1
+ wget --timeout=1 \
+ --tries=3 --waitretry=0 \
+ -o /dev/null -O /dev/null \
+ $LIBEUFIN_NEXUS_URL
+ break
+done
+sleep 1 #7293
+set -e
+echo OK
+export LIBEUFIN_NEXUS_USERNAME=exchange
+export LIBEUFIN_NEXUS_PASSWORD=x
+echo -n Creating a EBICS connection at Nexus..
+libeufin-cli connections new-ebics-connection \
+ --ebics-url "http://localhost:1$1/ebicsweb" \
+ --host-id talerebics \
+ --partner-id talerpartner \
+ --ebics-user-id exchangeebics \
+ talerconn
+echo OK
+echo -n Setup EBICS keying..
+libeufin-cli connections connect talerconn > /dev/null
+echo OK
+echo -n Download bank account name from Sandbox..
+libeufin-cli connections download-bank-accounts talerconn
+echo OK
+echo -n Importing bank account info into Nexus..
+libeufin-cli connections import-bank-account \
+ --offered-account-id exchange \
+ --nexus-bank-account-id exchange-nexus \
+ talerconn
+echo OK
+echo -n Setup payments submission task..
+# Tries every second.
+libeufin-cli accounts task-schedule \
+ --task-type submit \
+ --task-name exchange-payments \
+ --task-cronspec "* * *" \
+ exchange-nexus
+echo OK
+# Tries every second. Ask C52
+echo -n Setup history fetch task..
+libeufin-cli accounts task-schedule \
+ --task-type fetch \
+ --task-name exchange-history \
+ --task-cronspec "* * *" \
+ --task-param-level report \
+ --task-param-range-type latest \
+ exchange-nexus
+echo OK
+# TBD: create Taler facade.
+echo -n Create the Taler facade at Nexus..
+libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency TESTKUDOS --facade-name test-facade \
+ talerconn exchange-nexus
+echo OK
+# Facade schema: http://localhost:$1/facades/test-facade/taler-wire-gateway/
diff --git a/contrib/taler-nexus-prepare b/contrib/taler-nexus-prepare
index 66a0b1c1..6a36387d 100755
--- a/contrib/taler-nexus-prepare
+++ b/contrib/taler-nexus-prepare
@@ -1,128 +1,115 @@
-#!/usr/bin/env python3
-# This file is in the public domain.
+#!/bin/bash
-from requests import get, post
-from subprocess import call
-import base64
+set -eu
# EBICS details
-EBICS_URL = "http://localhost:5000/ebicsweb"
-HOST_ID = "HOST01"
-PARTNER_ID = "PARTNER1"
-USER_ID = "USER1"
-EBICS_VERSION = "H004"
-
-SUBSCRIBER_IBAN = "ES9121000418450200051332"
-SUBSCRIBER_BIC = "BIC"
-SUBSCRIBER_NAME = "Exchange"
-
-BANK_ACCOUNT_LABEL = "my-bank-account"
-BANK_CONNECTION_LABEL = "my-bank-connection"
+EBICS_URL="http://localhost:5000/ebicsweb"
+HOST_ID="HOST01"
+PARTNER_ID="PARTNER1"
+USER_ID="USER1"
+
+# This is used _both_ at Sandbox and at Nexus.
+# Basically, Nexus imports the offered bank account
+# using the same name used by the Sandbox.
+BANK_ACCOUNT_LABEL="my-bank-account"
+BANK_CONNECTION_LABEL="my-bank-connection"
FACADE_LABEL="my-facade"
-USERNAME="Exchange"
-USER_AUTHORIZATION_HEADER = "basic {}".format(
- base64.b64encode(b"Exchange:x").decode("utf-8")
-)
-
-def assertResponse(response):
- if response.status_code != 200:
- print("Test failed on URL: {}".format(response.url))
- # stdout/stderr from both services is A LOT of text.
- # Confusing to dump all that to console.
- print("Check nexus.log and sandbox.log, probably under /tmp")
- exit(1)
- # Allows for finer grained checks.
- return response
-
-# Create a nexus (super-) user
-check_call(["libeufin-nexus",
- "superuser",
- "--db-name", "/tmp/nexus-exchange-test.sqlite3",
- "Exchange",
- "--password", "x"]
-)
-
-# Create a EBICS bank connection.
-assertResponse(
- post(
- "http://localhost:5001/bank-connections",
- json=dict(
- name=BANK_CONNECTION_LABEL,
- source="new",
- type="ebics",
- data=dict(
- ebicsURL=EBICS_URL, hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID
- ),
- ),
- headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
- )
-)
-
-# Create a facade
-assertResponse(
- post(
- "http://localhost:5001/facades",
- json=dict(
- name=FACADE_LABEL,
- type="taler-wire-gateway",
- creator=USERNAME,
- config=dict(
- bankAccount=BANK_ACCOUNT_LABEL,
- bankConnection=BANK_CONNECTION_LABEL,
- reserveTransferLevel="UNUSED",
- intervalIncremental="UNUSED"
- )
- ),
- headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
- )
-)
-
-# Create the EBICS host at the Sandbox.
-assertResponse(
- post(
- "http://localhost:5000/admin/ebics/host",
- json=dict(hostID=HOST_ID, ebicsVersion=EBICS_VERSION),
- )
-)
-
-# Create Exchange EBICS subscriber at the Sandbox.
-assertResponse(
- post(
- "http://localhost:5000/admin/ebics/subscribers",
- json=dict(hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID),
- )
-)
-
-# Create a bank account associated to the Exchange's EBICS subscriber,
-# again at the Sandbox.
-assertResponse(
- post(
- "http://localhost:5000/admin/ebics/bank-accounts",
- json=dict(
- subscriber=dict(hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID),
- iban=SUBSCRIBER_IBAN,
- bic=SUBSCRIBER_BIC,
- name=SUBSCRIBER_NAME,
- label=BANK_ACCOUNT_LABEL,
- ),
- )
-)
-
-# 'connect' to the bank: upload+download keys.
-assertResponse(
- post(
- "http://localhost:5001/bank-connections/{}/connect".format(BANK_CONNECTION_LABEL),
- json=dict(),
- headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
- )
-)
-
-# Download bank accounts.
-assertResponse(
- post(
- "http://localhost:5001/bank-connections/{}/ebics/import-accounts".format(BANK_CONNECTION_LABEL),
- json=dict(),
- headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
- )
-)
+export LIBEUFIN_SANDBOX_USERNAME=exchange
+export LIBEUFIN_SANDBOX_PASSWORD=x
+export LIBEUFIN_SANDBOX_URL=http://localhost:5000/demobanks/default
+libeufin-cli sandbox demobank register --name "Exchange Company"
+
+export LIBEUFIN_SANDBOX_USERNAME=fortytwo
+export LIBEUFIN_SANDBOX_PASSWORD=x
+export LIBEUFIN_SANDBOX_URL=http://localhost:5000/demobanks/default
+libeufin-cli sandbox demobank register \
+ --name User42 --iban FR7630006000011234567890189
+
+export LIBEUFIN_SANDBOX_USERNAME=fortythree
+export LIBEUFIN_SANDBOX_PASSWORD=x
+export LIBEUFIN_SANDBOX_URL=http://localhost:5000/demobanks/default
+libeufin-cli sandbox demobank register \
+ --name User43 --iban GB33BUKB20201555555555
+
+export LIBEUFIN_SANDBOX_USERNAME=admin
+export LIBEUFIN_SANDBOX_PASSWORD=secret
+export LIBEUFIN_SANDBOX_URL=http://localhost:5000/demobanks/default
+echo -n "Create EBICS host at Sandbox..."
+libeufin-cli sandbox \
+ --sandbox-url "http://localhost:5000" \
+ ebicshost create --host-id $HOST_ID
+echo " OK"
+
+echo -n "Create exchange EBICS subscriber at Sandbox..."
+libeufin-cli sandbox \
+ demobank new-ebicssubscriber --host-id $HOST_ID \
+ --user-id $USER_ID --partner-id $PARTNER_ID \
+ --bank-account exchange # that's a username _and_ a bank account name
+echo " OK"
+unset LIBEUFIN_SANDBOX_USERNAME
+unset LIBEUFIN_SANDBOX_PASSWORD
+unset LIBEUFIN_SANDBOX_URL
+
+export LIBEUFIN_NEXUS_USERNAME=exchange
+export LIBEUFIN_NEXUS_PASSWORD=x
+export LIBEUFIN_NEXUS_URL=http://localhost:5001/
+
+echo -n "Create the exchange (super)user at Nexus..."
+libeufin-nexus superuser exchange --password x
+echo " DONE"
+
+echo -n "Creating a EBICS connection at Nexus..."
+libeufin-cli connections new-ebics-connection \
+ --ebics-url $EBICS_URL \
+ --host-id $HOST_ID \
+ --partner-id $PARTNER_ID \
+ --ebics-user-id $USER_ID \
+ $BANK_CONNECTION_LABEL
+echo " OK"
+
+echo -n "Setup EBICS keying..."
+libeufin-cli connections connect $BANK_CONNECTION_LABEL > /dev/null
+echo " OK"
+
+echo -n "Download bank account name from Sandbox..."
+libeufin-cli connections download-bank-accounts $BANK_CONNECTION_LABEL
+echo " OK"
+
+echo -n "Importing bank account info into Nexus..."
+libeufin-cli connections import-bank-account \
+ --offered-account-id exchange \
+ --nexus-bank-account-id $BANK_ACCOUNT_LABEL \
+ $BANK_CONNECTION_LABEL
+echo " OK"
+
+echo -n "Create the Taler facade at Nexus..."
+libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency KUDOS --facade-name $FACADE_LABEL \
+ $BANK_CONNECTION_LABEL $BANK_ACCOUNT_LABEL
+echo " DONE"
+
+echo -n Setup payments submission task..
+# Tries every second.
+libeufin-cli accounts task-schedule \
+ --task-type submit \
+ --task-name exchange-payments \
+ --task-cronspec "* * *" \
+ $BANK_ACCOUNT_LABEL
+echo OK
+# Tries every second. Ask C52
+echo -n Setup history fetch task..
+libeufin-cli accounts task-schedule \
+ --task-type fetch \
+ --task-name exchange-history \
+ --task-cronspec "* * *" \
+ --task-param-level report \
+ --task-param-range-type latest \
+ $BANK_ACCOUNT_LABEL
+echo OK
+
+# unset, in case the script gets 'source'd.
+unset LIBEUFIN_NEXUS_USERNAME
+unset LIBEUFIN_NEXUS_PASSWORD
+unset LIBEUFIN_NEXUS_URL
diff --git a/contrib/tos/bfh.rst b/contrib/tos/bfh.rst
new file mode 100644
index 00000000..85f041c3
--- /dev/null
+++ b/contrib/tos/bfh.rst
@@ -0,0 +1,310 @@
+Terms Of Service
+================
+
+Last Updated: 09.06.2022
+
+Welcome! The ICE research center of the Bern University of Applied Sciences
+in Switzerland (“we,” “our,” or “us”) provides an experimental payment service
+through our Internet presence (collectively the “Services”). Before using our
+Services, please read the Terms of Service (the “Terms” or the “Agreement”)
+carefully.
+
+This is research
+----------------
+
+This is a research experiment. Any funds wired to our Bitcoin address are
+considered a donation to our research group. We may use them to enable
+payments following the GNU Taler protocol, or simply keep them at our
+discretion. The service is experimental and may also be discontinued at
+any time, in which case all remaining funds will definitively be kept by
+the research group.
+
+
+Overview
+--------
+
+This section provides a brief summary of the highlights of this
+Agreement. Please note that when you accept this Agreement, you are accepting
+all of the terms and conditions and not just this section. We and possibly
+other third parties provide Internet services which interact with the Taler
+Wallet’s self-hosted personal payment application. When using the Taler Wallet
+to interact with our Services, you are agreeing to our Terms, so please read
+carefully.
+
+Highlights:
+~~~~~~~~~~~
+
+ • You are responsible for keeping the data in your Taler Wallet at all times
+ under your control. Any losses arising from you not being in control of
+ your private information are your problem.
+ • We may transfer funds we receive from our users to any legal
+ recipient to the best of our ability within the limitations of the law and
+ our implementation. However, the Services offered today are highly
+ experimental and the set of recipients of funds is severely restricted.
+ Again, we stress this is a research experiment and technically all funds
+ held by the exchange are owned by the research group of the university.
+ • For our Services, we may charge transaction fees. The specific fee structure
+ is provided based on the Taler protocol and should be shown to you when you
+ withdraw electronic coins using a Taler Wallet. You agree and understand
+ that the Taler protocol allows for the fee structure to change.
+ • You agree to not intentionally overwhelm our systems with requests and
+ follow responsible disclosure if you find security issues in our services.
+ • We cannot be held accountable for our Services not being available due to
+ any circumstances. If we modify or terminate our services,
+ we may give you the opportunity to recover your funds. However,
+ given the experimental state of the Services today, this may not be
+ possible. You are strongly advised to limit your use of the Service
+ to small-scale experiments expecting total loss of all funds.
+
+These terms outline approved uses of our Services. The Services and these
+Terms are still at an experimental stage. If you have any questions or
+comments related to this Agreement, please send us a message to
+ice@bfh.ch. If you do not agree to this Agreement, you must not
+use our Services.
+
+How you accept this policy
+--------------------------
+
+By sending funds to us (to top-up your Taler Wallet), you acknowledge that you
+have read, understood, and agreed to these Terms. We reserve the right to
+change these Terms at any time. If you disagree with the change, we may in the
+future offer you with an easy option to recover your unspent funds. However,
+in the current experimental period you acknowledge that this feature is not
+yet available, resulting in your funds being lost unless you accept the new
+Terms. If you continue to use our Services other than to recover your unspent
+funds, your continued use of our Services following any such change will
+signify your acceptance to be bound by the then current Terms. Please check
+the effective date above to determine if there have been any changes since you
+have last reviewed these Terms.
+
+Services
+--------
+
+We will try to transfer funds that we receive from users to any legal
+recipient to the best of our ability and within the limitations of the
+law. However, the Services offered today are highly experimental and the set
+of recipients of funds is severely restricted. The Taler Wallet can be loaded
+by exchanging fiat or cryptocurrencies against electronic coins. We are
+providing this exchange service. Once your Taler Wallet is loaded with
+electronic coins they can be spent for purchases if the seller is accepting
+Taler as a means of payment. We are not guaranteeing that any seller is
+accepting Taler at all or a particular seller. The seller or recipient of
+deposits of electronic coins must specify the target account, as per the
+design of the Taler protocol. They are responsible for following the protocol
+and specifying the correct bank account, and are solely liable for any losses
+that may arise from specifying the wrong account. We may allow the government
+to link wire transfers to the underlying contract hash. It is the
+responsibility of recipients to preserve the full contracts and to pay
+whatever taxes and charges may be applicable. Technical issues may lead to
+situations where we are unable to make transfers at all or lead to incorrect
+transfers that cannot be reversed. We may refuse to execute transfers if the
+transfers are prohibited by a competent legal authority and we are ordered to
+do so.
+
+When using our Services, you agree to not take any action that intentionally
+imposes an unreasonable load on our infrastructure. If you find security
+problems in our Services, you agree to first report them to
+security@taler-systems.com and grant us the right to publish your report. We
+warrant that we will ourselves publicly disclose any issues reported within 3
+months, and that we will not prosecute anyone reporting security issues if
+they did not exploit the issue beyond a proof-of-concept, and followed the
+above responsible disclosure practice.
+
+
+Fees
+----
+
+You agree to pay the fees for exchanges and withdrawals completed via the
+Taler Wallet ("Fees") as defined by us, which we may change from time to
+time. With the exception of wire transfer fees, Taler transaction fees are set
+for any electronic coin at the time of withdrawal and fixed throughout the
+validity period of the respective electronic coin. Your wallet should obtain
+and display applicable fees when withdrawing funds. Fees for coins obtained as
+change may differ from the fees applicable to the original coin. Wire transfer
+fees that are independent from electronic coins may change annually. You
+authorize us to charge or deduct applicable fees owed in connection with
+deposits, exchanges and withdrawals following the rules of the Taler protocol.
+We reserve the right to provide different types of rewards to users either in
+the form of discount for our Services or in any other form at our discretion
+and without prior notice to you.
+
+Eligibility and Financial self-responsibility
+---------------------------------------------
+
+To be eligible to use our Services, you must be able to form legally binding
+contracts or have the permission of your legal guardian. By using our
+Services, you represent and warrant that you meet all eligibility requirements
+that we outline in these Terms.
+
+You will be responsible for maintaining the availability, integrity and
+confidentiality of the data stored in your wallet. When you setup a Taler
+Wallet, you are strongly advised to follow the precautionary measures offered
+by the software to minimize the chances to losse access to or control over
+your Wallet data. We will not be liable for any loss or damage arising from
+your failure to comply with this paragraph.
+
+Copyrights and trademarks
+-------------------------
+
+The Taler Wallet is released under the terms of the GNU General Public License
+(GNU GPL). You have the right to access, use, and share the Taler Wallet, in
+modified or unmodified form. However, the GPL is a strong copyleft license,
+which means that any derivative works must be distributed under the same
+license terms as the original software. If you have any questions, you should
+review the GNU GPL’s full terms and conditions at
+https://www.gnu.org/licenses/gpl-3.0.en.html. “Taler” itself is a trademark
+of Taler Systems SA. You are welcome to use the name in relation to processing
+payments using the Taler protocol, assuming your use is compatible with an
+official release from the GNU Project that is not older than two years.
+
+
+Limitation of liability & disclaimer of warranties
+--------------------------------------------------
+
+You understand and agree that we have no control over, and no duty to take any
+action regarding: Failures, disruptions, errors, or delays in processing that
+you may experience while using our Services; The risk of failure of hardware,
+software, and Internet connections; The risk of malicious software being
+introduced or found in the software underlying the Taler Wallet; The risk that
+third parties may obtain unauthorized access to information stored within your
+Taler Wallet, including, but not limited to your Taler Wallet coins or backup
+encryption keys. You release us from all liability related to any losses,
+damages, or claims arising from:
+
+(a) user error such as forgotten passwords, incorrectly constructed
+ transactions;
+(b) server failure or data loss;
+(c) unauthorized access to the Taler Wallet application;
+(d) bugs or other errors in the Taler Wallet software; and
+(e) any unauthorized third party activities, including, but not limited to,
+ the use of viruses, phishing, brute forcing, or other means of attack
+ against the Taler Wallet. We make no representations concerning any
+ Third Party Content contained in or accessed through our Services.
+
+Any other terms, conditions, warranties, or representations associated with
+such content, are solely between you and such organizations and/or
+individuals.
+
+To the fullest extent permitted by applicable law, in no event will we or any
+of our officers, directors, representatives, agents, servants, counsel,
+employees, consultants, lawyers, and other personnel authorized to act,
+acting, or purporting to act on our behalf (collectively the “Taler Parties”)
+be liable to you under contract, tort, strict liability, negligence, or any
+other legal or equitable theory, for:
+
+(a) any lost profits, data loss, cost of procurement of substitute goods or
+ services, or direct, indirect, incidental, special, punitive, compensatory,
+ or consequential damages of any kind whatsoever resulting from:
+
+ (i) your use of, or conduct in connection with, our services;
+ (ii) any unauthorized use of your wallet and/or private key due to your
+ failure to maintain the confidentiality of your wallet;
+ (iii) any interruption or cessation of transmission to or from the services; or
+ (iv) any bugs, viruses, trojan horses, or the like that are found in the Taler
+ Wallet software or that may be transmitted to or through our services by
+ any third party (regardless of the source of origination), or
+
+(b) any direct damages.
+
+These limitations apply regardless of legal theory, whether based on tort,
+strict liability, breach of contract, breach of warranty, or any other legal
+theory, and whether or not we were advised of the possibility of such
+damages. Some jurisdictions do not allow the exclusion or limitation of
+liability for consequential or incidental damages, so the above limitation may
+not apply to you.
+
+Our services are provided "as is" and without warranty of any kind. To the
+maximum extent permitted by law, we disclaim all representations and
+warranties, express or implied, relating to the services and underlying
+software or any content on the services, whether provided or owned by us or by
+any third party, including without limitation, warranties of merchantability,
+fitness for a particular purpose, title, non-infringement, freedom from
+computer virus, and any implied warranties arising from course of dealing,
+course of performance, or usage in trade, all of which are expressly
+disclaimed. In addition, we do not represent or warrant that the content
+accessible via the services is accurate, complete, available, current, free of
+viruses or other harmful components, or that the results of using the services
+will meet your requirements. Some states do not allow the disclaimer of
+implied warranties, so the foregoing disclaimers may not apply to you. This
+paragraph gives you specific legal rights and you may also have other legal
+rights that vary from state to state.
+
+Indemnity and Time limitation on claims and Termination
+-------------------------------------------------------
+
+To the extent permitted by applicable law, you agree to defend, indemnify, and
+hold harmless the Taler Parties from and against any and all claims, damages,
+obligations, losses, liabilities, costs or debt, and expenses (including, but
+not limited to, attorney’s fees) arising from: (a) your use of and access to
+the Services; (b) any feedback or submissions you provide to us concerning the
+Taler Wallet; (c) your violation of any term of this Agreement; or (d) your
+violation of any law, rule, or regulation, or the rights of any third party.
+
+You agree that any claim you may have arising out of or related to your
+relationship with us must be filed within one year after such claim arises,
+otherwise, your claim in permanently barred.
+
+In the event of termination concerning your use of our Services, your
+obligations under this Agreement will still continue.
+
+
+Discontinuance of services and Force majeure
+--------------------------------------------
+
+We may, in our sole discretion and without cost to you, with or without prior
+notice, and at any time, modify or discontinue, temporarily or permanently,
+any portion of our Services. We will use the Taler protocol’s provisions to
+notify Wallets if our Services are to be discontinued. It is your
+responsibility to ensure that the Taler Wallet is online at least once every
+three months to observe these notifications. We shall not be held responsible
+or liable for any loss of funds in the event that we discontinue or depreciate
+the Services and your Taler Wallet fails to transfer out the coins within a
+three months notification period.
+
+We shall not be held liable for any delays, failure in performance, or
+interruptions of service which result directly or indirectly from any cause or
+condition beyond our reasonable control, including but not limited to: any
+delay or failure due to any act of God, act of civil or military authorities,
+act of terrorism, civil disturbance, war, strike or other labor dispute, fire,
+interruption in telecommunications or Internet services or network provider
+services, failure of equipment and/or software, other catastrophe, or any
+other occurrence which is beyond our reasonable control and shall not affect
+the validity and enforceability of any remaining provisions.
+
+
+Governing law, Waivers, Severability and Assignment
+---------------------------------------------------
+
+No matter where you’re located, the laws of Switzerland will govern these
+Terms. If any provisions of these Terms are inconsistent with any applicable
+law, those provisions will be superseded or modified only to the extent such
+provisions are inconsistent. The parties agree to submit to the ordinary
+courts in Bern, Switzerland for exclusive jurisdiction of any dispute
+arising out of or related to your use of the Services or your breach of these
+Terms.
+
+Our failure to exercise or delay in exercising any right, power, or privilege
+under this Agreement shall not operate as a waiver; nor shall any single or
+partial exercise of any right, power, or privilege preclude any other or
+further exercise thereof.
+
+You agree that we may assign any of our rights and/or transfer, sub-contract,
+or delegate any of our obligations under these Terms.
+
+If it turns out that any part of this Agreement is invalid, void, or for any
+reason unenforceable, that term will be deemed severable and limited or
+eliminated to the minimum extent necessary.
+
+This Agreement sets forth the entire understanding and agreement as to the
+subject matter hereof and supersedes any and all prior discussions,
+agreements, and understandings of any kind (including, without limitation, any
+prior versions of this Agreement) and every nature between us. Except as
+provided for above, any modification to this Agreement must be in writing and
+must be signed by both parties.
+
+
+Questions or comments
+---------------------
+
+We welcome comments, questions, concerns, or suggestions. Please send us a
+message on our contact page at legal@taler-systems.com.
diff --git a/contrib/tos/en/0.epub b/contrib/tos/en/0.epub
index 2e6c6609..4417674e 100644
--- a/contrib/tos/en/0.epub
+++ b/contrib/tos/en/0.epub
Binary files differ
diff --git a/contrib/tos/en/0.html b/contrib/tos/en/0.html
index 6e7f66f5..0a1c1d33 100644
--- a/contrib/tos/en/0.html
+++ b/contrib/tos/en/0.html
@@ -20,11 +20,21 @@
<div class="section" id="terms-of-service">
<h1>Terms Of Service<a class="headerlink" href="#terms-of-service" title="Permalink to this headline">¶</a></h1>
-<p>Last Updated: 12.4.2019</p>
-<p>Welcome! Taler Systems SA (“we,” “our,” or “us”) provides a payment service
+<p>Last Updated: 09.06.2022</p>
+<p>Welcome! The ICE research center of the Bern University of Applied Sciences
+in Switzerland (“we,” “our,” or “us”) provides an experimental payment service
through our Internet presence (collectively the “Services”). Before using our
Services, please read the Terms of Service (the “Terms” or the “Agreement”)
carefully.</p>
+<div class="section" id="this-is-research">
+<h2>This is research<a class="headerlink" href="#this-is-research" title="Permalink to this headline">¶</a></h2>
+<p>This is a research experiment. Any funds wired to our Bitcoin address are
+considered a donation to our research group. We may use them to enable
+payments following the GNU Taler protocol, or simply keep them at our
+discretion. The service is experimental and may also be discontinued at
+any time, in which case all remaining funds will definitively be kept by
+the research group.</p>
+</div>
<div class="section" id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
<p>This section provides a brief summary of the highlights of this
@@ -41,10 +51,12 @@ carefully.</p>
<li><p>You are responsible for keeping the data in your Taler Wallet at all times
under your control. Any losses arising from you not being in control of
your private information are your problem.</p></li>
-<li><p>We will try to transfer funds we hold in escrow for our users to any legal
+<li><p>We may transfer funds we receive from our users to any legal
recipient to the best of our ability within the limitations of the law and
our implementation. However, the Services offered today are highly
-experimental and the set of recipients of funds is severely restricted.</p></li>
+experimental and the set of recipients of funds is severely restricted.
+Again, we stress this is a research experiment and technically all funds
+held by the exchange are owned by the research group of the university.</p></li>
<li><p>For our Services, we may charge transaction fees. The specific fee structure
is provided based on the Taler protocol and should be shown to you when you
withdraw electronic coins using a Taler Wallet. You agree and understand
@@ -52,8 +64,8 @@ that the Taler protocol allows for the fee structure to change.</p></li>
<li><p>You agree to not intentionally overwhelm our systems with requests and
follow responsible disclosure if you find security issues in our services.</p></li>
<li><p>We cannot be held accountable for our Services not being available due to
-circumstances beyond our control. If we modify or terminate our services,
-we will try to give you the opportunity to recover your funds. However,
+any circumstances. If we modify or terminate our services,
+we may give you the opportunity to recover your funds. However,
given the experimental state of the Services today, this may not be
possible. You are strongly advised to limit your use of the Service
to small-scale experiments expecting total loss of all funds.</p></li>
@@ -62,7 +74,7 @@ to small-scale experiments expecting total loss of all funds.</p></li>
<p>These terms outline approved uses of our Services. The Services and these
Terms are still at an experimental stage. If you have any questions or
comments related to this Agreement, please send us a message to
-<a class="reference external" href="mailto:legal&#37;&#52;&#48;taler-systems&#46;com">legal<span>&#64;</span>taler-systems<span>&#46;</span>com</a>. If you do not agree to this Agreement, you must not
+<a class="reference external" href="mailto:ice&#37;&#52;&#48;bfh&#46;ch">ice<span>&#64;</span>bfh<span>&#46;</span>ch</a>. If you do not agree to this Agreement, you must not
use our Services.</p>
</div>
</div>
@@ -82,26 +94,26 @@ have last reviewed these Terms.</p>
</div>
<div class="section" id="services">
<h2>Services<a class="headerlink" href="#services" title="Permalink to this headline">¶</a></h2>
-<p>We will try to transfer funds that we hold in escrow for our users to any
-legal recipient to the best of our ability and within the limitations of the
-law and our implementation. However, the Services offered today are highly
-experimental and the set of recipients of funds is severely restricted. The
-Taler Wallet can be loaded by exchanging fiat currencies against electronic
-coins. We are providing this exchange service. Once your Taler Wallet is
-loaded with electronic coins they can be spent for purchases if the seller is
-accepting Taler as a means of payment. We are not guaranteeing that any seller
-is accepting Taler at all or a particular seller. The seller or recipient of
+<p>We will try to transfer funds that we receive from users to any legal
+recipient to the best of our ability and within the limitations of the
+law. However, the Services offered today are highly experimental and the set
+of recipients of funds is severely restricted. The Taler Wallet can be loaded
+by exchanging fiat or cryptocurrencies against electronic coins. We are
+providing this exchange service. Once your Taler Wallet is loaded with
+electronic coins they can be spent for purchases if the seller is accepting
+Taler as a means of payment. We are not guaranteeing that any seller is
+accepting Taler at all or a particular seller. The seller or recipient of
deposits of electronic coins must specify the target account, as per the
design of the Taler protocol. They are responsible for following the protocol
and specifying the correct bank account, and are solely liable for any losses
-that may arise from specifying the wrong account. We will allow the government
+that may arise from specifying the wrong account. We may allow the government
to link wire transfers to the underlying contract hash. It is the
responsibility of recipients to preserve the full contracts and to pay
whatever taxes and charges may be applicable. Technical issues may lead to
situations where we are unable to make transfers at all or lead to incorrect
-transfers that cannot be reversed. We will only refuse to execute transfers if
-the transfers are prohibited by a competent legal authority and we are ordered
-to do so.</p>
+transfers that cannot be reversed. We may refuse to execute transfers if the
+transfers are prohibited by a competent legal authority and we are ordered to
+do so.</p>
<p>When using our Services, you agree to not take any action that intentionally
imposes an unreasonable load on our infrastructure. If you find security
problems in our Services, you agree to first report them to
@@ -267,7 +279,7 @@ the validity and enforceability of any remaining provisions.</p>
Terms. If any provisions of these Terms are inconsistent with any applicable
law, those provisions will be superseded or modified only to the extent such
provisions are inconsistent. The parties agree to submit to the ordinary
-courts in Zurich, Switzerland for exclusive jurisdiction of any dispute
+courts in Bern, Switzerland for exclusive jurisdiction of any dispute
arising out of or related to your use of the Services or your breach of these
Terms.</p>
<p>Our failure to exercise or delay in exercising any right, power, or privilege
diff --git a/contrib/tos/en/0.pdf b/contrib/tos/en/0.pdf
index 89d39493..f145a83a 100644
--- a/contrib/tos/en/0.pdf
+++ b/contrib/tos/en/0.pdf
Binary files differ
diff --git a/contrib/tos/en/0.txt b/contrib/tos/en/0.txt
index c124d70e..19db0984 100644
--- a/contrib/tos/en/0.txt
+++ b/contrib/tos/en/0.txt
@@ -1,12 +1,24 @@
Terms Of Service
****************
-Last Updated: 12.4.2019
+Last Updated: 09.06.2022
-Welcome! Taler Systems SA (“we,” “our,” or “us”) provides a payment
-service through our Internet presence (collectively the “Services”).
-Before using our Services, please read the Terms of Service (the
-“Terms” or the “Agreement”) carefully.
+Welcome! The ICE research center of the Bern University of Applied
+Sciences in Switzerland (“we,” “our,” or “us”) provides an
+experimental payment service through our Internet presence
+(collectively the “Services”). Before using our Services, please read
+the Terms of Service (the “Terms” or the “Agreement”) carefully.
+
+
+This is research
+================
+
+This is a research experiment. Any funds wired to our Bitcoin address
+are considered a donation to our research group. We may use them to
+enable payments following the GNU Taler protocol, or simply keep them
+at our discretion. The service is experimental and may also be
+discontinued at any time, in which case all remaining funds will
+definitively be kept by the research group.
Overview
@@ -28,11 +40,13 @@ Highlights:
all times under your control. Any losses arising from you not
being in control of your private information are your problem.
- * We will try to transfer funds we hold in escrow for our users to
- any legal recipient to the best of our ability within the
- limitations of the law and our implementation. However, the
- Services offered today are highly experimental and the set of
- recipients of funds is severely restricted.
+ * We may transfer funds we receive from our users to any legal
+ recipient to the best of our ability within the limitations of
+ the law and our implementation. However, the Services offered
+ today are highly experimental and the set of recipients of funds
+ is severely restricted. Again, we stress this is a research
+ experiment and technically all funds held by the exchange are
+ owned by the research group of the university.
* For our Services, we may charge transaction fees. The specific
fee structure is provided based on the Taler protocol and should
@@ -45,19 +59,18 @@ Highlights:
issues in our services.
* We cannot be held accountable for our Services not being
- available due to circumstances beyond our control. If we modify
- or terminate our services, we will try to give you the
- opportunity to recover your funds. However, given the
- experimental state of the Services today, this may not be
- possible. You are strongly advised to limit your use of the
- Service to small-scale experiments expecting total loss of all
- funds.
+ available due to any circumstances. If we modify or terminate our
+ services, we may give you the opportunity to recover your funds.
+ However, given the experimental state of the Services today, this
+ may not be possible. You are strongly advised to limit your use
+ of the Service to small-scale experiments expecting total loss of
+ all funds.
These terms outline approved uses of our Services. The Services and
these Terms are still at an experimental stage. If you have any
questions or comments related to this Agreement, please send us a
-message to legal@taler-systems.com. If you do not agree to this
-Agreement, you must not use our Services.
+message to ice@bfh.ch. If you do not agree to this Agreement, you must
+not use our Services.
How you accept this policy
@@ -80,26 +93,25 @@ since you have last reviewed these Terms.
Services
========
-We will try to transfer funds that we hold in escrow for our users to
-any legal recipient to the best of our ability and within the
-limitations of the law and our implementation. However, the Services
-offered today are highly experimental and the set of recipients of
-funds is severely restricted. The Taler Wallet can be loaded by
-exchanging fiat currencies against electronic coins. We are providing
-this exchange service. Once your Taler Wallet is loaded with
-electronic coins they can be spent for purchases if the seller is
-accepting Taler as a means of payment. We are not guaranteeing that
-any seller is accepting Taler at all or a particular seller. The
-seller or recipient of deposits of electronic coins must specify the
-target account, as per the design of the Taler protocol. They are
-responsible for following the protocol and specifying the correct bank
-account, and are solely liable for any losses that may arise from
-specifying the wrong account. We will allow the government to link
-wire transfers to the underlying contract hash. It is the
-responsibility of recipients to preserve the full contracts and to pay
-whatever taxes and charges may be applicable. Technical issues may
-lead to situations where we are unable to make transfers at all or
-lead to incorrect transfers that cannot be reversed. We will only
+We will try to transfer funds that we receive from users to any legal
+recipient to the best of our ability and within the limitations of the
+law. However, the Services offered today are highly experimental and
+the set of recipients of funds is severely restricted. The Taler
+Wallet can be loaded by exchanging fiat or cryptocurrencies against
+electronic coins. We are providing this exchange service. Once your
+Taler Wallet is loaded with electronic coins they can be spent for
+purchases if the seller is accepting Taler as a means of payment. We
+are not guaranteeing that any seller is accepting Taler at all or a
+particular seller. The seller or recipient of deposits of electronic
+coins must specify the target account, as per the design of the Taler
+protocol. They are responsible for following the protocol and
+specifying the correct bank account, and are solely liable for any
+losses that may arise from specifying the wrong account. We may allow
+the government to link wire transfers to the underlying contract hash.
+It is the responsibility of recipients to preserve the full contracts
+and to pay whatever taxes and charges may be applicable. Technical
+issues may lead to situations where we are unable to make transfers at
+all or lead to incorrect transfers that cannot be reversed. We may
refuse to execute transfers if the transfers are prohibited by a
competent legal authority and we are ordered to do so.
@@ -306,7 +318,7 @@ No matter where you’re located, the laws of Switzerland will govern
these Terms. If any provisions of these Terms are inconsistent with
any applicable law, those provisions will be superseded or modified
only to the extent such provisions are inconsistent. The parties agree
-to submit to the ordinary courts in Zurich, Switzerland for exclusive
+to submit to the ordinary courts in Bern, Switzerland for exclusive
jurisdiction of any dispute arising out of or related to your use of
the Services or your breach of these Terms.
diff --git a/contrib/tos/en/0.xml b/contrib/tos/en/0.xml
index ee93a4cc..7f42db04 100644
--- a/contrib/tos/en/0.xml
+++ b/contrib/tos/en/0.xml
@@ -1,14 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">
<!-- Generated by Docutils 0.16 -->
-<document source="/research/taler/exchange/contrib/tos/tos.rst">
+<document source="/home/grothoff/research/taler/exchange/contrib/tos/tos.rst">
<section ids="terms-of-service" names="terms\ of\ service">
<title>Terms Of Service</title>
- <paragraph>Last Updated: 12.4.2019</paragraph>
- <paragraph>Welcome! Taler Systems SA (“we,” “our,” or “us”) provides a payment service
+ <paragraph>Last Updated: 09.06.2022</paragraph>
+ <paragraph>Welcome! The ICE research center of the Bern University of Applied Sciences
+ in Switzerland (“we,” “our,” or “us”) provides an experimental payment service
through our Internet presence (collectively the “Services”). Before using our
Services, please read the Terms of Service (the “Terms” or the “Agreement”)
carefully.</paragraph>
+ <section ids="this-is-research" names="this\ is\ research">
+ <title>This is research</title>
+ <paragraph>This is a research experiment. Any funds wired to our Bitcoin address are
+ considered a donation to our research group. We may use them to enable
+ payments following the GNU Taler protocol, or simply keep them at our
+ discretion. The service is experimental and may also be discontinued at
+ any time, in which case all remaining funds will definitively be kept by
+ the research group.</paragraph>
+ </section>
<section ids="overview" names="overview">
<title>Overview</title>
<paragraph>This section provides a brief summary of the highlights of this
@@ -28,10 +38,12 @@
your private information are your problem.</paragraph>
</list_item>
<list_item>
- <paragraph>We will try to transfer funds we hold in escrow for our users to any legal
+ <paragraph>We may transfer funds we receive from our users to any legal
recipient to the best of our ability within the limitations of the law and
our implementation. However, the Services offered today are highly
- experimental and the set of recipients of funds is severely restricted.</paragraph>
+ experimental and the set of recipients of funds is severely restricted.
+ Again, we stress this is a research experiment and technically all funds
+ held by the exchange are owned by the research group of the university.</paragraph>
</list_item>
<list_item>
<paragraph>For our Services, we may charge transaction fees. The specific fee structure
@@ -45,8 +57,8 @@
</list_item>
<list_item>
<paragraph>We cannot be held accountable for our Services not being available due to
- circumstances beyond our control. If we modify or terminate our services,
- we will try to give you the opportunity to recover your funds. However,
+ any circumstances. If we modify or terminate our services,
+ we may give you the opportunity to recover your funds. However,
given the experimental state of the Services today, this may not be
possible. You are strongly advised to limit your use of the Service
to small-scale experiments expecting total loss of all funds.</paragraph>
@@ -56,7 +68,7 @@
<paragraph>These terms outline approved uses of our Services. The Services and these
Terms are still at an experimental stage. If you have any questions or
comments related to this Agreement, please send us a message to
- <reference refuri="mailto:legal@taler-systems.com">legal@taler-systems.com</reference>. If you do not agree to this Agreement, you must not
+ <reference refuri="mailto:ice@bfh.ch">ice@bfh.ch</reference>. If you do not agree to this Agreement, you must not
use our Services.</paragraph>
</section>
</section>
@@ -76,26 +88,26 @@
</section>
<section ids="services" names="services">
<title>Services</title>
- <paragraph>We will try to transfer funds that we hold in escrow for our users to any
- legal recipient to the best of our ability and within the limitations of the
- law and our implementation. However, the Services offered today are highly
- experimental and the set of recipients of funds is severely restricted. The
- Taler Wallet can be loaded by exchanging fiat currencies against electronic
- coins. We are providing this exchange service. Once your Taler Wallet is
- loaded with electronic coins they can be spent for purchases if the seller is
- accepting Taler as a means of payment. We are not guaranteeing that any seller
- is accepting Taler at all or a particular seller. The seller or recipient of
+ <paragraph>We will try to transfer funds that we receive from users to any legal
+ recipient to the best of our ability and within the limitations of the
+ law. However, the Services offered today are highly experimental and the set
+ of recipients of funds is severely restricted. The Taler Wallet can be loaded
+ by exchanging fiat or cryptocurrencies against electronic coins. We are
+ providing this exchange service. Once your Taler Wallet is loaded with
+ electronic coins they can be spent for purchases if the seller is accepting
+ Taler as a means of payment. We are not guaranteeing that any seller is
+ accepting Taler at all or a particular seller. The seller or recipient of
deposits of electronic coins must specify the target account, as per the
design of the Taler protocol. They are responsible for following the protocol
and specifying the correct bank account, and are solely liable for any losses
- that may arise from specifying the wrong account. We will allow the government
+ that may arise from specifying the wrong account. We may allow the government
to link wire transfers to the underlying contract hash. It is the
responsibility of recipients to preserve the full contracts and to pay
whatever taxes and charges may be applicable. Technical issues may lead to
situations where we are unable to make transfers at all or lead to incorrect
- transfers that cannot be reversed. We will only refuse to execute transfers if
- the transfers are prohibited by a competent legal authority and we are ordered
- to do so.</paragraph>
+ transfers that cannot be reversed. We may refuse to execute transfers if the
+ transfers are prohibited by a competent legal authority and we are ordered to
+ do so.</paragraph>
<paragraph>When using our Services, you agree to not take any action that intentionally
imposes an unreasonable load on our infrastructure. If you find security
problems in our Services, you agree to first report them to
@@ -283,7 +295,7 @@
Terms. If any provisions of these Terms are inconsistent with any applicable
law, those provisions will be superseded or modified only to the extent such
provisions are inconsistent. The parties agree to submit to the ordinary
- courts in Zurich, Switzerland for exclusive jurisdiction of any dispute
+ courts in Bern, Switzerland for exclusive jurisdiction of any dispute
arising out of or related to your use of the Services or your breach of these
Terms.</paragraph>
<paragraph>Our failure to exercise or delay in exercising any right, power, or privilege
diff --git a/debian/changelog b/debian/changelog
index 8dcaf12d..c151d9ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+taler-exchange (0.8.99-1) unstable; urgency=low
+
+ * Updating to latest pre-release from Git.
+
+ -- Christian Grothoff <grothoff@taler.net> Mon, 20 Jun 2022 13:12:58 +0200
+
taler-exchange (0.8.5-3) unstable; urgency=low
* Updating to latest Git with minor bugfixes and improvements.
diff --git a/debian/control b/debian/control
index 894a1dd3..3f55173e 100644
--- a/debian/control
+++ b/debian/control
@@ -9,27 +9,22 @@ Build-Depends:
bash,
debhelper-compat (= 12),
gettext,
- libgnunet-dev (>=0.15.3),
+ libgnunet-dev (>=0.17.1),
libcurl4-gnutls-dev (>=7.35.0) | libcurl4-openssl-dev (>= 7.35.0),
- libgcrypt20-dev (>=1.6),
+ libgcrypt20-dev (>=1.8),
libgnutls28-dev (>=3.2.12),
libidn2-dev,
libjansson-dev,
libltdl-dev (>=2.2),
- libmicrohttpd-dev (>=0.9.63),
- libpq-dev (>=9.5),
+ libmicrohttpd-dev (>=0.9.71),
+ libpq-dev (>=13),
libsodium-dev (>=1.0.11),
- libsqlite3-dev (>=3.8),
libunistring-dev (>=0.9.2),
python3-jinja2,
- net-tools,
po-debconf,
python3-dev,
texinfo (>=5.2),
zlib1g-dev
-Build-Conflicts:
- autoconf2.13,
- automake1.4
Standards-Version: 4.5.0
Vcs-Git: https://salsa.debian.org/debian/taler-exchange.git
Vcs-browser: https://salsa.debian.org/debian/taler-exchange
@@ -72,7 +67,8 @@ Depends:
${misc:Depends},
${shlibs:Depends}
Recommends:
- taler-exchange-offline (= ${binary:Version})
+ taler-exchange-offline (= ${binary:Version}),
+ postgresql (>=13.0)
Description: GNU's payment system operator
Package: taler-exchange-offline
@@ -109,9 +105,9 @@ Section: libdevel
Architecture: any
Depends:
libtalerexchange (= ${binary:Version}),
- libgnunet-dev (>=0.15.3),
- libgcrypt20-dev (>=1.6),
- libmicrohttpd-dev (>=0.9.33),
+ libgnunet-dev (>=0.17.1),
+ libgcrypt20-dev (>=1.8),
+ libmicrohttpd-dev (>=0.9.71),
${misc:Depends},
${shlibs:Depends}
Description: libraries to talk to a GNU Taler exchange (development)
diff --git a/debian/libtalerexchange.install b/debian/libtalerexchange.install
index 35961e82..62dd84a6 100644
--- a/debian/libtalerexchange.install
+++ b/debian/libtalerexchange.install
@@ -5,5 +5,6 @@ usr/share/taler/config.d/paths.conf
usr/share/taler/config.d/taler.conf
debian/etc-libtalerexchange/* etc/
usr/bin/taler-config
+usr/bin/taler-crypto-worker
usr/share/man/man5/taler.conf.5
usr/share/man/man1/taler-config*
diff --git a/debian/rules b/debian/rules
index 13d55647..fa259625 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,9 @@ include /usr/share/dpkg/architecture.mk
%:
dh ${@}
+override_dh_builddeb:
+ dh_builddeb -- -Zgzip
+
override_dh_auto_configure-arch:
dh_auto_configure -- --disable-rpath --with-microhttpd=yes $(shell dpkg-buildflags --export=configure)
@@ -37,6 +40,7 @@ override_dh_installsystemd:
dh_installsystemd -ptaler-exchange --name=taler-exchange-aggregator --no-start --no-enable
dh_installsystemd -ptaler-exchange --name=taler-exchange-transfer --no-start --no-enable
dh_installsystemd -ptaler-exchange --name=taler-exchange-wirewatch --no-start --no-enable
+ dh_installsystemd -ptaler-exchange --name=taler-exchange-secmod-cs --no-start --no-enable
dh_installsystemd -ptaler-exchange --name=taler-exchange-secmod-eddsa --no-start --no-enable
dh_installsystemd -ptaler-exchange --name=taler-exchange-secmod-rsa --no-start --no-enable
dh_installsystemd -ptaler-exchange --name=taler-exchange-closer --no-start --no-enable
diff --git a/debian/taler-exchange.postrm b/debian/taler-exchange.postrm
index 6c31a459..6488d268 100644
--- a/debian/taler-exchange.postrm
+++ b/debian/taler-exchange.postrm
@@ -7,13 +7,16 @@ if [ -f /usr/share/debconf/confmodule ]; then
fi
case "${1}" in
-purge) ;;
-remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;;
+purge)
+ rm -rf /var/lib/taler/exchange-offline /var/lib/taler/exchange-secmod-*
+ ;;
+remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear)
+ ;;
*)
- echo "postrm called with unknown argument \`${1}'" >&2
- exit 1
- ;;
+ echo "postrm called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
esac
#DEBHELPER#
diff --git a/debian/taler-exchange.taler-exchange-aggregator.service b/debian/taler-exchange.taler-exchange-aggregator.service
index 683c1a81..aa4f32e3 100644
--- a/debian/taler-exchange.taler-exchange-aggregator.service
+++ b/debian/taler-exchange.taler-exchange-aggregator.service
@@ -13,3 +13,4 @@ StandardError=journal
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-aggregator@.service b/debian/taler-exchange.taler-exchange-aggregator@.service
new file mode 100644
index 00000000..aa4f32e3
--- /dev/null
+++ b/debian/taler-exchange.taler-exchange-aggregator@.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=GNU Taler payment system exchange aggregator service
+PartOf=taler-exchange.target
+
+[Service]
+User=taler-exchange-aggregator
+Type=simple
+Restart=always
+RestartSec=100ms
+ExecStart=/usr/bin/taler-exchange-aggregator -c /etc/taler/taler.conf
+StandardOutput=journal
+StandardError=journal
+PrivateTmp=yes
+PrivateDevices=yes
+ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-closer.service b/debian/taler-exchange.taler-exchange-closer.service
index 01c52b2d..d3a654cc 100644
--- a/debian/taler-exchange.taler-exchange-closer.service
+++ b/debian/taler-exchange.taler-exchange-closer.service
@@ -13,3 +13,4 @@ StandardError=journal
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-expire.service b/debian/taler-exchange.taler-exchange-expire.service
new file mode 100644
index 00000000..e4432f23
--- /dev/null
+++ b/debian/taler-exchange.taler-exchange-expire.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=GNU Taler payment system exchange expire service
+PartOf=taler-exchange.target
+
+[Service]
+User=taler-exchange-expire
+Type=simple
+Restart=always
+RestartSec=100ms
+ExecStart=/usr/bin/taler-exchange-expire -c /etc/taler/taler.conf
+StandardOutput=journal
+StandardError=journal
+PrivateTmp=yes
+PrivateDevices=yes
+ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-httpd.service b/debian/taler-exchange.taler-exchange-httpd.service
index 68bde0d6..98d76f6f 100644
--- a/debian/taler-exchange.taler-exchange-httpd.service
+++ b/debian/taler-exchange.taler-exchange-httpd.service
@@ -19,6 +19,7 @@ StandardError=journal
PrivateTmp=no
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
[Install]
WantedBy=multi-user.target
diff --git a/debian/taler-exchange.taler-exchange-httpd@.service b/debian/taler-exchange.taler-exchange-httpd@.service
index 4235f72e..e0246899 100644
--- a/debian/taler-exchange.taler-exchange-httpd@.service
+++ b/debian/taler-exchange.taler-exchange-httpd@.service
@@ -21,6 +21,7 @@ StandardError=journal
PrivateTmp=no
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
[Install]
WantedBy=multi-user.target
diff --git a/debian/taler-exchange.taler-exchange-secmod-cs.service b/debian/taler-exchange.taler-exchange-secmod-cs.service
index 15b87a3c..3b5e0745 100644
--- a/debian/taler-exchange.taler-exchange-secmod-cs.service
+++ b/debian/taler-exchange.taler-exchange-secmod-cs.service
@@ -14,3 +14,5 @@ StandardError=journal
PrivateTmp=no
PrivateDevices=yes
ProtectSystem=full
+IPAddressDeny=any
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-secmod-eddsa.service b/debian/taler-exchange.taler-exchange-secmod-eddsa.service
index e4898581..e8fba173 100644
--- a/debian/taler-exchange.taler-exchange-secmod-eddsa.service
+++ b/debian/taler-exchange.taler-exchange-secmod-eddsa.service
@@ -14,3 +14,6 @@ StandardError=journal
PrivateTmp=no
PrivateDevices=yes
ProtectSystem=full
+IPAddressDeny=any
+Slice=taler-exchange.slice
+
diff --git a/debian/taler-exchange.taler-exchange-secmod-rsa.service b/debian/taler-exchange.taler-exchange-secmod-rsa.service
index 6c5a3d61..10a9585a 100644
--- a/debian/taler-exchange.taler-exchange-secmod-rsa.service
+++ b/debian/taler-exchange.taler-exchange-secmod-rsa.service
@@ -14,3 +14,5 @@ StandardError=journal
PrivateTmp=no
PrivateDevices=yes
ProtectSystem=full
+IPAddressDeny=any
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-transfer.service b/debian/taler-exchange.taler-exchange-transfer.service
index b2615b7c..c7187b30 100644
--- a/debian/taler-exchange.taler-exchange-transfer.service
+++ b/debian/taler-exchange.taler-exchange-transfer.service
@@ -14,3 +14,4 @@ StandardError=journal
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-wirewatch.service b/debian/taler-exchange.taler-exchange-wirewatch.service
index 54704cb8..e4947214 100644
--- a/debian/taler-exchange.taler-exchange-wirewatch.service
+++ b/debian/taler-exchange.taler-exchange-wirewatch.service
@@ -14,3 +14,4 @@ StandardError=journal
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange-wirewatch@.service b/debian/taler-exchange.taler-exchange-wirewatch@.service
index 54704cb8..e4947214 100644
--- a/debian/taler-exchange.taler-exchange-wirewatch@.service
+++ b/debian/taler-exchange.taler-exchange-wirewatch@.service
@@ -14,3 +14,4 @@ StandardError=journal
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
+Slice=taler-exchange.slice
diff --git a/debian/taler-exchange.taler-exchange.slice b/debian/taler-exchange.taler-exchange.slice
new file mode 100644
index 00000000..b5bb71e2
--- /dev/null
+++ b/debian/taler-exchange.taler-exchange.slice
@@ -0,0 +1,7 @@
+[Unit]
+Description=Slice for GNU taler exchange processes
+Before=slices.target
+
+[Slice]
+# Add settings that should affect all GNU Taler exchange
+# components here.
diff --git a/debian/taler-exchange.taler-exchange.target b/debian/taler-exchange.taler-exchange.target
index eea37c80..65ec77c1 100644
--- a/debian/taler-exchange.taler-exchange.target
+++ b/debian/taler-exchange.taler-exchange.target
@@ -6,6 +6,7 @@ Wants=taler-exchange-httpd.service
Wants=taler-exchange-wirewatch.service
Wants=taler-exchange-aggregator.service
Wants=taler-exchange-closer.service
+Wants=taler-exchange-expire.service
Wants=taler-exchange-transfer.service
[Install]
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 70f10c34..edb226a8 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -21,10 +21,13 @@ man_MANS = \
prebuilt/man/taler-exchange-benchmark.1 \
prebuilt/man/taler-exchange-closer.1 \
prebuilt/man/taler-exchange-dbinit.1 \
+ prebuilt/man/taler-exchange-expire.1 \
prebuilt/man/taler-exchange-httpd.1 \
prebuilt/man/taler-exchange-offline.1 \
+ prebuilt/man/taler-exchange-secmod-cs.1\
prebuilt/man/taler-exchange-secmod-eddsa.1\
prebuilt/man/taler-exchange-secmod-rsa.1 \
+ prebuilt/man/taler-exchange-router.1\
prebuilt/man/taler-exchange-transfer.1\
prebuilt/man/taler-exchange-wirewatch.1 \
prebuilt/man/taler-exchange-wire-gateway-client.1\
diff --git a/doc/cs/ads/glossary.tex b/doc/cs/ads/glossary.tex
index 67ff003b..7132f89a 100644
--- a/doc/cs/ads/glossary.tex
+++ b/doc/cs/ads/glossary.tex
@@ -1,12 +1,12 @@
%!TEX root = ../thesis.tex
%
-% vorher in Konsole folgendes aufrufen:
+% vorher in Konsole folgendes aufrufen:
% makeglossaries makeglossaries dokumentation.acn && makeglossaries dokumentation.glo
%
%
-% Glossareintraege --> referenz, name, beschreibung
+% Glossareintraege --> reference, name, beschreibung
% Aufruf mit \gls{...}
%
% \newglossaryentry{non-repudiation}{name={non-repudiation},plural={non-repudiation},description={After a message is signed, one can not dispute that a message was signed}}
@@ -18,36 +18,36 @@
}
\newglossaryentry{25519}{
- name = {Curve25519},
- description = {A popular elliptic curve used in many cryptographic systems based on elliptic curve cryptography. See section \ref{par:curve25519}}
+ name = {Curve25519},
+ description = {A popular elliptic curve used in many cryptographic systems based on elliptic curve cryptography. See section \ref{par:curve25519}}
}
\newglossaryentry{fdh}{
name = {FDH},
- description = {A Full-Domain Hash is a hash function with an image size equal to the original gorup. See section \ref{sec:rsa-fdh}}.
-}
+ description = {A Full-Domain Hash is a hash function with an image size equal to the original gorup. See section \ref{sec:rsa-fdh}}.
+}
\newglossaryentry{idempotence}{
name = {idempotence},
- description = {Idempotence in the context of computer science is a property to ensure that the state of system will not change, no matter how many times the same request was made. See section \ref{abort-idempotency}}
-}
+ description = {Idempotence in the context of computer science is a property to ensure that the state of system will not change, no matter how many times the same request was made. See section \ref{abort-idempotency}}
+}
\newglossaryentry{abort-idempotency}{
name = {abort-idempotency},
- description = {Abort-idempotency is a special case of \gls{idempotence}. On every step in a protocol it needs to be ensured that even on an abort, the same request always receives the same response. See section \ref{abort-idempotency}}
-}
+ description = {Abort-idempotency is a special case of \gls{idempotence}. On every step in a protocol it needs to be ensured that even on an abort, the same request always receives the same response. See section \ref{abort-idempotency}}
+}
\newglossaryentry{RSABS}{
name = {RSA Blind Signatures},
- description = {Chaums Blind Signature Scheme based on RSA. See section \ref{sec:blind-rsa-sign}}
+ description = {Chaums Blind Signature Scheme based on RSA. See section \ref{sec:blind-rsa-sign}}
}
\newglossaryentry{CSBS}{
name = {Clause Blind Schnorr Signatures},
description = {A secure variant of Blind Schnorr Signature Schemes introduced in section \ref{sec:clause-blind-schnorr-sig}}
-}
+}
% \newglossaryentry{25519}{
% name = {},
- % description = {}
-% } \ No newline at end of file
+ % description = {}
+% }
diff --git a/doc/cs/content/1_introduction.tex b/doc/cs/content/1_introduction.tex
index 1ed9e058..e0fdaa01 100644
--- a/doc/cs/content/1_introduction.tex
+++ b/doc/cs/content/1_introduction.tex
@@ -51,7 +51,7 @@ In scope are all necessary changes on the protocol(s) and components for the fol
\item design and implement a protocol where the user proves to the exchange the knowledge of the coin that is to be signed (optional)
\end{itemize}
-Out of scope is production readyness of the implementation.
+Out of scope is production readiness of the implementation.
This is because changes in the protocos and code need to be thoroughly vetted to ensure that no weaknesses or security vulnerabilities were introduced.
Such an audit is out of scope for the thesis and is recommended to be performed in the future.
The iOS wallet will not be considered in this work.
@@ -69,4 +69,4 @@ Scope changes during the project:
\item \textbf{Adjusted: } Focus is on the implementation of the exchange protocols (Withdraw, Spend, Refresh and cryptographic utilities)
\item \textbf{Adjusted: } Implementation of the refresh protocol and wallet-core are nice-to-have goals
\item \textbf{Removed: } The Merchant and the android wallet implementations are out of scope
-\end{itemize} \ No newline at end of file
+\end{itemize}
diff --git a/doc/cs/content/3_preliminaries.tex b/doc/cs/content/3_preliminaries.tex
index e63e65d3..7d7b7ca2 100644
--- a/doc/cs/content/3_preliminaries.tex
+++ b/doc/cs/content/3_preliminaries.tex
@@ -141,7 +141,6 @@ This can be used to detect compromised signing keys or a malicious exchange.
\subsection{Properties}
\label{sec:taler-properties}
-%Alle Taler Eigenschaften die wir angreifen wollen auflisten und bezug nehmen wie diese erreicht werden
This section describes Taler's properties.
\subsubsection{Free Software}
@@ -299,7 +298,7 @@ If verification is successful, only Alice knows her private key and Bob uses Ali
A digital signature scheme has a message space M, a signature space S and three algorithms:
\begin{itemize}
\item Key generation: $(pk,sk) \gets keyGen()$
- \item Signatue generation: $s \gets $sign$_sk(m)$
+ \item Signature generation: $s \gets $sign$_sk(m)$
\item Verification: $ v \gets $verify$_pk(m,s)$ where $v \in {0,1}$
\end{itemize}
If the result of the verification algorithm equals 1, a signature for m is called valid.
@@ -783,7 +782,7 @@ A good introduction to cut and choose protocols gives the Paper from Claude Cré
The expression cut-and-choose was later introduced by David Chaum in analogy to a popular cake sharing problem:
Given a complete cake to be shared among two parties distrusting of each other (for reasons of serious appetite).
A fair way for them to share the cake is to have one of them cut the cake in two equals hares, and let the other one choose his favourite share.
- This solution guarantes that it is in the formers best interest to cut the shares as evenly as possible."
+ This solution guarantees that it is in the formers best interest to cut the shares as evenly as possible."
}
\end{center}
@@ -870,10 +869,10 @@ Figure \ref{fig:withdraw-loophole-exploit} explains how such a payment would wor
Note that we omitted the parts leading up to the coin creation (contract, agreement of price, number of coins and their denominations).
This is how it works on a high level:
\begin{enumerate}
- \item The malicous merchant generates and blinds coins, which are then transmitted to the customer
+ \item The malicious merchant generates and blinds coins, which are then transmitted to the customer
\item The customer authorizes the withdraw from his reserve by signing the blinded coins with the private key of his reserve, thus generating withdraw confirmations.
- \item The withdraw confirmations are transmitted to the exchange, which generates the signatures and returns them to the malicous merchant.
- \item The malicous merchant unblinds the signatures.
+ \item The withdraw confirmations are transmitted to the exchange, which generates the signatures and returns them to the malicious merchant.
+ \item The malicious merchant unblinds the signatures.
He is now in possession of the coin, thus the payment is completed.
\end{enumerate}
@@ -882,7 +881,7 @@ This is how it works on a high level:
\resizebox{1.0\textwidth}{!}{$\displaystyle
\begin{array}{ l c l}
% preliminaries
- \textbf{Customer} & & \textbf{malicous Merchant}
+ \textbf{Customer} & & \textbf{malicious Merchant}
\\ \text{knows:} & & \text{knows:}
\\ \text{reserve keys } w_s, W_p
\\ \text{denomination public key } D_p = \langle e, N \rangle & & \text{denomination public key } D_p = \langle e, N \rangle
@@ -903,7 +902,7 @@ This is how it works on a high level:
\\
\hline
\\
- \textbf{malicous Merchant} & & \textbf{Exchange}
+ \textbf{malicious Merchant} & & \textbf{Exchange}
\\\text{knows:} & & \text{knows:}
\\& & \text{reserve public key } W_p
\\ \text{denomination public key } D_p = \langle e, N \rangle & & \text{denomination keys } d_s, D_p
@@ -949,7 +948,6 @@ Chapter 4.1.4 describes more general aspects as well as the contract header and
\subsubsection{Spend Protocol}
The payment process begins when a customer submits a shopping cart (one or more items to buy) and commits his intent to buy them.
The merchant has a key pair skM, pkM of which the customer knows the public key.
-% besseres Wort als commit?
Note that certain details contained in contract header or deposit permission like merchant \ac{KYC} information, deposit and refund deadlines and fees are left out.
The deposit state machine can be seen in figure \ref{fig:deposit:states}.
\begin{figure}[htp]
@@ -1033,7 +1031,7 @@ In cases where there are multiple deposit permissions (meaning that multiple coi
\item Is the signature of the coin valid?
\item Is $ f $ (the value to be spent) smaller or equal the residual value of the coin (check for overspending attempt)?
\end{itemize}
- If all checks are successful, the exchange saves the deposit record containing the deposit permission and its signature in a database, substracts the spent value from the residual value of the coin and schedules the money transfer to the merchant's account $ A_m $ (grouping payments is done to reduce payment fees).
+ If all checks are successful, the exchange saves the deposit record containing the deposit permission and its signature in a database, subtracts the spent value from the residual value of the coin and schedules the money transfer to the merchant's account $ A_m $ (grouping payments is done to reduce payment fees).
\\The exchange calculates a deposit confirmation signature $ \sigma_{DC} $ for the deposit permission with the exchange signing private key and returns them to the merchant.
\\This signature is also used to prove that a merchant was the first to receive payment from a certain coin.
Without this, an evil exchange could later deny confirming a payment and claim double spending.
@@ -1180,7 +1178,7 @@ The customer, which holds the old partially spend coin and knows \\$C_{old} = \t
On the exchange's side various checks are done to validate the request.
Detailed steps of the commit phase are shown in figure \ref{fig:refresh-part1}.
-
+
\begin{figure}
\begin{equation*}
\resizebox{1.0\textwidth}{!}{$\displaystyle
@@ -1464,4 +1462,4 @@ When the list of trusted auditor certs of a customer/merchant somehow can be man
One attack scenario would be to attack customers/merchants with a supply-chain attack on the wallets or merchant backends' implementation.
With software supply-chain attacks on the rise in 2020/21 (although the concept is not new) such an attack could have a big impact. \\
Since auditor certs are coupled with the wallet (or merchant) implementation, a bank, country, central bank or auditor will most likely publish a wallet and a merchant implementation for the corresponding Taler ecosystem.
-%This would make it possible for the publisher to make changes on the Taler protocol for this specific implementation. \ No newline at end of file
+%This would make it possible for the publisher to make changes on the Taler protocol for this specific implementation.
diff --git a/doc/cs/content/4_2_specification.tex b/doc/cs/content/4_2_specification.tex
index efe6a3c3..fe745fc6 100644
--- a/doc/cs/content/4_2_specification.tex
+++ b/doc/cs/content/4_2_specification.tex
@@ -256,7 +256,7 @@ Further, the API ensures that a caller must generate two secret $r$ as in the Cl
* To ensure unpredictability a new nonce should be used when a new r needs to be derived.
* Uses HKDF internally.
* Comment: Can be done in one HKDF shot and split output.
- *
+ *
* @param nonce is a random nonce
* @param lts is a long-term-secret in form of a private key
* @param[out] r array containing derived secrets r0 and r1
@@ -265,8 +265,8 @@ Further, the API ensures that a caller must generate two secret $r$ as in the Cl
GNUNET_CRYPTO_cs_r_derive (const struct GNUNET_CRYPTO_CsNonce *nonce,
const struct GNUNET_CRYPTO_CsPrivateKey *lts,
struct GNUNET_CRYPTO_CsRSecret r[2]);
-
-
+
+
/**
* Extract the public R of the given secret r.
*
@@ -289,7 +289,7 @@ The blinding secrets are generated by a client who provides a secret as seed to
* To provide abort-idempotency, blinding factors need to be derived but still need to be UNPREDICTABLE
* To ensure unpredictability a new nonce has to be used.
* Uses HKDF internally
- *
+ *
* @param secret is secret to derive blinding factors
* @param secret_len secret length
* @param[out] bs array containing the two derivedGNUNET_CRYPTO_CsBlindingSecret
@@ -306,7 +306,7 @@ Further the Clause Blind Schnorr API provides an API to calculate the two blinde
/**
* Calculate two blinded c's
* Comment: One would be insecure due to Wagner's algorithm solving ROS
- *
+ *
* @param bs array of the two blinding factor structs each containing alpha and beta
* @param r_pub array of the two signer's nonce R
* @param pub the public key of the signer
@@ -336,7 +336,7 @@ See listing \ref{lst:crypto-sign-api}.
* To ensure unpredictability a new nonce has to be used for every signature
* HKDF is used internally for derivation
* r0 and r1 can be derived prior by using GNUNET_CRYPTO_cs_r_derive
- *
+ *
* @param priv private key to use for the signing and as LTS in HKDF
* @param r array of the two secret nonce from the signer
* @param c array of the two blinded c to sign c_b
@@ -370,7 +370,7 @@ GNUNET_CRYPTO_cs_unblind (
struct GNUNET_CRYPTO_CsS *signature_scalar);
\end{lstlisting}
-The verify API takes the message and its signature with the public key and returns GNUNET\_OK for a valid signature and GNUNET\_SYSERR otherwhise.
+The verify API takes the message and its signature with the public key and returns GNUNET\_OK for a valid signature and GNUNET\_SYSERR otherwise.
See listing \ref{lst:crypto-verify-api}.
\begin{lstlisting}[style=bfh-c,language=C,, caption={GNUnet verify API}, label={lst:crypto-verify-api}]
@@ -411,7 +411,7 @@ In crypto.c many utility functions are provided to create planchets (for planche
One difference between \gls{RSABS} and \gls{CSBS} is, that the coin private key and RSA blinding secret can be created at the same point in time, since the RSA blinding secret is created randomly.
However, for Clause Blind Schnorr secrets an additional step is needed, the public $R_0$ and $R_1$ are required to calculate the blinding seed to derive the secrets.
-A planchet in the Clause Blind Schnorr Signature Scheme can be created as followed (implementation details ommited).
+A planchet in the Clause Blind Schnorr Signature Scheme can be created as followed (implementation details omitted).
\begin{enumerate}
\item Create planchet with new \ac{EdDSA} private key
diff --git a/doc/cs/content/4_3_implementation.tex b/doc/cs/content/4_3_implementation.tex
index 07423e4e..879e69e8 100644
--- a/doc/cs/content/4_3_implementation.tex
+++ b/doc/cs/content/4_3_implementation.tex
@@ -94,8 +94,8 @@ The corresponding crypto helper, that talks with the security module, and its te
\item \texttt{src/util/test\_helper\_cs.c}: Tests and benchmarks for the \gls{CSBS} crypto helper
\end{itemize}
% Crypto API offene Punkte:
-%Input-Validierung von Punkten und Skalar
-% Clamping beschreiben: https://neilmadden.blog/2020/05/28/whats-the-curve25519-clamping-all-about/
+%Input-validation of points and scalars:
+% describe clamping: https://neilmadden.blog/2020/05/28/whats-the-curve25519-clamping-all-about/
% Testing: inverse operations, blinded signature test
@@ -219,7 +219,7 @@ Tests for deposit are implemented here:
\begin{itemize}
\item \url{/src/testing/test_exchange_api.c}: Add tests (see "struct TALER\_TESTING\_Command\ spend\_cs[]") that spend \gls{CSBS} coins withdrawn in tests added for withdrawal
\item \url{/src/json/json_pack.c}: Implement \gls{CSBS} case in function TALER\_JSON\_pack\_denom\_sig
-\end{itemize}
+\end{itemize}
\section{Fixing a Minor Security Issue in Taler's RSA Blind Signature Protocols}
\label{sec:taler-vuln}
@@ -230,7 +230,7 @@ The issue was only in the implementation of the current RSA Blind Signature prot
\label{sec:taler-vuln-desc}
The redesigned \gls{CSBS} protocols already include the denomination key in the nonce check, which fixes this issue (see \ref{sec:withdraw-protocol-schnorr}).
-In the case of \gls{RSABS}, the current protocol includes an \gls{idempotence} check by persisting the hash value of the blinded coin $m'$.
+In the case of \gls{RSABS}, the current protocol includes an \gls{idempotence} check by persisting the hash value of the blinded coin $m'$.
On a withdrawal/refresh the \gls{idempotence} check compares if the hash value of $m'$ was seen in the past and returns the 'old' signature on a match.
This could lead to the following scenario:
@@ -277,7 +277,7 @@ After discussing this issue with Christian Grothoff, the conclusion was to inclu
return GNUNET_OK;
case TALER_DENOMINATION_CS:
...
-
+
\end{lstlisting}
The issue is fixed by adding a hash of the current denomination key into the calculation of the hash used in the \gls{idempotence} check.
@@ -295,7 +295,7 @@ The applied fix can be seen in listing \ref{lst:fixed-idempotence}.
{
struct GNUNET_HashContext *hash_context;
hash_context = GNUNET_CRYPTO_hash_context_start ();
-
+
GNUNET_CRYPTO_hash_context_read (hash_context,
&denom_hash->hash,
sizeof(denom_hash->hash));
@@ -312,7 +312,7 @@ The applied fix can be seen in listing \ref{lst:fixed-idempotence}.
{
struct GNUNET_HashContext *hash_context;
hash_context = GNUNET_CRYPTO_hash_context_start ();
-
+
GNUNET_CRYPTO_hash_context_read (hash_context,
&denom_hash->hash,
sizeof(denom_hash->hash));
diff --git a/doc/cs/content/5_discussion.tex b/doc/cs/content/5_discussion.tex
index c68b4a79..8381273c 100644
--- a/doc/cs/content/5_discussion.tex
+++ b/doc/cs/content/5_discussion.tex
@@ -57,7 +57,7 @@ This section compares how the two schemes perform regarding CPU usage, latency,
Clause Schnorr has fixed key sizes with 256 bits (32 bytes), which we compare against different RSA key sizes (1024, 2048, 3072 and 4096 bits).
In terms of security, \gls{CSBS} 256 bit keys could be compared to 3072 bit RSA keys (see \url{https://www.keylength.com/} for more information).
-\subsection{CPU Usage}
+\subsection{CPU Usage}
Various benchmarks were made on different CPU architectures.
This section discusses the main results, detailed information about the performance comparison can be found in appendix \ref{chap:app-perf}.
We thank the Taler team for providing measurements from additional systems and architectures.
@@ -75,7 +75,7 @@ Signing and blinding operations are much faster in \gls{CSBS}, also \gls{CSBS} s
\begin{bfhBox}[BFH-MediumBlue]{Setup}
CPU: 8-core AMD Ryzen 7 PRO 5850U \\
OS: Ubuntu 21.10 Linux 5.13.0-25-generic \#26-Ubuntu SMP Fri Jan 7 15:48:31 UTC 2022 x86\_64 x86\_64 x86\_64 GNU/Linux \\
- libsodium version: 1.0.18-1build1 \\
+ libsodium version: 1.0.18-1build1 \\
libgcrypt version: 1.8.7-5ubuntu2 \\\\
Benchmarks with other hardware setups can be found in appendix \ref{chap:app-perf}.
\end{bfhBox}
@@ -112,7 +112,7 @@ RSA 1024 is in some situations faster than the \gls{CSBS} implementation.
Note that 1024 bit keys are not recommended for many use cases, but the highest currently known RSA factorization done is 829 bits \cite{enwiki:1055393696}.
The following section \ref{sec:disc-risk} explains the risk running RSA 1024 or \gls{CSBS} denominations further.\\
The blind and unblind operations are running in a wallet implementation, therefore the comparison with RSA 1024 is very interesting for devices with less CPU power.
-Comparison of such hardware can be found in appendix \ref{chap:app-perf}, these comparison results come to the same conlcusion.\\
+Comparison of such hardware can be found in appendix \ref{chap:app-perf}, these comparison results come to the same conclusion.\\
Although RSA 1024 bit is much faster in the blinding operation, \gls{CSBS} still perform better when calculating the blinding and unblinding operations together.
\gls{CSBS} unblinding computes only an addition of two scalars $s + \alpha \mod p$, while RSA computes $s * r^{-1}$.
To conclude, \gls{CSBS} are faster than RSA 1024 bit and provide a better level of security.
@@ -205,7 +205,7 @@ The disk space comparison for a wallet can be found in \ref{tab:comp-wallet-spac
These are theoretical calculations, implementations may choose to persist additional values.
\end{bfhWarnBox}
The reasons that \gls{CSBS} use less bandwidth is mostly because the signature/key sizes are much smaller.
-The bandwith improvements for the \texttt{/keys} API is the same as specified in the table with disk space comparison \ref{tab:comp-sign-space}.
+The bandwidth improvements for the \texttt{/keys} API is the same as specified in the table with disk space comparison \ref{tab:comp-sign-space}.
For \gls{CSBS} many calculations are performed twice, therefore also two values are submitted.
Table \ref{tab:comp-band-withd} compares the bandwidth used in a withdrawal.
The 32 byte values $2 * n_w, 2 * D_p, R_0, R_1, s,W_p, c_0, c_1, \sigma_W$ as well as an integer $b$ are transmitted for \gls{CSBS}.\\
@@ -222,14 +222,14 @@ Depending on the hash size another 32 byte (or 64 byte) value is transmitted.
\setupBfhTabular
\begin{tabular}{lccr}
\rowcolor{BFH-tablehead}
- \textbf{Signature Scheme} & \textbf{Bandwith used} & \textbf{Factor} & \textbf{1M coins}\\\hline
+ \textbf{Signature Scheme} & \textbf{Bandwidth used} & \textbf{Factor} & \textbf{1M coins}\\\hline
CS 256 bits & 356 bytes & 1x & 324 MB\\\hline
RSA 1024 bit & 448 bytes & 1.3x & 448 MB \\\hline
RSA 2048 bit & 832 bytes & 2.5x & 832 MB\\\hline
RSA 3072 bit & 1216 bytes & 3.75x & 1216 MB\\\hline
RSA 4096 bit & 1600 bytes & 4.9x & 1600 MB\\\hline
\end{tabular}
- \caption{Bandwith comparison withdrawal}
+ \caption{Bandwidth comparison withdrawal}
\label{tab:comp-band-withd}
\end{table}
diff --git a/doc/cs/content/6_conclusion.tex b/doc/cs/content/6_conclusion.tex
index c270e765..8ee12fa5 100644
--- a/doc/cs/content/6_conclusion.tex
+++ b/doc/cs/content/6_conclusion.tex
@@ -25,8 +25,8 @@ The thesis provides several results to add support for Schnorr's blind signature
\end{itemize}
\item Comparison and Analysis
\begin{itemize}
- \item Performance (speed, space, latency \& bandwith)
- \item Security
+ \item Performance (speed, space, latency \& bandwidth)
+ \item Security
\item Scheme Comparison
\end{itemize}
\item Fixing a minor security issue in Taler's current protocols
@@ -47,7 +47,7 @@ This section provides an outlook on what can be done in future work.
\item Evaluating \& implementing \gls{CSBS} on other curves
\end{itemize}
-There are some remaining protocols to implement, which were out of scope for this thesis.
+There are some remaining protocols to implement, which were out of scope for this thesis.
To run \gls{CSBS} in production, these protocols have to be implemented too.
Further, the merchant needs to support \gls{CSBS} too.
The merchant implementation can be done fast, as the merchant only verifies denomination signatures in most cases. \\
@@ -58,7 +58,7 @@ A security audit should always be made when implementing big changes like these.
As mentioned in the scope section, the optional goal to find and implement a good solution for the withdraw loophole was dropped.
This was due to the scope shift and because the analysis of the problem showed that finding a good solution needs more research and is a whole project in itself (see \ref{sec:scope} for more information).\\
Furthermore, \gls{CSBS} could be implemented on other curves.
-For example Curve448 \cite{cryptoeprint:2015:625} could be used, as it provides 224 bits of security, wheras \gls{25519} \cite{bern:curve25519} provides about 128 bits of security.
+For example Curve448 \cite{cryptoeprint:2015:625} could be used, as it provides 224 bits of security, whereas \gls{25519} \cite{bern:curve25519} provides about 128 bits of security.
Curve secp256k1 could further improve \gls{CSBS} performance.
While providing support for Curve448 should not be problematic, a potential implementation for secp256k1 needs further analysis (see \cite{bernlange:safecurves} and \cite{bip:schnorr-bitc} for more information).
@@ -67,4 +67,4 @@ This thesis includes understanding, analyzing, integrating and implementing a re
Furthermore, the implementation is done in Taler, an intuitive and modern solution for a social responsible payment system with high ethical standards.
Although there was a lot of work, we enjoyed working on such a modern and very interesting topic.
Especially the first successful signature verification and the signature scheme performance benchmarks motivated us to push the implementation and integration into Taler forward.\\
-We are happy to provide an implementation of a modern scheme and making it available as free software. \ No newline at end of file
+We are happy to provide an implementation of a modern scheme and making it available as free software.
diff --git a/doc/prebuilt b/doc/prebuilt
-Subproject 74d9c44ebc257a3d8b9c2c0a806508bd0cc5269
+Subproject b988d98d4856758484eb23c27bfdc9e602d4235
diff --git a/src/Makefile.am b/src/Makefile.am
index 5d46850c..05c0b742 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,7 @@ SUBDIRS = \
mhd \
bank-lib \
exchangedb \
+ kyclogic \
exchange \
auditordb \
auditor \
diff --git a/src/auditor/.gitignore b/src/auditor/.gitignore
index 6d25d8ba..59088a1b 100644
--- a/src/auditor/.gitignore
+++ b/src/auditor/.gitignore
@@ -19,3 +19,7 @@ generate-auditor-basedb-revocation.conf
revocation-tmp-*
auditor-basedb.wdb
taler-auditor-sync
+auditor-basedb.sqlite3
+taler-auditor-test.sqlite3
+libeufin-nexus.pid
+libeufin-sandbox.pid
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index 6d49da6d..a74e0ad2 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -210,8 +210,10 @@ EXTRA_DIST = \
auditor-basedb.age \
auditor-basedb.conf \
auditor-basedb.sql \
+ auditor-basedb-libeufin.sql \
auditor-basedb.mpub \
revoke-basedb.age \
revoke-basedb.conf \
revoke-basedb.sql \
+ revoke-basedb-libeufin.sql \
revoke-basedb.mpub
diff --git a/src/auditor/auditor-basedb-libeufin.sql b/src/auditor/auditor-basedb-libeufin.sql
new file mode 100644
index 00000000..2392e6e4
--- /dev/null
+++ b/src/auditor/auditor-basedb-libeufin.sql
@@ -0,0 +1,138 @@
+PRAGMA foreign_keys=OFF;
+BEGIN TRANSACTION;
+CREATE TABLE DemobankConfigs (id INTEGER PRIMARY KEY AUTOINCREMENT, currency TEXT NOT NULL, allowRegistrations BOOLEAN NOT NULL, withSignupBonus BOOLEAN NOT NULL, bankDebtLimit INT NOT NULL, usersDebtLimit INT NOT NULL, hostname TEXT NOT NULL, suggestedExchangeBaseUrl TEXT NULL, suggestedExchangePayto TEXT NULL, uiTitle TEXT NOT NULL);
+INSERT INTO DemobankConfigs VALUES(1,'TESTKUDOS',1,0,1000000,1000,'default','http://localhost:8081/','payto://iban/SANDBOXX/DE514871?receiver-name=Exchange+Company','Demo Bank');
+CREATE TABLE EbicsSubscriberPublicKeys (id INTEGER PRIMARY KEY AUTOINCREMENT, rsaPublicKey BLOB NOT NULL, "state" INT NOT NULL);
+INSERT INTO EbicsSubscriberPublicKeys VALUES(1,X'30820122300d06092a864886f70d01010105000382010f003082010a0282010100a03098ff00d2f1d4f9ef23e8c29e687c9d206404605896c548793a0fd6ad563bcd256524b3ca2816c1df50252b3a413c8ee1781cfcaf06cfea4adc64b4a895768b2ef25fe38011364e5b8198a4aa0a517a64bf01a798ddb1200439990e13e4cb3c82d79b8ece3f725e0d81053d5a31befdeb6e2841dc0a5404aaf31d7b9ce5398d97f362a531d2a4b199669072bed882bd10fb354b45416544d975a5cbde40c000ebcac8a6038ba921a46a69e3b9dc87c7ae8e5a4805b45f08e25b6e76f746ed82a86f5ae10ac5b4107722119e67db808508c73643b95b1855e45cfa9095ee7b07ffdd86486611eef5d581235fe5008a7e079f0897aa7103969926a9e76f239f0203010001',1);
+INSERT INTO EbicsSubscriberPublicKeys VALUES(2,X'30820122300d06092a864886f70d01010105000382010f003082010a028201010080f109291d50ac1d186bc40584f8a2115d736d7ad311bd4f62a0f83e6bd49b847a6d8875d5f9e1bf4055cabefd619fee55cf21723799d2415018ac98275716c67ec6fb51f88fa4ca09c1bd710f16c7c2a09c4d5bac2666bede0325655a409d4a08cee6221be791984c65985d434bb2ca10603c84237633ba5d32c4220d2f0ef7c25b94c18edbe30a55da170531b3b1edfac012dea78696981a3967e9dfae10006dc0f8ce1f8af3c6e99ba57e1c30118ca90b43aea96a49df16169163b21274a6ce568e306b15da4b95720ab58ebdd2bb618cc5330b5c969b4ab57cee55e1413012d305ce8c1a16aa938e5940d5daca716408f8a0ff0c2da516baed034cbbfde10203010001',1);
+INSERT INTO EbicsSubscriberPublicKeys VALUES(3,X'30820122300d06092a864886f70d01010105000382010f003082010a0282010100b0ceebf64877cd9a8f331caa9c24ea334e4afc1b9744aff9ea02b14d973f86018e00955e8e9e109fd6b55021e15adff4f224cf0c0736ed203fbf914dda8555f66ddb921bf2560637f6b3457a46bc2b83bea579fdc0e8254de0320bf6686c2571581e38ee204b7c366ee3299b683251596548d8944f8110613ddf2004770722c76f8ff1000c76dca6560d7725e9fe5fa6bb053db0bd567fe0831966fe2f5020aecc35d40154bd91275e0ca72c83b67b26b7dd597e3bf0ed83434ec87d107ad2fbdc4a0df2ecf974b5f0446d517a8bfce43e855b848f212d99ffa7c7590d7d8dfc93657b3ade490696f1e55bb8681009dd4403e13f9abe1dce30f24895fa7e0c990203010001',1);
+CREATE TABLE BankAccountTransactions (id INTEGER PRIMARY KEY AUTOINCREMENT, creditorIban TEXT NOT NULL, creditorBic TEXT NULL, creditorName TEXT NOT NULL, debtorIban TEXT NOT NULL, debtorBic TEXT NULL, debtorName TEXT NOT NULL, subject TEXT NOT NULL, amount TEXT NOT NULL, currency TEXT NOT NULL, "date" BIGINT NOT NULL, accountServicerReference TEXT NOT NULL, pmtInfId TEXT NULL, direction TEXT NOT NULL, account INT NOT NULL, demobank BIGINT NOT NULL, CONSTRAINT fk_BankAccountTransactions_account_id FOREIGN KEY (account) REFERENCES BankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_BankAccountTransactions_demobank_id FOREIGN KEY (demobank) REFERENCES DemobankConfigs(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO BankAccountTransactions VALUES(1,'DE514871','SANDBOXX','Exchange Company','DE729925','SANDBOXX','Name unknown','HTW6DPCWEB0QCYAZ7ZTD89N17AMYR7BCRY06R727YNNJ47Q4GTHG','10','TESTKUDOS',1660496839825,'LWA21AG2',NULL,'CRDT',4,1);
+INSERT INTO BankAccountTransactions VALUES(2,'DE514871','SANDBOXX','Exchange Company','DE729925','SANDBOXX','Name unknown','HTW6DPCWEB0QCYAZ7ZTD89N17AMYR7BCRY06R727YNNJ47Q4GTHG','10','TESTKUDOS',1660496839825,'LWA21AG2',NULL,'DBIT',9,1);
+INSERT INTO BankAccountTransactions VALUES(3,'DE514871','SANDBOXX','Exchange Company','DE729731','SANDBOXX','Name unknown','K2V2B3YEMZFMWQ475KNV2HT7RSPA1YXFY210749MN9WBDCBT94AG','18','TESTKUDOS',1660496846987,'DLBB92WX',NULL,'CRDT',4,1);
+INSERT INTO BankAccountTransactions VALUES(4,'DE514871','SANDBOXX','Exchange Company','DE729731','SANDBOXX','Name unknown','K2V2B3YEMZFMWQ475KNV2HT7RSPA1YXFY210749MN9WBDCBT94AG','18','TESTKUDOS',1660496846987,'DLBB92WX',NULL,'DBIT',10,1);
+CREATE TABLE BankAccounts (id INTEGER PRIMARY KEY AUTOINCREMENT, iban TEXT NOT NULL, bic TEXT DEFAULT 'SANDBOXX' NOT NULL, label TEXT NOT NULL, owner TEXT NOT NULL, isPublic BOOLEAN DEFAULT 0 NOT NULL, demoBank BIGINT NOT NULL, lastTransaction BIGINT NULL, CONSTRAINT fk_BankAccounts_demoBank_id FOREIGN KEY (demoBank) REFERENCES DemobankConfigs(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_BankAccounts_lastTransaction_id FOREIGN KEY (lastTransaction) REFERENCES BankAccountTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO BankAccounts VALUES(1,'DE123633','SANDBOXX','bank','bank',0,1,NULL);
+INSERT INTO BankAccounts VALUES(2,'DE402450','SANDBOXX','fortytwo','fortytwo',0,1,NULL);
+INSERT INTO BankAccounts VALUES(3,'DE320557','SANDBOXX','fortythree','fortythree',0,1,NULL);
+INSERT INTO BankAccounts VALUES(4,'DE514871','SANDBOXX','exchange','exchange',0,1,3);
+INSERT INTO BankAccounts VALUES(5,'DE784482','SANDBOXX','tor','tor',0,1,NULL);
+INSERT INTO BankAccounts VALUES(6,'DE822276','SANDBOXX','gnunet','gnunet',0,1,NULL);
+INSERT INTO BankAccounts VALUES(7,'DE652970','SANDBOXX','tutorial','tutorial',0,1,NULL);
+INSERT INTO BankAccounts VALUES(8,'DE064323','SANDBOXX','survey','survey',0,1,NULL);
+INSERT INTO BankAccounts VALUES(9,'DE729925','SANDBOXX','testuser-hwi9z7th','testuser-hwi9z7th',0,1,2);
+INSERT INTO BankAccounts VALUES(10,'DE729731','SANDBOXX','testuser-7wwue25w','testuser-7wwue25w',0,1,4);
+CREATE TABLE EbicsSubscribers (id INTEGER PRIMARY KEY AUTOINCREMENT, userID TEXT NOT NULL, partnerID TEXT NOT NULL, systemID TEXT NULL, hostID TEXT NOT NULL, signatureKey INT NULL, encryptionKey INT NULL, authorizationKey INT NULL, nextOrderID INT NOT NULL, "state" INT NOT NULL, bankAccount INT NULL, CONSTRAINT fk_EbicsSubscribers_signatureKey_id FOREIGN KEY (signatureKey) REFERENCES EbicsSubscriberPublicKeys(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_EbicsSubscribers_encryptionKey_id FOREIGN KEY (encryptionKey) REFERENCES EbicsSubscriberPublicKeys(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_EbicsSubscribers_authorizationKey_id FOREIGN KEY (authorizationKey) REFERENCES EbicsSubscriberPublicKeys(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_EbicsSubscribers_bankAccount_id FOREIGN KEY (bankAccount) REFERENCES BankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO EbicsSubscribers VALUES(1,'exchangeebics','talerpartner',NULL,'talerebics',1,3,2,1,3,4);
+CREATE TABLE EbicsHosts (id INTEGER PRIMARY KEY AUTOINCREMENT, hostID TEXT NOT NULL, ebicsVersion TEXT NOT NULL, signaturePrivateKey BLOB NOT NULL, encryptionPrivateKey BLOB NOT NULL, authenticationPrivateKey BLOB NOT NULL);
+INSERT INTO EbicsHosts VALUES(1,'talerebics','2.5',X'308204be020100300d06092a864886f70d0101010500048204a8308204a40201000282010100845de39a06645e17048233a6b50ff54823e026751ab484cf07a946b6088c8a73daa9b8b8277644079fe629b65d453ad4edb4794b7b56ee544bb0aae275859f77d9efe33facd83c1b14f86e32d7435207b4065b48e7d5d3483d92dc7c62fb2ba454062b532e745a9d2c7d2b417557754fd008cb011dc0f3612a8b1f4cc2f182e7c185cba1d76b86cab98125c6c15c18cd320da84e40b9ab01802b3a0ec63dac7f442c16aec2e0f33ccc8323391f9a48d84aaf1003c6584e406d8aeb48abc07e96c40d9f4242494324bd203330bface36777358d4921c4c2e33d42ea396d1dc3151756949d863722156b0fe7dd81b255ee007b901b964c0284ac9cb163d2fbc5c10203010001028201002d78574444e7db8e8aa4f37b53fd8c63e0b7125eedf28f20d35fea0384424b196b471c465e7ff8f4a990164a28162d14922789f74d025ad2a841a32231fed9fe00e6b028e28651777827b32b51d93567a20700fab57135a83e46a1e934d3557598cb99bc745bd1f8e61c856c7213be1fd1b6038e799b1bc0082e4c6d411657c224b9506fe4d1f9faf2ea2033fb9e3ee40b00760d26736a4d16a2cc6b4b1f712986b297948a035389d2f38c55a970280b8761fa45f20901d962f4a9c700cdb0184c410ce3d16dc14ad1a032848005c80771bde19d91e50b72d114e425c3df7e2aa7ee4196ebb065384795c8b4083f86256d9173b7572429212eb9134820a90bc102818100ec7e1e2f558008cf3b72a23fa7ce8da27063218de040802332d6b42fcde3b01975bf8ecd6592fbfac7b026cd698333a3948c881028304d245480ffb70186f94d6b0f54e6dc3037e09fb457d172910dfbc80cf9358d22f976bcb76cfc88856abea327bd522d2cd39a9767a8ea13d9b407e86dbbb3707d51a92c418ccc56a6db79028181008f4900d763d26019866414ae122b9ed02cb8660d63697a5ec07fc17195958e732861569e677015a6c31df9d3629ad5e50465abab6266af0a0dcdadb6a3336772d93bdd292b2782e84b1969fe4f5e4f25983de8209846702097e1c575d6f82e6052ac4b2a3866bb97190b2927856993a3cd95d94f67d2aaeddb2fb1891a0c62890281810094861460f7da842dda110172e6e9a32bfc5755b06bc1367864aa50d9a0fdb91014522cd6344f9e6efe5053de37c0cd82937dbaca22e34adf612eeeea394c526fdba7f25356bff5a7ddc4fe4e2d1c8a62b15dec79445d4dbcd38283310a7077fca82d020a85129d067ec5fc609dfce0c302a73ff5ced4f59f408b1e690a969a490281805ba9f255d8d04f16453965596eda6500fc7b031e71889af65ee3dc171400d75ea8688d074d591120dc16232aae1c2bd615180dd8d85ca482240e7ea1268ace15550fcd0e774311a615d52e4fb8eab66b7097ba1690140fcb6a1ecf39f1ca57b0db72c9ab3ae5ce007dcefc07027c662d166a54d94dac2219846d60803b1fcd3102818100da7322ec1e0b9f19aa9ca60f70f660559ddfe1fc34130b342e3de89cd73e682985c49d0c9ba8fb36d07d885f25e7a3316614b7438e036d66890d194dafeec9a1395dac762f874cc5a4cf21e267a1219968192a0837d29e6ae4f6c2f3bf38649e7879b23239bfca1051047fbcfcc0f271d8e9d36e785461f4ff0f0ae00476f6e1',X'308204be020100300d06092a864886f70d0101010500048204a8308204a40201000282010100a07146544ea9da3cad747f447799c166c54df89d908f65dbc5c9c509ce92427aa31a1f386d59adb8bbcc0e6272cc628c0b53e67efc853d93855bd058f1bc659e8c9cd67f52bb13b3008bc677763c9278ce6b1c76972e8ce2d3eecf0b408aa8fdc0615b680ba491f91ae9349072dbfa969cb007846e4282daebb0cbc9283cb6b4746a9da6824de3a09b486182d689cac024b6b5749f6d77b660f3aaa708c83a7534bc55e33298c0a59efa02db44438c4fa573f85921fa80e2e9bad798b3cbf8f965672d6a16219059e6bf6bfc78a7a6fb634922a7739aaf0a336466ddde78952639e54a0565ac71dee8d4fbef9a62be4c1ffe70df8da4e1b979bcc717d0826b010203010001028201002433eb2eb2e158c140527d3531d79bf058ad13605a724105aa47b112596e5f59d4dbdc179b7514e20e5e2910c5dea08e0130595e66149aa462ff28b0293bdda23d1056c63c20c27d2dae5c863043d2b937baab9d86d7962ac8afa6405fbbea0df80effd5266b6814d1a1b59eb28c38ab2b87fcea4106f907f50edbacf44b5ede55b8a306b7902fc0172b71924a4fd85cebf964b968be5bb1f773b633d71ecbae20fbbd239685fe1c041248f2faf2e09fbfa62ca3046ce29c7e39b246d512e0cf5d5980a8b8ca44518e1dfcdb3228bc6bf196f66ff978f110cb9940a7e0a9bad133f6873bf2f21f2906dde4c5bbb345ce3bd2253b7548d26ce41b086b3b3c5a5102818100cfeed83df59b45c8543d6b9df34b375bf8d253bd7d652dd607aa966327b59ba41aa47be8d377912360f1243ad9a34b6a08dc507e7bb3354ba9bb6eb0a4d2ddacd6a634d5120c934ec4f1b6c7ec53a72ec51d9dfae1ea27c250352415a9ae61a1e4f4b0261bea71af07bec0cc03f35a52c090e1233267fe04b2e5180ab66db7d302818100c58803bd89bd39168c3a1a90690f06f2cf9e042f8671300acf98c07c6e02b6f7a8fbb37d4049c09cb9bc796ff2508f3cb7b40a93cb0ca94182812ab70b46016e850b5fff01661ff23b16048a38c00be7cbe40e7d9f50a622584ff0b4eee4bb2fdfa49565cb47ad50aa9c04ed27123abf3f6e18e20d3189cbcaa6fec858e4c15b0281804e8de645ea1ee20b1fc0208308a216e4f928c49826e26da1993dda18d5aca78324c995424d79b36c513868be8ef041126b0c88a0702d30ea47d256ac0768de7468975c084f0c4f2e87fae559bc2f924e7a0b895e79b0d39a7660cd241df9924aee4b7eacb709282fbed652d200801454850976f4ac1b5b7cfcf4cdd3663e271f0281810096c708dbdfccc14bd5c3f04cf4f49480393c4bc39f22bce233ae4c976e3dc23def0e19e6ec709f86c23bfc9217eba83a579b254bc4fd28212a25c05e324bc082052a369f6708f62fa72c5a50cb9ac43bae25a96df872ce2d7f2d9df5ee38482df5cf227eae194b513cb995051502d436f18aef917532b0150fde42b2d92fdbeb028181008e6ed60bdeb541f51aad5c8d529230bfc5f235cf92a84c11061dad6278779b853fa883dc0d67527b01ec7875d43a7b8e363cb4e4bb1f7468d072daaae3236c26dc9c5f4d0bb96f11afa8dc74610ffedc41bd21e1edc4ff7aac2af9a4c0c31025c99cd39ee24433299b0e125ce89290b3f1dbaf77e768339ab36f46a92d56d444',X'308204bb020100300d06092a864886f70d0101010500048204a5308204a102010002820101009db344205a0a1da5925bce9ac63141e3df90bf37f9b48472d3ba9095ae5c471f6a4f3f2c662a2f76fb82e1c1c6f47c85db29df664cf629fb7c028b65a20b9632abda20a15fc1480cc40c0d35f252197b80cf3592f90891791fa9a9fd385043319f5bd904d4e14b4a3e1d4a21fa74e0f3b6a8d45a8016677a22dec34ae9c8659bfbfa65e04a30c4337699044f340995a6e6bc2003f1126e2c8cb1274bde543753cf7cc0fd643b4c3f9fa13e609b0ea0b6bda537209b1555eda704c98109aaaf4c9696b7ac5daefa8521ce5465bf791fab73012c053c9e3b11583cb7a3035f6c222a56e750425a7fca673e88fe893c53cfb907420e243a95fb858f84a4b8247d2102030100010281ff494e0b5cfe7db54a41be6b4b86d55ecb8e20bac24a509f40c12af80a9c02490d515d85001e7d7d92d157059a0de19800a0dfd5f8b7cdb5b630eefddd4076225b6b86f9a409dece9f208279a19a028fd5d90a78dcd8e622b92afeb30602274d14c3feede2511268ed19f2838347e90ca83d403d75d414960530305c977614b126148fddcd0b0f5cdc471282f1af91307761d8f86dfb3dcb185715defd02a031aa9cacb62cb7c59a3062afd289b85c9277dffb4b57bcba9a64900e463e0a9a6d40e4ef39d2a6a93c0b0e8d5414c3487fc6a4ae3a71f6cf7d21d75f85b2ac0463672ff9fbc07121fa17f941dfca46fc448d2c493ba5d8d9890a10ab4064cc459d02818100e5333484c6fb68268e3e57f96917deec4960e88dd5b2c5608eb0bba99aa98b84948754ba0d004d09eda6fb2d7b840d01bf3b4e9a882686b9ece61600e9b2ef88be0a751950f026d5883420a9dc6cef4e9d9698cf257122615a73e09ed152aa86357ce1f9bd2e587d569d05359e3d562b8b4958f530a518cd50e575f7b0f13e7f02818100b023cfc51e65f71cbd793e95e7f648f151631024766f33e7abdd8bbe7c6dff147ce9f86b4a7016f52f04925012d98b77cbf78704ee3511a115a8bb76d728388b38f34318b159f6be082ff622f37956f5444cbbd0913f7bc4cb37ec60482ce546d19d6b0828eab6f2d17d454bd1a9eb46b9ec5d68603a503e1fc77e6814d3b45f028180287bfaf2d912df3ab03562e4b3237c44d05145c287d4a3f8823bc56a17df8abd485eff203ddba7bff132657b8b2daffe7700cac990f2fd292a271a0bdf3bb403bb4dad91633288297f7d75a78b3fd2a55840998d3d57d672cbbf5c15b173a09b442762e2f1ff95b1cdf2be50d23a9355edac6f02202d894bfad60d184b30d191028181009ab359506f9a6ea73762bdad3bc5fbdab6f8a2bce3a857962a44b2efe2a95957cd3e51892a1fb88a2f797c6807a639f0459c6961d33598fe39dfb0867802436743e5a41093f3c7daafa630301257882072945280a491754b2a913b7274f1b98db19ce8dc89d35c4b77e2e671e8fbac40ba1af70f2d350a35060458e961216f510281805f354bc62c72a82628b2d91c56118edd8c0cad1dfec5432c0c599efc58245b527992a702fd0513e85dd81562efd5d78234ff4c56ef3a4cf28872e81aad86ee11b7925838f895a8afb426881ec4408637b2d6b4d6111dd8d4a065c2ae5e1cab59b23c493e107ab049ea5005117a9f149bfccb40de5c50f66968283cbd07533c04');
+CREATE TABLE EbicsDownloadTransactions (transactionID TEXT NOT NULL, orderType TEXT NOT NULL, host INT NOT NULL, subscriber INT NOT NULL, encodedResponse TEXT NOT NULL, transactionKeyEnc BLOB NOT NULL, numSegments INT NOT NULL, segmentSize INT NOT NULL, receiptReceived BOOLEAN NOT NULL, CONSTRAINT fk_EbicsDownloadTransactions_host_id FOREIGN KEY (host) REFERENCES EbicsHosts(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_EbicsDownloadTransactions_subscriber_id FOREIGN KEY (subscriber) REFERENCES EbicsSubscribers(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO EbicsDownloadTransactions VALUES('703DEA54DE1B8CE45A4AF81A27593992','HTD',1,1,'C6aVtscKHFxbLQsXpeMmREJ0z2Gg/S2cgtXdpou4yyRQiU6S4Pe9GDuS5qb0agkOAW9lvoB5KLwtwQB6jwWVaMr2x/goq6YCr5Qr/BKqR2ifzQ9svO+jicj6uy9yx6hPghoSdg2DiYJ/tDYvnym8r4NbxoswduZM7iD22jTz8AdbLOVIxyzIEXq80PF3pUqTzaiPMWbwfcJQPBeAg5k7NR77qND+egOkz6spSFASLssms+UfAC+XLdEkhNHeTsTIg+6q0ncnyKX2nhhLoFHYtslaZxb4koHiqyEJ1NOyUa1AUA0oW1wF5Nf+qnHwZUMWztZzVIRDfMC8moBmXT//TR+XVa+GWRKFeGyHi+NiXu0se4J+kw5B9RoNoDhB1e2nkvm7FQC3pSFZC1zkW4aLdHxMQI4IOhT+kVAN7yM3fMRLx+2BQP2N6eu9E1nSL5R9Lt+oNQV+Gxw49vwm6DHWsvlbJf2KohRhiiD8sF8p15GanLgqVdFWZUu+6ub0mE9TcgEBFVLna/EOv2CK2CmJryC54IUl2CCyM2X/MDgGladrf23njBX51xosrb1B8czghQYKqCRgYrkEjuKGt4hOG5O1IFDd7jZ8XnKBqSTRo8O/15OAcvhjQ1kc6h05mBLW7Fz9pLMI7InuXNkRIZDUj/mcJjihe+ZwAgF7+r70uWceIo28YUJzf+AcOXBGocyzGWzU289mdRFW02qjcmk27A==',X'4768f088251391c76108c17a6562e87db0549ee871847f4de9d1b6e29de5885113304f4f5c80d9a3294f384cfe696fa69ce38b2808c8a9127c2e210d7d456ec54083f23d284c4cdba79f63e99daddf470e994749c4ae183d789e74b83098631b053509ebc4aea8c5f524ddf2b2c37f8d657238b521b7d00a2faea02a17c9e1d768037f8ffb56f357cad1bdd615f7cf4fe60b91f9ee989c7a5f2a8c035a05f7087abaaaeee00682c28a7889e88333876f9d09545c8a3477d1d61883f5a4d52a5757dac9a87974f30838e07171f4634ef56bbeba53648288cbe811f8c098bc16c53473a343883b7d57d5f991d225e9fabc30c558d5cd76e6a8960f1bdcffb5a884',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('AA3A4C88BE37BE34E82AFE98D632602D','C52',1,1,'TuExSqrFjw+Gjnc89Pwm77gmleWSuAF7Q5i/8ioJpOvb/s3NS0ovMAoPn877ozkejOnGOgISjhbSvw8fSIEE6DR+q6gelQmz2svvdQOah3R/xhwCQtbzkAxl657QVHRNHgkCCqHXXT3AGzOZhKgYimxGcGiNJbp1XTtzmlKKlbgi1GQqO9CFClFYcpisVPMr0Go1AbLr0UG/QNJ+S+fsvy6x/gCaJ1HPhM+DovJHSqTbZk6WenMU1X/+3CE9XGrZKZvfxoPrFGYlwFMQv68C2zZnm/5r01yud1Wv9FYrHaZY32mFhfbpurFldsALS78yZnvZ7dON/7tSKovfxLYK47tsnztzkr7lWUSFiTcwPlJo5uSjEZIob3VFcvcs5vGwdYMdp6ibEJ+sTRm7gauUdJ7jI9JjD9oQA1KjM/TJw66Nb2v770t0P4GECicjCpSmxYFaSi/wceNa26k4sk+LjIScKdLkJsxJNDZhd3gfZkQ75kMyiQmmbOJAbw2YCnOMNPzu4zCEb8y7HdPi2/BxiYzrev/hJ+EOYBB4ck+GXj6FAF92HZ119fQlKDs5mtIH7lQ71qA53TSLBYFQCYyrfwkRUVI9KgzpARM7EkvFvPOaM6VPYMT8TT+UNLPsbT/bqoUyxzUV7J2cNxu0lkTd/1OY+VQUrtUJEEKl4DRNGWTU3B4lZPsceN6Dx1SiLfnEWe4q1kzyEw6lJfRTHGJz+w3PsmNZXImfp9anXqCfk8T5iEvcb88p9s0KW14wRSC8T1OGegRf8JzQZKU6sWlC6w60hYHHPwbjViVMd4M/++/CKq7dprJDmFkbr4XIU7/IqD5fZuYsV9U076dEyeKBNubPbfEeV1ueKBDy7CnGh1g=',X'15e037c1eafd1f9e2e8a775e004818341a16b462e71add887c2dd1f51593bf3c917893b16ad94436a3d3fcb15e32de51c8b25ee304fd28f64584d9025ab8cfe908bca00e551391d34b73806e21f2285e4e37fcd2af5ca685b747dc08d694b65820c3c61dbf47f00f60e94b0324807b7ea499f65f4ba8ba59e0c5440a8cd6412d67afc628a6765ebe46667db3499aa24139caf70c864b4325e5c19a5c6fad01e312487edc0359760126a161c9a94645d28d6cfd594a595d68131ed18e675b8954d1a5b2a7d939afb0ca07d84eedc9dd980406c33ae04d7cbbc28ca617989a58da0495bfa7fe2453e2493a00adf3affc78b096ce5f641a51791e526a7ec42fab8d',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('A2711F2886318EF5E1AA0CC88F04AB8C','C52',1,1,'36V7B89SVXgMESVQKpDQRIIydmgjL8nwKTd6zi5C78uY6iFZe2y6J4QiNZVfju+bEozSakKjpxPhSYgbO+/qeOqHBGgd0xOwM662VA+Seue+QDncPqMtpruei/KQmpSBI2FPYih2UUTgeHtTLAvJ4zj8m5x4U3M+uQ1LDn3RxbghANvYB+t0ZbAidM2Ww1xsGNpneDp1K3VW0wM2qkxJZOcl/IWG8E+y2EA+Z3VTVpqj6i1f0IDmydsBe+bJJIW8SHN9aE0aQBbRpKN/kLGaHa1oYGapgu/1vbul3Np37h0QnfVWlBeNGzTrfUnZSeKqX1OquD+g8HdRRc4b2dP9kn5dQXnyIXPJ1xPm6DG1KQQfTKcvTQGOzQbqabS70kePvcqGnxG0r2Oszl9tUL/QRkNBRPXsZLiE5LV7R9XH/5rn3cYKdE1dR0G8ZZonfoToDKiOIKBxqwafs77KnAu3YtqGXIYmHEeMY/4KaGIS6nRFmow+Hc8D2H4XrGBnbkfI32h8Zw9zseClE548OvM5plxkqwPE1BMVTGmKgTkk14hYEH6a/aA3sHhD6tzZuv/DKZWiy05Fka6Zc/Mng11SAotq9HR4M+AchF25MLOqyMEcGeIMlsFx7bVwlRWQ6XppFBeutKYhh5Ae/66MjB14T8bjaM+BiPxtuQ1gKfG3ekOcIA+ztEFycGXN0OFu57UXv2ITPyH4WjcyPixk64+u/+F1KJJXOQ7AVlHhZ6Rdpti/NaMwfhox8tV3hL7zEY70r88cSecTcwJ1qv6f9bajZOhhdqFaBGZtPGKBXHEr7RHvn2SCeQugMKaGzGwP7gHmTs7/OgcYsRclbtuA4KiaYo/YyyKmYflFIxd7y4VFDaA=',X'abd6417b1fac7b7d4423936831fc3f2b4ca0881e48e96ba1490dda1696339c62785be785e07d6fcf4b77b945bbd2ed06611a2a63f4f66beb2a80cc048f894949df8e5ca75a875e845710b2a7ee6289ffac867a8ee573882fc9a5776e56094156f84e1280cfd75ae31b89b0bfdd85cedd3f975e4dcaa2327b4de1fb82cda2d5de87fad03becabe14362b5241bcb765fa3d9ebf815d552547f118c6d1ff200082fd33403fd22a4ed40b0405f6389a2207966b5368d0153c2e1062c20bfa7620fd13af4bad91fae8d21597eeedd75e4baf131d8b88b101ce414fe4c5324b4f8259bbc0719fbd32ccdb5537b140ac89c874fd76ee262fae3dfbb7f318077e730f3c8',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('2F3BF32E9591B4DDABB5BB92B45B8C61','C52',1,1,'MJewVec3qTYR7WqN10EaoiplDJyE3bqPbcWx7e8hWmNTTqYmxAukHoaV5X1msZBCSKJv15zbhoIqlr8NVANcnTUm6obYLvZLZpP6tfDoVdhVwYelalh4GRRm/GfJ69346HKyJxOjYE12Amij0TNPZjOzmfQRhyODSqyHpLBwmNvcCt4wR8w4jFc1WPXOlJkdo/IDVGOrrTSHLOKYpwaegbaxp3IQ7qmnkcxtrUUjv12Deij6YnNab8Oru2vJHmQ68iVZeCDUtsQeQQuGdwhk+V+w1lr5mxEPDV8PU4ayfP7l9yXB4eiTek9HFtZC6t4MoWDfQZgEEBaL4U68OUH5bUsw2++8GP6uuTeE7wBj/VrHtkjdYFchI7+6edG5JIDkfQQuI4dgA6B08skk0Ovt7PFda3CK+h8PxWMh/kEwhB2tuBzoM8zcqzPliHUk7qLFQuDHwjrJAfnCUnyj/5oSihIdDt48WqXA5wrihPhvQJEJH77blDeXrgf0U/NVmjNlEFteEF5TvFG76eb83UNBzRk1xKMfbrwiewN7Xk+CFRQr3uqfPjPeo+qAYm5sfTTKa9y8OCeD7iIu2402OAb5hCuQflcSJQdlBVycAGl7DI/DeT8HtDCLpi7b7gbaZ8jD5eVmDiHUDxBFEUt0Cse0LdUVQGEgJnssNgPi0I8wQZb0KNSCXe7SeBiwnCc7l4OsgWROixmC1iEZNnpANLGl9V8PhDKrj490nXgWxvj69m1sfnh5VLIBNj6i2FrqOlcqwyHLJojXfrDTPBUr5k01X9FRYOY79wBsXHRS15zT+EJPj5Uskh0RqHr+KAH6SWNRw1UyOpDnpgHvJW6WUX1BEYEMVNMIvwoV34it3AGQeB8=',X'698348567dd0a168fa8a14ee072592913870c82df8b8c343292085cadf6e2c2f6941f65398ff218032ea8fe985f2839e4d8fc16f890e73b2d399b40233eaaaad9c1bf7caf54c5fde4deda0409a0bebc79117eb2baea0e69283d64fe7b04acaedb67043b451e32b852815181feed0051c40103c6b4c04ac9eb2f9abc2407f90b830965ee3d9d981962af90987db2d6cdc44b3adf53ace2022936344f68d38877ca7e0f50893f2cd3719091ec25e2630a3aa12cf64e90ad66b17e860d136bc82ba7883925e161c98fe2f85d4a0084b99f5989267cb638ae774166ee320459a95e9d9ce8685ea8d78637dc73ce6d11476464b687760707358a28b3b6e50e1a0d4aa',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('F049F3593A00B8FEB22457BDB6B40777','C52',1,1,'iSdT+peifVwyL2cbUHqzKsjlOgnaj1X5/6v+wNO9rSKOAwSVBK0C6YECE8Ux7PUkW/Vd/kuhQxn39wAhqtbohvEuTJbRt6pAUG+qaHuXy3NTOnD/3GNywyqNZfkuxhPNKK9LdSDp53wFrySZqjNpS2idprrYYGdFfVsYYbSt/lB2dPgRqOTV7atMwkIoAL7DG8f2CH/OXptC0eex+UzeRwMGPfRuD2g+qjhmsa23YlgBZ7ggMHgypGSR0hJp7KgaNYrBQPj0p8/cpZ6yKqvcYHpOcE9u8OoibpymrDhy+hRCKcnp5z16vgaUCyCyOqQL1dQxkF2leEgXYbK464GNoQF21BP6u+67TBTbMGUn02dwP0R7fk/z2fAQeMRSSXKstPO6qTuE7CWci+1JIsd4Utof5Ps5u0PCm/hIAPqgZf0FUMlrbNBz6yJN3V/LUdk2fbgIN5e8l5QAEoMUCM6RRJGRpXPadtU7LNgypiJLLcb23IKFAag0GqMZ72n4CZy39wgI0R1RfuVDLzjUMpAiA298xFnZSZJFHTEVbHisVQvIsBAXq5NXrtlwZEwkunYqJfDqKw+vQzTViGWFMqEgiEpTIEZxEmQvnhkLRPw2Gnjs+iRvj5CmNaUWkPa01eAsRaNQ/y7hBb6LHi4DaaY4hH9YcRR7KiUXkwvkbtcEE00MStyGr2FGeQimpqR1bjpk/ku0p3P+uQy52GdhH9wEIwvc/TAJkH9knX5bPZdrQ8qu6DL1fNTnsciSBUuReTLlG4gDarVy+7rqroVWAewKmtSnl462m7eV+trkUFkgSaK/mUBfjFZAdj/EbD4pS9nBxoMnt9ueKLiA5fPalkhJosmddii4KwhZqzO7LUb/vfQ=',X'908a6ff3c2b92cc47e35ee91065ae329d6107edf90abcf67e0c4444a0da3179ffdc8391b471c3805be70eaecaaad3f4831e83ba51bdf33a185f6ad87bb04b4e2a8b80e486e504774ec9114ec3f9da2988a3b588260d26b4d255dfa0010429362b662648274c1dc72e91d716de6c9b8fa8f522a3f70da4967f86abb5de638ba0eb44a8881319399d7062ac515bda493c88652a942a563198421f52b7a914997d08c9ba726385f9fc9ba2ceae88d9a0459b22e0d8a8ae8bcdaab2c8d2ba281dd83a8fbec0ace2b019a01f7c297d63afbc27aca4038ffe722e12772bc0b452d432eb98be82c0a3f8269567ce28770c4c953fdca76eb72b5393f24fac62578087dd4',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('6153951B34EE6086FF6324E1B932F894','C52',1,1,'dSpqmaMU2tdvg7WPW6TsGjW+lC1vypTxCyhOo9T1xHGiAPYGNew0ZCoD2pPw2P/8JWsgz0vF45UnkIy5hz/1D0kXeJbL4gV4ZvntXd6VjZXi2xETy1EnkDXs4PNoPyYExS5HWlm1uw3Y7DUf3VqWBrJNAXJBOvuiKnWEzRiwPN9QolHoAMHp05kR3Vj+MjcdKY6xzgUZKV/UYt1kdDMKS0J5KwHMG1irrHOAZALW+ZEJFh1Ur2E3+DA+nK9raLyvH9TfF+iYGOMquX0TPQEn2nIbo9OiBd5pWQQiZQakFe8EBKiMjeMvQFp4EcOK87tqpHSNb3YLufsjEA0iQ8ZsxpNaGkA1j6T7fBhgYW0QO8nrLKxKZhxzhq2z4cnc1DMhiAvRqaTy8mtLfIfiZRYiYv+m7oqbWMI4Ga4iZoZJ/ABnSi7TGVSViD2Yn+62auRM00jD2pfubC06aK//KTBwIycwmUbweIlAw+Adq1f1T/mX+1iuZrecwhRN05WT1T0yM9GpL1/EtWq1FjMTENH16g2mX+V6JbBtjrTNX7GkiNKrDwMMFJXbmogC/BFPwJfXF5BCApkO0DysH2Btdzl5wU0yMtGMWPS2U67okMvVexNoiQC06mRxLiY4uufTQ0emXN4KLbpc/K20qMxfwpltO1R51+yAE7wUav6hV7BuIUAdf5chVvm7YQqS3/pqysGyZ1A5gEJzCKh1yY2mIdI8zAvUiCbQibWWTnBIBuByg4JUCif+db+lHO+tmhA0xF9/FP23FRwiDLlFHUPRwUhY0B8R3GC+WW/o2DjkFyy1BzdfcfORmeDEpbVJzqPoEXCHqgm8vMO/vtsD6iIfwu9DpND3n2SQ4Ucs6pf79vN1+LM=',X'6012c09f966f96376c4bad17fface36241631ae4d4b9a1c9d14f19e50ab19b86bad919e9b60694fa1eea66fc78ecb628e50b24b311bac38f6de737e9e287cf9e12d102d47248900a4ceab16751bdfdce9512cde26a434df0fb326c34c11f80cff88e2a283096c0d51723b02e8bf4b47125800ce76cc6ca111aac789a95fbab89c18bb33e35c460a0aabd037ad8bc096cff3fdb0eef2370ad8597223dc9c3a664ffaf3e18e42d5de280b9434635dca47bfd133bfc5e84b3ff7b66bd1bb0128ec0e228825626219bd6e4a6a2288aa419f2bbe58aaff08a7506f43fa516b2fa46fe3ff839157a6e718d4b3aef649b67f06c3caeec0f49a76c8a6d29ec33123b2d41',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('C6E8E7702F05BE8FFB5A9058616387CD','C52',1,1,'kOF/k6tKwN2+Lm+EQHZPjhyGxpbZla5FlrLAVcHGbxW+2qmfx8bcgM/ahGP45DADSYyeRhBwQalW3FtIUtpSHuYaQiLDvHTHHHi76wjixqC8ydVeZGFt8sJqj1nfJWoMlOJMvYX/qIw6Pr9Tbv1ZrAyIlFN4R9qAFCVwsLG2jlKeB0E1czbz/rfx7Tv5NekrVsSEkfQeZj7J7mCXnmA5sXWv99E311j8rO6fX+i0NjJ06QfXLjpP6EnWoz5GEu50eHD+kYFd4NpBEo444+BFsX03abk28VMvzXihpyajM3XnGBncx9IhKKM+PkXQttx5X971AFOxqieh4dcvY3hMM3lktvNNL2p/dQ/YyOBFHLgttOj3wK7lut4S5d2jJa7CWWDWwRK7D1bwfaEIarwqi9gDty7GacTAlxSTPjc1kt9jL1XUIlru/z8YVRme6zDas1+BeXAvYn5UtcexZY8xeNpTUr+GpxU9BNaIuyQSPzGG5MbZKZ2KvIAaPizxGhLPDcUfmtlTSTo4Gagzn62xjKHUAM9icz/54/trUpq4YTGdrpYWhvO0Aw0Emume4o4n2tUUQFh6p6iQlIWj33ObOnTS0bfaw/MVQsl4vVVZDS6cj04l/kGtiknYMCo3N1mQELs2/iG9pUjPf33jxZt1avmkAK2MLicyO+qV1z/0d4XNToPsdQlp2agwF5Zk6Em1G7dKfbqgeG70ipyVaIdMnJWNNSXQY5JrOGCM7QqLSbT/CKWmZ3lIlovqnGQN7qoIPrVHucp4QQDk49vqoo8WJEGY5HmhME8MXExREr0kOyhFVxTw58UNKJbY6oBt01lhusT/0Aj7ZokvLVeIeEV4Ur3HJiHuaBsQXe/XVIe9UW6CCq4c+ME8iJdM3DVOlJ26wNyX2lSpzc/FSUETXaCMYtQRHOWELzkV8jOCsKEZ/+N9i5sFH6K8glgYC/TD0yJikGuLxCjMjo3L1mHSlu/1WZ83WKRGzL7sELnkNkUw6iVGis20eO+qNOCblFlKofYpI2ae//AGw0FRFrWUYQYoFH6PocaeYe/TEQK0TY7yvt1kq8TNh7WNIhQqqLJXKv170GkM+zPk4SABeTVaZGrv9X3K7D1pg6ODI/n6dh0wMNNe2CLHdwradnFHBATTI0dYNruWfHRHNcidhsjrOIjpPomZhd7Vg5rGXTMpK1CLu0J04Riox02WiS8fWVTP89KRFcww4NBLtYjSX0kU7wdQzd8TbSAFrgylkDE5Mav2IKmh6Iag/uGRoq8/QKGl8o+IfXtjnCt7P70bSRfZiqdSYTVU3rib0C3GerGTJ97u/ErlLLi0U3K6xds/rU9ckx0/smxpl52X9VYHcICK9FJ/v6Ix9ap4FtuJw6RX2APtYzFggsNs6kq+PlVazwfRZ4CKFcPN/sjHU8tU3NYHd2WL69YFHw6FfeYeVSRcnpGKMzY5EHlr3bJbkCflHoXnRP2lV3F3wa01FPKwBvlFtrPvOw==',X'14c789ad7283e71f2af23122e76ebb416234bca66a5989bd56aa8590a6e962959bba3be695f8d0a27314a389469b6237add1647ba2922d7e7850ac1a726064d784f6bbd35b94cc7fe0f64eec6efd3c270e4cdc72e00fde799537d935ea68592f3acf2d422b57340b40dbebd75f27e89d107cd411479d7486e4f0097caf524fc0afa5f714a02b0ac268ba1b826bd18336be456f2c6396df9c8fc525fd3d6396f37b0a8e3ca5b158c63b534f7b2adb7613f9518555426d72021aad0131f503621cf71d70561620e3c6054b6858071215774a036f354387c96e70d1965eaf882f4b04c7364ca5aad630bd28110e3f2b663cb5b8b34169ace4938e7aa6511008c560',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('B8AA73BE0B8D7822D959A7790A82607E','C52',1,1,'p4hzf74UZkce6ZaQ/inOiAAPJTjT49npCUQ5PW78p50cEoXJh6h5MM/G5YdJQdzmxh3+FbFxY3EWHFGPTws/AcCr7Q10XStJy5RI8VQsuGmqHqzitNsOpjd2PyAjHqPq//bxi/TUnRC9o+3Q4ZlsUd1eAjsx/uHqo0aleJeSofxggYkh+w/QbIf7qCfGK7nh6QXTJ7qhDhjlX60TrnElZrKFmLMqstMXgAT5FilAQdXPdLjbFnUrFQQjQaEDvyneoiS4iaC+blrHCwx0pI5XJTz6/PZt1iYj6IWluLPZ8j/jG65KyUntpQLCyP/lYxigYnB9nhU7DvsIJ7+SDE3AfBaF+bkHYdZrPIWeYNMay0IPI47lT4P5igVDTBw2cRiy0KJViieUfIAuhZg3DEcLKl5M6GT5jwesO950hMVZnHRpA6CUSB4je9uE0LIu/SgUv7kSPG5+CDejj+9fkSbYCFgL7BMf3TmLUilUUcCaBE9JpdoD6iL7On6zfBbN/Z9Ul1pnfpShYLN/px9k7j8l2gj5DoJyRTC4hEaf3w4XFvcUJ/eeKXfWPU9jrkunBwcjO6Y5vojjDssm9gxyURLTTi+O9XMGShICzSp5aYtLRdBp61OkfQTBHwI40ZViM73NoVppJo/D/ccDhf2bxpucpkDVHgzYB7Ho+0pujmbi7inqwI8Mu1XqR6dmDpw7THdiewUsq5rWBbNLIsh9lYHjD91GTzeQdDqIL6pnRm8HQPjzuoRl4ahHuIrPyNao0loEqtGejmORk7pANOzHst7JTOwXrV0j7FRV7WnKJkE76ZSt/F6rny3QfEbL0JZ/fYQBQa4UOI6HmnrDCBDXDcmgUchQKW2BSeDwyaIiELE6JwXEegWUlk+XmBcalkCg2HRqtIoJnSLyrZIVTy7A7J3tWPnq9qSYaXq2Hhckr5ovV7oDtAdLSNqo/f+SJBfmVenJ+aBD05JTj0auuctnCi/CBitgiVaB7gX6v0WRHycsA6Hf9ie/2mmkzt1nQKB1wjxus/sYxsc2RuZB5yL75dSeFPxW2T1GNlR0S5uPflIM5FjUsMrohuS0nlqgE8XM6xg6hIUqWE2AIZiPFG+plJ8OTvhBAKCqVCrj0DV1cd2LXsCLuXliygQu2JElGXJ75gEDK2qxR6B6lVvNSCAPXWJTSO/zu4zATWfHE6J5EFodWqgHVys0bHUDS9D+7qTlDiyWLI1FQCPkwyhIJ5AzMmSpi14KvibGmLleVtbZCj4S2Jnu0sdvZFSESLaRtUbftyDbAc5+ITlgmo+uZeIIt7N6xolioHuU7yHWHk9mWHWDK5C9tDuBSTquA9faCyYHQh+hRgOZZ1/cu52rJ0W3+JGRKQwD4+OV8NV5CYW7VScxga+lTZSKMBkMA+DrHI/0MtyzzGXkcrBcrP7rWQA3+pSoh0jek31WQoiK6Ki7V+D287ZRIDNiEABZdVr+XsaA2vuFuCVm/M5zttheiyIrGNgWBw==',X'4c684a8ff03b8831e90d396757b00284ee9f9c5a8abc475b08d1b3d922864b7a7bbb31da47193d8532c627583da5c5891e375b3f0740d6fbdf5709f37bcff3b2fa9f3489257b623625e6d569503467264800aaf7e7cad0a61a64146037942db5aad4d496ed75615b2914fdb0fb27d27fe2ed8eab922fbf683e05881224d4c232b5ef65ee5613702ab84d91905fcfc204a50ae8a1b89e48edccc083e81336a655c18a109eb9fd20b01cf55dc44e8f9c32371f7c1bc095b4b0a2496f9034aeccbff0bede4120af7a30c08427a5f96a26cfe9c5f18236fe5087a5616164fe58bda0eba60d3f02e40b5f9397e276cb8782daee360c546efc4e6505a2bc6d2fe74220',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('74FC29A02A40A36B7FDEE19410F296DD','C52',1,1,'AkFrU1APeExcg5ICD4Wa5rkAeqBTmFmJmAAz/EMqoTJ253s7+EWuEXJ/d7S20o6B0+Nk+U8onns2av1LKSYjZlPyp+XTi87Lpn8azKw0x7yY+pRa+AK2MUaDiOpwz8AN8dQi+DFS76DnFYzgolzwdJBrUh46Pm36K1JzSFLGlg/q2EiDK303y0AndEvIxLKvdpjJFInzKXh4XYaycdbQBrpV+xqzcbKqZEupf8HLEsTjqsPSsLJ5RyeOq+cbVi1sN4kM9S2SvxgYJyyIA6geyuywE7wWHDvfgFiAktpnQ1XXzpUYQDoc3TJ37t3qN78GQ06r8JU3ZNSnzCqVMddqDBdnJUmE7uOqolCM3b46MeAYn1CY9dyavnj/NHoxoLdb0tAC8u7GIIsqFXkZELCJVN3BC48jSTzcNmGSUYCxpOwpF9UTaydfR5LbuOuJYV8F5tZvotqGXkKMbONgIvyyR2swIDuSPLtlxCULXv3+AhRVsSdEi+zsNI2Uz0kFXq0+gNYTUjcW0EM//Hpi9qtsYzFCiIaSjseOqVQTsYkBcoL7x7UHlc/ydojdjixSmEOfpQVCbVQbFVftOl5FOKcIcWMt5kDu4pNbIWdlSVUUtkrGYhZtFEE3Jmq2nuO0TlhlZvkYITfZuBU0vg9RYWLcJO5mY+oA4Gxe/G/4xENhVAZrK0H1OmOFcDbnWPJzlCkvh1zIsHA5eCcxIOWIDejzgCnPz2xBahhcLuI7PsDodacDmIyPQpc4p6LvF2z8syw6+GsrooL2sWfM/RxDtkqX+NcoHib5B/qcjSsSNNLEHw+k4bKrv0ocC52zaWpy0WpMHR5JrcecFP0UzUwTQS0FNMF8hlqOvQk+twtUw2sU1a7o4u1kVvX55xSV5SuRAfvc3WzJWaF6GbYiNN6sR8X791CJ/9BwnOIBcSXiYoxKzT3dMwhgFr4GW6Z9242FZ1E5fYo/LlNlC8MMV6z1RvO2vTGFhP7VzQjQ+7gj8CPHPdljo9mKsjWUlV3eMRU5epzfJc/iGt8COA8MegXkWmEg77llQVI6x676yODOIKvKk1fOQ2Afdp3fyPWDQ3rNme1XeHBlc+H+PhRN/5kFXvy+Amn7GAMLJOJMYLNi2Va0u4BnwhC9TzBJYq403UbBM2uvMkZk3iMLoKZswbvRRRcyERxnhW6IUXgmDOif++uhxM5R7Ps/yvkQIVxXK9RG1cjLlZCkM/gy+aqXAHlaLfqZFD2V2O6cr/hFpTIhFDNoRK9bWxqwrQqYR+DHcRT8A3/EFU/uBqqzkUqf12u5pAu3YKCObxAtYtTlPyolR2wDMcpwjJQ6Tl1tFyKRvk94F8ypkQg9wIdJY3O3ebfJv6nmA+xyvAmv69fR2x/tMKiv45RD1hnTeGKr/WZC+dHNvGWaI6NaBkh1wn/A56+XuS7VbQ9xj0YkqOQOW+pdAAk9mRY+hyBzDCSJfqWaQ3UvISV8dQzkjXvc/EW+l8nmZrrivQ==',X'641839f19528e2af2fbf2e3e3bd94c755c5828a7890cfb4d9b13b53632a4426b499d7cc61b7abfd279a369cbdda2b785a36825401d0bc66f07d598d4f18068b5073802e237a86fbcbc99fd4068d68eb3609163bd93875f736fc187f59d32912ca09a8f5dcdba0593329b9ce3dc0b66120f40af9695434b71148ffcb92dcfbcd195e3f5a9f1621789c3340dbe9cda7e8ea558bea9ba1cfd143cb46a64f75a3ba109e0f7b98253b8594cb0fd0f9a0dfe4a7e3527c19b1ff9bfd6c1e1afcf23b9f638829950c43b3862211bdaaf447a065160393a723c8ee349e5016346ba2fdf38b39b12807cdef26fa6709854956fe75116d87ec0134aba23396226dcd8a60653',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('4F0DDCD6B21631E5B36B60C19B391B1B','C52',1,1,'Q1MQ1zNgGtX2z0CjJ3pzAbj1Z8CIU0krKNh4kCcD3Kte1HU9aErDc1+EpuNB6UqaHgmGcs2yUK999mBNDMQjKn3Xy4EOoeiJMHUMICcttD6dEoHRIKGCEFvR9QX+ZOj7Au5S+CRjaNApBct9nr8zEIUmkTpBFbQ9W74DgoWPhVMG+wDMsdTQAH9ATrYrecrmphWWPQ0aZGHQA8zfXPphB85bc74ARPj3z3gkV2iChjSKHPghI00Aia2KkL6hajAOC8qsaBnNdUWxI31HtvMT65Ej+qvHLCJ6dxXyfDcEZXr22yBM+nPJ8FD/ZLq8aJVcu4kN3fiiuok37zGh/AMXIlQL157KCmQkp8DtszMzWT0ka7VuYzgMMQJtAGjLYtyCuGqoX7laX+SVltkgbnB1cRKNekIdQU9YMQQIXgW+ZMDGP1NL4xWPVcWf7LR/nHOVAs2AI+8VkTmHLdT0NnAUw/954qJtQmkeDjJDMxBorqPEJAWi2IPcSUWQTFRqohuorlncOk+ijpqtnK/RaKBE7gOijJXkRTzImfM2rhtQ49NTIu+OSNT4b31EcNd60UgtQNh23+UYsGlk7j3EPskQl1SnFCjYVuqhNIj4WIs7RDJItLClwHw97RPyq0RVNBMTnXvP4sum22UxV/Mj3TRjjBbpZMcKdRx6iHy8Y5XcqfPgor9ojwUlpziPf/BR+dCbVtqTFaRJzl6E9dAHo4cnBmBa+bTKPCED1YNfZ6aUnICw6hYvpnmPsQ/lC1W7oRbGMQlfK5k/dc9BsRt0kOkma05mOYM3mkaxOl5bZFwf3jVkE/MB5pqxVWX2BsbHEEqd9gsae12tO5cKz+I0plMEKRS42AEoe3yJG2T5/z4dbf8nwBr+DiFGkV4Zx9cR2GBX4XVK0Ewy7XJ0dyjfHFAoZL6c3bchrf+gGnx45NK75s7h1BlvI6fP1BUvu28qSELVsJIWMq6P9wCL3qwA/6m9i0cAHilr8mxeN7ramN57xycBPXz+UMafOxNNs8Bib9RQlzYOUGgr4/lGTdFaa9UZSyQe5LvCoqwaglOR4btaIrN0tANz7tUMYRjT5Ed6QbJgzJwqEGdrQ6/K+dd+v920GJyEJUPi5wSzYNZQHcn4kpT7y2GlgBEOWgSQ4kRM8aWA5t11RrmKOKSNMiLCOEif2rxTxfSD9eaC3NjOrXh67VskaOy/e1kyAoaf/vbHfBKcmViowmfJ3GY0FV2uF0m/qY810HQCuu5OtWsIdRYZRM29yUQ+71m0zGW5iekX7wp2u1lKOye29NwzCAEq6v7ZyC4g8OmDlNT+yMpZz8qATJ6bHaTvckRMrunyvNha97eUjxe5Uha4gZxzh2EQcTUlYrCSQJKhyFCKJafdqAFfrj0cRWVqzPqq2piOt4lAqpXIVLoLZbxCWgiN2ohQtlDyIPEsLflXFe4CX7B1G8Dh99mtIJUB4AbDXlIAmcUqmBRstLjqi/WoYmCcUpmR/wcLuMRUM7yQ0L0sam5Pm8npetuu5LuGV7qnrJ11Nnc3X1hpS+Gx46gTH6QCyCN22/JeIizeUyrTW1FiEraONBvreHNYm4eq4oAIdx9Z1gg+v4P8j11a0iPFM3mO4US5qqNfDcJq4xd9lswN27Qex8XwUqA=',X'981a96283e83b2a85576dad342f3d7afce2c0165202549c4c2b87f40025b625a787eedfcf25c2bdb32366247048777708bdef222cd7f5528de59fa193326d50bf6639cfc93b24db7eb8abad34ce97bc9a6807f148a9e2a2e764102fe698762575422ebc947261df4a91de21b8ed32940ae1d40319d71b64b004a2bfc64f83d630549b9c45937d630e65ffb124d7a5f95c6412a85d76354fea19d8cb3d808ad79488a45fa53facd10e312b6d5b61b4846b12c77ef05594ce8ecd7ee42435f0b90e845ab11d0ab856b09b2ac81ce0fc1bbffe4a39b26c071de40213b5b06ce82406106af338212f51b72daaba830fe20ff495468d180cfbe4123372edae8dfacf6',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('C6B7A1D05CA9104E76C79C4F90110A5B','C52',1,1,'5oUFJDfg/kzP2qwKuuEwPVRVYi7CV21XlSt8ASX4bH2l3SX/h9O7sKgBpOv0tUFomVVjW6W2HBIppKMm0wRRGWU/zWFycGcJAtZJzOyw6HMs2Fjjw5imAScE9yvkwUsKguNLeG3jW2bzoa93gXvLCLBZEvPWQW4pbwOLkZ0IohoQaqqcw1IC7uKctuS6AgALV6G2YaZ5MUe7c9+dBA1xth/7DjECR3Z3MNIEYhLBBZG0NOfw0Geo2JK8+iRwbWoDxKK66PLdZba9ZDWFfMdnGXU3BZQU57/GE/Sm0AaiPm1zcBuT5koEB4QDCs1L26DislzlZ69MjhrNdnRv2kyTNx7v4X5JQsa0d+7Jcdoudt7IRduwtFoMq0xq52RHZwGIRuzoMb4u7JKESVKIxW4t5DjblEVTbbjKAw/sjm8rGbJNQQD8XVN7kF1u/G0NABK7MKtmGKNlgrlxEJc70xbQTrowC28D3mmz6RvhDToZuurNgcPFRnOGuGU5gC5JEgYtWmWiRVNDERqXgP2GNphmLyyU2R0dJCqH5Wlci19slohMYVctb27ggMPX4IiGP27NDPcT0jCyaWlXvGSa1z5MNFRcrImk1Za2IeYJsLhbIp9XrPoAm0F2FCH7GmDoTiD9VxWBi7Ip6wPAUkPxLo+U3KHpYm8bMM3tytm9Ayq5pn9Z0TROq4paQJp6jKaw6Q8fDX1Efd3zyh81V3Kt6kKBNrTHmh0HS5/6FVeRLvZBJ7BCzwSJf64wTFLnjJYBzOqLw4uHca1I9tN1P/ayv3GguGAL5+y2r5neRfwZY/SBMkpHMlqaT6t1VdO5RlyyMeNNn13zNlllm8tpOv6hWlkTfMqYRsp1AH8M5JR/iyPzaOjBb3wT9YDaaJjo615Golz8sa2iSX+DxDzdTjWwi6P2lynu5jWv8q3bEBgKzNmFpwdNh53Ht7xo2u4c7W5PsoheUYMTh5qDYdmgQUl0bLCvEptzbtlC4iGkGn9nXuKBuwNIvqKhIauMd/fwC3cBdcCbeStSdChDKxyZx5D/Ud4QmdjL0pkFiJDt1eRMeJXVVO962SDzOJM0dIobtz2VNRaGHQIa8/WzGChXP6HOCDi6HtLSf3E852PEUpYybMz53JZuUJSGIKKtQ8vW86U6/vzxIV0CbvjQcl/FJYpuXl5CgsZD8VfkQjQp0MvJlRWJgHTnvsl/4f0u2jEKy/MMCCe7Bkebf5XQKdOIBk+dn8Fwnt6f4qOADH04cvH1VsA5QbZjHjvExAt5HHtUzXiBylzhsuyW+NCXKGsJi46Dl3zhtPRVEHJXlHoXrZ/8mYpX/gQejCOprEHQBpBhHJJVKyabMjF1FT0Psk6WKvj6IXQRHJsg0KJkyfowgHN5EBLS5ezkwVcP+ZDupq09KskZrDMrQjJ64UOkS/dXzMS75787OpgFoqtOV4xKpI6puJTkOq8Ljy96GDrVsUTNE2qWCKXGOLqAsC3c+lKg24g4JUHYCP6bTYyhD7s7q7K7T96KMeZjSVMhT39rvT7zrdzw4JER/LoAdygB8p5MK9cfck8wKW6ju6nW15tMf5cgfgS0nD0pgqrBbQ4IvbKWJx9xoZyrJOrWkeLSSU2qhfvdsBXFFHk7fbkp7lmzS0nei0OfsYY=',X'4a2522e25e0566a4c77a7744a06c2304f325a4e781893b782cd133b00025e790e3d386041c7a6d85f5b7cbb46b54fbc9fcd0044a2395b9c40e2f19b867d0c212f76a89c79649b4038914fb97ae6b6e9da1ca8ac801d9c9d14638efed7de865f1272a71e58eed57aee5fe56586e56eb1be96eb195f7feff175576537f7b29e3ce1de0a35a0514d474d20a732e75573a37aa05c1a33031b3ff36c8ce8e08bd91e3fffac6bc1852c9354b6b909680298ea6737abee78f1654f51f5e6ae81b3c80e5f982c88ba83a482cde5f73ce85a6b76c5aa3ca6943ffb5cac3c92892560adad3e303d41ca7c7eb0788ec7a4e67954020285fda5d4304cdad6d5418b141467008',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('7E3487EF3E9F6ED90677E05B6D727106','C52',1,1,'ii4vegJRDL+1TBXNMijDWLMLQ6dGgGbk6VzI372UadlWJb8rC9I3m4vqgai1icUjxrsYbvcpZo0pY262e7pWdFhxzMxeAo/2kwhA1UIRW5Rf/4EuiLfMOFgHkbamjzMbdeO+ZNbPA1q8yriBp2fIer0QEgHRZ8XUCn9uKPSxZQtYPXxUOHcEY+MQdz/1sl6FIQwr+wg96DVzQXsECR2k+B8FmKLJWaxb145pDb4rwO0z5Eg2u/s1M+IlBhBYtU+J7xjb29MeyvqujlEwK/kibz1y4wtSOFc3dzLXv0gAnf03Qbrz0UuTo3Cc9uVHNLt2egfX2MKMEzJIixQPx/k/tNWU+12qX3/uxMSmExUmRC47m+quYFLfBZzV91KhKUmPAvlSL0PulRgSm77RFWqnbE0MtTkWweX3rkYFhU0NMqQHxTYkgB8uEplICzJ5dopMr8CYQQ2xwzwL87HDIi5ueOCVuk/Z6lOat4lyIq9gKfH3MLS3aN1xi9qsPXTUVVNVzOCM/WHp8BcKYct04Bet5u8EosgVD8VKI9ls5YhmeM6nBapw/2wYkd3ZcVRFcFOOvxmeaBdvwQyeTwu/vy4VMl3hqoAoon6hYLcA3Pe4W2PG4au591jtioUUPA3WIzgMiLRWJrosRY/NvTL3iiSXYXdPJbclUAX54KwPQRsXuRbnvLsRIAnj1jZOHVdylKpaqRhMaA+lvH7YvF4l7uFBrdSPUKbHQi1DU7JbRKrMRNHUSe8b3tDBeHEIx1O+t/AIMG/8mHKNpHZ0nNaSH6WYZM5eKU2v3coTzLHEYvPs0CtLhc6ALc3OqMQ/DE4BfXPHK97tPiY+ziWVn/bmeSoe65g4O9eOuPzvm4wV1D6Yn/k2DxqGdx+GXkiXTlUTl9esNGxptWS477pcdD4wLsWc40qHNMVfyHmEILKHsNzbeJbvuU+qehFFjQVIy3SohNqPI9gtcqhWbauXkUHQqbnKSjVkv0WvnHR9A7dLoUlcPZ6Ga8TpoXGu8cSaM/BSU1FGRiy2SzAgzFRIvMJSF2t3dafbCO7xF49aRkU8S2sXbbBABCw7XdxgcothyO4zXsiFHOejS2cS0Gjp4qN2VqWMAqgVPTC8NCsGj87HZwzIeQEp8HELC1FWbDOvOLsXmjlxQgOQSXh7CnUE5AYs9KFkMqZZjk4G+0WAejngV2f6TO5Yfb0/+7ssLzdgCQ5PfdNa1y2Rw7HhVleE8XizMJNq/2uf3kbpl5uMUASlezZngMlP/r6W/AWBALAKNzq56jZFb9wNizTaxWrfOL6Q7ihm4gSmLGXWxPdlF7P/jIEJ+W5yqWijsy/VfhR8bHgftG+gTOKpZBaVGsC54vbgZaAE8rlcjRbDPXdbxEnkBS9ytcqNdvYc4r4qD7v4ZUtR2UhXzBg/GjjC2DHbMXSMKvTufr0si1CbkRgo3lNEYqdwNlRgcZtQhB8gqB3DRGFUU+Lz4Qu3TkxiOr3jnTWgbPieT0WWHJQCRJoFy8pZixrUS0L7LLMePfw9klorGHiLpYw8rV+/58/o2Ua0oHboUeDsNGs/GggOs7jbTICqKgiYLArMmbfLrYKTAmXF61VmD3IKB6WgLSOoQkFgtmz6NMqbfIhq8kaoua+cyke7k76xQSI=',X'671b88221b1fb0ea2f408796c6554dccd04be83941e2fac3a454a93e98e9c95c56950bd8360666ffc6f3e7e7bdd34b7a182a7550624c7fed0d4962837c565b60fb7eba45a8567d328b1d3983f1d995e8a1607807f67e46b2e067b1cdeef70ee9a2d58b642332a6f9c647b0eb3b65d610426e456216bcb120c8116ccfdb2b0b85624acb588e3d7a8f1b560a5bd3e4f47f66806395661efe713723b444bc33bbd0a084c194a7a2498bbec44d3b125b1a47c5dd6faad609872ea35b1f9cdf679263c8cbc201a26d07c151f655b4da09116292d264c7aa3336ca425118a0122ee6e3fafdecae14df21d9c008fbaa89502fadeed6fa7182786b754036fbce5ef308ca',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('F640544C0C8F2B39DA4CB9A58B44538F','C52',1,1,'kp6gv2c4Hp/gP7F1u/UXOGDPd+wSctRxr6RCC8U+Mvaj/ZYXW354t7tnWvQH+1r7LvW3nDhhuWJMbhFjrVMR1GZlcnq+3WNlZxuj44q+zv/yKiWJPImt8/fXGyXYVe0+Ys9ol/n/grt/vEFrc8QXeNeiB3g1di1KXcxu9oRnOJhEh2RLRR4VljY+zC46pC+ijLUy88pnHfSs0Him/tehQ4lJ6C97WWFRYJquVd5FJx8grKhY6XEWxhjch+5tNKSX8OAMfDTmj/bXS1JYEwD8B2WqO1TcIY90U9KEg9abR3flxXQxL9ejJ9UoCjAd1aJ3Wx6kNwB5CWYCg+VSWxMpDjpdGKNTBhyX2ZKP5gIACL3M0pzR7kqGVbJU9ostGX2YszRfws1PNaroG1ZfK5Je/GMvpnx1D5lZfxpc93px5yQ9zp7KtHjaGsazvZ7xWkrm2QTS/2yyP3fhmW8CWEsJ3OboUdVHOtbZYkiaw6EjfybNpucoGspYgfs7aA+pC9S/OygfdebLZmP1fEuuJbYx8HsvwllW0mj6poWc/mCahzPJsbp3Kb5h55WsNpEf0gNLxrtGYE/6iskyG0RhB5YO/mt/7ewl1rtYw576iON2+PKnmSpqFVG5WrdmxZvoC0iH6f1cm2QRxiHLBk832LR3tC5utODUoIyn3DNBcow+aL18I+VCL7qDYzOf0mXLjJ4JrDkETjM6Yg0NATdJ5GAlxSQvcs75vJxylfitl+bTPBFhEs4wlttbNjCZeVIXC/6pqNq5YEU0kcQCSfhwKCWjepJpAwlG1yQoHPFaYxCmGOjxWgQCgJVGNLWgRBOhUKTa139Vf05ylToVYfQFMmloxhhg2CAAkTbIJ5Dlg8g49LhAa8Da/s+QZ0PzySUDT6NhEzp26gSg2CvYKWpCjFWKMNOtPTXPUYb5sI9nSCR0Inh7eJyejBET6wFE2zJlFFd9rNIp4noPi89so3IrKYT8DBdKvD0REtPpSDLpCCDypOOB38LjiJgZpw0AsDJ5UFIJW1HKSjCY9l0EqUia13LSHeNVXH8kTD1+dw+6WGQ6SRYBOMJWfOCMGTpBm8XDG5SSzUePqLBA4tiWm/bpTq1NGM9JhOTzRZt6DH65McQZGe5t+t8as74BCCdQCpjSs2jEpejjSO0H0dPKitCEyu02j877dyZ4MOel/NOshQg6bE8o0IXkBjc/fO+vXmfSNoql7V5Okoz5XFfa6BUSpBuBCOnJPDalErFWirhityHuDFz5ISI3ccg/qFP9Z73dt3CDeKcDFFwU8O7BE4BlmLJIF9SgIL3OTrsxP7pstEyHRluMr1ZVFLOFRJvX7ULWfg0TpOKSk+8AtTiJSkl/80xL6RTZ5XAiumUMm1O8jQnamVNw9koZQGyailuO55Gt2nE36Wj9YR1UVQQzaI31qp8RxP0RCVMJ7Wq7DgTmSF85p+1ZVFhPynredYyP3arJ6EEA1GaI4sp5FoxwFwg8XUcuN88RoLHBP/k5Ewiiewm1Uh7UY/smCsqWe9Ys+6lmH5P0NpgCtAtBgDbClikfzaB/iyqGxQ6RbTcbS2tr7L52RAp3VM5vLOpI+dc/B+9mLHyCwbkCK/UndteapD4bFn1uHQQ9qszHm5oaZ58UN+kTCFY=',X'5884751f3bdd78b65aaa46c9133fdd4cc82cd2c374e5db46a0d89d8ffcb958229558a7e026aa8ab8ed719a6099e1f45e127e56fead6aaef6203e395cffaa468bc4be638909e51c2a3c077e8eea53b0718a095c4efdff29b13fc4f8c653f69cff0cd38b3ea885e5337c1f06d4b49129fb6149265f160b01afe8d2646143ef7a1316f3c2708af7b51cfafe18a8e66afd2e99c086b82d9287981a25408f0bc8346ef01ecefd1176286d5e8e055ab69f5e6b1284163b6903a5120cc6e76a1574b52f37e44561f86c104298a7957b2c52a2be442958cfed49d7a9cf78f0487337cc02c467c984fba891414eb5a619662ff041436c8b446395dfb38d60bf9476eabaeb',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('40252EF44AB3332AB358FADB1C381C38','C52',1,1,'c1weJeiTVaUCFkNaF9Y4TWTpwjEUQh/Wfpmalwu4+t9aABurZPuu4JRKDNVOyO38IclQHoX2TP7kOoNtchAhOxt9/Ev05aTZdLUeBZoHAj3T3oBZBz/cwe+DRet88Y35QdN72EJYGuLsMgjCE0/dI9v+Nwwq7SX90hBNYPLX+Fuv6VAH0EYegO79jie2ppqZ/WClY1GxhTRtDgJ+GObIu9VTYdYvU3ZUBeK76wWPyYxgpWnGNzIBuJgUc780xZQCp33OnIRIzldPb5Hcr2ArXpZ5GxbH3uK3OOVB2krTPwPCcKDzcUtswyaga6vhDZVLiscjzPfvXHtytmZm7N1HqYuw8gUSmoqgCZhFfidzGOCZnZ1PCYiNXCA00V7ijRuLYhHUi2WT1+Lgyi7R+DEeVcA78DEAZm+4PyZG2YH3DVI11L0c1d+bKGiFag7O4ZPzFtY06XB3Z53ALofRoSLQPdyk0gbGHtp7ZxmDbgrHyghxvdO1kDNc5kOvKNRW0kftPROS6I1UWJSHMiraKkQgrAAFqmrEQcbjbw7WwJfedh0kdfV/MjlR3bOk4frsR7Mr5X82mieS/BOFQC1zna+YYNmWK8gn10Syh0bMbKZ6mMrvd430le8AqXazgal78yvwPFhz8/lxocb10quoGJLWW0wARpTBHBCUOiiqLlRnopeQmRpPexZvZ5tNRufIbyY4pT74I2AslWydr2Rr9K7e9kkzUMTKft127KOawHvMmWJFgxhy+u4uclGa776pfUF/yxuffKl9nO3pUYVh+704p5ufsYqGxj3suQtXNLRiNRb0pEnvdC7Uz93cQa6NRJvXj6Q+gFFN/CLdTCgA7S8BhZbP7cF7RpaQhcJ2L/n3ppUklAMcwQ6Zg8x5sM6djIi8YqamThZcD1srBrCZ1mnnWhm5z+IkdU4rTZLpG9+0TMJ7aDI0sDYAIzh7mTYPQAoRLSji4VUuiLf//EtEhcJrlXherYKRoly5zZf+78qrxQzNr32jO56vqYQ/PMG8KRFmP7AQcG0pDtSo+UVpviY1AASfN5V1w08ss3syf/jG95jpIHfVCQWf5z/5JNah03NVD7fAbQl533SvRHehO9HZrxDRRBdpiD+vAApRNzhhD4wnTf2bgptHfyhauRqZh1iG+kkPdPpUzdL+H7l6wKMJ3tqGUsqGTtHrMe9NscyI6w507MEhjPMUR5V3XCyeJ9HQ6/DsLfwCCNemz8oI8dHO57z2vvcWbVvLTWUpD7968y/yk0VrDqysWC/Io8ZysrY5SIYVm2Fh2LAuCGlV6kInSvG8MhV/BdtuMg7LsIT400EW/nUxF5ImgIqNgSU6f/3Bs8WItO9PP5MUSeu+5SrpnSuR3P0VRfXqzScLAqWuvZh4sDqABnHkk1jPG0WPFWj0uMxMkOdVF7/pF91XVopW+pTXhwikGD6StuvYKOLwhVwmwaeaQXoo+/+UT6vXT7fy0UCL4dpmYGTZfDuOkZzVGyN1VNGXeOEUeiFvOFlq1djfuFgyOYuJNA2JhA/HEZJvI5A0FcGeJLiG3Lkin1y497ZS3tERBFMJpTAmBDZDenRElCb3RthRhOOlbkUH1IXzLyzlQbsxHfukfvd1e4Uhi1G/LwJSR1KmGmFT1y8YM8Y=',X'8439ee47256c0c1269ef72fb7e482fe737eb05a2395486c7b44763f03ee53dc8d1229bccee28c23e2d64a1d852c628185266e571edf9b223c5c3311391452d7b0a61d08126bd94b7d0ea7d38101a005cd0643cc95f33a9e2fe02d316872f481d35cd40b019639b43bae5e5c4afd49efc3a3116b22e57ecc56189d6a97e7e16f0f8c761788c5afce631e75d9c78eb6d87ffefb0dfd36157d4f302c4ab7cf4c0ad6343b2a90c21c6666f871f3c008b57a99e09da7a0cd7ed3dfe08dc9c8b0434412f0079218fdabdbaa9415a856d341b0c3f18801dad90f859d7a831b7606b5eac294f1d4362aa57e22ea73cca4b7b0feeaeffcef1e779786764b62a8cadc183b9',1,4096,0);
+INSERT INTO EbicsDownloadTransactions VALUES('A39E4AED69FA52311187E0D04D2E719D','C52',1,1,'XbvlXVhRVYGsJiaYAiFiWUoLpj/nFXVLqQJIJ6o7qHU+N7TWOOEli5tCsdYcHenNMate/hHjnDTdXkXrLWxBEUUdk2ZOwCm5fd7/TIuu0op7rpRudXAjYJY0gGgQ1qcAf1ILBxq0A01k/x4tC9uXcCClAYm9FEy9vbtQveYopryLJDK2u69Nx0nf4QKTaj0IFK3Ne7QwlJygP2zuBF+KCpM6QWGeNUEL+2LY/Nv742quC91Pgd2KXY8bCK7LE7yKSOxLjjpqqj56BPtasmlwIJeU+P+7VQTi/aD8D4bNjzCtM9jTHg+4Je2UQQPZe6pA3eTQnED01G1IUu0pU027IaxjZUOLp4EHyWPNgNZqDDiIRmllypzQCU67Gco6G01qkcCOOhwpkiL3KiT0Jg4XrOTm7Ij0hhldVOE7d07WhQO1FPoD73C0Av1l3ZaxIRHYrPvskv6JGzN4O9h9fPw6/VH6LlbxZKt/h+4UefSkbYnfcyqG3qOYeBgPyMl9hBtBN0Hl10BV1tc7LK8niFHQZfzxx39YmmoJMKXYdgvzrBjyNjeHFEkvajBEsUkLY15hUTseq0V2lMKu1+vMlnzM/lgwwjjDWU6/CfUIJxWOwhCPWO6s11at0JVk2jjIQM1Wxl3JV8zi73bBt8sdGVPdeXioXsUvlRFZ1nW9MkNdjar7JrRDMfTusmzir38UeAM9AL57RwR8MuzJye/kkBtH/Qbw++0baULjhTzQSz3VRcl39suOoBtTXeJx+qwVa11KmryISxyIeFHVrheTI5lZSuamvIS3ccJhtPgv7kMoSr24kholZ4qlq7ljXo0t9jd0MwFF0k7fBPhAGDHR1pO2VV3FNYXX2NOwreqnm4htOJlj68qGWX+SHzBtG8puE1UdOhnvnaKx80ZJqx8r/oKV9YQnCyFdvcY2ACeCnCLilxOn+BzlHDFBX6r5bZ2GFDMgixkyad0OEr0p1C6JWyvoBG97f540mVq7JU/rrkrSNYVJhZt3fIjNWaj/XSNxkifWWTIcNYgAGdTl9FZFyD+UEvb/hjfIfyCXJo7qf+RExl33+E55ChNSHoQyotXveYZiQ1Hos6bGus/fhxZjacoATtp2H897jM92/PSomJbztcwKsBAFq1v3hFr9A7F2yOgPIl4+TcPWuOcD/nNnLFCSY68BItlInW/0pPwjqXy9o8OtIynigdJgepv3Z2LR9vmPsXWUHNuMsNmayajK0jGLqaMO60UTXUklYx65dyTFiqz40Somz8Xkz5zSfeGfsvqdyxoWmzdwnn5k+NTd2HVnQsefa5/a0ywNpdMVQB7sWsTXKSXFCz3LslWOOHPPp1uQf9k/k2CSLla4AZsNpuqbtchEoyqgROdoGcab6G73ZLgKSLKwCW9/URBc5ECj8hDN0pn0DBdJiNbHb348LLoiFiRB3rOpB+1d8KF9qKBzk8X22NDOuFtyvlTlZKfLRbgtmVVCG/SmpZFgpXaDyz6cYYu4vBtLOmdoD7jmI5F/v23ovZS5KJyr+BEPpAJ4ZUKNT7HfJeJY/g3eN3dLAmics8ribx4DGuKEZIyH9m5EUdKyX3QgXYh6fHEdBLXwltzYbHKZsM3VRI62bihGcburP5ON2DmyYVjy8Fn5eU0Ey8Y=',X'49328ac8d80a8d4ca6844d1571e85e4a92a8035cb22198417cbb03efc4cf7fc1dbfe363edd64189941753fe2f885c479f5394f1eda5a8417baeed03c41ab4e053170e5fa3ccbd00a91e612dfc12c65c4624bb1b9c0800cb961fce70ad5cbad687aaf708a0bd9dff3f6f5f30d27b474c25e7e9707b10489d6e7b3bac832aa152d8e9c4220307dd33b0a5990b01669f06eaf51e16f76109455a57640476a3b4f08e02ad9d97e5256cf3441304308ce535d83bc25527329f673bcde5684879ddf5f1abefd195df262866fccd34061e3f53306af6787275e44bc21ec1ce1ce95b02c68c507e98eeaac876c1fb2d33877e54dfd6697337786006529c31c861ff3a913',1,4096,0);
+CREATE TABLE EbicsUploadTransactions (transactionID TEXT NOT NULL, orderType TEXT NOT NULL, orderID TEXT NOT NULL, host INT NOT NULL, subscriber INT NOT NULL, numSegments INT NOT NULL, lastSeenSegment INT NOT NULL, transactionKeyEnc BLOB NOT NULL, CONSTRAINT fk_EbicsUploadTransactions_host_id FOREIGN KEY (host) REFERENCES EbicsHosts(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_EbicsUploadTransactions_subscriber_id FOREIGN KEY (subscriber) REFERENCES EbicsSubscribers(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE EbicsUploadTransactionChunks (transactionID TEXT NOT NULL, chunkIndex INT NOT NULL, chunkContent BLOB NOT NULL);
+CREATE TABLE EbicsOrderSignatures (id INTEGER PRIMARY KEY AUTOINCREMENT, orderID TEXT NOT NULL, orderType TEXT NOT NULL, partnerID TEXT NOT NULL, userID TEXT NOT NULL, signatureAlgorithm TEXT NOT NULL, signatureValue BLOB NOT NULL);
+CREATE TABLE BankAccountFreshTransactions (id INTEGER PRIMARY KEY AUTOINCREMENT, "transaction" BIGINT NOT NULL, CONSTRAINT fk_BankAccountFreshTransactions_transaction_id FOREIGN KEY ("transaction") REFERENCES BankAccountTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO BankAccountFreshTransactions VALUES(1,1);
+INSERT INTO BankAccountFreshTransactions VALUES(2,2);
+INSERT INTO BankAccountFreshTransactions VALUES(3,3);
+INSERT INTO BankAccountFreshTransactions VALUES(4,4);
+CREATE TABLE BankAccountReports (id INTEGER PRIMARY KEY AUTOINCREMENT, reportId TEXT NOT NULL, creationTime BIGINT NOT NULL, xmlMessage TEXT NOT NULL, bankAccount INT NOT NULL, CONSTRAINT fk_BankAccountReports_bankAccount_id FOREIGN KEY (bankAccount) REFERENCES BankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE BankAccountStatements (id INTEGER PRIMARY KEY AUTOINCREMENT, statementId TEXT NOT NULL, creationTime BIGINT NOT NULL, xmlMessage TEXT NOT NULL, bankAccount INT NOT NULL, balanceClbd TEXT NOT NULL, CONSTRAINT fk_BankAccountStatements_bankAccount_id FOREIGN KEY (bankAccount) REFERENCES BankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE TalerWithdrawals (id INTEGER PRIMARY KEY AUTOINCREMENT, wopid BINARY(16) NOT NULL, amount TEXT NOT NULL, selectionDone BOOLEAN DEFAULT 0 NOT NULL, aborted BOOLEAN DEFAULT 0 NOT NULL, confirmationDone BOOLEAN DEFAULT 0 NOT NULL, reservePub TEXT NULL, selectedExchangePayto TEXT NULL, walletBankAccount INT NOT NULL, CONSTRAINT fk_TalerWithdrawals_walletBankAccount_id FOREIGN KEY (walletBankAccount) REFERENCES BankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO TalerWithdrawals VALUES(1,X'e85c38b2920444c9aab20f4926d20a6c','10',1,0,1,'HTW6DPCWEB0QCYAZ7ZTD89N17AMYR7BCRY06R727YNNJ47Q4GTHG','payto://iban/SANDBOXX/DE514871?receiver-name=Exchange+Company',9);
+INSERT INTO TalerWithdrawals VALUES(2,X'f383c7879f26482584e86aa90b10aff2','18',1,0,1,'K2V2B3YEMZFMWQ475KNV2HT7RSPA1YXFY210749MN9WBDCBT94AG','payto://iban/SANDBOXX/DE514871?receiver-name=Exchange+Company',10);
+CREATE TABLE DemobankCustomers (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, passwordHash TEXT NOT NULL, "name" TEXT NULL);
+INSERT INTO DemobankCustomers VALUES(1,'fortytwo','sha256-salted$UtJxNQYxLoI=$stx5iheOyEgzfK+m9P2r3JSy70D8JTWXJtCD7grFX9M=','Forty Two');
+INSERT INTO DemobankCustomers VALUES(2,'fortythree','sha256-salted$i1FyvNRmgeE=$fezKwJxZA3gPSJygSi8dXyvMRxMkQHtXII9X5NClMAk=','Forty Three');
+INSERT INTO DemobankCustomers VALUES(3,'exchange','sha256-salted$VDGQkn7Usqs=$9cnyVBjO+WVIgTIyeQ7pD+U1Yj1ZZXHk9nX81w0DoFY=','Exchange Company');
+INSERT INTO DemobankCustomers VALUES(4,'tor','sha256-salted$FEsrX8Efm6k=$ZRickLniKTQ7tYUNKc8lDq3VCbE9KRsOfbrdK+GWk6g=','Tor Project');
+INSERT INTO DemobankCustomers VALUES(5,'gnunet','sha256-salted$ufN49w1+i+I=$sns8F5C5a+roZ4u783zl/34OSUCOBqHdPFF8VuEA6FI=','GNUnet');
+INSERT INTO DemobankCustomers VALUES(6,'tutorial','sha256-salted$xk/oqfFugxM=$adk5C9K4czaHBlMQn0qLeJfkmgLi1eVpMjcCuGeHiWA=','Tutorial');
+INSERT INTO DemobankCustomers VALUES(7,'survey','sha256-salted$Ny4FhY94KyY=$gxN0i88OAuj6mAA7auEjXAyNjfmAyq7QuwAbXs+PDKU=','Survey');
+INSERT INTO DemobankCustomers VALUES(8,'testuser-hwi9z7th','sha256-salted$DeOWXrnBY6A=$zH37tTKxrQEgpv17d1UW/sDpOYqfPvSM31o9zGkQaEE=',NULL);
+INSERT INTO DemobankCustomers VALUES(9,'testuser-7wwue25w','sha256-salted$HwpnyLja5bE=$lGADKhJ+fKW7k4ec+uDMhWeCI3me0Y0YXcYFGXPa1OU=',NULL);
+CREATE TABLE NexusScheduledTasks (id INTEGER PRIMARY KEY AUTOINCREMENT, resourceType TEXT NOT NULL, resourceId TEXT NOT NULL, taskName TEXT NOT NULL, taskType TEXT NOT NULL, taskCronspec TEXT NOT NULL, taskParams TEXT NOT NULL, nextScheduledExecutionSec BIGINT NULL, lastScheduledExecutionSec BIGINT NULL);
+INSERT INTO NexusScheduledTasks VALUES(1,'bank-account','exchange-nexus','exchange-payments','submit','* * *',replace('{\n "rangeType" : null,\n "level" : null\n}','\n',char(10)),1660496860,1660496857);
+INSERT INTO NexusScheduledTasks VALUES(2,'bank-account','exchange-nexus','exchange-history','fetch','* * *',replace('{\n "rangeType" : "latest",\n "level" : "report"\n}','\n',char(10)),1660496860,1660496857);
+CREATE TABLE NexusUsers (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, password TEXT NOT NULL, superuser BOOLEAN NOT NULL);
+INSERT INTO NexusUsers VALUES(1,'exchange','sha256-salted$/p962JXzi/E=$cmuLHvEgTfLAXqctQ2FOIuKzVxgw50UT65CSslAPFqw=',1);
+CREATE TABLE NexusBankConnections (id INTEGER PRIMARY KEY AUTOINCREMENT, connectionId TEXT NOT NULL, "type" TEXT NOT NULL, "user" BIGINT NOT NULL, CONSTRAINT fk_NexusBankConnections_user_id FOREIGN KEY ("user") REFERENCES NexusUsers(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO NexusBankConnections VALUES(1,'talerconn','ebics',1);
+CREATE TABLE NexusBankAccounts (id INTEGER PRIMARY KEY AUTOINCREMENT, bankAccountId TEXT NOT NULL, accountHolder TEXT NOT NULL, iban TEXT NOT NULL, bankCode TEXT NOT NULL, defaultBankConnection BIGINT NULL, lastStatementCreationTimestamp BIGINT NULL, lastReportCreationTimestamp BIGINT NULL, lastNotificationCreationTimestamp BIGINT NULL, highestSeenBankMessageSerialId BIGINT NOT NULL, pain001counter BIGINT DEFAULT 1 NOT NULL, CONSTRAINT fk_NexusBankAccounts_defaultBankConnection_id FOREIGN KEY (defaultBankConnection) REFERENCES NexusBankConnections(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO NexusBankAccounts VALUES(1,'exchange-nexus','Account Holder','DE514871','SANDBOXX',1,NULL,NULL,NULL,14,1);
+CREATE TABLE NexusBankTransactions (id INTEGER PRIMARY KEY AUTOINCREMENT, accountTransactionId TEXT NOT NULL, bankAccount BIGINT NOT NULL, creditDebitIndicator TEXT NOT NULL, currency TEXT NOT NULL, amount TEXT NOT NULL, status VARCHAR(16) NOT NULL, updatedBy BIGINT NULL, transactionJson TEXT NOT NULL, CONSTRAINT fk_NexusBankTransactions_bankAccount_id FOREIGN KEY (bankAccount) REFERENCES NexusBankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_NexusBankTransactions_updatedBy_id FOREIGN KEY (updatedBy) REFERENCES NexusBankTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO NexusBankTransactions VALUES(1,'AcctSvcrRef:LWA21AG2',1,'CRDT','TESTKUDOS','10','BOOK',NULL,replace('{\n "amount" : "TESTKUDOS:10",\n "creditDebitIndicator" : "CRDT",\n "status" : "BOOK",\n "bankTransactionCode" : "PMNT-ICDT-ESCT",\n "valueDate" : "2022-08-14Z",\n "bookingDate" : "2022-08-14Z",\n "accountServicerRef" : "LWA21AG2",\n "batches" : [ {\n "batchTransactions" : [ {\n "amount" : "TESTKUDOS:10",\n "creditDebitIndicator" : "CRDT",\n "details" : {\n "debtor" : {\n "name" : "Name unknown"\n },\n "debtorAccount" : {\n "iban" : "DE729925"\n },\n "debtorAgent" : {\n "bic" : "SANDBOXX"\n },\n "endToEndId" : "NOTPROVIDED",\n "paymentInformationId" : "NOTPROVIDED",\n "unstructuredRemittanceInformation" : "HTW6DPCWEB0QCYAZ7ZTD89N17AMYR7BCRY06R727YNNJ47Q4GTHG"\n }\n } ]\n } ]\n}','\n',char(10)));
+INSERT INTO NexusBankTransactions VALUES(2,'AcctSvcrRef:DLBB92WX',1,'CRDT','TESTKUDOS','18','BOOK',NULL,replace('{\n "amount" : "TESTKUDOS:18",\n "creditDebitIndicator" : "CRDT",\n "status" : "BOOK",\n "bankTransactionCode" : "PMNT-ICDT-ESCT",\n "valueDate" : "2022-08-14Z",\n "bookingDate" : "2022-08-14Z",\n "accountServicerRef" : "DLBB92WX",\n "batches" : [ {\n "batchTransactions" : [ {\n "amount" : "TESTKUDOS:18",\n "creditDebitIndicator" : "CRDT",\n "details" : {\n "debtor" : {\n "name" : "Name unknown"\n },\n "debtorAccount" : {\n "iban" : "DE729731"\n },\n "debtorAgent" : {\n "bic" : "SANDBOXX"\n },\n "endToEndId" : "NOTPROVIDED",\n "paymentInformationId" : "NOTPROVIDED",\n "unstructuredRemittanceInformation" : "K2V2B3YEMZFMWQ475KNV2HT7RSPA1YXFY210749MN9WBDCBT94AG"\n }\n } ]\n } ]\n}','\n',char(10)));
+CREATE TABLE PaymentInitiations (id INTEGER PRIMARY KEY AUTOINCREMENT, bankAccount BIGINT NOT NULL, preparationDate BIGINT NOT NULL, submissionDate BIGINT NULL, "sum" DECIMAL(20, 2) NOT NULL, currency TEXT NOT NULL, endToEndId TEXT NOT NULL, paymentInformationId TEXT NOT NULL, instructionId TEXT NOT NULL, subject TEXT NOT NULL, creditorIban TEXT NOT NULL, creditorBic TEXT NULL, creditorName TEXT NOT NULL, submitted BOOLEAN DEFAULT 0 NOT NULL, messageId TEXT NOT NULL, rawConfirmation BIGINT NULL, CONSTRAINT fk_PaymentInitiations_bankAccount_id FOREIGN KEY (bankAccount) REFERENCES NexusBankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_PaymentInitiations_rawConfirmation_id FOREIGN KEY (rawConfirmation) REFERENCES NexusBankTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE NexusEbicsSubscribers (id INTEGER PRIMARY KEY AUTOINCREMENT, ebicsURL TEXT NOT NULL, hostID TEXT NOT NULL, partnerID TEXT NOT NULL, userID TEXT NOT NULL, systemID TEXT NULL, signaturePrivateKey BLOB NOT NULL, encryptionPrivateKey BLOB NOT NULL, authenticationPrivateKey BLOB NOT NULL, bankEncryptionPublicKey BLOB NULL, bankAuthenticationPublicKey BLOB NULL, nexusBankConnection BIGINT NOT NULL, ebicsIniState VARCHAR(16) NOT NULL, ebicsHiaState VARCHAR(16) NOT NULL, CONSTRAINT fk_NexusEbicsSubscribers_nexusBankConnection_id FOREIGN KEY (nexusBankConnection) REFERENCES NexusBankConnections(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO NexusEbicsSubscribers VALUES(1,'http://localhost:18082/ebicsweb','talerebics','talerpartner','exchangeebics',NULL,X'308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100a03098ff00d2f1d4f9ef23e8c29e687c9d206404605896c548793a0fd6ad563bcd256524b3ca2816c1df50252b3a413c8ee1781cfcaf06cfea4adc64b4a895768b2ef25fe38011364e5b8198a4aa0a517a64bf01a798ddb1200439990e13e4cb3c82d79b8ece3f725e0d81053d5a31befdeb6e2841dc0a5404aaf31d7b9ce5398d97f362a531d2a4b199669072bed882bd10fb354b45416544d975a5cbde40c000ebcac8a6038ba921a46a69e3b9dc87c7ae8e5a4805b45f08e25b6e76f746ed82a86f5ae10ac5b4107722119e67db808508c73643b95b1855e45cfa9095ee7b07ffdd86486611eef5d581235fe5008a7e079f0897aa7103969926a9e76f239f020301000102820100401570ff82eae0c81cfca856f394bfa42a8fccb35b7fd541334f1c053e12b60ed27105577b7d8230287b17eae6b2356aee9610a1380d2522844e52810f2cea2e345c21a66eb2cb2ff884ef018bce62b659ca7807476f063157e798cb3c308535310dff0742480c65ca6e8890fa0c5d1e55229c3d0aabe68dda18318e37e77a63bb01c1768dbc9be48b9d805358862ae0035d74aade349aa9ce3856610f11e5ee3966f615ed159224629ab1c5a3cc1cb07cb6036e979b7b3fccf161e79619ddb5dfe6f6a50a930233a97cf2caa26ec676735a07e36b56f580e4c0400b3929fa51d7885b11530f060ecdf768a346b2c15c3e4476ee54869110cd061a9eee18dde102818100dffa28b59b6f7e0304d45389efd9981710afd8b742ce1e0756da8f1be3e2a9075ee651db9a3c47251155029b5de9090e4884772bb5de15421f442cc15d111c0bfae19eb16db8156625cb08da610b9bda781ccb388e531909bdb9f5f0735ed121d0e2df26b1f43ba7b9d78ca594a49bc59f694f77bd0d8d31907f60dc0910690902818100b717be36b3eb711cc9abf10e967cc79878344bfcc3d3deef4fad1bea89f681661c973315487064810c8cd6b4c9cc0e6ced1af95b1afda072a91f7e02e3de6f9fc30ea2c50d4e26861579114f8f71d6a6ad5d23e9ae08923e24db98d2ae2504468c2382a4bcb29f35998d21f27bcf1b9af205dbedeeb2f11123a878acfebb196702818100b62b89a0ec63aa625a33381f20ee223de05ca62fa82e6d4e1ade79377e0a84e071d7730ce24dd4afd9810335cb1417417ec9ff039650a389bc547ef266f7db9002e62f64b090e116cbf66fa4eef9ba31df2fcc3a9bc80abd598b3ef5eb605b48ddd5291b17f245f30dbcbbb0914db144f37b7c1f2fad2e01fa3d2052d72c79c1028180154635fce7350144a60e4b893565344ffc0f9f90b4346720097304de60bf7ad3a198d3ffb2161527858ccbd9dfe4ccfc4d24a83ab4cd299a891a36ab214d144d4cfde35de028e78306f5b5543847b2f855069088b3871d6f091b570b8bde933b9b46f9042944dc08ff598dcb3e2597808e84adc45ccb0005cccde38fbe5d811b02818005d64a2996a8decfed4e56984ca60b6852a8d5962d6f87a90b48c54989f9b07c549fa2eecb5954f6f40055404cf62c6cf5204ab55a3803ce5263068b25d46f4c3cd6c766eed9ffc03bf4b5f7fcaeff0647af27dd28896f63ebca820d53649c90fb0d19c7d88beaed67133e5e1dfaa09eb649b3bcff7fc0a88199e7a65ff402da',X'308204be020100300d06092a864886f70d0101010500048204a8308204a40201000282010100b0ceebf64877cd9a8f331caa9c24ea334e4afc1b9744aff9ea02b14d973f86018e00955e8e9e109fd6b55021e15adff4f224cf0c0736ed203fbf914dda8555f66ddb921bf2560637f6b3457a46bc2b83bea579fdc0e8254de0320bf6686c2571581e38ee204b7c366ee3299b683251596548d8944f8110613ddf2004770722c76f8ff1000c76dca6560d7725e9fe5fa6bb053db0bd567fe0831966fe2f5020aecc35d40154bd91275e0ca72c83b67b26b7dd597e3bf0ed83434ec87d107ad2fbdc4a0df2ecf974b5f0446d517a8bfce43e855b848f212d99ffa7c7590d7d8dfc93657b3ade490696f1e55bb8681009dd4403e13f9abe1dce30f24895fa7e0c99020301000102820100017e9e4c04acce9621e3c2b8467da16531a23ca357120392cf419a9217573820c73c8606b899e976107093eed562d945cece34d9db2dc1af661a8e75e405008706c2b6677a12f41681055eeefbae178813927e87809bf5c4c4c2678b7bb27e5688f228750adcd87df54e024a080574de9696990e17e5f5677d0867d2e1d6b39a8c5e49eb8e471a4ddcae02536a0b937d2f52b5eccf1c8e52af9946884b6b293fc40e7bdf5a40db014e3d75abf0e0b9cb02d5c37937da0873f7f7ba06a3eb3dcc1b6f616d0c87d6bf157e662d4320e4fcd317fffde0f7435cc45090b4e57f68dcc00c2af7b8ffd837fdcff124e80e5d684721b1dbc0a88d5add1e5f25a3ad7a0102818100edf52e9138afb895a59ecb0a98d208c8b04ded15132550bf46c86eb61139b87a8635bd0f4df060fa0194bd90e414dc7b9d972870394b16d00c93251f5cc64e8bbdee6d72d77b8c074fc8fe2845cadbc836b5f542d7028015c1df56c6e7a2ad27a7918cb5d95fc18b969b21d69684ec674cebc1b3253312e40f3303d3300b83b902818100be36d05e19b63c928b863c8be5828107414a9bb0712f98d6699e8a8083ffeb02b02aa292c6efb9ce84c76ef7c9d5fd0e9fec6720ce50ac2fc8e53ac3635b009484415a1046fcdb512c45fbcb428b790982589a11380de407a00e34bf56b20c31d7fee640a4fee327fdfa4dd27a1511263c6bc44f395482679a3eaf09927affe1028180595fd870b4f0d30c69db5d798a7280d817d7fcef0874e082272ccae05951eba7215777be12d0f12b95826f3cc75dca7e276f89c1b4d32e2b503dc818a278dd318151d70be6414213d0f4b5f91c5597fcf80799a9d425dd43cec07ad05459f65d4983d26ccecb375f9d5e80f41f2ea7b818dd07b0a88d29503d213513921d110902818100b9dd09c1c951fee21b1fb1ede8f79a68a26deaaf8009c8484ab03619d9e1a99bd8d3f04387cc1b3d271550e322ffcbe40c748d58cb009d1f9c28114176c6274cf7e67bc0c7fcafb9238fc6b8186ffc77443c9b5f13ecced27c9d25018a0f3447480db4a39a15cd94f8612ac5edb0c42f1e7f17356a899f5ae8a7339620e1bb4102818100c303637b559ae4d14e22edf46730a6af3fe48489fef315703684f985c4dbe4fa00162a47c06a91484966a99933676de2fdfb1db87bb83cfdf2c4468be2ebc32171132ea079f8b355b1f8256f4c29a1e509661e692031e330daa73141507181994a7887cf8cbc25a32b68ca001320d097f50a842e4707bb214e0133d72e1ebc29',X'308204bc020100300d06092a864886f70d0101010500048204a6308204a2020100028201010080f109291d50ac1d186bc40584f8a2115d736d7ad311bd4f62a0f83e6bd49b847a6d8875d5f9e1bf4055cabefd619fee55cf21723799d2415018ac98275716c67ec6fb51f88fa4ca09c1bd710f16c7c2a09c4d5bac2666bede0325655a409d4a08cee6221be791984c65985d434bb2ca10603c84237633ba5d32c4220d2f0ef7c25b94c18edbe30a55da170531b3b1edfac012dea78696981a3967e9dfae10006dc0f8ce1f8af3c6e99ba57e1c30118ca90b43aea96a49df16169163b21274a6ce568e306b15da4b95720ab58ebdd2bb618cc5330b5c969b4ab57cee55e1413012d305ce8c1a16aa938e5940d5daca716408f8a0ff0c2da516baed034cbbfde10203010001028201001135198ddd15a9027101e0b503dbd27512cd96acaf824c8b4d9441ccc2c32ac5f138b0df58e0f2197dd2752e2bce5d73870c0f6098bef46a36f034085227b328663ed3c74aae90c54dac074611476efd3045eba4f24265afcf1d085e903ed33ed0121c702cdd2876f4ab123c5000c829632a14a965ba1e891e6ae9f5c960a0548ba0f8c80fc0b44b2bcbfd7cb262faebcc48a1dd3087168e8ad688d81d1db2648a67827d7d6d19bbe2716cab80ee519f6df12a2717e1a72e1159a74ff99ab33bccf6457d00b311f4ce16c10dea334d6acdb49d17c3354c0bc09f76e0d67d889625b5bb88f54236e3f100a8175a0559b7313dca7c077137eb12a393f16b0a51e102818100b94d3e1b3c8fe822780894d402abc0bdb047e3ac6d61a472d1c97b29a1f5aedd285c13ef27bd96658a064f68d7834971912d9d44afcac8210b82d7be22959f1ec9bcdd35ca22b3be1fbf5e3a692083c34ad8fd4f9b3841ec6b7bdfe8a91c5d2029ec514e00d0a32795b4ea26f9f7e5bca01179384c27cfb87e5da67f14720b3502818100b222fdd00bac834f5d496bed29a79a956a20a9426e78cdaf75218c32a1a7c4a68e28bf063163aa0a5151ce4c99ea77bc80edfaf08f5966f05003cfd83aef41e04ac9f9795d55300a359bc0309663303b60c614aeeafd12534b5093789c03f772d5e0fd7b8b7c9c9a5a44a63019eb54bcdfebae30447276f8a368d97be0d6117d02818077010576e681213b29cd910f4b9bd44fbe6b9ceb3ae02f85d1f74c92e341ee8878081281500b71104b015c745f9c2049c04c04297da084c0bc2cceb37c708cdd70004c2ce4613f0046515789b9c438faee11c7351de1966ce86688d959ea2e609eabf7575a2ca3eba338a9fc5822fdb71331c5a1033fba26a9792999899ee85502818072abebcf9d74342346de18c7d6e4b9b22d5b511a1e9b4d6d016dd31e54c9f6e170e9f1ee3ea4f5b5269c0ebd68e772a4ba2a783b9b4be5e414de1f5206be361df887043d88436a65681517272fe832084747bbd0ce1c934b63543f5a88b454fa6b8c2620fdadfdf1aee23a4904a6652a20cb4a9a6fb56fb8a718bbc7eef85ed102818064df3f7c47baa50d894fefc0d712cb71579112d773bebfa89b01bee826800c0faf6307d5237adf7a2e12deff9968cc598e58e88298892d6b2051d9639377b36d765434136cea010e4b61a13eef486308e250f901c59ac9e6de8e14bcb34db3aa42918f98f24e8f5ecf882c7ba3814ae6fe5352ac009481239df40fde5e76db27',X'30820122300d06092a864886f70d01010105000382010f003082010a0282010100a07146544ea9da3cad747f447799c166c54df89d908f65dbc5c9c509ce92427aa31a1f386d59adb8bbcc0e6272cc628c0b53e67efc853d93855bd058f1bc659e8c9cd67f52bb13b3008bc677763c9278ce6b1c76972e8ce2d3eecf0b408aa8fdc0615b680ba491f91ae9349072dbfa969cb007846e4282daebb0cbc9283cb6b4746a9da6824de3a09b486182d689cac024b6b5749f6d77b660f3aaa708c83a7534bc55e33298c0a59efa02db44438c4fa573f85921fa80e2e9bad798b3cbf8f965672d6a16219059e6bf6bfc78a7a6fb634922a7739aaf0a336466ddde78952639e54a0565ac71dee8d4fbef9a62be4c1ffe70df8da4e1b979bcc717d0826b010203010001',X'30820122300d06092a864886f70d01010105000382010f003082010a02820101009db344205a0a1da5925bce9ac63141e3df90bf37f9b48472d3ba9095ae5c471f6a4f3f2c662a2f76fb82e1c1c6f47c85db29df664cf629fb7c028b65a20b9632abda20a15fc1480cc40c0d35f252197b80cf3592f90891791fa9a9fd385043319f5bd904d4e14b4a3e1d4a21fa74e0f3b6a8d45a8016677a22dec34ae9c8659bfbfa65e04a30c4337699044f340995a6e6bc2003f1126e2c8cb1274bde543753cf7cc0fd643b4c3f9fa13e609b0ea0b6bda537209b1555eda704c98109aaaf4c9696b7ac5daefa8521ce5465bf791fab73012c053c9e3b11583cb7a3035f6c222a56e750425a7fca673e88fe893c53cfb907420e243a95fb858f84a4b8247d210203010001',1,'SENT','SENT');
+CREATE TABLE NexusBankBalances (id INTEGER PRIMARY KEY AUTOINCREMENT, balance TEXT NOT NULL, creditDebitIndicator TEXT NOT NULL, bankAccount BIGINT NOT NULL, "date" TEXT NOT NULL, CONSTRAINT fk_NexusBankBalances_bankAccount_id FOREIGN KEY (bankAccount) REFERENCES NexusBankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE AnastasisIncomingPayments (id INTEGER PRIMARY KEY AUTOINCREMENT, payment BIGINT NOT NULL, subject TEXT NOT NULL, timestampMs BIGINT NOT NULL, incomingPaytoUri TEXT NOT NULL, CONSTRAINT fk_AnastasisIncomingPayments_payment_id FOREIGN KEY (payment) REFERENCES NexusBankTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE TalerIncomingPayments (id INTEGER PRIMARY KEY AUTOINCREMENT, payment BIGINT NOT NULL, reservePublicKey TEXT NOT NULL, timestampMs BIGINT NOT NULL, incomingPaytoUri TEXT NOT NULL, CONSTRAINT fk_TalerIncomingPayments_payment_id FOREIGN KEY (payment) REFERENCES NexusBankTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO TalerIncomingPayments VALUES(1,1,'HTW6DPCWEB0QCYAZ7ZTD89N17AMYR7BCRY06R727YNNJ47Q4GTHG',1660496840600,'payto://iban/SANDBOXX/DE729925?receiver-name=Name+unknown');
+INSERT INTO TalerIncomingPayments VALUES(2,2,'K2V2B3YEMZFMWQ475KNV2HT7RSPA1YXFY210749MN9WBDCBT94AG',1660496847228,'payto://iban/SANDBOXX/DE729731?receiver-name=Name+unknown');
+CREATE TABLE Facades (id INTEGER PRIMARY KEY AUTOINCREMENT, facadeName TEXT NOT NULL, "type" TEXT NOT NULL, creator BIGINT NOT NULL, CONSTRAINT fk_Facades_creator_id FOREIGN KEY (creator) REFERENCES NexusUsers(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO Facades VALUES(1,'test-facade','taler-wire-gateway',1);
+CREATE TABLE TalerRequestedPayments (id INTEGER PRIMARY KEY AUTOINCREMENT, facade BIGINT NOT NULL, payment BIGINT NOT NULL, requestUid TEXT NOT NULL, amount TEXT NOT NULL, exchangeBaseUrl TEXT NOT NULL, wtid TEXT NOT NULL, creditAccount TEXT NOT NULL, CONSTRAINT fk_TalerRequestedPayments_facade_id FOREIGN KEY (facade) REFERENCES Facades(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_TalerRequestedPayments_payment_id FOREIGN KEY (payment) REFERENCES PaymentInitiations(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE FacadeState (id INTEGER PRIMARY KEY AUTOINCREMENT, bankAccount TEXT NOT NULL, bankConnection TEXT NOT NULL, currency TEXT NOT NULL, reserveTransferLevel TEXT NOT NULL, facade BIGINT NOT NULL, highestSeenMessageSerialId BIGINT DEFAULT 0 NOT NULL, CONSTRAINT fk_FacadeState_facade_id FOREIGN KEY (facade) REFERENCES Facades(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO FacadeState VALUES(1,'exchange-nexus','talerconn','TESTKUDOS','UNUSED',1,2);
+CREATE TABLE TalerInvalidIncomingPayments (id INTEGER PRIMARY KEY AUTOINCREMENT, payment BIGINT NOT NULL, timestampMs BIGINT NOT NULL, refunded BOOLEAN DEFAULT 0 NOT NULL, CONSTRAINT fk_TalerInvalidIncomingPayments_payment_id FOREIGN KEY (payment) REFERENCES NexusBankTransactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+CREATE TABLE NexusBankMessages (id INTEGER PRIMARY KEY AUTOINCREMENT, bankConnection BIGINT NOT NULL, messageId TEXT NOT NULL, code TEXT NOT NULL, message BLOB NOT NULL, errors BOOLEAN DEFAULT 0 NOT NULL, CONSTRAINT fk_NexusBankMessages_bankConnection_id FOREIGN KEY (bankConnection) REFERENCES NexusBankConnections(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO NexusBankMessages VALUES(1,1,'sandbox-1660496829108','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363832393130383c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a30392e3130383535345a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a30392e3130383535345a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(2,1,'sandbox-1660496831480','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363833313438303c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31312e3438303730375a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31312e3438303730375a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(3,1,'sandbox-1660496833707','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363833333730373c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31332e3730373839325a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31332e3730373839325a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(4,1,'sandbox-1660496835920','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363833353932303c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31352e3932303532395a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31352e3932303532395a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(5,1,'sandbox-1660496838119','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363833383131393c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31382e3131393832325a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a31382e3131393832325a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(6,1,'sandbox-1660496840341','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363834303334313c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32302e3334313936365a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32302e3334313936365a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(7,1,'sandbox-1660496842676','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363834323637363c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32322e3637363138325a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32322e3637363138325a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(8,1,'sandbox-1660496844874','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363834343837343c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32342e3837343039335a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32342e3837343039335a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(9,1,'sandbox-1660496847050','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363834373035303c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32372e3035303630345a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32372e3035303630345a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e32383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e444c4242393257583c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393733313c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4b325632423359454d5a464d57513437354b4e56324854375253504131595846593231303734394d4e39574244434254393441473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(10,1,'sandbox-1660496849291','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363834393239313c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32392e3239313633385a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a32392e3239313633385a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e32383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e444c4242393257583c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393733313c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4b325632423359454d5a464d57513437354b4e56324854375253504131595846593231303734394d4e39574244434254393441473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(11,1,'sandbox-1660496851469','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363835313436393c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33312e3436393236315a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33312e3436393236315a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e32383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e444c4242393257583c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393733313c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4b325632423359454d5a464d57513437354b4e56324854375253504131595846593231303734394d4e39574244434254393441473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(12,1,'sandbox-1660496853634','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363835333633343c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33332e3633343034375a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33332e3633343034375a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e32383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e444c4242393257583c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393733313c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4b325632423359454d5a464d57513437354b4e56324854375253504131595846593231303734394d4e39574244434254393441473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(13,1,'sandbox-1660496855791','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363835353739313c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33352e3739313034345a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33352e3739313034345a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e32383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e444c4242393257583c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393733313c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4b325632423359454d5a464d57513437354b4e56324854375253504131595846593231303734394d4e39574244434254393441473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+INSERT INTO NexusBankMessages VALUES(14,1,'sandbox-1660496857946','C52',X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0a3c446f63756d656e7420786d6c6e733d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322220786d6c6e733a7873693d22687474703a2f2f7777772e77332e6f72672f323030312f584d4c536368656d612d696e7374616e636522207873693a736368656d614c6f636174696f6e3d2275726e3a69736f3a7374643a69736f3a32303032323a746563683a7873643a63616d742e3035322e3030312e30322063616d742e3035322e3030312e30322e787364223e0a20203c426b546f4373746d72416363745270743e0a202020203c4772704864723e0a2020202020203c4d736749643e73616e64626f782d313636303439363835373934363c2f4d736749643e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33372e3934363836335a3c2f4372654474546d3e0a202020203c2f4772704864723e0a202020203c5270743e0a2020202020203c49643e303c2f49643e0a2020202020203c456c6374726e635365714e623e303c2f456c6374726e635365714e623e0a2020202020203c4c676c5365714e623e303c2f4c676c5365714e623e0a2020202020203c4372654474546d3e323032322d30382d31345431373a30373a33372e3934363836335a3c2f4372654474546d3e0a2020202020203c416363743e0a20202020202020203c49643e0a202020202020202020203c4942414e3e44453531343837313c2f4942414e3e0a20202020202020203c2f49643e0a20202020202020203c4363793e544553544b55444f533c2f4363793e0a20202020202020203c4f776e723e0a202020202020202020203c4e6d3e44656269746f722f4f776e6572204e616d653c2f4e6d3e0a20202020202020203c2f4f776e723e0a20202020202020203c537663723e0a202020202020202020203c46696e496e73746e49643e0a2020202020202020202020203c4e6d3e4c6962657566696e2042616e6b3c2f4e6d3e0a2020202020202020202020203c4f7468723e0a20202020202020202020202020203c49643e303c2f49643e0a20202020202020202020202020203c497373723e58593c2f497373723e0a2020202020202020202020203c2f4f7468723e0a202020202020202020203c2f46696e496e73746e49643e0a20202020202020203c2f537663723e0a2020202020203c2f416363743e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e505243443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c42616c3e0a20202020202020203c54703e0a202020202020202020203c43644f7250727472793e0a2020202020202020202020203c43643e434c42443c2f43643e0a202020202020202020203c2f43644f7250727472793e0a20202020202020203c2f54703e0a20202020202020203c416d74204363793d22544553544b55444f53223e32383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f44743e0a2020202020203c2f42616c3e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e4c574132314147323c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31303c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393932353c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4854573644504357454230514359415a375a544438394e3137414d59523742435259303652373237594e4e4a34375134475448473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a2020202020203c4e7472793e0a20202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020203c436474446274496e643e435244543c2f436474446274496e643e0a20202020202020203c5374733e424f4f4b3c2f5374733e0a20202020202020203c426f6f6b6744743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f426f6f6b6744743e0a20202020202020203c56616c44743e0a202020202020202020203c44743e323032322d30382d31345a3c2f44743e0a20202020202020203c2f56616c44743e0a20202020202020203c41636374537663725265663e444c4242393257583c2f41636374537663725265663e0a20202020202020203c426b547843643e0a202020202020202020203c446f6d6e3e0a2020202020202020202020203c43643e504d4e543c2f43643e0a2020202020202020202020203c466d6c793e0a20202020202020202020202020203c43643e494344543c2f43643e0a20202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a2020202020202020202020203c2f466d6c793e0a202020202020202020203c2f446f6d6e3e0a202020202020202020203c50727472793e0a2020202020202020202020203c43643e303c2f43643e0a2020202020202020202020203c497373723e58593c2f497373723e0a202020202020202020203c2f50727472793e0a20202020202020203c2f426b547843643e0a20202020202020203c4e74727944746c733e0a202020202020202020203c547844746c733e0a2020202020202020202020203c526566733e0a20202020202020202020202020203c4d736749643e4e4f5450524f56494445443c2f4d736749643e0a20202020202020202020202020203c506d74496e6649643e4e4f5450524f56494445443c2f506d74496e6649643e0a20202020202020202020202020203c456e64546f456e6449643e4e4f5450524f56494445443c2f456e64546f456e6449643e0a2020202020202020202020203c2f526566733e0a2020202020202020202020203c416d7444746c733e0a20202020202020202020202020203c5478416d743e0a202020202020202020202020202020203c416d74204363793d22544553544b55444f53223e31383c2f416d743e0a20202020202020202020202020203c2f5478416d743e0a2020202020202020202020203c2f416d7444746c733e0a2020202020202020202020203c426b547843643e0a20202020202020202020202020203c446f6d6e3e0a202020202020202020202020202020203c43643e504d4e543c2f43643e0a202020202020202020202020202020203c466d6c793e0a2020202020202020202020202020202020203c43643e494344543c2f43643e0a2020202020202020202020202020202020203c537562466d6c7943643e455343543c2f537562466d6c7943643e0a202020202020202020202020202020203c2f466d6c793e0a20202020202020202020202020203c2f446f6d6e3e0a20202020202020202020202020203c50727472793e0a202020202020202020202020202020203c43643e303c2f43643e0a202020202020202020202020202020203c497373723e58593c2f497373723e0a20202020202020202020202020203c2f50727472793e0a2020202020202020202020203c2f426b547843643e0a2020202020202020202020203c526c746450746965733e0a20202020202020202020202020203c446274723e0a202020202020202020202020202020203c4e6d3e4e616d6520756e6b6e6f776e3c2f4e6d3e0a20202020202020202020202020203c2f446274723e0a20202020202020202020202020203c44627472416363743e0a202020202020202020202020202020203c49643e0a2020202020202020202020202020202020203c4942414e3e44453732393733313c2f4942414e3e0a202020202020202020202020202020203c2f49643e0a20202020202020202020202020203c2f44627472416363743e0a2020202020202020202020203c2f526c746450746965733e0a2020202020202020202020203c526c7464416774733e0a20202020202020202020202020203c446274724167743e0a202020202020202020202020202020203c46696e496e73746e49643e0a2020202020202020202020202020202020203c4249433e53414e44424f58583c2f4249433e0a202020202020202020202020202020203c2f46696e496e73746e49643e0a20202020202020202020202020203c2f446274724167743e0a2020202020202020202020203c2f526c7464416774733e0a2020202020202020202020203c526d74496e663e0a20202020202020202020202020203c55737472643e4b325632423359454d5a464d57513437354b4e56324854375253504131595846593231303734394d4e39574244434254393441473c2f55737472643e0a2020202020202020202020203c2f526d74496e663e0a202020202020202020203c2f547844746c733e0a20202020202020203c2f4e74727944746c733e0a2020202020203c2f4e7472793e0a202020203c2f5270743e0a20203c2f426b546f4373746d72416363745270743e0a3c2f446f63756d656e743e',0);
+CREATE TABLE OfferedBankAccounts (id INTEGER PRIMARY KEY AUTOINCREMENT, offeredAccountId TEXT NOT NULL, bankConnection BIGINT NOT NULL, iban TEXT NOT NULL, bankCode TEXT NOT NULL, holderName TEXT NOT NULL, imported BIGINT NULL, CONSTRAINT fk_OfferedBankAccounts_bankConnection_id FOREIGN KEY (bankConnection) REFERENCES NexusBankConnections(id) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT fk_OfferedBankAccounts_imported_id FOREIGN KEY (imported) REFERENCES NexusBankAccounts(id) ON DELETE RESTRICT ON UPDATE RESTRICT);
+INSERT INTO OfferedBankAccounts VALUES(1,'exchange',1,'DE514871','SANDBOXX','Account Holder',1);
+CREATE TABLE NexusPermissions (id INTEGER PRIMARY KEY AUTOINCREMENT, resourceType TEXT NOT NULL, resourceId TEXT NOT NULL, subjectType TEXT NOT NULL, subjectName TEXT NOT NULL, permissionName TEXT NOT NULL);
+DELETE FROM sqlite_sequence;
+INSERT INTO sqlite_sequence VALUES('DemobankConfigs',1);
+INSERT INTO sqlite_sequence VALUES('BankAccounts',10);
+INSERT INTO sqlite_sequence VALUES('DemobankCustomers',9);
+INSERT INTO sqlite_sequence VALUES('EbicsHosts',1);
+INSERT INTO sqlite_sequence VALUES('EbicsSubscribers',1);
+INSERT INTO sqlite_sequence VALUES('NexusUsers',1);
+INSERT INTO sqlite_sequence VALUES('NexusBankConnections',1);
+INSERT INTO sqlite_sequence VALUES('NexusEbicsSubscribers',1);
+INSERT INTO sqlite_sequence VALUES('EbicsSubscriberPublicKeys',3);
+INSERT INTO sqlite_sequence VALUES('OfferedBankAccounts',1);
+INSERT INTO sqlite_sequence VALUES('NexusBankAccounts',1);
+INSERT INTO sqlite_sequence VALUES('NexusScheduledTasks',2);
+INSERT INTO sqlite_sequence VALUES('Facades',1);
+INSERT INTO sqlite_sequence VALUES('FacadeState',1);
+INSERT INTO sqlite_sequence VALUES('NexusBankMessages',14);
+INSERT INTO sqlite_sequence VALUES('TalerWithdrawals',2);
+INSERT INTO sqlite_sequence VALUES('BankAccountTransactions',4);
+INSERT INTO sqlite_sequence VALUES('BankAccountFreshTransactions',4);
+INSERT INTO sqlite_sequence VALUES('NexusBankTransactions',2);
+INSERT INTO sqlite_sequence VALUES('TalerIncomingPayments',2);
+CREATE UNIQUE INDEX accountLabelIndex ON BankAccounts (label);
+CREATE UNIQUE INDEX NexusBankAccounts_bankAccountId ON NexusBankAccounts (bankAccountId);
+CREATE UNIQUE INDEX Facades_facadeName ON Facades (facadeName);
+CREATE UNIQUE INDEX OfferedBankAccounts_offeredAccountId_bankConnection ON OfferedBankAccounts (offeredAccountId, bankConnection);
+CREATE UNIQUE INDEX NexusPermissions_resourceType_resourceId_subjectType_subjectName_permissionName ON NexusPermissions (resourceType, resourceId, subjectType, subjectName, permissionName);
+COMMIT;
diff --git a/src/auditor/auditor-basedb.age b/src/auditor/auditor-basedb.age
index 18fdb08e..e704d4b5 100644
--- a/src/auditor/auditor-basedb.age
+++ b/src/auditor/auditor-basedb.age
@@ -1 +1 @@
-1651516353
+1660496859
diff --git a/src/auditor/auditor-basedb.conf b/src/auditor/auditor-basedb.conf
index a67f2bf1..5e3942a5 100644
--- a/src/auditor/auditor-basedb.conf
+++ b/src/auditor/auditor-basedb.conf
@@ -1,139 +1,139 @@
-[arm]
-CONFIG = /research/taler/exchange/src/auditor/auditor-basedb.conf
+[instance-default]
+KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv
+NAME = Merchant Inc.
-[benchmark]
-MERCHANT_DETAILS = merchant_details.json
-BANK_DETAILS = bank_details.json
+[exchange-account-1]
+PAYTO_URI = payto://iban/SANDBOXX/DE514871?receiver-name=Exchange+Company
+enable_debit = yes
+enable_credit = yes
-[coin_kudos_10]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.01
-fee_withdraw = TESTKUDOS:0.01
-duration_legal = 3 years
-duration_spend = 2 years
-duration_withdraw = 7 days
-value = TESTKUDOS:10
+[exchange-accountcredentials-1]
+WIRE_GATEWAY_URL = http://localhost:8082/facades/test-facade/taler-wire-gateway/
+WIRE_GATEWAY_AUTH_METHOD = basic
+USERNAME = exchange
+PASSWORD = x
-[coin_kudos_8]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.04
-fee_refresh = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.02
-fee_withdraw = TESTKUDOS:0.05
-duration_legal = 3 years
-duration_spend = 2 years
-duration_withdraw = 7 days
-value = TESTKUDOS:8
+[merchant-account-merchant]
+PAYTO_URI = payto://x-taler-bank/localhost/42
+HONOR_default = YES
+ACTIVE_default = YES
-[coin_kudos_5]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.01
-fee_withdraw = TESTKUDOS:0.01
-duration_legal = 3 years
-duration_spend = 2 years
-duration_withdraw = 7 days
-value = TESTKUDOS:5
+[merchant-exchange-default]
+MASTER_KEY = 8PZ0QC89YREAFB9TAM2SK8NRA9G2RMXA4Q814N0RX3Y8DQ64H0G0
+EXCHANGE_BASE_URL = http://localhost:8081/
+CURRENCY = TESTKUDOS
-[coin_kudos_4]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.02
-fee_refresh = TESTKUDOS:0.04
-fee_deposit = TESTKUDOS:0.03
-fee_withdraw = TESTKUDOS:0.03
-duration_legal = 3 years
-duration_spend = 2 years
-duration_withdraw = 7 days
-value = TESTKUDOS:4
+[payments-generator]
+currency = TESTKUDOS
+instance = default
+bank = http://localhost:8082/
+merchant = http://localhost:9966/
+exchange_admin = http://localhost:18080/
+exchange-admin = http://localhost:18080/
+exchange = http://localhost:8081/
-[coin_kudos_2]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.02
-fee_refresh = TESTKUDOS:0.04
-fee_deposit = TESTKUDOS:0.03
-fee_withdraw = TESTKUDOS:0.03
-duration_legal = 3 years
-duration_spend = 2 years
+[coin_kudos_ct_1]
+value = TESTKUDOS:0.01
duration_withdraw = 7 days
-value = TESTKUDOS:2
-
-[coin_kudos_1]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.02
-fee_withdraw = TESTKUDOS:0.02
-duration_legal = 3 years
duration_spend = 2 years
-duration_withdraw = 7 days
-value = TESTKUDOS:1
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.01
+fee_deposit = TESTKUDOS:0.01
+fee_refresh = TESTKUDOS:0.01
+fee_refund = TESTKUDOS:0.01
+CIPHER = RSA
+rsa_keysize = 1024
[coin_kudos_ct_10]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_deposit = TESTKUDOS:0.01
-fee_withdraw = TESTKUDOS:0.01
-duration_legal = 3 years
-duration_spend = 2 years
-duration_withdraw = 7 days
value = TESTKUDOS:0.10
-
-[coin_kudos_ct_1]
-rsa_keysize = 1024
-CIPHER = RSA
-fee_refund = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.01
-fee_deposit = TESTKUDOS:0.01
-fee_withdraw = TESTKUDOS:0.01
+duration_withdraw = 7 days
+duration_spend = 2 years
duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.01
+fee_deposit = TESTKUDOS:0.01
+fee_refresh = TESTKUDOS:0.03
+fee_refund = TESTKUDOS:0.01
+CIPHER = RSA
+rsa_keysize = 1024
+
+[coin_kudos_1]
+value = TESTKUDOS:1
+duration_withdraw = 7 days
duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.02
+fee_deposit = TESTKUDOS:0.02
+fee_refresh = TESTKUDOS:0.03
+fee_refund = TESTKUDOS:0.01
+CIPHER = RSA
+rsa_keysize = 1024
+
+[coin_kudos_2]
+value = TESTKUDOS:2
duration_withdraw = 7 days
-value = TESTKUDOS:0.01
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.03
+fee_deposit = TESTKUDOS:0.03
+fee_refresh = TESTKUDOS:0.04
+fee_refund = TESTKUDOS:0.02
+CIPHER = RSA
+rsa_keysize = 1024
-[payments-generator]
-exchange = http://localhost:8081/
-exchange-admin = http://localhost:18080/
-exchange_admin = http://localhost:18080/
-merchant = http://localhost:9966/
-bank = http://localhost:8082/
-instance = default
-currency = TESTKUDOS
+[coin_kudos_4]
+value = TESTKUDOS:4
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.03
+fee_deposit = TESTKUDOS:0.03
+fee_refresh = TESTKUDOS:0.04
+fee_refund = TESTKUDOS:0.02
+CIPHER = RSA
+rsa_keysize = 1024
-[merchant-exchange-default]
-CURRENCY = TESTKUDOS
-EXCHANGE_BASE_URL = http://localhost:8081/
-MASTER_KEY = W2824S2YNKFZDR0P57Q005J23XGFWSE2GB24A1YS0157NE3F24NG
+[coin_kudos_5]
+value = TESTKUDOS:5
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.01
+fee_deposit = TESTKUDOS:0.01
+fee_refresh = TESTKUDOS:0.03
+fee_refund = TESTKUDOS:0.01
+CIPHER = RSA
+rsa_keysize = 1024
-[merchant-account-merchant]
-ACTIVE_default = YES
-HONOR_default = YES
-PAYTO_URI = payto://x-taler-bank/localhost/42
+[coin_kudos_8]
+value = TESTKUDOS:8
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.05
+fee_deposit = TESTKUDOS:0.02
+fee_refresh = TESTKUDOS:0.03
+fee_refund = TESTKUDOS:0.04
+CIPHER = RSA
+rsa_keysize = 1024
-[exchange-accountcredentials-1]
-PASSWORD = x
-USERNAME = Exchange
-WIRE_GATEWAY_AUTH_METHOD = basic
-WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
+[coin_kudos_10]
+value = TESTKUDOS:10
+duration_withdraw = 7 days
+duration_spend = 2 years
+duration_legal = 3 years
+fee_withdraw = TESTKUDOS:0.01
+fee_deposit = TESTKUDOS:0.01
+fee_refresh = TESTKUDOS:0.03
+fee_refund = TESTKUDOS:0.01
+CIPHER = RSA
+rsa_keysize = 1024
-[exchange-account-1]
-enable_credit = yes
-enable_debit = yes
-PAYTO_URI = payto://x-taler-bank/localhost/Exchange
+[benchmark]
+BANK_DETAILS = bank_details.json
+MERCHANT_DETAILS = merchant_details.json
-[instance-default]
-NAME = Merchant Inc.
-KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv
+[arm]
+CONFIG = /research/taler/exchange/src/auditor/auditor-basedb.conf
[taler]
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
@@ -143,10 +143,10 @@ CURRENCY = TESTKUDOS
CONFIG = postgres:///auditor-basedb
[merchant]
-DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
-KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
-DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
WIREFORMAT = default
+DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
+KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
+DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
WIRE_TRANSFER_DELAY = 1 minute
FORCE_AUDIT = YES
UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
@@ -155,18 +155,18 @@ UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
CONFIG = postgres:///auditor-basedb
[exchange]
-LOOKAHEAD_SIGN = 32 weeks 1 day
+MASTER_PUBLIC_KEY = 8PZ0QC89YREAFB9TAM2SK8NRA9G2RMXA4Q814N0RX3Y8DQ64H0G0
SIGNKEY_DURATION = 4 weeks
-MASTER_PUBLIC_KEY = W2824S2YNKFZDR0P57Q005J23XGFWSE2GB24A1YS0157NE3F24NG
+LOOKAHEAD_SIGN = 32 weeks 1 day
SIGNKEY_LEGAL_DURATION = 4 weeks
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
[bank]
-SERVE = http
-ALLOW_REGISTRATIONS = YES
-SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
-SUGGESTED_EXCHANGE = http://localhost:8081/
HTTP_PORT = 8082
+SUGGESTED_EXCHANGE = http://localhost:8081/
+SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
+ALLOW_REGISTRATIONS = YES
+SERVE = http
MAX_DEBT_BANK = TESTKUDOS:100000.0
MAX_DEBT = TESTKUDOS:50.0
DATABASE = postgres:///auditor-basedb
@@ -175,9 +175,9 @@ DATABASE = postgres:///auditor-basedb
CONFIG = postgres:///auditor-basedb
[auditor]
-PUBLIC_KEY = MSF4QDJMZTT9CC5EMHS480F652QAS40SEXEPAW0GGB9G9RB9B5T0
-TINY_AMOUNT = TESTKUDOS:0.01
BASE_URL = http://localhost:8083/
+TINY_AMOUNT = TESTKUDOS:0.01
+PUBLIC_KEY = 41SE6QAX583WXH9BD77YMXJ46DDZRK4Z3FA2H2Y5CH8XD2H547AG
[PATHS]
TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
diff --git a/src/auditor/auditor-basedb.fees b/src/auditor/auditor-basedb.fees
deleted file mode 100644
index ef2a6d12..00000000
--- a/src/auditor/auditor-basedb.fees
+++ /dev/null
Binary files differ
diff --git a/src/auditor/auditor-basedb.mpub b/src/auditor/auditor-basedb.mpub
index efa2b454..5dc24b54 100644
--- a/src/auditor/auditor-basedb.mpub
+++ b/src/auditor/auditor-basedb.mpub
@@ -1 +1 @@
-NYBEPNN9Z5C6ZKM4BTD7TWRD9EBE6TE2YE12STA6GJHBP4HVQCYG
+8PZ0QC89YREAFB9TAM2SK8NRA9G2RMXA4Q814N0RX3Y8DQ64H0G0
diff --git a/src/auditor/auditor-basedb.sql b/src/auditor/auditor-basedb.sql
index e2b83be6..e60a1e0c 100644
--- a/src/auditor/auditor-basedb.sql
+++ b/src/auditor/auditor-basedb.sql
@@ -2,8 +2,8 @@
-- PostgreSQL database dump
--
--- Dumped from database version 13.5 (Debian 13.5-0+deb11u1)
--- Dumped by pg_dump version 13.5 (Debian 13.5-0+deb11u1)
+-- Dumped from database version 13.7 (Debian 13.7-0+deb11u1)
+-- Dumped by pg_dump version 13.7 (Debian 13.7-0+deb11u1)
SET statement_timeout = 0;
SET lock_timeout = 0;
@@ -31,6 +31,48 @@ COMMENT ON SCHEMA _v IS 'Schema for versioning data and functionality.';
--
+-- Name: auditor; Type: SCHEMA; Schema: -; Owner: -
+--
+
+CREATE SCHEMA auditor;
+
+
+--
+-- Name: SCHEMA auditor; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON SCHEMA auditor IS 'taler-auditor data';
+
+
+--
+-- Name: exchange; Type: SCHEMA; Schema: -; Owner: -
+--
+
+CREATE SCHEMA exchange;
+
+
+--
+-- Name: SCHEMA exchange; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON SCHEMA exchange IS 'taler-exchange data';
+
+
+--
+-- Name: merchant; Type: SCHEMA; Schema: -; Owner: -
+--
+
+CREATE SCHEMA merchant;
+
+
+--
+-- Name: SCHEMA merchant; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON SCHEMA merchant IS 'taler-merchant data';
+
+
+--
-- Name: assert_patch_is_applied(text); Type: FUNCTION; Schema: _v; Owner: -
--
@@ -257,10 +299,10 @@ COMMENT ON FUNCTION _v.unregister_patch(in_patch_name text, OUT versioning integ
--
--- Name: add_constraints_to_account_merges_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_account_merges_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_account_merges_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_account_merges_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -274,10 +316,10 @@ $$;
--
--- Name: add_constraints_to_aggregation_tracking_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_aggregation_tracking_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_aggregation_tracking_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_aggregation_tracking_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -291,10 +333,10 @@ $$;
--
--- Name: add_constraints_to_contracts_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_contracts_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_contracts_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_contracts_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -308,10 +350,10 @@ $$;
--
--- Name: add_constraints_to_cs_nonce_locks_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_cs_nonce_locks_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_cs_nonce_locks_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_cs_nonce_locks_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -325,10 +367,10 @@ $$;
--
--- Name: add_constraints_to_deposits_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_deposits_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_deposits_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_deposits_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -344,10 +386,10 @@ $$;
--
--- Name: add_constraints_to_known_coins_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_known_coins_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_known_coins_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_known_coins_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -361,10 +403,39 @@ $$;
--
--- Name: add_constraints_to_purse_deposits_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_legitimizations_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_purse_deposits_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_legitimizations_partition(partition_suffix character varying) RETURNS void
+ LANGUAGE plpgsql
+ AS $$
+DECLARE
+ partition_name VARCHAR;
+BEGIN
+ partition_name = concat_ws('_', 'legitimizations', partition_suffix);
+ EXECUTE FORMAT (
+ 'ALTER TABLE ' || partition_name
+ || ' '
+ 'ADD CONSTRAINT ' || partition_name || '_legitimization_serial_id_key '
+ 'UNIQUE (legitimization_serial_id)');
+ EXECUTE FORMAT (
+ 'CREATE INDEX IF NOT EXISTS ' || partition_name || '_by_provider_and_legi_index '
+ 'ON '|| partition_name || ' '
+ '(provider_section,provider_legitimization_id)'
+ );
+ EXECUTE FORMAT (
+ 'COMMENT ON INDEX ' || partition_name || '_by_provider_and_legi_index '
+ 'IS ' || quote_literal('used (rarely) in kyc_provider_account_lookup') || ';'
+ );
+END
+$$;
+
+
+--
+-- Name: add_constraints_to_purse_deposits_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
+--
+
+CREATE FUNCTION exchange.add_constraints_to_purse_deposits_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -378,10 +449,10 @@ $$;
--
--- Name: add_constraints_to_purse_merges_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_purse_merges_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_purse_merges_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_purse_merges_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -395,10 +466,27 @@ $$;
--
--- Name: add_constraints_to_purse_requests_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_purse_refunds_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
+--
+
+CREATE FUNCTION exchange.add_constraints_to_purse_refunds_partition(partition_suffix character varying) RETURNS void
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ EXECUTE FORMAT (
+ 'ALTER TABLE purse_refunds_' || partition_suffix || ' '
+ 'ADD CONSTRAINT purse_refunds_' || partition_suffix || '_purse_refunds_serial_id_key '
+ 'UNIQUE (purse_refunds_serial_id) '
+ );
+END
+$$;
+
+
+--
+-- Name: add_constraints_to_purse_requests_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_purse_requests_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_purse_requests_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -412,10 +500,10 @@ $$;
--
--- Name: add_constraints_to_recoup_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_recoup_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_recoup_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_recoup_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -429,10 +517,10 @@ $$;
--
--- Name: add_constraints_to_recoup_refresh_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_recoup_refresh_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_recoup_refresh_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_recoup_refresh_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -446,10 +534,10 @@ $$;
--
--- Name: add_constraints_to_refresh_commitments_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_refresh_commitments_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_refresh_commitments_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_refresh_commitments_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -463,10 +551,10 @@ $$;
--
--- Name: add_constraints_to_refresh_revealed_coins_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_refresh_revealed_coins_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_refresh_revealed_coins_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_refresh_revealed_coins_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -485,10 +573,10 @@ $$;
--
--- Name: add_constraints_to_refresh_transfer_keys_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_refresh_transfer_keys_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_refresh_transfer_keys_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_refresh_transfer_keys_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -502,10 +590,10 @@ $$;
--
--- Name: add_constraints_to_refunds_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_refunds_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_refunds_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_refunds_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -520,10 +608,10 @@ $$;
--
--- Name: add_constraints_to_reserves_close_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_reserves_close_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_reserves_close_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_reserves_close_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -537,10 +625,10 @@ $$;
--
--- Name: add_constraints_to_reserves_in_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_reserves_in_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_reserves_in_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_reserves_in_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -554,10 +642,10 @@ $$;
--
--- Name: add_constraints_to_reserves_out_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_reserves_out_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_reserves_out_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_reserves_out_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -571,10 +659,10 @@ $$;
--
--- Name: add_constraints_to_wad_in_entries_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_wad_in_entries_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_wad_in_entries_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_wad_in_entries_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -588,10 +676,10 @@ $$;
--
--- Name: add_constraints_to_wad_out_entries_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_wad_out_entries_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_wad_out_entries_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_wad_out_entries_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -605,10 +693,10 @@ $$;
--
--- Name: add_constraints_to_wads_in_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_wads_in_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_wads_in_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_wads_in_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -624,10 +712,10 @@ $$;
--
--- Name: add_constraints_to_wads_out_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_wads_out_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_wads_out_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_wads_out_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -641,10 +729,10 @@ $$;
--
--- Name: add_constraints_to_wire_out_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_wire_out_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_wire_out_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_wire_out_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -658,14 +746,13 @@ $$;
--
--- Name: add_constraints_to_wire_targets_partition(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: add_constraints_to_wire_targets_partition(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.add_constraints_to_wire_targets_partition(partition_suffix character varying) RETURNS void
+CREATE FUNCTION exchange.add_constraints_to_wire_targets_partition(partition_suffix character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
EXECUTE FORMAT (
'ALTER TABLE wire_targets_' || partition_suffix || ' '
'ADD CONSTRAINT wire_targets_' || partition_suffix || '_wire_target_serial_id_key '
@@ -676,16 +763,14 @@ $$;
--
--- Name: create_foreign_hash_partition(character varying, integer, character varying, integer, character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_foreign_hash_partition(character varying, integer, character varying, integer, character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_foreign_hash_partition(source_table_name character varying, modulus integer, shard_suffix character varying, current_shard_num integer, local_user character varying DEFAULT 'taler-exchange-httpd'::character varying) RETURNS void
+CREATE FUNCTION exchange.create_foreign_hash_partition(source_table_name character varying, modulus integer, shard_suffix character varying, current_shard_num integer, local_user character varying DEFAULT 'taler-exchange-httpd'::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
RAISE NOTICE 'Creating %_% on %', source_table_name, shard_suffix, shard_suffix;
-
EXECUTE FORMAT(
'CREATE FOREIGN TABLE IF NOT EXISTS %I '
'PARTITION OF %I '
@@ -697,22 +782,20 @@ BEGIN
,current_shard_num-1
,shard_suffix
);
-
EXECUTE FORMAT(
'ALTER FOREIGN TABLE %I OWNER TO %I'
,source_table_name || '_' || shard_suffix
,local_user
);
-
END
$$;
--
--- Name: create_foreign_range_partition(character varying, integer); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_foreign_range_partition(character varying, integer); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_foreign_range_partition(source_table_name character varying, partition_num integer) RETURNS void
+CREATE FUNCTION exchange.create_foreign_range_partition(source_table_name character varying, partition_num integer) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -722,16 +805,14 @@ $$;
--
--- Name: create_foreign_servers(integer, character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_foreign_servers(integer, character varying, character varying, character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_foreign_servers(amount integer, domain character varying, remote_user character varying DEFAULT 'taler'::character varying, remote_user_password character varying DEFAULT 'taler'::character varying) RETURNS void
+CREATE FUNCTION exchange.create_foreign_servers(amount integer, domain character varying, remote_user character varying DEFAULT 'taler'::character varying, remote_user_password character varying DEFAULT 'taler'::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
PERFORM prepare_sharding();
-
FOR i IN 1..amount LOOP
PERFORM create_shard_server(
i::varchar
@@ -745,24 +826,20 @@ BEGIN
,'taler-exchange-httpd'
);
END LOOP;
-
PERFORM drop_default_partitions();
-
END
$$;
--
--- Name: create_hash_partition(character varying, integer, integer); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_hash_partition(character varying, integer, integer); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_hash_partition(source_table_name character varying, modulus integer, partition_num integer) RETURNS void
+CREATE FUNCTION exchange.create_hash_partition(source_table_name character varying, modulus integer, partition_num integer) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
RAISE NOTICE 'Creating partition %_%', source_table_name, partition_num;
-
EXECUTE FORMAT(
'CREATE TABLE IF NOT EXISTS %I '
'PARTITION OF %I '
@@ -772,307 +849,236 @@ BEGIN
,modulus
,partition_num-1
);
-
END
$$;
--
--- Name: create_partitioned_table(character varying, character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_partitioned_table(character varying, character varying, character varying, character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_partitioned_table(table_definition character varying, table_name character varying, main_table_partition_str character varying, shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_partitioned_table(table_definition character varying, table_name character varying, main_table_partition_str character varying, shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
IF shard_suffix IS NOT NULL THEN
table_name=table_name || '_' || shard_suffix;
main_table_partition_str = '';
END IF;
-
EXECUTE FORMAT(
table_definition,
table_name,
main_table_partition_str
);
-
END
$$;
--
--- Name: create_partitions(integer); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_partitions(integer); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_partitions(num_partitions integer) RETURNS void
+CREATE FUNCTION exchange.create_partitions(num_partitions integer) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
modulus INTEGER;
BEGIN
-
modulus := num_partitions;
-
PERFORM detach_default_partitions();
-
LOOP
-
PERFORM create_hash_partition(
'wire_targets'
,modulus
,num_partitions
);
PERFORM add_constraints_to_wire_targets_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'reserves'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'reserves_in'
,modulus
,num_partitions
);
PERFORM add_constraints_to_reserves_in_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'reserves_close'
,modulus
,num_partitions
);
PERFORM add_constraints_to_reserves_close_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'reserves_out'
,modulus
,num_partitions
);
PERFORM add_constraints_to_reserves_out_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'reserves_out_by_reserve'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'known_coins'
,modulus
,num_partitions
);
PERFORM add_constraints_to_known_coins_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'refresh_commitments'
,modulus
,num_partitions
);
PERFORM add_constraints_to_refresh_commitments_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'refresh_revealed_coins'
,modulus
,num_partitions
);
PERFORM add_constraints_to_refresh_revealed_coins_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'refresh_transfer_keys'
,modulus
,num_partitions
);
PERFORM add_constraints_to_refresh_transfer_keys_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'deposits'
,modulus
,num_partitions
);
PERFORM add_constraints_to_deposits_partition(num_partitions::varchar);
-
--- TODO: dynamically (!) creating/deleting deposits partitions:
--- create new partitions 'as needed', drop old ones once the aggregator has made
--- them empty; as 'new' deposits will always have deadlines in the future, this
--- would basically guarantee no conflict between aggregator and exchange service!
--- SEE also: https://www.cybertec-postgresql.com/en/automatic-partition-creation-in-postgresql/
--- (article is slightly wrong, as this works:)
---CREATE TABLE tab (
--- id bigint GENERATED ALWAYS AS IDENTITY,
--- ts timestamp NOT NULL,
--- data text
--- PARTITION BY LIST ((ts::date));
--- CREATE TABLE tab_def PARTITION OF tab DEFAULT;
--- BEGIN
--- CREATE TABLE tab_part2 (LIKE tab);
--- insert into tab_part2 (id,ts, data) values (5,'2022-03-21', 'foo');
--- alter table tab attach partition tab_part2 for values in ('2022-03-21');
--- commit;
--- Naturally, to ensure this is actually 100% conflict-free, we'd
--- need to create tables at the granularity of the wire/refund deadlines;
--- that is right now configurable via AGGREGATOR_SHIFT option.
-
--- FIXME: range partitioning
--- PERFORM create_range_partition(
--- 'deposits_by_ready'
--- ,modulus
--- ,num_partitions
--- );
---
--- PERFORM create_range_partition(
--- 'deposits_for_matching'
--- ,modulus
--- ,num_partitions
--- );
-
PERFORM create_hash_partition(
'refunds'
,modulus
,num_partitions
);
PERFORM add_constraints_to_refunds_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'wire_out'
,modulus
,num_partitions
);
PERFORM add_constraints_to_wire_out_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'aggregation_transient'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'aggregation_tracking'
,modulus
,num_partitions
);
PERFORM add_constraints_to_aggregation_tracking_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'recoup'
,modulus
,num_partitions
);
PERFORM add_constraints_to_recoup_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'recoup_by_reserve'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'recoup_refresh'
,modulus
,num_partitions
);
PERFORM add_constraints_to_recoup_refresh_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'prewire'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'cs_nonce_locks'
,modulus
,num_partitions
);
PERFORM add_constraints_to_cs_nonce_locks_partition(num_partitions::varchar);
-
- ---------------- P2P ----------------------
-
PERFORM create_hash_partition(
'purse_requests'
,modulus
,num_partitions
);
PERFORM add_constraints_to_purse_requests_partition(num_partitions::varchar);
-
+ PERFORM create_hash_partition(
+ 'purse_refunds'
+ ,modulus
+ ,num_partitions
+ );
+ PERFORM add_constraints_to_purse_refunds_partition(num_partitions::varchar);
PERFORM create_hash_partition(
'purse_merges'
,modulus
,num_partitions
);
PERFORM add_constraints_to_purse_merges_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'account_merges'
,modulus
,num_partitions
);
PERFORM add_constraints_to_account_merges_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'contracts'
,modulus
,num_partitions
);
PERFORM add_constraints_to_contracts_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'history_requests'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'close_requests'
,modulus
,num_partitions
);
-
PERFORM create_hash_partition(
'purse_deposits'
,modulus
,num_partitions
);
PERFORM add_constraints_to_purse_deposits_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'wad_out_entries'
,modulus
,num_partitions
);
PERFORM add_constraints_to_wad_out_entries_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'wads_in'
,modulus
,num_partitions
);
PERFORM add_constraints_to_wads_in_partition(num_partitions::varchar);
-
PERFORM create_hash_partition(
'wad_in_entries'
,modulus
,num_partitions
);
PERFORM add_constraints_to_wad_in_entries_partition(num_partitions::varchar);
-
num_partitions=num_partitions-1;
EXIT WHEN num_partitions=0;
-
END LOOP;
-
PERFORM drop_default_partitions();
-
END
$$;
--
--- Name: create_range_partition(character varying, integer); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_range_partition(character varying, integer); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_range_partition(source_table_name character varying, partition_num integer) RETURNS void
+CREATE FUNCTION exchange.create_range_partition(source_table_name character varying, partition_num integer) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
@@ -1082,16 +1088,14 @@ $$;
--
--- Name: create_shard_server(character varying, integer, integer, character varying, character varying, character varying, character varying, integer, character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_shard_server(character varying, integer, integer, character varying, character varying, character varying, character varying, integer, character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_shard_server(shard_suffix character varying, total_num_shards integer, current_shard_num integer, remote_host character varying, remote_user character varying, remote_user_password character varying, remote_db_name character varying DEFAULT 'taler-exchange'::character varying, remote_port integer DEFAULT 5432, local_user character varying DEFAULT 'taler-exchange-httpd'::character varying) RETURNS void
+CREATE FUNCTION exchange.create_shard_server(shard_suffix character varying, total_num_shards integer, current_shard_num integer, remote_host character varying, remote_user character varying, remote_user_password character varying, remote_db_name character varying DEFAULT 'taler-exchange'::character varying, remote_port integer DEFAULT 5432, local_user character varying DEFAULT 'taler-exchange-httpd'::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
RAISE NOTICE 'Creating server %', remote_host;
-
EXECUTE FORMAT(
'CREATE SERVER IF NOT EXISTS %I '
'FOREIGN DATA WRAPPER postgres_fdw '
@@ -1101,7 +1105,6 @@ BEGIN
,remote_host
,remote_port
);
-
EXECUTE FORMAT(
'CREATE USER MAPPING IF NOT EXISTS '
'FOR %I SERVER %I '
@@ -1111,7 +1114,6 @@ BEGIN
,remote_user
,remote_user_password
);
-
EXECUTE FORMAT(
'GRANT ALL PRIVILEGES '
'ON FOREIGN SERVER %I '
@@ -1119,7 +1121,6 @@ BEGIN
,shard_suffix
,local_user
);
-
PERFORM create_foreign_hash_partition(
'wire_targets'
,total_num_shards
@@ -1197,20 +1198,6 @@ BEGIN
,current_shard_num
,local_user
);
--- PERFORM create_foreign_range_partition(
--- 'deposits_by_ready'
--- ,total_num_shards
--- ,shard_suffix
--- ,current_shard_num
--- ,local_user
--- );
--- PERFORM create_foreign_range_partition(
--- 'deposits_for_matching'
--- ,total_num_shards
--- ,shard_suffix
--- ,current_shard_num
--- ,local_user
--- );
PERFORM create_foreign_hash_partition(
'refunds'
,total_num_shards
@@ -1274,9 +1261,6 @@ BEGIN
,current_shard_num
,local_user
);
-
- ------------------- P2P --------------------
-
PERFORM create_foreign_hash_partition(
'purse_requests'
,total_num_shards
@@ -1285,6 +1269,13 @@ BEGIN
,local_user
);
PERFORM create_foreign_hash_partition(
+ 'purse_refunds'
+ ,total_num_shards
+ ,shard_suffix
+ ,current_shard_num
+ ,local_user
+ );
+ PERFORM create_foreign_hash_partition(
'purse_merges'
,total_num_shards
,shard_suffix
@@ -1347,80 +1338,72 @@ BEGIN
,current_shard_num
,local_user
);
-
END
$$;
--
--- Name: FUNCTION create_shard_server(shard_suffix character varying, total_num_shards integer, current_shard_num integer, remote_host character varying, remote_user character varying, remote_user_password character varying, remote_db_name character varying, remote_port integer, local_user character varying); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION create_shard_server(shard_suffix character varying, total_num_shards integer, current_shard_num integer, remote_host character varying, remote_user character varying, remote_user_password character varying, remote_db_name character varying, remote_port integer, local_user character varying); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.create_shard_server(shard_suffix character varying, total_num_shards integer, current_shard_num integer, remote_host character varying, remote_user character varying, remote_user_password character varying, remote_db_name character varying, remote_port integer, local_user character varying) IS 'Create a shard server on the master
+COMMENT ON FUNCTION exchange.create_shard_server(shard_suffix character varying, total_num_shards integer, current_shard_num integer, remote_host character varying, remote_user character varying, remote_user_password character varying, remote_db_name character varying, remote_port integer, local_user character varying) IS 'Create a shard server on the master
node with all foreign tables and user mappings';
--
--- Name: create_table_account_merges(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_account_merges(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_account_merges(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_account_merges(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'account_merges';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(account_merge_request_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE
- ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)' -- REFERENCES reserves (reserve_pub) ON DELETE CASCADE
+ '(account_merge_request_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)'
',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
- ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)' -- REFERENCES purse_requests (purse_pub)
+ ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
+ ',wallet_h_payto BYTEA NOT NULL CHECK (LENGTH(wallet_h_payto)=32)'
',PRIMARY KEY (purse_pub)'
') %s ;'
,table_name
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: change to materialized index by reserve_pub!
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_reserve_pub '
'ON ' || table_name || ' '
'(reserve_pub);'
);
-
END
$$;
--
--- Name: create_table_aggregation_tracking(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_aggregation_tracking(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_aggregation_tracking(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_aggregation_tracking(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'aggregation_tracking';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(aggregation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',deposit_serial_id INT8 PRIMARY KEY' -- REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE' -- FIXME chnage to coint_pub + deposit_serial_id for more efficient depost -- or something else ???
- ',wtid_raw BYTEA NOT NULL' -- CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE'
+ '(aggregation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',deposit_serial_id INT8 PRIMARY KEY'
+ ',wtid_raw BYTEA NOT NULL'
') %s ;'
,table_name
,'PARTITION BY HASH (deposit_serial_id)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_wtid_raw_index '
'ON ' || table_name || ' '
@@ -1430,27 +1413,26 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_by_wtid_raw_index '
'IS ' || quote_literal('for lookup_transactions') || ';'
);
-
END
$$;
--
--- Name: create_table_aggregation_transient(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_aggregation_transient(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_aggregation_transient(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_aggregation_transient(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'aggregation_transient';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
'(amount_val INT8 NOT NULL'
',amount_frac INT4 NOT NULL'
',wire_target_h_payto BYTEA CHECK (LENGTH(wire_target_h_payto)=32)'
+ ',merchant_pub BYTEA CHECK (LENGTH(merchant_pub)=32)'
',exchange_account_section TEXT NOT NULL'
',wtid_raw BYTEA NOT NULL CHECK (LENGTH(wtid_raw)=32)'
') %s ;'
@@ -1458,25 +1440,24 @@ BEGIN
,'PARTITION BY HASH (wire_target_h_payto)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_close_requests(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_close_requests(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_close_requests(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_close_requests(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'close_requests';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)' -- REFERENCES reserves(reserve_pub) ON DELETE CASCADE
+ '(close_request_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)'
',close_timestamp INT8 NOT NULL'
',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
',close_val INT8 NOT NULL'
@@ -1487,25 +1468,23 @@ BEGIN
,'PARTITION BY HASH (reserve_pub)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_contracts(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_contracts(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_contracts(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_contracts(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'contracts';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(contract_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE
+ '(contract_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
',pub_ckey BYTEA NOT NULL CHECK (LENGTH(pub_ckey)=32)'
',contract_sig BYTEA NOT NULL CHECK (LENGTH(contract_sig)=64)'
@@ -1517,23 +1496,21 @@ BEGIN
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_cs_nonce_locks(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_cs_nonce_locks(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_cs_nonce_locks(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_cs_nonce_locks(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(cs_nonce_lock_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
+ '(cs_nonce_lock_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',nonce BYTEA PRIMARY KEY CHECK (LENGTH(nonce)=32)'
',op_hash BYTEA NOT NULL CHECK (LENGTH(op_hash)=64)'
',max_denomination_serial INT8 NOT NULL'
@@ -1542,28 +1519,26 @@ BEGIN
,'PARTITION BY HASH (nonce)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_deposits(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_deposits(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_deposits(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_deposits(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'deposits';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(deposit_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- PRIMARY KEY'
+ '(deposit_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',shard INT8 NOT NULL'
- ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)' -- REFERENCES known_coins (coin_pub) ON DELETE CASCADE
- ',known_coin_id INT8 NOT NULL' -- REFERENCES known_coins (known_coin_id) ON DELETE CASCADE' --- FIXME: column needed???
+ ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
+ ',known_coin_id INT8 NOT NULL'
',amount_with_fee_val INT8 NOT NULL'
',amount_with_fee_frac INT4 NOT NULL'
',wallet_timestamp INT8 NOT NULL'
@@ -1577,36 +1552,32 @@ BEGIN
',wire_target_h_payto BYTEA CHECK (LENGTH(wire_target_h_payto)=32)'
',done BOOLEAN NOT NULL DEFAULT FALSE'
',extension_blocked BOOLEAN NOT NULL DEFAULT FALSE'
- ',extension_details_serial_id INT8' -- REFERENCES extension_details (extension_details_serial_id) ON DELETE CASCADE'
+ ',extension_details_serial_id INT8'
') %s ;'
,table_name
,'PARTITION BY HASH (coin_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_coin_pub_index '
'ON ' || table_name || ' '
'(coin_pub);'
);
-
END
$$;
--
--- Name: create_table_deposits_by_ready(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_deposits_by_ready(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_deposits_by_ready(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_deposits_by_ready(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'deposits_by_ready';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
'(wire_deadline INT8 NOT NULL'
@@ -1618,68 +1589,61 @@ BEGIN
,'PARTITION BY RANGE (wire_deadline)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_main_index '
'ON ' || table_name || ' '
'(wire_deadline ASC, shard ASC, coin_pub);'
);
-
END
$$;
--
--- Name: create_table_deposits_for_matching(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_deposits_for_matching(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_deposits_for_matching(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_deposits_for_matching(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'deposits_for_matching';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
'(refund_deadline INT8 NOT NULL'
',merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)'
- ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)' -- REFERENCES known_coins (coin_pub) ON DELETE CASCADE
+ ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
',deposit_serial_id INT8'
') %s ;'
,table_name
,'PARTITION BY RANGE (refund_deadline)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_main_index '
'ON ' || table_name || ' '
'(refund_deadline ASC, merchant_pub, coin_pub);'
);
-
END
$$;
--
--- Name: create_table_history_requests(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_history_requests(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_history_requests(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_history_requests(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'history_requests';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)' -- REFERENCES reserves(reserve_pub) ON DELETE CASCADE
+ '(history_request_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)'
',request_timestamp INT8 NOT NULL'
',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
',history_fee_val INT8 NOT NULL'
@@ -1690,54 +1654,75 @@ BEGIN
,'PARTITION BY HASH (reserve_pub)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_known_coins(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_known_coins(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_known_coins(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_known_coins(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR default 'known_coins';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(known_coin_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',denominations_serial INT8 NOT NULL' -- REFERENCES denominations (denominations_serial) ON DELETE CASCADE'
+ '(known_coin_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',denominations_serial INT8 NOT NULL'
',coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32)'
',age_commitment_hash BYTEA CHECK (LENGTH(age_commitment_hash)=32)'
',denom_sig BYTEA NOT NULL'
- ',remaining_val INT8 NOT NULL'
- ',remaining_frac INT4 NOT NULL'
+ ',remaining_val INT8 NOT NULL DEFAULT(0)'
+ ',remaining_frac INT4 NOT NULL DEFAULT(0)'
') %s ;'
,table_name
- ,'PARTITION BY HASH (coin_pub)' -- FIXME: or include denominations_serial? or multi-level partitioning?;
+ ,'PARTITION BY HASH (coin_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
+END
+$$;
+
+
+--
+-- Name: create_table_legitimizations(character varying); Type: FUNCTION; Schema: exchange; Owner: -
+--
+CREATE FUNCTION exchange.create_table_legitimizations(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ PERFORM create_partitioned_table(
+ 'CREATE TABLE IF NOT EXISTS %I'
+ '(legitimization_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',h_payto BYTEA NOT NULL CHECK (LENGTH(h_payto)=32)'
+ ',expiration_time INT8 NOT NULL DEFAULT (0)'
+ ',provider_section VARCHAR NOT NULL'
+ ',provider_user_id VARCHAR DEFAULT NULL'
+ ',provider_legitimization_id VARCHAR DEFAULT NULL'
+ ',UNIQUE (h_payto, provider_section)'
+ ') %s ;'
+ ,'legitimizations'
+ ,'PARTITION BY HASH (h_payto)'
+ ,shard_suffix
+ );
END
$$;
--
--- Name: create_table_prewire(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_prewire(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_prewire(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_prewire(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'prewire';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
'(prewire_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY'
@@ -1750,9 +1735,7 @@ BEGIN
,'PARTITION BY HASH (prewire_uuid)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_finished_index '
'ON ' || table_name || ' '
@@ -1762,7 +1745,6 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_by_finished_index '
'IS ' || quote_literal('for gc_prewire') || ';'
);
- -- FIXME: find a way to combine these two indices?
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_failed_finished_index '
'ON ' || table_name || ' '
@@ -1772,28 +1754,26 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_by_failed_finished_index '
'IS ' || quote_literal('for wire_prepare_data_get') || ';'
);
-
END
$$;
--
--- Name: create_table_purse_deposits(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_purse_deposits(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_purse_deposits(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_purse_deposits(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'purse_deposits';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(purse_deposit_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE
- ',partner_serial_id INT8' -- REFERENCES partners(partner_serial_id) ON DELETE CASCADE'
+ '(purse_deposit_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',partner_serial_id INT8'
',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
- ',coin_pub BYTEA NOT NULL' -- REFERENCES known_coins (coin_pub) ON DELETE CASCADE'
+ ',coin_pub BYTEA NOT NULL'
',amount_with_fee_val INT8 NOT NULL'
',amount_with_fee_frac INT4 NOT NULL'
',coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)'
@@ -1803,37 +1783,32 @@ BEGIN
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: change to materialized index by coin_pub!
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_coin_pub '
'ON ' || table_name || ' '
'(coin_pub);'
);
-
END
$$;
--
--- Name: create_table_purse_merges(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_purse_merges(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_purse_merges(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_purse_merges(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'purse_merges';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(purse_merge_request_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY '-- UNIQUE
- ',partner_serial_id INT8' -- REFERENCES partners(partner_serial_id) ON DELETE CASCADE
- ',reserve_pub BYTEA NOT NULL CHECK(length(reserve_pub)=32)'--REFERENCES reserves (reserve_pub) ON DELETE CASCADE
- ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)' --REFERENCES purse_requests (purse_pub) ON DELETE CASCADE
+ '(purse_merge_request_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY '
+ ',partner_serial_id INT8'
+ ',reserve_pub BYTEA NOT NULL CHECK(length(reserve_pub)=32)'
+ ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
',merge_sig BYTEA NOT NULL CHECK (LENGTH(merge_sig)=64)'
',merge_timestamp INT8 NOT NULL'
',PRIMARY KEY (purse_pub)'
@@ -1842,10 +1817,7 @@ BEGIN
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: change to materialized index by reserve_pub!
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_reserve_pub '
'ON ' || table_name || ' '
@@ -1855,32 +1827,62 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_reserve_pub '
'IS ' || quote_literal('needed in reserve history computation') || ';'
);
+END
+$$;
+
+--
+-- Name: create_table_purse_refunds(character varying); Type: FUNCTION; Schema: exchange; Owner: -
+--
+
+CREATE FUNCTION exchange.create_table_purse_refunds(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+ LANGUAGE plpgsql
+ AS $$
+DECLARE
+ table_name VARCHAR DEFAULT 'purse_refunds';
+BEGIN
+ PERFORM create_partitioned_table(
+ 'CREATE TABLE IF NOT EXISTS %I '
+ '(purse_refunds_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
+ ',PRIMARY KEY (purse_pub)'
+ ') %s ;'
+ ,table_name
+ ,'PARTITION BY HASH (purse_pub)'
+ ,shard_suffix
+ );
+ table_name = concat_ws('_', table_name, shard_suffix);
END
$$;
--
--- Name: create_table_purse_requests(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_purse_requests(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_purse_requests(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_purse_requests(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'purse_requests';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(purse_requests_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE
+ '(purse_requests_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
',merge_pub BYTEA NOT NULL CHECK (LENGTH(merge_pub)=32)'
+ ',purse_creation INT8 NOT NULL'
',purse_expiration INT8 NOT NULL'
',h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)'
',age_limit INT4 NOT NULL'
+ ',flags INT4 NOT NULL'
+ ',refunded BOOLEAN NOT NULL DEFAULT(FALSE)'
+ ',finished BOOLEAN NOT NULL DEFAULT(FALSE)'
+ ',in_reserve_quota BOOLEAN NOT NULL DEFAULT(FALSE)'
',amount_with_fee_val INT8 NOT NULL'
',amount_with_fee_frac INT4 NOT NULL'
+ ',purse_fee_val INT8 NOT NULL'
+ ',purse_fee_frac INT4 NOT NULL'
',balance_val INT8 NOT NULL DEFAULT (0)'
',balance_frac INT4 NOT NULL DEFAULT (0)'
',purse_sig BYTEA NOT NULL CHECK(LENGTH(purse_sig)=64)'
@@ -1890,124 +1892,112 @@ BEGIN
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: change to materialized index by marge_pub!
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_merge_pub '
'ON ' || table_name || ' '
'(merge_pub);'
);
-
+ EXECUTE FORMAT (
+ 'CREATE INDEX IF NOT EXISTS ' || table_name || '_purse_expiration '
+ 'ON ' || table_name || ' '
+ '(purse_expiration);'
+ );
END
$$;
--
--- Name: create_table_recoup(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_recoup(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_recoup(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_recoup(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'recoup';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(recoup_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)' -- REFERENCES known_coins (coin_pub)
+ '(recoup_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
',coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)'
',coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)'
',amount_val INT8 NOT NULL'
',amount_frac INT4 NOT NULL'
',recoup_timestamp INT8 NOT NULL'
- ',reserve_out_serial_id INT8 NOT NULL' -- REFERENCES reserves_out (reserve_out_serial_id) ON DELETE CASCADE'
+ ',reserve_out_serial_id INT8 NOT NULL'
') %s ;'
,table_name
,'PARTITION BY HASH (coin_pub);'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_coin_pub_index '
'ON ' || table_name || ' '
'(coin_pub);'
);
-
END
$$;
--
--- Name: create_table_recoup_by_reserve(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_recoup_by_reserve(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_recoup_by_reserve(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_recoup_by_reserve(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'recoup_by_reserve';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(reserve_out_serial_id INT8 NOT NULL' -- REFERENCES reserves (reserve_out_serial_id) ON DELETE CASCADE
- ',coin_pub BYTEA CHECK (LENGTH(coin_pub)=32)' -- REFERENCES known_coins (coin_pub)
+ '(reserve_out_serial_id INT8 NOT NULL'
+ ',coin_pub BYTEA CHECK (LENGTH(coin_pub)=32)'
') %s ;'
,table_name
,'PARTITION BY HASH (reserve_out_serial_id)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_main_index '
'ON ' || table_name || ' '
'(reserve_out_serial_id);'
);
-
END
$$;
--
--- Name: create_table_recoup_refresh(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_recoup_refresh(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_recoup_refresh(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_recoup_refresh(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'recoup_refresh';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(recoup_refresh_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)' -- REFERENCES known_coins (coin_pub)
- ',known_coin_id BIGINT NOT NULL' -- REFERENCES known_coins (known_coin_id) ON DELETE CASCADE
+ '(recoup_refresh_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
+ ',known_coin_id BIGINT NOT NULL'
',coin_sig BYTEA NOT NULL CHECK(LENGTH(coin_sig)=64)'
',coin_blind BYTEA NOT NULL CHECK(LENGTH(coin_blind)=32)'
',amount_val INT8 NOT NULL'
',amount_frac INT4 NOT NULL'
',recoup_timestamp INT8 NOT NULL'
- ',rrc_serial INT8 NOT NULL' -- REFERENCES refresh_revealed_coins (rrc_serial) ON DELETE CASCADE -- UNIQUE'
+ ',rrc_serial INT8 NOT NULL'
') %s ;'
,table_name
,'PARTITION BY HASH (coin_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: any query using this index will be slow. Materialize index or change query?
- -- Also: which query uses this index?
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_rrc_serial_index '
'ON ' || table_name || ' '
@@ -2018,27 +2008,25 @@ BEGIN
'ON ' || table_name || ' '
'(coin_pub);'
);
-
END
$$;
--
--- Name: create_table_refresh_commitments(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_refresh_commitments(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_refresh_commitments(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_refresh_commitments(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'refresh_commitments';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(melt_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
+ '(melt_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',rc BYTEA PRIMARY KEY CHECK (LENGTH(rc)=64)'
- ',old_coin_pub BYTEA NOT NULL' -- REFERENCES known_coins (coin_pub) ON DELETE CASCADE'
+ ',old_coin_pub BYTEA NOT NULL'
',old_coin_sig BYTEA NOT NULL CHECK(LENGTH(old_coin_sig)=64)'
',amount_with_fee_val INT8 NOT NULL'
',amount_with_fee_frac INT4 NOT NULL'
@@ -2048,76 +2036,66 @@ BEGIN
,'PARTITION BY HASH (rc)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- Note: index spans partitions, may need to be materialized.
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_old_coin_pub_index '
'ON ' || table_name || ' '
'(old_coin_pub);'
);
-
END
$$;
--
--- Name: create_table_refresh_revealed_coins(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_refresh_revealed_coins(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_refresh_revealed_coins(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_refresh_revealed_coins(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'refresh_revealed_coins';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(rrc_serial BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',melt_serial_id INT8 NOT NULL' -- REFERENCES refresh_commitments (melt_serial_id) ON DELETE CASCADE'
+ '(rrc_serial BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',melt_serial_id INT8 NOT NULL'
',freshcoin_index INT4 NOT NULL'
',link_sig BYTEA NOT NULL CHECK(LENGTH(link_sig)=64)'
- ',denominations_serial INT8 NOT NULL' -- REFERENCES denominations (denominations_serial) ON DELETE CASCADE'
- ',coin_ev BYTEA NOT NULL' -- UNIQUE'
- ',h_coin_ev BYTEA NOT NULL CHECK(LENGTH(h_coin_ev)=64)' -- UNIQUE'
+ ',denominations_serial INT8 NOT NULL'
+ ',coin_ev BYTEA NOT NULL'
+ ',h_coin_ev BYTEA NOT NULL CHECK(LENGTH(h_coin_ev)=64)'
',ev_sig BYTEA NOT NULL'
',ewv BYTEA NOT NULL'
- -- ,PRIMARY KEY (melt_serial_id, freshcoin_index) -- done per shard
') %s ;'
,table_name
,'PARTITION BY HASH (melt_serial_id)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_coins_by_melt_serial_id_index '
'ON ' || table_name || ' '
'(melt_serial_id);'
);
-
END
$$;
--
--- Name: create_table_refresh_transfer_keys(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_refresh_transfer_keys(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_refresh_transfer_keys(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_refresh_transfer_keys(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'refresh_transfer_keys';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(rtc_serial BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',melt_serial_id INT8 PRIMARY KEY' -- REFERENCES refresh_commitments (melt_serial_id) ON DELETE CASCADE'
+ '(rtc_serial BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',melt_serial_id INT8 PRIMARY KEY'
',transfer_pub BYTEA NOT NULL CHECK(LENGTH(transfer_pub)=32)'
',transfer_privs BYTEA NOT NULL'
') %s ;'
@@ -2125,71 +2103,63 @@ BEGIN
,'PARTITION BY HASH (melt_serial_id)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_refunds(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_refunds(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_refunds(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_refunds(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'refunds';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(refund_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)' -- REFERENCES known_coins (coin_pub) ON DELETE CASCADE
- ',deposit_serial_id INT8 NOT NULL' -- REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE'
+ '(refund_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
+ ',deposit_serial_id INT8 NOT NULL'
',merchant_sig BYTEA NOT NULL CHECK(LENGTH(merchant_sig)=64)'
',rtransaction_id INT8 NOT NULL'
',amount_with_fee_val INT8 NOT NULL'
',amount_with_fee_frac INT4 NOT NULL'
- -- ,PRIMARY KEY (deposit_serial_id, rtransaction_id) -- done per shard!
') %s ;'
,table_name
,'PARTITION BY HASH (coin_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_coin_pub_index '
'ON ' || table_name || ' '
'(coin_pub);'
);
-
END
$$;
--
--- Name: create_table_reserves(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_reserves(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_reserves(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_reserves(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'reserves';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
'(reserve_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY'
',reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)'
- ',current_balance_val INT8 NOT NULL'
- ',current_balance_frac INT4 NOT NULL'
+ ',current_balance_val INT8 NOT NULL DEFAULT(0)'
+ ',current_balance_frac INT4 NOT NULL DEFAULT(0)'
',purses_active INT8 NOT NULL DEFAULT(0)'
',purses_allowed INT8 NOT NULL DEFAULT(0)'
- ',kyc_required BOOLEAN NOT NULL DEFAULT(FALSE)'
- ',kyc_passed BOOLEAN NOT NULL DEFAULT(FALSE)'
+ ',max_age INT4 NOT NULL DEFAULT(120)'
',expiration_date INT8 NOT NULL'
',gc_date INT8 NOT NULL'
') %s ;'
@@ -2197,9 +2167,7 @@ BEGIN
,'PARTITION BY HASH (reserve_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_expiration_index '
'ON ' || table_name || ' '
@@ -2226,26 +2194,24 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_by_gc_date_index '
'IS ' || quote_literal('for reserve garbage collection') || ';'
);
-
END
$$;
--
--- Name: create_table_reserves_close(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_reserves_close(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_reserves_close(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_reserves_close(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR default 'reserves_close';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(close_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE / PRIMARY KEY'
- ',reserve_pub BYTEA NOT NULL' -- REFERENCES reserves (reserve_pub) ON DELETE CASCADE'
+ '(close_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',reserve_pub BYTEA NOT NULL'
',execution_date INT8 NOT NULL'
',wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)'
',wire_target_h_payto BYTEA CHECK (LENGTH(wire_target_h_payto)=32)'
@@ -2258,9 +2224,7 @@ BEGIN
,'PARTITION BY HASH (reserve_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_close_uuid_index '
'ON ' || table_name || ' '
@@ -2276,20 +2240,19 @@ $$;
--
--- Name: create_table_reserves_in(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_reserves_in(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_reserves_in(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_reserves_in(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR default 'reserves_in';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(reserve_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
- ',reserve_pub BYTEA PRIMARY KEY' -- REFERENCES reserves (reserve_pub) ON DELETE CASCADE'
+ '(reserve_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',reserve_pub BYTEA PRIMARY KEY'
',wire_reference INT8 NOT NULL'
',credit_val INT8 NOT NULL'
',credit_frac INT4 NOT NULL'
@@ -2301,15 +2264,12 @@ BEGIN
,'PARTITION BY HASH (reserve_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_reserve_in_serial_id_index '
'ON ' || table_name || ' '
'(reserve_in_serial_id);'
);
- -- FIXME: where do we need this index? Can we do better?
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_exch_accnt_section_execution_date_idx '
'ON ' || table_name || ' '
@@ -2317,7 +2277,6 @@ BEGIN
',execution_date'
');'
);
- -- FIXME: where do we need this index? Can we do better?
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_exch_accnt_reserve_in_serial_id_idx '
'ON ' || table_name || ' '
@@ -2325,29 +2284,27 @@ BEGIN
'reserve_in_serial_id DESC'
');'
);
-
END
$$;
--
--- Name: create_table_reserves_out(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_reserves_out(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_reserves_out(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_reserves_out(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR default 'reserves_out';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(reserve_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
+ '(reserve_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',h_blind_ev BYTEA CHECK (LENGTH(h_blind_ev)=64) UNIQUE'
- ',denominations_serial INT8 NOT NULL' -- REFERENCES denominations (denominations_serial)'
+ ',denominations_serial INT8 NOT NULL'
',denom_sig BYTEA NOT NULL'
- ',reserve_uuid INT8 NOT NULL' -- REFERENCES reserves (reserve_uuid) ON DELETE CASCADE'
+ ',reserve_uuid INT8 NOT NULL'
',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
',execution_date INT8 NOT NULL'
',amount_with_fee_val INT8 NOT NULL'
@@ -2357,15 +2314,12 @@ BEGIN
,'PARTITION BY HASH (h_blind_ev)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_reserve_out_serial_id_index '
'ON ' || table_name || ' '
'(reserve_out_serial_id);'
);
- -- FIXME: change query to use reserves_out_by_reserve instead and materialize execution_date there as well???
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_reserve_uuid_and_execution_date_index '
'ON ' || table_name || ' '
@@ -2375,59 +2329,53 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_by_reserve_uuid_and_execution_date_index '
'IS ' || quote_literal('for get_reserves_out and exchange_do_withdraw_limit_check') || ';'
);
-
END
$$;
--
--- Name: create_table_reserves_out_by_reserve(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_reserves_out_by_reserve(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_reserves_out_by_reserve(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_reserves_out_by_reserve(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'reserves_out_by_reserve';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(reserve_uuid INT8 NOT NULL' -- REFERENCES reserves (reserve_uuid) ON DELETE CASCADE
+ '(reserve_uuid INT8 NOT NULL'
',h_blind_ev BYTEA CHECK (LENGTH(h_blind_ev)=64)'
') %s '
,table_name
,'PARTITION BY HASH (reserve_uuid)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_main_index '
'ON ' || table_name || ' '
'(reserve_uuid);'
);
-
END
$$;
--
--- Name: create_table_wad_in_entries(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_wad_in_entries(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_wad_in_entries(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_wad_in_entries(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'wad_in_entries';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(wad_in_entry_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE
- ',wad_in_serial_id INT8' -- REFERENCES wads_in (wad_in_serial_id) ON DELETE CASCADE
+ '(wad_in_entry_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',wad_in_serial_id INT8'
',reserve_pub BYTEA NOT NULL CHECK(LENGTH(reserve_pub)=32)'
',purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)'
',h_contract BYTEA NOT NULL CHECK(LENGTH(h_contract)=64)'
@@ -2446,10 +2394,7 @@ BEGIN
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: change to materialized index by reserve_pub!
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_reserve_pub '
'ON ' || table_name || ' '
@@ -2459,26 +2404,24 @@ BEGIN
'COMMENT ON INDEX ' || table_name || '_reserve_pub '
'IS ' || quote_literal('needed in reserve history computation') || ';'
);
-
END
$$;
--
--- Name: create_table_wad_out_entries(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_wad_out_entries(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_wad_out_entries(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_wad_out_entries(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'wad_out_entries';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(wad_out_entry_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE
- ',wad_out_serial_id INT8' -- REFERENCES wads_out (wad_out_serial_id) ON DELETE CASCADE
+ '(wad_out_entry_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
+ ',wad_out_serial_id INT8'
',reserve_pub BYTEA NOT NULL CHECK(LENGTH(reserve_pub)=32)'
',purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)'
',h_contract BYTEA NOT NULL CHECK(LENGTH(h_contract)=64)'
@@ -2497,34 +2440,29 @@ BEGIN
,'PARTITION BY HASH (purse_pub)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
- -- FIXME: change to materialized index by reserve_pub!
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_reserve_pub '
'ON ' || table_name || ' '
'(reserve_pub);'
);
-
END
$$;
--
--- Name: create_table_wads_in(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_wads_in(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_wads_in(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_wads_in(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'wads_in';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(wad_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE
+ '(wad_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',wad_id BYTEA PRIMARY KEY CHECK (LENGTH(wad_id)=24)'
',origin_exchange_url TEXT NOT NULL'
',amount_val INT8 NOT NULL'
@@ -2536,27 +2474,25 @@ BEGIN
,'PARTITION BY HASH (wad_id)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_wads_out(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_wads_out(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_wads_out(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_wads_out(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'wads_out';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I '
- '(wad_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' --UNIQUE
+ '(wad_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',wad_id BYTEA PRIMARY KEY CHECK (LENGTH(wad_id)=24)'
- ',partner_serial_id INT8 NOT NULL' -- REFERENCES partners(partner_serial_id) ON DELETE CASCADE
+ ',partner_serial_id INT8 NOT NULL'
',amount_val INT8 NOT NULL'
',amount_frac INT4 NOT NULL'
',execution_time INT8 NOT NULL'
@@ -2565,25 +2501,23 @@ BEGIN
,'PARTITION BY HASH (wad_id)'
,shard_suffix
);
-
END
$$;
--
--- Name: create_table_wire_out(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_wire_out(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_wire_out(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_wire_out(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
DECLARE
table_name VARCHAR DEFAULT 'wire_out';
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(wireout_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY' -- PRIMARY KEY'
+ '(wireout_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY'
',execution_date INT8 NOT NULL'
',wtid_raw BYTEA UNIQUE NOT NULL CHECK (LENGTH(wtid_raw)=32)'
',wire_target_h_payto BYTEA CHECK (LENGTH(wire_target_h_payto)=32)'
@@ -2595,58 +2529,50 @@ BEGIN
,'PARTITION BY HASH (wtid_raw)'
,shard_suffix
);
-
table_name = concat_ws('_', table_name, shard_suffix);
-
EXECUTE FORMAT (
'CREATE INDEX IF NOT EXISTS ' || table_name || '_by_wire_target_h_payto_index '
'ON ' || table_name || ' '
'(wire_target_h_payto);'
);
-
-
END
$$;
--
--- Name: create_table_wire_targets(character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: create_table_wire_targets(character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.create_table_wire_targets(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
+CREATE FUNCTION exchange.create_table_wire_targets(shard_suffix character varying DEFAULT NULL::character varying) RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
PERFORM create_partitioned_table(
'CREATE TABLE IF NOT EXISTS %I'
- '(wire_target_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY' -- UNIQUE'
+ '(wire_target_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
',wire_target_h_payto BYTEA PRIMARY KEY CHECK (LENGTH(wire_target_h_payto)=32)'
',payto_uri VARCHAR NOT NULL'
- ',kyc_ok BOOLEAN NOT NULL DEFAULT (FALSE)'
- ',external_id VARCHAR'
') %s ;'
,'wire_targets'
,'PARTITION BY HASH (wire_target_h_payto)'
,shard_suffix
);
-
END
$$;
--
--- Name: defer_wire_out(); Type: PROCEDURE; Schema: public; Owner: -
+-- Name: defer_wire_out(); Type: PROCEDURE; Schema: exchange; Owner: -
--
-CREATE PROCEDURE public.defer_wire_out()
+CREATE PROCEDURE exchange.defer_wire_out()
LANGUAGE plpgsql
AS $$
BEGIN
IF EXISTS (
SELECT 1
- FROM information_Schema.constraint_column_usage
+ FROM exchange.information_Schema.constraint_column_usage
WHERE table_name='wire_out'
AND constraint_name='wire_out_ref')
THEN
@@ -2657,25 +2583,24 @@ END $$;
--
--- Name: deposits_delete_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: deposits_delete_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.deposits_delete_trigger() RETURNS trigger
+CREATE FUNCTION exchange.deposits_delete_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
DECLARE
was_ready BOOLEAN;
BEGIN
- was_ready = NOT (OLD.done OR OLD.extension_blocked);
-
+ was_ready = NOT (OLD.done OR OLD.extension_blocked);
IF (was_ready)
THEN
- DELETE FROM deposits_by_ready
+ DELETE FROM exchange.deposits_by_ready
WHERE wire_deadline = OLD.wire_deadline
AND shard = OLD.shard
AND coin_pub = OLD.coin_pub
AND deposit_serial_id = OLD.deposit_serial_id;
- DELETE FROM deposits_for_matching
+ DELETE FROM exchange.deposits_for_matching
WHERE refund_deadline = OLD.refund_deadline
AND merchant_pub = OLD.merchant_pub
AND coin_pub = OLD.coin_pub
@@ -2686,27 +2611,26 @@ END $$;
--
--- Name: FUNCTION deposits_delete_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION deposits_delete_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.deposits_delete_trigger() IS 'Replicate deposit deletions into materialized indices.';
+COMMENT ON FUNCTION exchange.deposits_delete_trigger() IS 'Replicate deposit deletions into materialized indices.';
--
--- Name: deposits_insert_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: deposits_insert_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.deposits_insert_trigger() RETURNS trigger
+CREATE FUNCTION exchange.deposits_insert_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
DECLARE
is_ready BOOLEAN;
BEGIN
- is_ready = NOT (NEW.done OR NEW.extension_blocked);
-
+ is_ready = NOT (NEW.done OR NEW.extension_blocked);
IF (is_ready)
THEN
- INSERT INTO deposits_by_ready
+ INSERT INTO exchange.deposits_by_ready
(wire_deadline
,shard
,coin_pub
@@ -2716,7 +2640,7 @@ BEGIN
,NEW.shard
,NEW.coin_pub
,NEW.deposit_serial_id);
- INSERT INTO deposits_for_matching
+ INSERT INTO exchange.deposits_for_matching
(refund_deadline
,merchant_pub
,coin_pub
@@ -2732,17 +2656,17 @@ END $$;
--
--- Name: FUNCTION deposits_insert_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION deposits_insert_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.deposits_insert_trigger() IS 'Replicate deposit inserts into materialized indices.';
+COMMENT ON FUNCTION exchange.deposits_insert_trigger() IS 'Replicate deposit inserts into materialized indices.';
--
--- Name: deposits_update_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: deposits_update_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.deposits_update_trigger() RETURNS trigger
+CREATE FUNCTION exchange.deposits_update_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
DECLARE
@@ -2751,15 +2675,15 @@ DECLARE
is_ready BOOLEAN;
BEGIN
was_ready = NOT (OLD.done OR OLD.extension_blocked);
- is_ready = NOT (NEW.done OR NEW.extension_blocked);
+ is_ready = NOT (NEW.done OR NEW.extension_blocked);
IF (was_ready AND NOT is_ready)
THEN
- DELETE FROM deposits_by_ready
+ DELETE FROM exchange.deposits_by_ready
WHERE wire_deadline = OLD.wire_deadline
AND shard = OLD.shard
AND coin_pub = OLD.coin_pub
AND deposit_serial_id = OLD.deposit_serial_id;
- DELETE FROM deposits_for_matching
+ DELETE FROM exchange.deposits_for_matching
WHERE refund_deadline = OLD.refund_deadline
AND merchant_pub = OLD.merchant_pub
AND coin_pub = OLD.coin_pub
@@ -2767,7 +2691,7 @@ BEGIN
END IF;
IF (is_ready AND NOT was_ready)
THEN
- INSERT INTO deposits_by_ready
+ INSERT INTO exchange.deposits_by_ready
(wire_deadline
,shard
,coin_pub
@@ -2777,7 +2701,7 @@ BEGIN
,NEW.shard
,NEW.coin_pub
,NEW.deposit_serial_id);
- INSERT INTO deposits_for_matching
+ INSERT INTO exchange.deposits_for_matching
(refund_deadline
,merchant_pub
,coin_pub
@@ -2793,117 +2717,81 @@ END $$;
--
--- Name: FUNCTION deposits_update_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION deposits_update_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.deposits_update_trigger() IS 'Replicate deposits changes into materialized indices.';
+COMMENT ON FUNCTION exchange.deposits_update_trigger() IS 'Replicate deposits changes into materialized indices.';
--
--- Name: detach_default_partitions(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: detach_default_partitions(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.detach_default_partitions() RETURNS void
+CREATE FUNCTION exchange.detach_default_partitions() RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
RAISE NOTICE 'Detaching all default table partitions';
-
ALTER TABLE IF EXISTS wire_targets
DETACH PARTITION wire_targets_default;
-
ALTER TABLE IF EXISTS reserves
DETACH PARTITION reserves_default;
-
ALTER TABLE IF EXISTS reserves_in
DETACH PARTITION reserves_in_default;
-
ALTER TABLE IF EXISTS reserves_close
DETACH PARTITION reserves_close_default;
-
ALTER TABLE IF EXISTS reserves_out
DETACH PARTITION reserves_out_default;
-
ALTER TABLE IF EXISTS reserves_out_by_reserve
DETACH PARTITION reserves_out_by_reserve_default;
-
ALTER TABLE IF EXISTS known_coins
DETACH PARTITION known_coins_default;
-
ALTER TABLE IF EXISTS refresh_commitments
DETACH PARTITION refresh_commitments_default;
-
ALTER TABLE IF EXISTS refresh_revealed_coins
DETACH PARTITION refresh_revealed_coins_default;
-
ALTER TABLE IF EXISTS refresh_transfer_keys
DETACH PARTITION refresh_transfer_keys_default;
-
ALTER TABLE IF EXISTS deposits
DETACH PARTITION deposits_default;
-
---- TODO range partitioning
--- ALTER TABLE IF EXISTS deposits_by_ready
--- DETACH PARTITION deposits_by_ready_default;
---
--- ALTER TABLE IF EXISTS deposits_for_matching
--- DETACH PARTITION deposits_default_for_matching_default;
-
ALTER TABLE IF EXISTS refunds
DETACH PARTITION refunds_default;
-
ALTER TABLE IF EXISTS wire_out
DETACH PARTITION wire_out_default;
-
ALTER TABLE IF EXISTS aggregation_transient
DETACH PARTITION aggregation_transient_default;
-
ALTER TABLE IF EXISTS aggregation_tracking
DETACH PARTITION aggregation_tracking_default;
-
ALTER TABLE IF EXISTS recoup
DETACH PARTITION recoup_default;
-
ALTER TABLE IF EXISTS recoup_by_reserve
DETACH PARTITION recoup_by_reserve_default;
-
ALTER TABLE IF EXISTS recoup_refresh
DETACH PARTITION recoup_refresh_default;
-
ALTER TABLE IF EXISTS prewire
DETACH PARTITION prewire_default;
-
ALTER TABLE IF EXISTS cs_nonce_locks
DETACH partition cs_nonce_locks_default;
-
ALTER TABLE IF EXISTS purse_requests
DETACH partition purse_requests_default;
-
+ ALTER TABLE IF EXISTS purse_refunds
+ DETACH partition purse_refunds_default;
ALTER TABLE IF EXISTS purse_merges
DETACH partition purse_merges_default;
-
ALTER TABLE IF EXISTS account_merges
DETACH partition account_merges_default;
-
ALTER TABLE IF EXISTS contracts
DETACH partition contracts_default;
-
ALTER TABLE IF EXISTS history_requests
DETACH partition history_requests_default;
-
ALTER TABLE IF EXISTS close_requests
DETACH partition close_requests_default;
-
ALTER TABLE IF EXISTS purse_deposits
DETACH partition purse_deposits_default;
-
ALTER TABLE IF EXISTS wad_out_entries
DETACH partition wad_out_entries_default;
-
ALTER TABLE IF EXISTS wads_in
DETACH partition wads_in_default;
-
ALTER TABLE IF EXISTS wad_in_entries
DETACH partition wad_in_entries_default;
END
@@ -2911,24 +2799,22 @@ $$;
--
--- Name: FUNCTION detach_default_partitions(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION detach_default_partitions(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.detach_default_partitions() IS 'We need to drop default and create new one before deleting the default partitions
+COMMENT ON FUNCTION exchange.detach_default_partitions() IS 'We need to drop default and create new one before deleting the default partitions
otherwise constraints get lost too. Might be needed in shardig too';
--
--- Name: drop_default_partitions(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: drop_default_partitions(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.drop_default_partitions() RETURNS void
+CREATE FUNCTION exchange.drop_default_partitions() RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
RAISE NOTICE 'Dropping default table partitions';
-
DROP TABLE IF EXISTS wire_targets_default;
DROP TABLE IF EXISTS reserves_default;
DROP TABLE IF EXISTS reserves_in_default;
@@ -2940,8 +2826,6 @@ BEGIN
DROP TABLE IF EXISTS refresh_revealed_coins_default;
DROP TABLE IF EXISTS refresh_transfer_keys_default;
DROP TABLE IF EXISTS deposits_default;
---DROP TABLE IF EXISTS deposits_by_ready_default;
---DROP TABLE IF EXISTS deposits_for_matching_default;
DROP TABLE IF EXISTS refunds_default;
DROP TABLE IF EXISTS wire_out_default;
DROP TABLE IF EXISTS aggregation_transient_default;
@@ -2951,8 +2835,8 @@ BEGIN
DROP TABLE IF EXISTS recoup_refresh_default;
DROP TABLE IF EXISTS prewire_default;
DROP TABLE IF EXISTS cs_nonce_locks_default;
-
DROP TABLE IF EXISTS purse_requests_default;
+ DROP TABLE IF EXISTS purse_refunds_default;
DROP TABLE IF EXISTS purse_merges_default;
DROP TABLE IF EXISTS account_merges_default;
DROP TABLE IF EXISTS contracts_default;
@@ -2962,24 +2846,23 @@ BEGIN
DROP TABLE IF EXISTS wad_out_entries_default;
DROP TABLE IF EXISTS wads_in_default;
DROP TABLE IF EXISTS wad_in_entries_default;
-
END
$$;
--
--- Name: FUNCTION drop_default_partitions(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION drop_default_partitions(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.drop_default_partitions() IS 'Drop all default partitions once other partitions are attached.
+COMMENT ON FUNCTION exchange.drop_default_partitions() IS 'Drop all default partitions once other partitions are attached.
Might be needed in sharding too.';
--
--- Name: exchange_do_account_merge(bytea, bytea, bytea); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_account_merge(bytea, bytea, bytea); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_account_merge(in_purse_pub bytea, in_reserve_pub bytea, in_reserve_sig bytea, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_account_merge(in_purse_pub bytea, in_reserve_pub bytea, in_reserve_sig bytea, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
BEGIN
@@ -2988,10 +2871,10 @@ END $$;
--
--- Name: exchange_do_batch_withdraw(bigint, integer, bytea, bigint, bigint); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_batch_withdraw(bigint, integer, bytea, bigint, bigint); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_batch_withdraw(amount_val bigint, amount_frac integer, rpub bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT kycok boolean, OUT account_uuid bigint, OUT ruuid bigint) RETURNS record
+CREATE FUNCTION exchange.exchange_do_batch_withdraw(amount_val bigint, amount_frac integer, rpub bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT ruuid bigint) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -3017,7 +2900,7 @@ SELECT
,reserve_frac
,reserve_gc
,ruuid
- FROM reserves
+ FROM exchange.reserves
WHERE reserves.reserve_pub=rpub;
IF NOT FOUND
@@ -3025,8 +2908,6 @@ THEN
-- reserve unknown
reserve_found=FALSE;
balance_ok=FALSE;
- kycok=FALSE;
- account_uuid=0;
ruuid=2;
RETURN;
END IF;
@@ -3050,8 +2931,6 @@ ELSE
ELSE
reserve_found=TRUE;
balance_ok=FALSE;
- kycok=FALSE; -- we do not really know or care
- account_uuid=0;
RETURN;
END IF;
END IF;
@@ -3070,52 +2949,21 @@ WHERE
reserve_found=TRUE;
balance_ok=TRUE;
-
--- Obtain KYC status based on the last wire transfer into
--- this reserve. FIXME: likely not adequate for reserves that got P2P transfers!
--- SELECT
--- kyc_ok
--- ,wire_target_serial_id
--- INTO
--- kycok
--- ,account_uuid
--- FROM reserves_in
--- JOIN wire_targets ON (wire_source_h_payto = wire_target_h_payto)
--- WHERE reserve_pub=rpub
--- LIMIT 1; -- limit 1 should not be required (without p2p transfers)
-
-WITH reserves_in AS materialized (
- SELECT wire_source_h_payto
- FROM reserves_in WHERE
- reserve_pub=rpub
-)
-SELECT
- kyc_ok
- ,wire_target_serial_id
-INTO
- kycok
- ,account_uuid
-FROM wire_targets
- WHERE wire_target_h_payto = (
- SELECT wire_source_h_payto
- FROM reserves_in
- );
-
END $$;
--
--- Name: FUNCTION exchange_do_batch_withdraw(amount_val bigint, amount_frac integer, rpub bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT kycok boolean, OUT account_uuid bigint, OUT ruuid bigint); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION exchange_do_batch_withdraw(amount_val bigint, amount_frac integer, rpub bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT ruuid bigint); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.exchange_do_batch_withdraw(amount_val bigint, amount_frac integer, rpub bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT kycok boolean, OUT account_uuid bigint, OUT ruuid bigint) IS 'Checks whether the reserve has sufficient balance for a withdraw operation (or the request is repeated and was previously approved) and if so updates the database with the result. Excludes storing the planchets.';
+COMMENT ON FUNCTION exchange.exchange_do_batch_withdraw(amount_val bigint, amount_frac integer, rpub bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT ruuid bigint) IS 'Checks whether the reserve has sufficient balance for a withdraw operation (or the request is repeated and was previously approved) and if so updates the database with the result. Excludes storing the planchets.';
--
--- Name: exchange_do_batch_withdraw_insert(bytea, bigint, integer, bytea, bigint, bytea, bytea, bytea, bigint); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_batch_withdraw_insert(bytea, bigint, integer, bytea, bigint, bytea, bytea, bytea, bigint); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_batch_withdraw_insert(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, ruuid bigint, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, OUT out_denom_unknown boolean, OUT out_nonce_reuse boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_batch_withdraw_insert(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, ruuid bigint, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, OUT out_denom_unknown boolean, OUT out_nonce_reuse boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -3133,7 +2981,7 @@ out_nonce_reuse=TRUE;
SELECT denominations_serial
INTO denom_serial
- FROM denominations
+ FROM exchange.denominations
WHERE denom_pub_hash=h_denom_pub;
IF NOT FOUND
@@ -3145,7 +2993,7 @@ THEN
END IF;
out_denom_unknown=FALSE;
-INSERT INTO reserves_out
+INSERT INTO exchange.reserves_out
(h_blind_ev
,denominations_serial
,denom_sig
@@ -3178,7 +3026,7 @@ IF NOT NULL cs_nonce
THEN
-- Cache CS signature to prevent replays in the future
-- (and check if cached signature exists at the same time).
- INSERT INTO cs_nonce_locks
+ INSERT INTO exchange.cs_nonce_locks
(nonce
,max_denomination_serial
,op_hash)
@@ -3192,7 +3040,7 @@ THEN
THEN
-- See if the existing entry is identical.
SELECT 1
- FROM cs_nonce_locks
+ FROM exchange.cs_nonce_locks
WHERE nonce=cs_nonce
AND op_hash=h_coin_envelope;
IF NOT FOUND
@@ -3208,29 +3056,67 @@ END $$;
--
--- Name: FUNCTION exchange_do_batch_withdraw_insert(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, ruuid bigint, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, OUT out_denom_unknown boolean, OUT out_nonce_reuse boolean, OUT out_conflict boolean); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION exchange_do_batch_withdraw_insert(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, ruuid bigint, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, OUT out_denom_unknown boolean, OUT out_nonce_reuse boolean, OUT out_conflict boolean); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.exchange_do_batch_withdraw_insert(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, ruuid bigint, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, OUT out_denom_unknown boolean, OUT out_nonce_reuse boolean, OUT out_conflict boolean) IS 'Stores information about a planchet for a batch withdraw operation. Checks if the planchet already exists, and in that case indicates a conflict';
+COMMENT ON FUNCTION exchange.exchange_do_batch_withdraw_insert(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, ruuid bigint, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, OUT out_denom_unknown boolean, OUT out_nonce_reuse boolean, OUT out_conflict boolean) IS 'Stores information about a planchet for a batch withdraw operation. Checks if the planchet already exists, and in that case indicates a conflict';
--
--- Name: exchange_do_close_request(bytea, bytea); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_close_request(bytea, bigint, bytea); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_close_request(in_reserve_pub bytea, in_reserve_sig bytea, OUT out_final_balance_val bigint, OUT out_final_balance_frac integer, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_close_request(in_reserve_pub bytea, in_close_timestamp bigint, in_reserve_sig bytea, OUT out_final_balance_val bigint, OUT out_final_balance_frac integer, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
BEGIN
- -- FIXME
+
+ SELECT
+ current_balance_val
+ ,current_balance_frac
+ INTO
+ out_final_balance_val
+ ,out_final_balance_frac
+ FROM exchange.reserves
+ WHERE reserve_pub=in_reserve_pub;
+
+ IF NOT FOUND
+ THEN
+ out_final_balance_val=0;
+ out_final_balance_frac=0;
+ out_balance_ok = FALSE;
+ out_conflict = FALSE;
+ END IF;
+
+ INSERT INTO exchange.close_requests
+ (reserve_pub
+ ,close_timestamp
+ ,reserve_sig
+ ,close_val
+ ,close_frac)
+ VALUES
+ (in_reserve_pub
+ ,in_close_timestamp
+ ,in_reserve_sig
+ ,out_final_balance_val
+ ,out_final_balance_frac)
+ ON CONFLICT DO NOTHING;
+ out_conflict = NOT FOUND;
+
+ UPDATE reserves SET
+ current_balance_val=0
+ ,current_balance_frac=0
+ WHERE reserve_pub=in_reserve_pub;
+ out_balance_ok = TRUE;
+
END $$;
--
--- Name: exchange_do_deposit(bigint, integer, bytea, bytea, bigint, bigint, bigint, bigint, bytea, character varying, bytea, bigint, bytea, bytea, bigint, boolean, character varying); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_deposit(bigint, integer, bytea, bytea, bigint, bigint, bigint, bigint, bytea, character varying, bytea, bigint, bytea, bytea, bigint, boolean, character varying); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_deposit(in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_h_contract_terms bytea, in_wire_salt bytea, in_wallet_timestamp bigint, in_exchange_timestamp bigint, in_refund_deadline bigint, in_wire_deadline bigint, in_merchant_pub bytea, in_receiver_wire_account character varying, in_h_payto bytea, in_known_coin_id bigint, in_coin_pub bytea, in_coin_sig bytea, in_shard bigint, in_extension_blocked boolean, in_extension_details character varying, OUT out_exchange_timestamp bigint, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_deposit(in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_h_contract_terms bytea, in_wire_salt bytea, in_wallet_timestamp bigint, in_exchange_timestamp bigint, in_refund_deadline bigint, in_wire_deadline bigint, in_merchant_pub bytea, in_receiver_wire_account character varying, in_h_payto bytea, in_known_coin_id bigint, in_coin_pub bytea, in_coin_sig bytea, in_shard bigint, in_extension_blocked boolean, in_extension_details character varying, OUT out_exchange_timestamp bigint, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -3245,7 +3131,7 @@ BEGIN
IF NOT NULL in_extension_details
THEN
- INSERT INTO extension_details
+ INSERT INTO exchange.extension_details
(extension_options)
VALUES
(in_extension_details)
@@ -3255,7 +3141,7 @@ ELSE
END IF;
-INSERT INTO wire_targets
+INSERT INTO exchange.wire_targets
(wire_target_h_payto
,payto_uri)
VALUES
@@ -3268,12 +3154,12 @@ IF NOT FOUND
THEN
SELECT wire_target_serial_id
INTO wtsi
- FROM wire_targets
+ FROM exchange.wire_targets
WHERE wire_target_h_payto=in_h_payto;
END IF;
-INSERT INTO deposits
+INSERT INTO exchange.deposits
(shard
,coin_pub
,known_coin_id
@@ -3321,7 +3207,7 @@ THEN
exchange_timestamp
INTO
out_exchange_timestamp
- FROM deposits
+ FROM exchange.deposits
WHERE shard=in_shard
AND merchant_pub=in_merchant_pub
AND wire_target_h_payto=in_h_payto
@@ -3382,10 +3268,81 @@ END $$;
--
--- Name: exchange_do_gc(bigint, bigint); Type: PROCEDURE; Schema: public; Owner: -
+-- Name: exchange_do_expire_purse(bigint, bigint); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE PROCEDURE public.exchange_do_gc(in_ancient_date bigint, in_now bigint)
+CREATE FUNCTION exchange.exchange_do_expire_purse(in_start_time bigint, in_end_time bigint, OUT out_found boolean) RETURNS boolean
+ LANGUAGE plpgsql
+ AS $$
+DECLARE
+ my_purse_pub BYTEA;
+DECLARE
+ my_deposit record;
+BEGIN
+
+SELECT purse_pub
+ INTO my_purse_pub
+ FROM exchange.purse_requests
+ WHERE (purse_expiration >= in_start_time) AND
+ (purse_expiration < in_end_time) AND
+ (NOT finished) AND
+ (NOT refunded)
+ ORDER BY purse_expiration ASC
+ LIMIT 1;
+out_found = FOUND;
+IF NOT FOUND
+THEN
+ RETURN;
+END IF;
+
+UPDATE purse_requests
+ SET refunded=TRUE,
+ finished=TRUE
+ WHERE purse_pub=my_purse_pub;
+
+INSERT INTO exchange.purse_refunds
+ (purse_pub)
+ VALUES
+ (my_purse_pub);
+
+-- restore balance to each coin deposited into the purse
+FOR my_deposit IN
+ SELECT coin_pub
+ ,amount_with_fee_val
+ ,amount_with_fee_frac
+ FROM exchange.purse_deposits
+ WHERE purse_pub = my_purse_pub
+LOOP
+ UPDATE known_coins SET
+ remaining_frac=remaining_frac+my_deposit.amount_with_fee_frac
+ - CASE
+ WHEN remaining_frac+my_deposit.amount_with_fee_frac >= 100000000
+ THEN 100000000
+ ELSE 0
+ END,
+ remaining_val=remaining_val+my_deposit.amount_with_fee_val
+ + CASE
+ WHEN remaining_frac+my_deposit.amount_with_fee_frac >= 100000000
+ THEN 1
+ ELSE 0
+ END
+ WHERE coin_pub = my_deposit.coin_pub;
+ END LOOP;
+END $$;
+
+
+--
+-- Name: FUNCTION exchange_do_expire_purse(in_start_time bigint, in_end_time bigint, OUT out_found boolean); Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON FUNCTION exchange.exchange_do_expire_purse(in_start_time bigint, in_end_time bigint, OUT out_found boolean) IS 'Finds an expired purse in the given time range and refunds the coins (if any).';
+
+
+--
+-- Name: exchange_do_gc(bigint, bigint); Type: PROCEDURE; Schema: exchange; Owner: -
+--
+
+CREATE PROCEDURE exchange.exchange_do_gc(in_ancient_date bigint, in_now bigint)
LANGUAGE plpgsql
AS $$
DECLARE
@@ -3402,14 +3359,14 @@ DECLARE
denom_min INT8; -- minimum denomination still alive
BEGIN
-DELETE FROM prewire
+DELETE FROM exchange.prewire
WHERE finished=TRUE;
-DELETE FROM wire_fee
+DELETE FROM exchange.wire_fee
WHERE end_date < in_ancient_date;
-- TODO: use closing fee as threshold?
-DELETE FROM reserves
+DELETE FROM exchange.reserves
WHERE gc_date < in_now
AND current_balance_val = 0
AND current_balance_frac = 0;
@@ -3418,11 +3375,11 @@ SELECT
reserve_out_serial_id
INTO
reserve_out_min
- FROM reserves_out
+ FROM exchange.reserves_out
ORDER BY reserve_out_serial_id ASC
LIMIT 1;
-DELETE FROM recoup
+DELETE FROM exchange.recoup
WHERE reserve_out_serial_id < reserve_out_min;
-- FIXME: recoup_refresh lacks GC!
@@ -3430,103 +3387,157 @@ SELECT
reserve_uuid
INTO
reserve_uuid_min
- FROM reserves
+ FROM exchange.reserves
ORDER BY reserve_uuid ASC
LIMIT 1;
-DELETE FROM reserves_out
+DELETE FROM exchange.reserves_out
WHERE reserve_uuid < reserve_uuid_min;
-- FIXME: this query will be horribly slow;
-- need to find another way to formulate it...
-DELETE FROM denominations
+DELETE FROM exchange.denominations
WHERE expire_legal < in_now
AND denominations_serial NOT IN
(SELECT DISTINCT denominations_serial
- FROM reserves_out)
+ FROM exchange.reserves_out)
AND denominations_serial NOT IN
(SELECT DISTINCT denominations_serial
- FROM known_coins
+ FROM exchange.known_coins
WHERE coin_pub IN
(SELECT DISTINCT coin_pub
- FROM recoup))
+ FROM exchange.recoup))
AND denominations_serial NOT IN
(SELECT DISTINCT denominations_serial
- FROM known_coins
+ FROM exchange.known_coins
WHERE coin_pub IN
(SELECT DISTINCT coin_pub
- FROM recoup_refresh));
+ FROM exchange.recoup_refresh));
SELECT
melt_serial_id
INTO
melt_min
- FROM refresh_commitments
+ FROM exchange.refresh_commitments
ORDER BY melt_serial_id ASC
LIMIT 1;
-DELETE FROM refresh_revealed_coins
+DELETE FROM exchange.refresh_revealed_coins
WHERE melt_serial_id < melt_min;
-DELETE FROM refresh_transfer_keys
+DELETE FROM exchange.refresh_transfer_keys
WHERE melt_serial_id < melt_min;
SELECT
known_coin_id
INTO
coin_min
- FROM known_coins
+ FROM exchange.known_coins
ORDER BY known_coin_id ASC
LIMIT 1;
-DELETE FROM deposits
+DELETE FROM exchange.deposits
WHERE known_coin_id < coin_min;
SELECT
deposit_serial_id
INTO
deposit_min
- FROM deposits
+ FROM exchange.deposits
ORDER BY deposit_serial_id ASC
LIMIT 1;
-DELETE FROM refunds
+DELETE FROM exchange.refunds
WHERE deposit_serial_id < deposit_min;
-DELETE FROM aggregation_tracking
+DELETE FROM exchange.aggregation_tracking
WHERE deposit_serial_id < deposit_min;
SELECT
denominations_serial
INTO
denom_min
- FROM denominations
+ FROM exchange.denominations
ORDER BY denominations_serial ASC
LIMIT 1;
-DELETE FROM cs_nonce_locks
+DELETE FROM exchange.cs_nonce_locks
WHERE max_denomination_serial <= denom_min;
END $$;
--
--- Name: exchange_do_history_request(bytea, bytea, bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_history_request(bytea, bytea, bigint, bigint, integer); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_history_request(in_reserve_pub bytea, in_reserve_sig bytea, in_request_timestamp bigint, in_history_fee_val bigint, in_history_fee_frac integer, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_history_request(in_reserve_pub bytea, in_reserve_sig bytea, in_request_timestamp bigint, in_history_fee_val bigint, in_history_fee_frac integer, OUT out_balance_ok boolean, OUT out_idempotent boolean) RETURNS record
LANGUAGE plpgsql
AS $$
BEGIN
- -- FIXME
+
+ -- Insert and check for idempotency.
+ INSERT INTO exchange.history_requests
+ (reserve_pub
+ ,request_timestamp
+ ,reserve_sig
+ ,history_fee_val
+ ,history_fee_frac)
+ VALUES
+ (in_reserve_pub
+ ,in_request_timestamp
+ ,in_reserve_sig
+ ,in_history_fee_val
+ ,in_history_fee_frac)
+ ON CONFLICT DO NOTHING;
+
+ IF NOT FOUND
+ THEN
+ out_balance_ok=TRUE;
+ out_idempotent=TRUE;
+ RETURN;
+ END IF;
+
+ out_idempotent=FALSE;
+
+ -- Update reserve balance.
+ UPDATE reserves
+ SET
+ current_balance_frac=current_balance_frac-in_history_fee_frac
+ + CASE
+ WHEN current_balance_frac < in_history_fee_frac
+ THEN 100000000
+ ELSE 0
+ END,
+ current_balance_val=current_balance_val-in_history_fee_val
+ - CASE
+ WHEN current_balance_frac < in_history_fee_frac
+ THEN 1
+ ELSE 0
+ END
+ WHERE
+ reserve_pub=in_reserve_pub
+ AND ( (current_balance_val > in_history_fee_val) OR
+ ( (current_balance_frac >= in_history_fee_frac) AND
+ (current_balance_val >= in_history_fee_val) ) );
+
+ IF NOT FOUND
+ THEN
+ -- Either reserve does not exist, or balance insufficient.
+ -- Both we treat the same here as balance insufficient.
+ out_balance_ok=FALSE;
+ RETURN;
+ END IF;
+
+ out_balance_ok=TRUE;
END $$;
--
--- Name: exchange_do_melt(bytea, bigint, integer, bytea, bytea, bytea, bigint, integer, boolean); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_melt(bytea, bigint, integer, bytea, bytea, bytea, bigint, integer, boolean); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_melt(in_cs_rms bytea, in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_rc bytea, in_old_coin_pub bytea, in_old_coin_sig bytea, in_known_coin_id bigint, in_noreveal_index integer, in_zombie_required boolean, OUT out_balance_ok boolean, OUT out_zombie_bad boolean, OUT out_noreveal_index integer) RETURNS record
+CREATE FUNCTION exchange.exchange_do_melt(in_cs_rms bytea, in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_rc bytea, in_old_coin_pub bytea, in_old_coin_sig bytea, in_known_coin_id bigint, in_noreveal_index integer, in_zombie_required boolean, OUT out_balance_ok boolean, OUT out_zombie_bad boolean, OUT out_noreveal_index integer) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -3538,7 +3549,7 @@ BEGIN
-- (rare:) PERFORM recoup_refresh (by rrc_serial) -- crosses shards!
-- UPDATE known_coins (by coin_pub)
-INSERT INTO refresh_commitments
+INSERT INTO exchange.refresh_commitments
(rc
,old_coin_pub
,old_coin_sig
@@ -3563,7 +3574,7 @@ THEN
noreveal_index
INTO
out_noreveal_index
- FROM refresh_commitments
+ FROM exchange.refresh_commitments
WHERE rc=in_rc;
out_balance_ok=FOUND;
out_zombie_bad=FALSE; -- zombie is OK
@@ -3581,13 +3592,13 @@ THEN
-- operations, and then see if any of these
-- reveal operations was involved in a recoup.
PERFORM
- FROM recoup_refresh
+ FROM exchange.recoup_refresh
WHERE rrc_serial IN
(SELECT rrc_serial
- FROM refresh_revealed_coins
+ FROM exchange.refresh_revealed_coins
WHERE melt_serial_id IN
(SELECT melt_serial_id
- FROM refresh_commitments
+ FROM exchange.refresh_commitments
WHERE old_coin_pub=in_old_coin_pub));
IF NOT FOUND
THEN
@@ -3640,13 +3651,13 @@ THEN
denominations_serial
INTO
denom_max
- FROM denominations
+ FROM exchange.denominations
ORDER BY denominations_serial DESC
LIMIT 1;
-- Cache CS signature to prevent replays in the future
-- (and check if cached signature exists at the same time).
- INSERT INTO cs_nonce_locks
+ INSERT INTO exchange.cs_nonce_locks
(nonce
,max_denomination_serial
,op_hash)
@@ -3660,7 +3671,7 @@ THEN
THEN
-- Record exists, make sure it is the same
SELECT 1
- FROM cs_nonce_locks
+ FROM exchange.cs_nonce_locks
WHERE nonce=cs_rms
AND op_hash=in_rc;
@@ -3683,16 +3694,28 @@ END $$;
--
--- Name: exchange_do_purse_deposit(bigint, bytea, bigint, integer, bytea, bytea, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_purse_deposit(bigint, bytea, bigint, integer, bytea, bytea, bigint, integer); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_purse_deposit(in_partner_id bigint, in_purse_pub bytea, in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_coin_pub bytea, in_coin_sig bytea, in_amount_without_fee_val bigint, in_amount_without_fee_frac integer, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_purse_deposit(in_partner_id bigint, in_purse_pub bytea, in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_coin_pub bytea, in_coin_sig bytea, in_amount_without_fee_val bigint, in_amount_without_fee_frac integer, OUT out_balance_ok boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
+DECLARE
+ was_merged BOOLEAN;
+DECLARE
+ psi INT8; -- partner's serial ID (set if merged)
+DECLARE
+ my_amount_val INT8; -- total in purse
+DECLARE
+ my_amount_frac INT4; -- total in purse
+DECLARE
+ was_paid BOOLEAN;
+DECLARE
+ my_reserve_pub BYTEA;
BEGIN
-- Store the deposit request.
-INSERT INTO purse_deposits
+INSERT INTO exchange.purse_deposits
(partner_serial_id
,purse_pub
,coin_pub
@@ -3712,9 +3735,8 @@ IF NOT FOUND
THEN
-- Idempotency check: check if coin_sig is the same,
-- if so, success, otherwise conflict!
- SELECT
- 1
- FROM purse_deposits
+ PERFORM
+ FROM exchange.purse_deposits
WHERE coin_pub = in_coin_pub
AND purse_pub = in_purse_pub
AND coin_sig = in_cion_sig;
@@ -3778,18 +3800,90 @@ UPDATE purse_requests
out_conflict=FALSE;
out_balance_ok=TRUE;
+-- See if we can finish the merge or need to update the trigger time and partner.
+SELECT partner_serial_id
+ ,reserve_pub
+ INTO psi
+ ,my_reserve_pub
+ FROM exchange.purse_merges
+ WHERE purse_pub=in_purse_pub;
+
+IF NOT FOUND
+THEN
+ RETURN;
+END IF;
+
+SELECT
+ amount_with_fee_val
+ ,amount_with_fee_frac
+ INTO
+ my_amount_val
+ ,my_amount_frac
+ FROM exchange.purse_requests
+ WHERE (purse_pub=in_purse_pub)
+ AND ( ( ( (amount_with_fee_val <= balance_val)
+ AND (amount_with_fee_frac <= balance_frac) )
+ OR (amount_with_fee_val < balance_val) ) );
+IF NOT FOUND
+THEN
+ RETURN;
+END IF;
+
+IF (0 != psi)
+THEN
+ -- The taler-exchange-router will take care of this.
+ UPDATE purse_actions
+ SET action_date=0 --- "immediately"
+ ,partner_serial_id=psi
+ WHERE purse_pub=in_purse_pub;
+ELSE
+ -- This is a local reserve, update balance immediately.
+ UPDATE reserves
+ SET
+ current_balance_frac=current_balance_frac+my_amount_frac
+ - CASE
+ WHEN current_balance_frac + my_amount_frac >= 100000000
+ THEN 100000000
+ ELSE 0
+ END,
+ current_balance_val=current_balance_val+my_amount_val
+ + CASE
+ WHEN current_balance_frac + my_amount_frac >= 100000000
+ THEN 1
+ ELSE 0
+ END
+ WHERE reserve_pub=my_reserve_pub;
+
+ -- ... and mark purse as finished.
+ -- FIXME: combine with UPDATE above?
+ UPDATE purse_requests
+ SET finished=true
+ WHERE purse_pub=in_purse_pub;
+END IF;
+
+
END $$;
--
--- Name: exchange_do_purse_merge(bytea, bytea, bigint, bytea, character varying, bytea); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_purse_merge(bytea, bytea, bigint, bytea, character varying, bytea, bytea); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_purse_merge(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_partner_url character varying, in_reserve_pub bytea, OUT out_no_partner boolean, OUT out_no_balance boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_purse_merge(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_partner_url character varying, in_reserve_pub bytea, in_wallet_h_payto bytea, OUT out_no_partner boolean, OUT out_no_balance boolean, OUT out_no_reserve boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
+ my_amount_val INT8;
+DECLARE
+ my_amount_frac INT4;
+DECLARE
+ my_purse_fee_val INT8;
+DECLARE
+ my_purse_fee_frac INT4;
+DECLARE
my_partner_serial_id INT8;
+DECLARE
+ my_finished BOOLEAN;
BEGIN
IF in_partner_url IS NULL
@@ -3800,7 +3894,7 @@ ELSE
partner_serial_id
INTO
my_partner_serial_id
- FROM partners
+ FROM exchange.partners
WHERE partner_base_url=in_partner_url
AND start_date <= in_merge_timestamp
AND end_date > in_merge_timestamp;
@@ -3808,6 +3902,7 @@ ELSE
THEN
out_no_partner=TRUE;
out_conflict=FALSE;
+ out_no_reserve=FALSE;
RETURN;
END IF;
END IF;
@@ -3816,8 +3911,17 @@ out_no_partner=FALSE;
-- Check purse is 'full'.
-PERFORM
- FROM purse_requests
+SELECT amount_with_fee_val
+ ,amount_with_fee_frac
+ ,purse_fee_val
+ ,purse_fee_frac
+ ,finished
+ INTO my_amount_val
+ ,my_amount_frac
+ ,my_purse_fee_val
+ ,my_purse_fee_frac
+ ,my_finished
+ FROM exchange.purse_requests
WHERE purse_pub=in_purse_pub
AND balance_val >= amount_with_fee_val
AND ( (balance_frac >= amount_with_fee_frac) OR
@@ -3826,14 +3930,13 @@ IF NOT FOUND
THEN
out_no_balance=TRUE;
out_conflict=FALSE;
+ out_no_reserve=FALSE;
RETURN;
END IF;
out_no_balance=FALSE;
-
-
-- Store purse merge signature, checks for purse_pub uniqueness
-INSERT INTO purse_merges
+INSERT INTO exchange.purse_merges
(partner_serial_id
,reserve_pub
,purse_pub
@@ -3853,31 +3956,89 @@ THEN
-- Note that by checking 'merge_sig', we implicitly check
-- identity over everything that the signature covers.
PERFORM
- FROM purse_merges
+ FROM exchange.purse_merges
WHERE purse_pub=in_purse_pub
AND merge_sig=in_merge_sig;
IF NOT FOUND
THEN
-- Purse was merged, but to some other reserve. Not allowed.
out_conflict=TRUE;
+ out_no_reserve=FALSE;
RETURN;
END IF;
-- "success"
out_conflict=FALSE;
+ out_no_reserve=FALSE;
RETURN;
END IF;
out_conflict=FALSE;
+ASSERT NOT my_finished, 'internal invariant failed';
+
+PERFORM
+ FROM exchange.reserves
+ WHERE reserve_pub=in_reserve_pub;
+
+IF NOT FOUND
+THEN
+ out_no_reserve=TRUE;
+ RETURN;
+END IF;
+out_no_reserve=FALSE;
+
+
-- Store account merge signature.
-INSERT INTO account_merges
+INSERT INTO exchange.account_merges
(reserve_pub
,reserve_sig
- ,purse_pub)
+ ,purse_pub
+ ,wallet_h_payto)
VALUES
(in_reserve_pub
,in_reserve_sig
- ,in_purse_pub);
+ ,in_purse_pub
+ ,in_wallet_h_payto);
+
+-- If we need a wad transfer, mark purse ready for it.
+IF (0 != my_partner_serial_id)
+THEN
+ -- The taler-exchange-router will take care of this.
+ UPDATE purse_actions
+ SET action_date=0 --- "immediately"
+ ,partner_serial_id=my_partner_serial_id
+ WHERE purse_pub=in_purse_pub;
+ELSE
+ -- This is a local reserve, update reserve balance immediately.
+
+ -- Refund the purse fee, by adding it to the purse value:
+ my_amount_val = my_amount_val + my_purse_fee_val;
+ my_amount_frac = my_amount_frac + my_purse_fee_frac;
+ -- normalize result
+ my_amount_val = my_amount_val + my_amount_frac / 100000000;
+ my_amount_frac = my_amount_frac % 100000000;
+
+ UPDATE reserves
+ SET
+ current_balance_frac=current_balance_frac+my_amount_frac
+ - CASE
+ WHEN current_balance_frac + my_amount_frac >= 100000000
+ THEN 100000000
+ ELSE 0
+ END,
+ current_balance_val=current_balance_val+my_amount_val
+ + CASE
+ WHEN current_balance_frac + my_amount_frac >= 100000000
+ THEN 1
+ ELSE 0
+ END
+ WHERE reserve_pub=in_reserve_pub;
+
+ -- ... and mark purse as finished.
+ UPDATE purse_requests
+ SET finished=true
+ WHERE purse_pub=in_purse_pub;
+END IF;
RETURN;
@@ -3886,10 +4047,78 @@ END $$;
--
--- Name: exchange_do_recoup_to_coin(bytea, bigint, bytea, bytea, bigint, bytea, bigint); Type: FUNCTION; Schema: public; Owner: -
+-- Name: FUNCTION exchange_do_purse_merge(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_partner_url character varying, in_reserve_pub bytea, in_wallet_h_payto bytea, OUT out_no_partner boolean, OUT out_no_balance boolean, OUT out_no_reserve boolean, OUT out_conflict boolean); Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON FUNCTION exchange.exchange_do_purse_merge(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_partner_url character varying, in_reserve_pub bytea, in_wallet_h_payto bytea, OUT out_no_partner boolean, OUT out_no_balance boolean, OUT out_no_reserve boolean, OUT out_conflict boolean) IS 'Checks that the partner exists, the purse has not been merged with a different reserve and that the purse is full. If so, persists the merge data and either merges the purse with the reserve or marks it as ready for the taler-exchange-router. Caller MUST abort the transaction on failures so as to not persist data by accident.';
+
+
+--
+-- Name: exchange_do_recoup_by_reserve(bytea); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_recoup_to_coin(in_old_coin_pub bytea, in_rrc_serial bigint, in_coin_blind bytea, in_coin_pub bytea, in_known_coin_id bigint, in_coin_sig bytea, in_recoup_timestamp bigint, OUT out_recoup_ok boolean, OUT out_internal_failure boolean, OUT out_recoup_timestamp bigint) RETURNS record
+CREATE FUNCTION exchange.exchange_do_recoup_by_reserve(res_pub bytea) RETURNS TABLE(denom_sig bytea, denominations_serial bigint, coin_pub bytea, coin_sig bytea, coin_blind bytea, amount_val bigint, amount_frac integer, recoup_timestamp bigint)
+ LANGUAGE plpgsql
+ AS $$
+DECLARE
+ res_uuid BIGINT;
+ blind_ev BYTEA;
+ c_pub BYTEA;
+BEGIN
+ SELECT reserve_uuid
+ INTO res_uuid
+ FROM exchange.reserves
+ WHERE reserves.reserve_pub = res_pub;
+
+ FOR blind_ev IN
+ SELECT h_blind_ev
+ FROM exchange.reserves_out_by_reserve
+ WHERE reserves_out_by_reserve.reserve_uuid = res_uuid
+ LOOP
+ SELECT robr.coin_pub
+ INTO c_pub
+ FROM exchange.recoup_by_reserve robr
+ WHERE robr.reserve_out_serial_id = (
+ SELECT reserves_out.reserve_out_serial_id
+ FROM exchange.reserves_out
+ WHERE reserves_out.h_blind_ev = blind_ev
+ );
+ RETURN QUERY
+ SELECT kc.denom_sig,
+ kc.denominations_serial,
+ rc.coin_pub,
+ rc.coin_sig,
+ rc.coin_blind,
+ rc.amount_val,
+ rc.amount_frac,
+ rc.recoup_timestamp
+ FROM (
+ SELECT *
+ FROM exchange.known_coins
+ WHERE known_coins.coin_pub = c_pub
+ ) kc
+ JOIN (
+ SELECT *
+ FROM exchange.recoup
+ WHERE recoup.coin_pub = c_pub
+ ) rc USING (coin_pub);
+ END LOOP;
+END;
+$$;
+
+
+--
+-- Name: FUNCTION exchange_do_recoup_by_reserve(res_pub bytea); Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON FUNCTION exchange.exchange_do_recoup_by_reserve(res_pub bytea) IS 'Recoup by reserve as a function to make sure we hit only the needed partition and not all when joining as joins on distributed tables fetch ALL rows from the shards';
+
+
+--
+-- Name: exchange_do_recoup_to_coin(bytea, bigint, bytea, bytea, bigint, bytea, bigint); Type: FUNCTION; Schema: exchange; Owner: -
+--
+
+CREATE FUNCTION exchange.exchange_do_recoup_to_coin(in_old_coin_pub bytea, in_rrc_serial bigint, in_coin_blind bytea, in_coin_pub bytea, in_known_coin_id bigint, in_coin_sig bytea, in_recoup_timestamp bigint, OUT out_recoup_ok boolean, OUT out_internal_failure boolean, OUT out_recoup_timestamp bigint) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -3914,7 +4143,7 @@ SELECT
INTO
tmp_frac
,tmp_val
-FROM known_coins
+FROM exchange.known_coins
WHERE coin_pub=in_coin_pub;
IF NOT FOUND
@@ -3931,7 +4160,7 @@ THEN
recoup_timestamp
INTO
out_recoup_timestamp
- FROM recoup_refresh
+ FROM exchange.recoup_refresh
WHERE coin_pub=in_coin_pub;
out_recoup_ok=FOUND;
RETURN;
@@ -3972,7 +4201,7 @@ THEN
END IF;
-INSERT INTO recoup_refresh
+INSERT INTO exchange.recoup_refresh
(coin_pub
,known_coin_id
,coin_sig
@@ -4000,10 +4229,10 @@ END $$;
--
--- Name: exchange_do_recoup_to_reserve(bytea, bigint, bytea, bytea, bigint, bytea, bigint, bigint, bigint); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_recoup_to_reserve(bytea, bigint, bytea, bytea, bigint, bytea, bigint, bigint, bigint); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_recoup_to_reserve(in_reserve_pub bytea, in_reserve_out_serial_id bigint, in_coin_blind bytea, in_coin_pub bytea, in_known_coin_id bigint, in_coin_sig bytea, in_reserve_gc bigint, in_reserve_expiration bigint, in_recoup_timestamp bigint, OUT out_recoup_ok boolean, OUT out_internal_failure boolean, OUT out_recoup_timestamp bigint) RETURNS record
+CREATE FUNCTION exchange.exchange_do_recoup_to_reserve(in_reserve_pub bytea, in_reserve_out_serial_id bigint, in_coin_blind bytea, in_coin_pub bytea, in_known_coin_id bigint, in_coin_sig bytea, in_reserve_gc bigint, in_reserve_expiration bigint, in_recoup_timestamp bigint, OUT out_recoup_ok boolean, OUT out_internal_failure boolean, OUT out_recoup_timestamp bigint) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -4027,7 +4256,7 @@ SELECT
INTO
tmp_frac
,tmp_val
-FROM known_coins
+FROM exchange.known_coins
WHERE coin_pub=in_coin_pub;
IF NOT FOUND
@@ -4044,7 +4273,7 @@ THEN
recoup_timestamp
INTO
out_recoup_timestamp
- FROM recoup
+ FROM exchange.recoup
WHERE coin_pub=in_coin_pub;
out_recoup_ok=FOUND;
@@ -4089,7 +4318,7 @@ THEN
END IF;
-INSERT INTO recoup
+INSERT INTO exchange.recoup
(coin_pub
,coin_sig
,coin_blind
@@ -4115,10 +4344,10 @@ END $$;
--
--- Name: exchange_do_refund(bigint, integer, bigint, integer, bigint, integer, bytea, bigint, bigint, bigint, bytea, bytea, bytea); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_refund(bigint, integer, bigint, integer, bigint, integer, bytea, bigint, bigint, bigint, bytea, bytea, bytea); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_refund(in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_amount_val bigint, in_amount_frac integer, in_deposit_fee_val bigint, in_deposit_fee_frac integer, in_h_contract_terms bytea, in_rtransaction_id bigint, in_deposit_shard bigint, in_known_coin_id bigint, in_coin_pub bytea, in_merchant_pub bytea, in_merchant_sig bytea, OUT out_not_found boolean, OUT out_refund_ok boolean, OUT out_gone boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_refund(in_amount_with_fee_val bigint, in_amount_with_fee_frac integer, in_amount_val bigint, in_amount_frac integer, in_deposit_fee_val bigint, in_deposit_fee_frac integer, in_h_contract_terms bytea, in_rtransaction_id bigint, in_deposit_shard bigint, in_known_coin_id bigint, in_coin_pub bytea, in_merchant_pub bytea, in_merchant_sig bytea, OUT out_not_found boolean, OUT out_refund_ok boolean, OUT out_gone boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -4147,7 +4376,7 @@ INTO
,deposit_val
,deposit_frac
,out_gone
-FROM deposits
+FROM exchange.deposits
WHERE coin_pub=in_coin_pub
AND shard=in_deposit_shard
AND merchant_pub=in_merchant_pub
@@ -4163,7 +4392,7 @@ THEN
RETURN;
END IF;
-INSERT INTO refunds
+INSERT INTO exchange.refunds
(deposit_serial_id
,coin_pub
,merchant_sig
@@ -4188,7 +4417,7 @@ THEN
-- We do select over merchant_pub and h_contract_terms
-- primarily here to maximally use the existing index.
PERFORM
- FROM refunds
+ FROM exchange.refunds
WHERE coin_pub=in_coin_pub
AND deposit_serial_id=dsi
AND rtransaction_id=in_rtransaction_id
@@ -4228,7 +4457,7 @@ SELECT
INTO
tmp_val
,tmp_frac
- FROM refunds
+ FROM exchange.refunds
WHERE coin_pub=in_coin_pub
AND deposit_serial_id=dsi;
IF tmp_val IS NULL
@@ -4294,34 +4523,16 @@ END $$;
--
--- Name: exchange_do_reserve_purse(bytea, bytea, bigint, bytea, bigint, integer, bytea); Type: FUNCTION; Schema: public; Owner: -
+-- Name: exchange_do_reserve_purse(bytea, bytea, bigint, bytea, boolean, bigint, integer, bytea, bytea); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_reserve_purse(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_purse_fee_val bigint, in_purse_fee_frac integer, in_reserve_pub bytea, OUT out_no_funds boolean, OUT out_conflict boolean) RETURNS record
+CREATE FUNCTION exchange.exchange_do_reserve_purse(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_reserve_quota boolean, in_purse_fee_val bigint, in_purse_fee_frac integer, in_reserve_pub bytea, in_wallet_h_payto bytea, OUT out_no_funds boolean, OUT out_no_reserve boolean, OUT out_conflict boolean) RETURNS record
LANGUAGE plpgsql
AS $$
-DECLARE
- my_purses_active INT8;
-DECLARE
- my_purses_allowed INT8;
-DECLARE
- my_balance_val INT8;
-DECLARE
- my_balance_frac INT4;
-DECLARE
- my_kyc_passed BOOLEAN;
BEGIN
--- comment out for now
-IF TRUE
-THEN
- out_no_funds=FALSE;
- out_conflict=FALSE;
- RETURN;
-END IF;
-
-- Store purse merge signature, checks for purse_pub uniqueness
-INSERT INTO purse_merges
+INSERT INTO exchange.purse_merges
(partner_serial_id
,reserve_pub
,purse_pub
@@ -4341,118 +4552,107 @@ THEN
-- Note that by checking 'merge_sig', we implicitly check
-- identity over everything that the signature covers.
PERFORM
- FROM purse_merges
+ FROM exchange.purse_merges
WHERE purse_pub=in_purse_pub
AND merge_sig=in_merge_sig;
IF NOT FOUND
THEN
-- Purse was merged, but to some other reserve. Not allowed.
out_conflict=TRUE;
+ out_no_reserve=FALSE;
+ out_no_funds=FALSE;
RETURN;
END IF;
-- "success"
out_conflict=FALSE;
out_no_funds=FALSE;
+ out_no_reserve=FALSE;
RETURN;
END IF;
out_conflict=FALSE;
-
--- Store account merge signature.
-INSERT INTO account_merges
- (reserve_pub
- ,reserve_sig
- ,purse_pub)
- VALUES
- (in_reserve_pub
- ,in_reserve_sig
- ,in_purse_pub);
-
-
-
--- Charge reserve for purse creation.
--- FIXME: Use different type of purse
--- signature in this case, so that we
--- can properly account for the purse
--- fees when auditing!!!
-SELECT
- purses_active
- ,purses_allowed
- ,kyc_passed
- ,current_balance_val
- ,current_balance_frac
-INTO
- my_purses_active
- ,my_purses_allowed
- ,my_kyc_passed
- ,my_balance_val
- ,my_balance_frac
-FROM reserves
-WHERE reserve_pub=in_reserve_pub;
+PERFORM
+ FROM exchange.reserves
+ WHERE reserve_pub=in_reserve_pub;
IF NOT FOUND
THEN
- out_no_funds=TRUE;
- -- FIXME: be more specific in the returned
- -- error that we don't know the reserve
- -- (instead of merely saying it has no funds)
- RETURN;
-END IF;
-
-IF NOT my_kyc_passed
-THEN
- -- FIXME: might want to categorically disallow
- -- purse creation without KYC (depending on
- -- exchange settings => new argument?)
-END IF;
-
-IF ( (my_purses_active >= my_purses_allowed) AND
- ( (my_balance_val < in_purse_fee_val) OR
- ( (my_balance_val <= in_purse_fee_val) AND
- (my_balance_frac < in_purse_fee_frac) ) ) )
-THEN
+ out_no_reserve=TRUE;
out_no_funds=TRUE;
RETURN;
END IF;
+out_no_reserve=FALSE;
-IF (my_purses_active < my_purses_allowed)
+IF (in_reserve_quota)
THEN
- my_purses_active = my_purses_active + 1;
+ -- Increment active purses per reserve (and check this is allowed)
+ UPDATE reserves
+ SET purses_active=purses_active+1
+ WHERE reserve_pub=in_reserve_pub
+ AND purses_active < purses_allowed;
+ IF NOT FOUND
+ THEN
+ out_no_funds=TRUE;
+ RETURN;
+ END IF;
ELSE
- -- FIXME: See above: we should probably have
- -- very explicit wallet-approval in the
- -- signature to charge the reserve!
- my_balance_val = my_balance_val - in_purse_fee_val;
- IF (my_balance_frac > in_purse_fee_frac)
+ -- UPDATE reserves balance (and check if balance is enough to pay the fee)
+ UPDATE reserves
+ SET
+ current_balance_frac=current_balance_frac-in_purse_fee_frac
+ + CASE
+ WHEN current_balance_frac < in_purse_fee_frac
+ THEN 100000000
+ ELSE 0
+ END,
+ current_balance_val=current_balance_val-in_purse_fee_val
+ - CASE
+ WHEN current_balance_frac < in_purse_fee_frac
+ THEN 1
+ ELSE 0
+ END
+ WHERE reserve_pub=in_reserve_pub
+ AND ( (current_balance_val > in_purse_fee_val) OR
+ ( (current_balance_frac >= in_purse_fee_frac) AND
+ (current_balance_val >= in_purse_fee_val) ) );
+ IF NOT FOUND
THEN
- my_balance_frac = my_balance_frac - in_purse_fee_frac;
- ELSE
- my_balance_val = my_balance_val - 1;
- my_balance_frac = my_balance_frac + 100000000 - in_purse_fee_frac;
+ out_no_funds=TRUE;
+ RETURN;
END IF;
END IF;
-UPDATE reserves SET
- gc_date=min_reserve_gc
- ,current_balance_val=my_balance_val
- ,current_balance_frac=my_balance_frac
- ,purses_active=my_purses_active
- ,kyc_required=TRUE
-WHERE
- reserves.reserve_pub=rpub;
-
out_no_funds=FALSE;
+-- Store account merge signature.
+INSERT INTO exchange.account_merges
+ (reserve_pub
+ ,reserve_sig
+ ,purse_pub
+ ,wallet_h_payto)
+ VALUES
+ (in_reserve_pub
+ ,in_reserve_sig
+ ,in_purse_pub
+ ,in_wallet_h_payto);
+
END $$;
--
--- Name: exchange_do_withdraw(bytea, bigint, integer, bytea, bytea, bytea, bytea, bytea, bigint, bigint); Type: FUNCTION; Schema: public; Owner: -
+-- Name: FUNCTION exchange_do_reserve_purse(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_reserve_quota boolean, in_purse_fee_val bigint, in_purse_fee_frac integer, in_reserve_pub bytea, in_wallet_h_payto bytea, OUT out_no_funds boolean, OUT out_no_reserve boolean, OUT out_conflict boolean); Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON FUNCTION exchange.exchange_do_reserve_purse(in_purse_pub bytea, in_merge_sig bytea, in_merge_timestamp bigint, in_reserve_sig bytea, in_reserve_quota boolean, in_purse_fee_val bigint, in_purse_fee_frac integer, in_reserve_pub bytea, in_wallet_h_payto bytea, OUT out_no_funds boolean, OUT out_no_reserve boolean, OUT out_conflict boolean) IS 'Create a purse for a reserve.';
+
+
+--
+-- Name: exchange_do_withdraw(bytea, bigint, integer, bytea, bytea, bytea, bytea, bytea, bigint, bigint); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.exchange_do_withdraw(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, rpub bytea, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT kycok boolean, OUT account_uuid bigint, OUT ruuid bigint) RETURNS record
+CREATE FUNCTION exchange.exchange_do_withdraw(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, rpub bytea, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT nonce_ok boolean, OUT ruuid bigint) RETURNS record
LANGUAGE plpgsql
AS $$
DECLARE
@@ -4472,7 +4672,7 @@ BEGIN
SELECT denominations_serial
INTO denom_serial
- FROM denominations
+ FROM exchange.denominations
WHERE denom_pub_hash=h_denom_pub;
IF NOT FOUND
@@ -4480,8 +4680,6 @@ THEN
-- denomination unknown, should be impossible!
reserve_found=FALSE;
balance_ok=FALSE;
- kycok=FALSE;
- account_uuid=0;
ruuid=0;
ASSERT false, 'denomination unknown';
RETURN;
@@ -4498,7 +4696,7 @@ SELECT
,reserve_frac
,reserve_gc
,ruuid
- FROM reserves
+ FROM exchange.reserves
WHERE reserves.reserve_pub=rpub;
IF NOT FOUND
@@ -4506,15 +4704,14 @@ THEN
-- reserve unknown
reserve_found=FALSE;
balance_ok=FALSE;
- kycok=FALSE;
- account_uuid=0;
+ nonce_ok=TRUE;
ruuid=2;
RETURN;
END IF;
-- We optimistically insert, and then on conflict declare
-- the query successful due to idempotency.
-INSERT INTO reserves_out
+INSERT INTO exchange.reserves_out
(h_blind_ev
,denominations_serial
,denom_sig
@@ -4539,8 +4736,7 @@ THEN
-- idempotent query, all constraints must be satisfied
reserve_found=TRUE;
balance_ok=TRUE;
- kycok=TRUE;
- account_uuid=0;
+ nonce_ok=TRUE;
RETURN;
END IF;
@@ -4562,9 +4758,8 @@ ELSE
reserve_frac=reserve_frac - amount_frac;
ELSE
reserve_found=TRUE;
+ nonce_ok=TRUE; -- we do not really know
balance_ok=FALSE;
- kycok=FALSE; -- we do not really know or care
- account_uuid=0;
RETURN;
END IF;
END IF;
@@ -4590,7 +4785,7 @@ IF NOT NULL cs_nonce
THEN
-- Cache CS signature to prevent replays in the future
-- (and check if cached signature exists at the same time).
- INSERT INTO cs_nonce_locks
+ INSERT INTO exchange.cs_nonce_locks
(nonce
,max_denomination_serial
,op_hash)
@@ -4604,256 +4799,214 @@ THEN
THEN
-- See if the existing entry is identical.
SELECT 1
- FROM cs_nonce_locks
+ FROM exchange.cs_nonce_locks
WHERE nonce=cs_nonce
AND op_hash=h_coin_envelope;
IF NOT FOUND
THEN
reserve_found=FALSE;
balance_ok=FALSE;
- kycok=FALSE;
- account_uuid=0;
- ruuid=1; -- FIXME: return error message more nicely!
- ASSERT false, 'nonce reuse attempted by client';
+ nonce_ok=FALSE;
+ RETURN;
END IF;
END IF;
+ELSE
+ nonce_ok=TRUE; -- no nonce, hence OK!
END IF;
-
-
--- Obtain KYC status based on the last wire transfer into
--- this reserve. FIXME: likely not adequate for reserves that got P2P transfers!
--- SELECT
--- kyc_ok
--- ,wire_target_serial_id
--- INTO
--- kycok
--- ,account_uuid
--- FROM reserves_in
--- JOIN wire_targets ON (wire_source_h_payto = wire_target_h_payto)
--- WHERE reserve_pub=rpub
--- LIMIT 1; -- limit 1 should not be required (without p2p transfers)
-
-WITH reserves_in AS materialized (
- SELECT wire_source_h_payto
- FROM reserves_in WHERE
- reserve_pub=rpub
-)
-SELECT
- kyc_ok
- ,wire_target_serial_id
-INTO
- kycok
- ,account_uuid
-FROM wire_targets
- WHERE wire_target_h_payto = (
- SELECT wire_source_h_payto
- FROM reserves_in
- );
-
-END $$;
-
-
---
--- Name: FUNCTION exchange_do_withdraw(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, rpub bytea, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT kycok boolean, OUT account_uuid bigint, OUT ruuid bigint); Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON FUNCTION public.exchange_do_withdraw(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, rpub bytea, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT kycok boolean, OUT account_uuid bigint, OUT ruuid bigint) IS 'Checks whether the reserve has sufficient balance for a withdraw operation (or the request is repeated and was previously approved) and if so updates the database with the result';
-
-
---
--- Name: exchange_do_withdraw_limit_check(bigint, bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
---
-
-CREATE FUNCTION public.exchange_do_withdraw_limit_check(ruuid bigint, start_time bigint, upper_limit_val bigint, upper_limit_frac integer, OUT below_limit boolean) RETURNS boolean
- LANGUAGE plpgsql
- AS $$
-DECLARE
- total_val INT8;
-DECLARE
- total_frac INT8; -- INT4 could overflow during accumulation!
-BEGIN
--- NOTE: Read-only, but crosses shards.
--- Shards: reserves by reserve_pub
--- reserves_out by reserve_uuid -- crosses shards!!
-
-
-SELECT
- SUM(amount_with_fee_val) -- overflow here is not plausible
- ,SUM(CAST(amount_with_fee_frac AS INT8)) -- compute using 64 bits
- INTO
- total_val
- ,total_frac
- FROM reserves_out
- WHERE reserve_uuid=ruuid
- AND execution_date > start_time;
-
--- normalize result
-total_val = total_val + total_frac / 100000000;
-total_frac = total_frac % 100000000;
-
--- compare to threshold
-below_limit = (total_val < upper_limit_val) OR
- ( (total_val = upper_limit_val) AND
- (total_frac <= upper_limit_frac) );
END $$;
--
--- Name: FUNCTION exchange_do_withdraw_limit_check(ruuid bigint, start_time bigint, upper_limit_val bigint, upper_limit_frac integer, OUT below_limit boolean); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION exchange_do_withdraw(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, rpub bytea, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT nonce_ok boolean, OUT ruuid bigint); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.exchange_do_withdraw_limit_check(ruuid bigint, start_time bigint, upper_limit_val bigint, upper_limit_frac integer, OUT below_limit boolean) IS 'Check whether the withdrawals from the given reserve since the given time are below the given threshold';
+COMMENT ON FUNCTION exchange.exchange_do_withdraw(cs_nonce bytea, amount_val bigint, amount_frac integer, h_denom_pub bytea, rpub bytea, reserve_sig bytea, h_coin_envelope bytea, denom_sig bytea, now bigint, min_reserve_gc bigint, OUT reserve_found boolean, OUT balance_ok boolean, OUT nonce_ok boolean, OUT ruuid bigint) IS 'Checks whether the reserve has sufficient balance for a withdraw operation (or the request is repeated and was previously approved) and if so updates the database with the result';
--
--- Name: prepare_sharding(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: prepare_sharding(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.prepare_sharding() RETURNS void
+CREATE FUNCTION exchange.prepare_sharding() RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
-
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
-
PERFORM detach_default_partitions();
-
ALTER TABLE IF EXISTS wire_targets
DROP CONSTRAINT IF EXISTS wire_targets_pkey CASCADE
;
-
ALTER TABLE IF EXISTS reserves
DROP CONSTRAINT IF EXISTS reserves_pkey CASCADE
;
-
ALTER TABLE IF EXISTS reserves_in
DROP CONSTRAINT IF EXISTS reserves_in_pkey CASCADE
;
-
ALTER TABLE IF EXISTS reserves_close
DROP CONSTRAINT IF EXISTS reserves_close_pkey CASCADE
;
-
ALTER TABLE IF EXISTS reserves_out
DROP CONSTRAINT IF EXISTS reserves_out_pkey CASCADE
,DROP CONSTRAINT IF EXISTS reserves_out_denominations_serial_fkey
,DROP CONSTRAINT IF EXISTS reserves_out_h_blind_ev_key
;
-
ALTER TABLE IF EXISTS known_coins
DROP CONSTRAINT IF EXISTS known_coins_pkey CASCADE
,DROP CONSTRAINT IF EXISTS known_coins_denominations_serial_fkey
;
-
ALTER TABLE IF EXISTS refresh_commitments
DROP CONSTRAINT IF EXISTS refresh_commitments_pkey CASCADE
,DROP CONSTRAINT IF EXISTS refresh_old_coin_pub_fkey
;
-
ALTER TABLE IF EXISTS refresh_revealed_coins
DROP CONSTRAINT IF EXISTS refresh_revealed_coins_pkey CASCADE
,DROP CONSTRAINT IF EXISTS refresh_revealed_coins_denominations_serial_fkey
;
-
ALTER TABLE IF EXISTS refresh_transfer_keys
DROP CONSTRAINT IF EXISTS refresh_transfer_keys_pkey CASCADE
;
-
ALTER TABLE IF EXISTS deposits
DROP CONSTRAINT IF EXISTS deposits_pkey CASCADE
,DROP CONSTRAINT IF EXISTS deposits_extension_details_serial_id_fkey
,DROP CONSTRAINT IF EXISTS deposits_coin_pub_merchant_pub_h_contract_terms_key CASCADE
;
-
ALTER TABLE IF EXISTS refunds
DROP CONSTRAINT IF EXISTS refunds_pkey CASCADE
;
-
ALTER TABLE IF EXISTS wire_out
DROP CONSTRAINT IF EXISTS wire_out_pkey CASCADE
,DROP CONSTRAINT IF EXISTS wire_out_wtid_raw_key CASCADE
;
-
ALTER TABLE IF EXISTS aggregation_tracking
DROP CONSTRAINT IF EXISTS aggregation_tracking_pkey CASCADE
,DROP CONSTRAINT IF EXISTS aggregation_tracking_wtid_raw_fkey
;
-
ALTER TABLE IF EXISTS recoup
DROP CONSTRAINT IF EXISTS recoup_pkey CASCADE
;
-
ALTER TABLE IF EXISTS recoup_refresh
DROP CONSTRAINT IF EXISTS recoup_refresh_pkey CASCADE
;
-
ALTER TABLE IF EXISTS prewire
DROP CONSTRAINT IF EXISTS prewire_pkey CASCADE
;
-
ALTER TABLE IF EXISTS cs_nonce_locks
DROP CONSTRAINT IF EXISTS cs_nonce_locks_pkey CASCADE
;
-
ALTER TABLE IF EXISTS purse_requests
DROP CONSTRAINT IF EXISTS purse_requests_pkey CASCADE
;
-
+ ALTER TABLE IF EXISTS purse_refunds
+ DROP CONSTRAINT IF EXISTS purse_refunds_pkey CASCADE
+ ;
ALTER TABLE IF EXISTS purse_merges
DROP CONSTRAINT IF EXISTS purse_merges_pkey CASCADE
;
-
ALTER TABLE IF EXISTS account_merges
DROP CONSTRAINT IF EXISTS account_merges_pkey CASCADE
;
-
ALTER TABLE IF EXISTS contracts
DROP CONSTRAINT IF EXISTS contracts_pkey CASCADE
;
-
ALTER TABLE IF EXISTS history_requests
DROP CONSTRAINT IF EXISTS history_requests_pkey CASCADE
;
-
ALTER TABLE IF EXISTS close_requests
DROP CONSTRAINT IF EXISTS close_requests_pkey CASCADE
;
-
ALTER TABLE IF EXISTS purse_deposits
DROP CONSTRAINT IF EXISTS purse_deposits_pkey CASCADE
;
-
ALTER TABLE IF EXISTS wads_out
DROP CONSTRAINT IF EXISTS wads_out_pkey CASCADE
;
-
ALTER TABLE IF EXISTS wad_out_entries
DROP CONSTRAINT IF EXISTS wad_out_entries_pkey CASCADE
;
-
ALTER TABLE IF EXISTS wads_in
DROP CONSTRAINT IF EXISTS wads_in_pkey CASCADE
,DROP CONSTRAINT IF EXISTS wads_in_wad_id_origin_exchange_url_key
;
-
ALTER TABLE IF EXISTS wad_in_entries
DROP CONSTRAINT IF EXISTS wad_in_entries_pkey CASCADE
;
-
END
$$;
--
--- Name: recoup_delete_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: purse_requests_insert_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.recoup_delete_trigger() RETURNS trigger
+CREATE FUNCTION exchange.purse_requests_insert_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
- DELETE FROM recoup_by_reserve
+ ASSERT NOT NEW.finished,'Internal invariant violated';
+ INSERT INTO
+ purse_actions
+ (purse_pub
+ ,action_date)
+ VALUES
+ (NEW.purse_pub
+ ,NEW.purse_expiration);
+ RETURN NEW;
+END $$;
+
+
+--
+-- Name: FUNCTION purse_requests_insert_trigger(); Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON FUNCTION exchange.purse_requests_insert_trigger() IS 'When a purse is created, insert it into the purse_action table to take action when the purse expires.';
+
+
+--
+-- Name: purse_requests_on_update_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
+--
+
+CREATE FUNCTION exchange.purse_requests_on_update_trigger() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ IF (NEW.finished AND NOT OLD.finished)
+ THEN
+ IF (NEW.in_reserve_quota)
+ THEN
+ UPDATE reserves
+ SET purses_active=purses_active-1
+ WHERE reserve_pub IN
+ (SELECT reserve_pub
+ FROM exchange.purse_merges
+ WHERE purse_pub=NEW.purse_pub
+ LIMIT 1);
+ NEW.in_reserve_quota=FALSE;
+ END IF;
+ DELETE FROM exchange.purse_actions
+ WHERE purse_pub=NEW.purse_pub;
+ RETURN NEW;
+ END IF;
+ RETURN NEW;
+END $$;
+
+
+--
+-- Name: FUNCTION purse_requests_on_update_trigger(); Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON FUNCTION exchange.purse_requests_on_update_trigger() IS 'Trigger the router if the purse is ready. Also removes the entry from the router watchlist once the purse is finished.';
+
+
+--
+-- Name: recoup_delete_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
+--
+
+CREATE FUNCTION exchange.recoup_delete_trigger() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ DELETE FROM exchange.recoup_by_reserve
WHERE reserve_out_serial_id = OLD.reserve_out_serial_id
AND coin_pub = OLD.coin_pub;
RETURN OLD;
@@ -4861,21 +5014,21 @@ END $$;
--
--- Name: FUNCTION recoup_delete_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION recoup_delete_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.recoup_delete_trigger() IS 'Replicate recoup deletions into recoup_by_reserve table.';
+COMMENT ON FUNCTION exchange.recoup_delete_trigger() IS 'Replicate recoup deletions into recoup_by_reserve table.';
--
--- Name: recoup_insert_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: recoup_insert_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.recoup_insert_trigger() RETURNS trigger
+CREATE FUNCTION exchange.recoup_insert_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
- INSERT INTO recoup_by_reserve
+ INSERT INTO exchange.recoup_by_reserve
(reserve_out_serial_id
,coin_pub)
VALUES
@@ -4886,42 +5039,42 @@ END $$;
--
--- Name: FUNCTION recoup_insert_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION recoup_insert_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.recoup_insert_trigger() IS 'Replicate recoup inserts into recoup_by_reserve table.';
+COMMENT ON FUNCTION exchange.recoup_insert_trigger() IS 'Replicate recoup inserts into recoup_by_reserve table.';
--
--- Name: reserves_out_by_reserve_delete_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: reserves_out_by_reserve_delete_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.reserves_out_by_reserve_delete_trigger() RETURNS trigger
+CREATE FUNCTION exchange.reserves_out_by_reserve_delete_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
- DELETE FROM reserves_out_by_reserve
+ DELETE FROM exchange.reserves_out_by_reserve
WHERE reserve_uuid = OLD.reserve_uuid;
RETURN OLD;
END $$;
--
--- Name: FUNCTION reserves_out_by_reserve_delete_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION reserves_out_by_reserve_delete_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.reserves_out_by_reserve_delete_trigger() IS 'Replicate reserve_out deletions into reserve_out_by_reserve table.';
+COMMENT ON FUNCTION exchange.reserves_out_by_reserve_delete_trigger() IS 'Replicate reserve_out deletions into reserve_out_by_reserve table.';
--
--- Name: reserves_out_by_reserve_insert_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: reserves_out_by_reserve_insert_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.reserves_out_by_reserve_insert_trigger() RETURNS trigger
+CREATE FUNCTION exchange.reserves_out_by_reserve_insert_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
- INSERT INTO reserves_out_by_reserve
+ INSERT INTO exchange.reserves_out_by_reserve
(reserve_uuid
,h_blind_ev)
VALUES
@@ -4932,31 +5085,31 @@ END $$;
--
--- Name: FUNCTION reserves_out_by_reserve_insert_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION reserves_out_by_reserve_insert_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.reserves_out_by_reserve_insert_trigger() IS 'Replicate reserve_out inserts into reserve_out_by_reserve table.';
+COMMENT ON FUNCTION exchange.reserves_out_by_reserve_insert_trigger() IS 'Replicate reserve_out inserts into reserve_out_by_reserve table.';
--
--- Name: wire_out_delete_trigger(); Type: FUNCTION; Schema: public; Owner: -
+-- Name: wire_out_delete_trigger(); Type: FUNCTION; Schema: exchange; Owner: -
--
-CREATE FUNCTION public.wire_out_delete_trigger() RETURNS trigger
+CREATE FUNCTION exchange.wire_out_delete_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
- DELETE FROM aggregation_tracking
+ DELETE FROM exchange.aggregation_tracking
WHERE wtid_raw = OLD.wtid_raw;
RETURN OLD;
END $$;
--
--- Name: FUNCTION wire_out_delete_trigger(); Type: COMMENT; Schema: public; Owner: -
+-- Name: FUNCTION wire_out_delete_trigger(); Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON FUNCTION public.wire_out_delete_trigger() IS 'Replicate reserve_out deletions into aggregation_tracking. This replaces an earlier use of an ON DELETE CASCADE that required a DEFERRABLE constraint and conflicted with nice partitioning.';
+COMMENT ON FUNCTION exchange.wire_out_delete_trigger() IS 'Replicate reserve_out deletions into aggregation_tracking. This replaces an earlier use of an ON DELETE CASCADE that required a DEFERRABLE constraint and conflicted with nice partitioning.';
SET default_tablespace = '';
@@ -5019,271 +5172,10 @@ COMMENT ON COLUMN _v.patches.conflicts IS 'List of patches that conflict with gi
--
--- Name: account_merges; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.account_merges (
- account_merge_request_serial_id bigint NOT NULL,
- reserve_pub bytea NOT NULL,
- reserve_sig bytea NOT NULL,
- purse_pub bytea NOT NULL,
- CONSTRAINT account_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
- CONSTRAINT account_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32)),
- CONSTRAINT account_merges_reserve_sig_check CHECK ((length(reserve_sig) = 64))
-)
-PARTITION BY HASH (purse_pub);
-
-
---
--- Name: TABLE account_merges; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.account_merges IS 'Merge requests where a purse- and account-owner requested merging the purse into the account';
-
-
---
--- Name: COLUMN account_merges.reserve_pub; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.account_merges.reserve_pub IS 'public key of the target reserve';
-
-
---
--- Name: COLUMN account_merges.reserve_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.account_merges.reserve_sig IS 'signature by the reserve private key affirming the merge, of type TALER_SIGNATURE_WALLET_ACCOUNT_MERGE';
-
-
---
--- Name: COLUMN account_merges.purse_pub; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.account_merges.purse_pub IS 'public key of the purse';
-
-
---
--- Name: account_merges_account_merge_request_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.account_merges ALTER COLUMN account_merge_request_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.account_merges_account_merge_request_serial_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: account_merges_default; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.account_merges_default (
- account_merge_request_serial_id bigint NOT NULL,
- reserve_pub bytea NOT NULL,
- reserve_sig bytea NOT NULL,
- purse_pub bytea NOT NULL,
- CONSTRAINT account_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
- CONSTRAINT account_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32)),
- CONSTRAINT account_merges_reserve_sig_check CHECK ((length(reserve_sig) = 64))
-);
-ALTER TABLE ONLY public.account_merges ATTACH PARTITION public.account_merges_default FOR VALUES WITH (modulus 1, remainder 0);
-
-
---
--- Name: aggregation_tracking; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.aggregation_tracking (
- aggregation_serial_id bigint NOT NULL,
- deposit_serial_id bigint NOT NULL,
- wtid_raw bytea NOT NULL
-)
-PARTITION BY HASH (deposit_serial_id);
-
-
---
--- Name: TABLE aggregation_tracking; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.aggregation_tracking IS 'mapping from wire transfer identifiers (WTID) to deposits (and back)';
-
-
---
--- Name: COLUMN aggregation_tracking.wtid_raw; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.aggregation_tracking.wtid_raw IS 'identifier of the wire transfer';
-
-
---
--- Name: aggregation_tracking_aggregation_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.aggregation_tracking ALTER COLUMN aggregation_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.aggregation_tracking_aggregation_serial_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: aggregation_tracking_default; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.aggregation_tracking_default (
- aggregation_serial_id bigint NOT NULL,
- deposit_serial_id bigint NOT NULL,
- wtid_raw bytea NOT NULL
-);
-ALTER TABLE ONLY public.aggregation_tracking ATTACH PARTITION public.aggregation_tracking_default FOR VALUES WITH (modulus 1, remainder 0);
-
-
---
--- Name: aggregation_transient; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.aggregation_transient (
- amount_val bigint NOT NULL,
- amount_frac integer NOT NULL,
- wire_target_h_payto bytea,
- exchange_account_section text NOT NULL,
- wtid_raw bytea NOT NULL,
- CONSTRAINT aggregation_transient_wire_target_h_payto_check CHECK ((length(wire_target_h_payto) = 32)),
- CONSTRAINT aggregation_transient_wtid_raw_check CHECK ((length(wtid_raw) = 32))
-)
-PARTITION BY HASH (wire_target_h_payto);
-
-
---
--- Name: TABLE aggregation_transient; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.aggregation_transient IS 'aggregations currently happening (lacking wire_out, usually because the amount is too low); this table is not replicated';
-
-
---
--- Name: COLUMN aggregation_transient.amount_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.aggregation_transient.amount_val IS 'Sum of all of the aggregated deposits (without deposit fees)';
-
-
---
--- Name: COLUMN aggregation_transient.wtid_raw; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.aggregation_transient.wtid_raw IS 'identifier of the wire transfer';
-
-
---
--- Name: aggregation_transient_default; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.aggregation_transient_default (
- amount_val bigint NOT NULL,
- amount_frac integer NOT NULL,
- wire_target_h_payto bytea,
- exchange_account_section text NOT NULL,
- wtid_raw bytea NOT NULL,
- CONSTRAINT aggregation_transient_wire_target_h_payto_check CHECK ((length(wire_target_h_payto) = 32)),
- CONSTRAINT aggregation_transient_wtid_raw_check CHECK ((length(wtid_raw) = 32))
-);
-ALTER TABLE ONLY public.aggregation_transient ATTACH PARTITION public.aggregation_transient_default FOR VALUES WITH (modulus 1, remainder 0);
-
-
---
--- Name: app_bankaccount; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.app_bankaccount (
- is_public boolean NOT NULL,
- account_no integer NOT NULL,
- balance character varying NOT NULL,
- user_id integer NOT NULL
-);
-
-
---
--- Name: app_bankaccount_account_no_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.app_bankaccount_account_no_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: app_bankaccount_account_no_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.app_bankaccount_account_no_seq OWNED BY public.app_bankaccount.account_no;
-
-
---
--- Name: app_banktransaction; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.app_banktransaction (
- id bigint NOT NULL,
- amount character varying NOT NULL,
- subject character varying(200) NOT NULL,
- date timestamp with time zone NOT NULL,
- cancelled boolean NOT NULL,
- request_uid character varying(128) NOT NULL,
- credit_account_id integer NOT NULL,
- debit_account_id integer NOT NULL
-);
-
-
---
--- Name: app_banktransaction_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.app_banktransaction_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: app_banktransaction_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: auditor_balance_summary; Type: TABLE; Schema: auditor; Owner: -
--
-ALTER SEQUENCE public.app_banktransaction_id_seq OWNED BY public.app_banktransaction.id;
-
-
---
--- Name: app_talerwithdrawoperation; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.app_talerwithdrawoperation (
- withdraw_id uuid NOT NULL,
- amount character varying NOT NULL,
- selection_done boolean NOT NULL,
- confirmation_done boolean NOT NULL,
- aborted boolean NOT NULL,
- selected_reserve_pub text,
- selected_exchange_account_id integer,
- withdraw_account_id integer NOT NULL
-);
-
-
---
--- Name: auditor_balance_summary; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.auditor_balance_summary (
+CREATE TABLE auditor.auditor_balance_summary (
master_pub bytea NOT NULL,
denom_balance_val bigint NOT NULL,
denom_balance_frac integer NOT NULL,
@@ -5303,72 +5195,17 @@ CREATE TABLE public.auditor_balance_summary (
--
--- Name: TABLE auditor_balance_summary; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.auditor_balance_summary IS 'the sum of the outstanding coins from auditor_denomination_pending (denom_pubs must belong to the respectives exchange master public key); it represents the auditor_balance_summary of the exchange at this point (modulo unexpected historic_loss-style events where denomination keys are compromised)';
-
-
---
--- Name: auditor_denom_sigs; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.auditor_denom_sigs (
- auditor_denom_serial bigint NOT NULL,
- auditor_uuid bigint NOT NULL,
- denominations_serial bigint NOT NULL,
- auditor_sig bytea,
- CONSTRAINT auditor_denom_sigs_auditor_sig_check CHECK ((length(auditor_sig) = 64))
-);
-
-
---
--- Name: TABLE auditor_denom_sigs; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.auditor_denom_sigs IS 'Table with auditor signatures on exchange denomination keys.';
-
-
---
--- Name: COLUMN auditor_denom_sigs.auditor_uuid; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_balance_summary; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON COLUMN public.auditor_denom_sigs.auditor_uuid IS 'Identifies the auditor.';
+COMMENT ON TABLE auditor.auditor_balance_summary IS 'the sum of the outstanding coins from auditor_denomination_pending (denom_pubs must belong to the respectives exchange master public key); it represents the auditor_balance_summary of the exchange at this point (modulo unexpected historic_loss-style events where denomination keys are compromised)';
--
--- Name: COLUMN auditor_denom_sigs.denominations_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: auditor_denomination_pending; Type: TABLE; Schema: auditor; Owner: -
--
-COMMENT ON COLUMN public.auditor_denom_sigs.denominations_serial IS 'Denomination the signature is for.';
-
-
---
--- Name: COLUMN auditor_denom_sigs.auditor_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.auditor_denom_sigs.auditor_sig IS 'Signature of the auditor, of purpose TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS.';
-
-
---
--- Name: auditor_denom_sigs_auditor_denom_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.auditor_denom_sigs ALTER COLUMN auditor_denom_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.auditor_denom_sigs_auditor_denom_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: auditor_denomination_pending; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.auditor_denomination_pending (
+CREATE TABLE auditor.auditor_denomination_pending (
denom_pub_hash bytea NOT NULL,
denom_balance_val bigint NOT NULL,
denom_balance_frac integer NOT NULL,
@@ -5384,38 +5221,38 @@ CREATE TABLE public.auditor_denomination_pending (
--
--- Name: TABLE auditor_denomination_pending; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_denomination_pending; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_denomination_pending IS 'outstanding denomination coins that the exchange is aware of and what the respective balances are (outstanding as well as issued overall which implies the maximum value at risk).';
+COMMENT ON TABLE auditor.auditor_denomination_pending IS 'outstanding denomination coins that the exchange is aware of and what the respective balances are (outstanding as well as issued overall which implies the maximum value at risk).';
--
--- Name: COLUMN auditor_denomination_pending.num_issued; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN auditor_denomination_pending.num_issued; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON COLUMN public.auditor_denomination_pending.num_issued IS 'counts the number of coins issued (withdraw, refresh) of this denomination';
+COMMENT ON COLUMN auditor.auditor_denomination_pending.num_issued IS 'counts the number of coins issued (withdraw, refresh) of this denomination';
--
--- Name: COLUMN auditor_denomination_pending.denom_risk_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN auditor_denomination_pending.denom_risk_val; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON COLUMN public.auditor_denomination_pending.denom_risk_val IS 'amount that could theoretically be lost in the future due to recoup operations';
+COMMENT ON COLUMN auditor.auditor_denomination_pending.denom_risk_val IS 'amount that could theoretically be lost in the future due to recoup operations';
--
--- Name: COLUMN auditor_denomination_pending.recoup_loss_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN auditor_denomination_pending.recoup_loss_val; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON COLUMN public.auditor_denomination_pending.recoup_loss_val IS 'amount actually lost due to recoup operations past revocation';
+COMMENT ON COLUMN auditor.auditor_denomination_pending.recoup_loss_val IS 'amount actually lost due to recoup operations past revocation';
--
--- Name: auditor_exchange_signkeys; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_exchange_signkeys; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_exchange_signkeys (
+CREATE TABLE auditor.auditor_exchange_signkeys (
master_pub bytea NOT NULL,
ep_start bigint NOT NULL,
ep_expire bigint NOT NULL,
@@ -5428,17 +5265,17 @@ CREATE TABLE public.auditor_exchange_signkeys (
--
--- Name: TABLE auditor_exchange_signkeys; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_exchange_signkeys; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_exchange_signkeys IS 'list of the online signing keys of exchanges we are auditing';
+COMMENT ON TABLE auditor.auditor_exchange_signkeys IS 'list of the online signing keys of exchanges we are auditing';
--
--- Name: auditor_exchanges; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_exchanges; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_exchanges (
+CREATE TABLE auditor.auditor_exchanges (
master_pub bytea NOT NULL,
exchange_url character varying NOT NULL,
CONSTRAINT auditor_exchanges_master_pub_check CHECK ((length(master_pub) = 32))
@@ -5446,17 +5283,17 @@ CREATE TABLE public.auditor_exchanges (
--
--- Name: TABLE auditor_exchanges; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_exchanges; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_exchanges IS 'list of the exchanges we are auditing';
+COMMENT ON TABLE auditor.auditor_exchanges IS 'list of the exchanges we are auditing';
--
--- Name: auditor_historic_denomination_revenue; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_historic_denomination_revenue; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_historic_denomination_revenue (
+CREATE TABLE auditor.auditor_historic_denomination_revenue (
master_pub bytea NOT NULL,
denom_pub_hash bytea NOT NULL,
revenue_timestamp bigint NOT NULL,
@@ -5469,24 +5306,24 @@ CREATE TABLE public.auditor_historic_denomination_revenue (
--
--- Name: TABLE auditor_historic_denomination_revenue; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_historic_denomination_revenue; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_historic_denomination_revenue 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.';
+COMMENT ON TABLE auditor.auditor_historic_denomination_revenue 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.';
--
--- Name: COLUMN auditor_historic_denomination_revenue.revenue_balance_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN auditor_historic_denomination_revenue.revenue_balance_val; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON COLUMN public.auditor_historic_denomination_revenue.revenue_balance_val IS 'the sum of all of the profits we made on the coin except for withdraw fees (which are in historic_reserve_revenue); so this includes the deposit, melt and refund fees';
+COMMENT ON COLUMN auditor.auditor_historic_denomination_revenue.revenue_balance_val IS 'the sum of all of the profits we made on the coin except for withdraw fees (which are in historic_reserve_revenue); so this includes the deposit, melt and refund fees';
--
--- Name: auditor_historic_reserve_summary; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_historic_reserve_summary; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_historic_reserve_summary (
+CREATE TABLE auditor.auditor_historic_reserve_summary (
master_pub bytea NOT NULL,
start_date bigint NOT NULL,
end_date bigint NOT NULL,
@@ -5496,135 +5333,148 @@ CREATE TABLE public.auditor_historic_reserve_summary (
--
--- Name: TABLE auditor_historic_reserve_summary; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_historic_reserve_summary; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_historic_reserve_summary IS 'historic profits from reserves; we eventually GC auditor_historic_reserve_revenue, and then store the totals in here (by time intervals).';
+COMMENT ON TABLE auditor.auditor_historic_reserve_summary IS 'historic profits from reserves; we eventually GC auditor_historic_reserve_revenue, and then store the totals in here (by time intervals).';
--
--- Name: auditor_predicted_result; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_predicted_result; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_predicted_result (
+CREATE TABLE auditor.auditor_predicted_result (
master_pub bytea NOT NULL,
balance_val bigint NOT NULL,
- balance_frac integer NOT NULL
+ balance_frac integer NOT NULL,
+ drained_val bigint NOT NULL,
+ drained_frac integer NOT NULL
);
--
--- Name: TABLE auditor_predicted_result; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_predicted_result; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_predicted_result IS 'Table with the sum of the ledger, auditor_historic_revenue and the auditor_reserve_balance. This is the final amount that the exchange should have in its bank account right now.';
+COMMENT ON TABLE auditor.auditor_predicted_result IS 'Table with the sum of the ledger, auditor_historic_revenue and the auditor_reserve_balance and the drained profits. This is the final amount that the exchange should have in its bank account right now (and the total amount drained as profits to non-escrow accounts).';
--
--- Name: auditor_progress_aggregation; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_progress_aggregation; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_progress_aggregation (
+CREATE TABLE auditor.auditor_progress_aggregation (
master_pub bytea NOT NULL,
last_wire_out_serial_id bigint DEFAULT 0 NOT NULL
);
--
--- Name: TABLE auditor_progress_aggregation; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_progress_aggregation; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_progress_aggregation IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
+COMMENT ON TABLE auditor.auditor_progress_aggregation IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
statements to process. The indices include the last serial ID from the respective tables that we have processed. Thus, we need to select those table entries that are strictly larger (and process in monotonically increasing order).';
--
--- Name: auditor_progress_coin; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_progress_coin; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_progress_coin (
+CREATE TABLE auditor.auditor_progress_coin (
master_pub bytea NOT NULL,
last_withdraw_serial_id bigint DEFAULT 0 NOT NULL,
last_deposit_serial_id bigint DEFAULT 0 NOT NULL,
last_melt_serial_id bigint DEFAULT 0 NOT NULL,
last_refund_serial_id bigint DEFAULT 0 NOT NULL,
last_recoup_serial_id bigint DEFAULT 0 NOT NULL,
- last_recoup_refresh_serial_id bigint DEFAULT 0 NOT NULL
+ last_recoup_refresh_serial_id bigint DEFAULT 0 NOT NULL,
+ last_purse_deposits_serial_id bigint DEFAULT 0 NOT NULL,
+ last_purse_refunds_serial_id bigint DEFAULT 0 NOT NULL
);
--
--- Name: TABLE auditor_progress_coin; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_progress_coin; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_progress_coin IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
+COMMENT ON TABLE auditor.auditor_progress_coin IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
statements to process. The indices include the last serial ID from the respective tables that we have processed. Thus, we need to select those table entries that are strictly larger (and process in monotonically increasing order).';
--
--- Name: auditor_progress_deposit_confirmation; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_progress_deposit_confirmation; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_progress_deposit_confirmation (
+CREATE TABLE auditor.auditor_progress_deposit_confirmation (
master_pub bytea NOT NULL,
last_deposit_confirmation_serial_id bigint DEFAULT 0 NOT NULL
);
--
--- Name: TABLE auditor_progress_deposit_confirmation; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_progress_deposit_confirmation; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_progress_deposit_confirmation IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
+COMMENT ON TABLE auditor.auditor_progress_deposit_confirmation IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
statements to process. The indices include the last serial ID from the respective tables that we have processed. Thus, we need to select those table entries that are strictly larger (and process in monotonically increasing order).';
--
--- Name: auditor_progress_reserve; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_progress_reserve; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_progress_reserve (
+CREATE TABLE auditor.auditor_progress_reserve (
master_pub bytea NOT NULL,
last_reserve_in_serial_id bigint DEFAULT 0 NOT NULL,
last_reserve_out_serial_id bigint DEFAULT 0 NOT NULL,
last_reserve_recoup_serial_id bigint DEFAULT 0 NOT NULL,
- last_reserve_close_serial_id bigint DEFAULT 0 NOT NULL
+ last_reserve_close_serial_id bigint DEFAULT 0 NOT NULL,
+ last_purse_merges_serial_id bigint DEFAULT 0 NOT NULL,
+ last_purse_deposits_serial_id bigint DEFAULT 0 NOT NULL,
+ last_account_merges_serial_id bigint DEFAULT 0 NOT NULL,
+ last_history_requests_serial_id bigint DEFAULT 0 NOT NULL,
+ last_close_requests_serial_id bigint DEFAULT 0 NOT NULL
);
--
--- Name: TABLE auditor_progress_reserve; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_progress_reserve; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_progress_reserve IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
+COMMENT ON TABLE auditor.auditor_progress_reserve IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
statements to process. The indices include the last serial ID from the respective tables that we have processed. Thus, we need to select those table entries that are strictly larger (and process in monotonically increasing order).';
--
--- Name: auditor_reserve_balance; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_reserve_balance; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_reserve_balance (
+CREATE TABLE auditor.auditor_reserve_balance (
master_pub bytea NOT NULL,
reserve_balance_val bigint NOT NULL,
reserve_balance_frac integer NOT NULL,
withdraw_fee_balance_val bigint NOT NULL,
- withdraw_fee_balance_frac integer NOT NULL
+ withdraw_fee_balance_frac integer NOT NULL,
+ purse_fee_balance_val bigint NOT NULL,
+ purse_fee_balance_frac integer NOT NULL,
+ history_fee_balance_val bigint NOT NULL,
+ history_fee_balance_frac integer NOT NULL
);
--
--- Name: TABLE auditor_reserve_balance; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_reserve_balance; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_reserve_balance IS 'sum of the balances of all customer reserves (by exchange master public key)';
+COMMENT ON TABLE auditor.auditor_reserve_balance IS 'sum of the balances of all customer reserves (by exchange master public key)';
--
--- Name: auditor_reserves; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_reserves; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_reserves (
+CREATE TABLE auditor.auditor_reserves (
reserve_pub bytea NOT NULL,
master_pub bytea NOT NULL,
reserve_balance_val bigint NOT NULL,
@@ -5639,17 +5489,17 @@ CREATE TABLE public.auditor_reserves (
--
--- Name: TABLE auditor_reserves; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_reserves; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_reserves IS 'all of the customer reserves and their respective balances that the auditor is aware of';
+COMMENT ON TABLE auditor.auditor_reserves IS 'all of the customer reserves and their respective balances that the auditor is aware of';
--
--- Name: auditor_reserves_auditor_reserves_rowid_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: auditor_reserves_auditor_reserves_rowid_seq; Type: SEQUENCE; Schema: auditor; Owner: -
--
-CREATE SEQUENCE public.auditor_reserves_auditor_reserves_rowid_seq
+CREATE SEQUENCE auditor.auditor_reserves_auditor_reserves_rowid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -5658,17 +5508,17 @@ CREATE SEQUENCE public.auditor_reserves_auditor_reserves_rowid_seq
--
--- Name: auditor_reserves_auditor_reserves_rowid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: auditor_reserves_auditor_reserves_rowid_seq; Type: SEQUENCE OWNED BY; Schema: auditor; Owner: -
--
-ALTER SEQUENCE public.auditor_reserves_auditor_reserves_rowid_seq OWNED BY public.auditor_reserves.auditor_reserves_rowid;
+ALTER SEQUENCE auditor.auditor_reserves_auditor_reserves_rowid_seq OWNED BY auditor.auditor_reserves.auditor_reserves_rowid;
--
--- Name: auditor_wire_fee_balance; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_wire_fee_balance; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditor_wire_fee_balance (
+CREATE TABLE auditor.auditor_wire_fee_balance (
master_pub bytea NOT NULL,
wire_fee_balance_val bigint NOT NULL,
wire_fee_balance_frac integer NOT NULL
@@ -5676,68 +5526,154 @@ CREATE TABLE public.auditor_wire_fee_balance (
--
--- Name: TABLE auditor_wire_fee_balance; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE auditor_wire_fee_balance; Type: COMMENT; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditor_wire_fee_balance IS 'sum of the balances of all wire fees (by exchange master public key)';
+COMMENT ON TABLE auditor.auditor_wire_fee_balance IS 'sum of the balances of all wire fees (by exchange master public key)';
--
--- Name: auditors; Type: TABLE; Schema: public; Owner: -
+-- Name: deposit_confirmations; Type: TABLE; Schema: auditor; Owner: -
--
-CREATE TABLE public.auditors (
- auditor_uuid bigint NOT NULL,
- auditor_pub bytea NOT NULL,
- auditor_name character varying NOT NULL,
- auditor_url character varying NOT NULL,
- is_active boolean NOT NULL,
- last_change bigint NOT NULL,
- CONSTRAINT auditors_auditor_pub_check CHECK ((length(auditor_pub) = 32))
+CREATE TABLE auditor.deposit_confirmations (
+ master_pub bytea NOT NULL,
+ serial_id bigint NOT NULL,
+ h_contract_terms bytea NOT NULL,
+ h_extensions bytea NOT NULL,
+ h_wire bytea NOT NULL,
+ exchange_timestamp bigint NOT NULL,
+ refund_deadline bigint NOT NULL,
+ wire_deadline bigint NOT NULL,
+ amount_without_fee_val bigint NOT NULL,
+ amount_without_fee_frac integer NOT NULL,
+ coin_pub bytea NOT NULL,
+ merchant_pub bytea NOT NULL,
+ exchange_sig bytea NOT NULL,
+ exchange_pub bytea NOT NULL,
+ master_sig bytea NOT NULL,
+ CONSTRAINT deposit_confirmations_coin_pub_check CHECK ((length(coin_pub) = 32)),
+ CONSTRAINT deposit_confirmations_exchange_pub_check CHECK ((length(exchange_pub) = 32)),
+ CONSTRAINT deposit_confirmations_exchange_sig_check CHECK ((length(exchange_sig) = 64)),
+ CONSTRAINT deposit_confirmations_h_contract_terms_check CHECK ((length(h_contract_terms) = 64)),
+ CONSTRAINT deposit_confirmations_h_contract_terms_check1 CHECK ((length(h_contract_terms) = 64)),
+ CONSTRAINT deposit_confirmations_h_wire_check CHECK ((length(h_wire) = 64)),
+ CONSTRAINT deposit_confirmations_master_sig_check CHECK ((length(master_sig) = 64)),
+ CONSTRAINT deposit_confirmations_merchant_pub_check CHECK ((length(merchant_pub) = 32))
);
--
--- Name: TABLE auditors; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE deposit_confirmations; Type: COMMENT; Schema: auditor; Owner: -
+--
+
+COMMENT ON TABLE auditor.deposit_confirmations IS 'deposit confirmation sent to us by merchants; we must check that the exchange reported these properly.';
+
+
+--
+-- Name: deposit_confirmations_serial_id_seq; Type: SEQUENCE; Schema: auditor; Owner: -
+--
+
+CREATE SEQUENCE auditor.deposit_confirmations_serial_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: deposit_confirmations_serial_id_seq; Type: SEQUENCE OWNED BY; Schema: auditor; Owner: -
--
-COMMENT ON TABLE public.auditors IS 'Table with auditors the exchange uses or has used in the past. Entries never expire as we need to remember the last_change column indefinitely.';
+ALTER SEQUENCE auditor.deposit_confirmations_serial_id_seq OWNED BY auditor.deposit_confirmations.serial_id;
+
+
+--
+-- Name: wire_auditor_account_progress; Type: TABLE; Schema: auditor; Owner: -
+--
+
+CREATE TABLE auditor.wire_auditor_account_progress (
+ master_pub bytea NOT NULL,
+ account_name text NOT NULL,
+ last_wire_reserve_in_serial_id bigint DEFAULT 0 NOT NULL,
+ last_wire_wire_out_serial_id bigint DEFAULT 0 NOT NULL,
+ wire_in_off bigint NOT NULL,
+ wire_out_off bigint NOT NULL
+);
+
+
+--
+-- Name: TABLE wire_auditor_account_progress; Type: COMMENT; Schema: auditor; Owner: -
+--
+
+COMMENT ON TABLE auditor.wire_auditor_account_progress IS 'information as to which transactions the auditor has processed in the exchange database. Used for SELECTing the
+ statements to process. The indices include the last serial ID from the respective tables that we have processed. Thus, we need to select those table entries that are strictly larger (and process in monotonically increasing order).';
+
+
+--
+-- Name: wire_auditor_progress; Type: TABLE; Schema: auditor; Owner: -
+--
+
+CREATE TABLE auditor.wire_auditor_progress (
+ master_pub bytea NOT NULL,
+ last_timestamp bigint NOT NULL,
+ last_reserve_close_uuid bigint NOT NULL
+);
+
+
+--
+-- Name: account_merges; Type: TABLE; Schema: exchange; Owner: -
+--
+
+CREATE TABLE exchange.account_merges (
+ account_merge_request_serial_id bigint NOT NULL,
+ reserve_pub bytea NOT NULL,
+ reserve_sig bytea NOT NULL,
+ purse_pub bytea NOT NULL,
+ wallet_h_payto bytea NOT NULL,
+ CONSTRAINT account_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
+ CONSTRAINT account_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32)),
+ CONSTRAINT account_merges_reserve_sig_check CHECK ((length(reserve_sig) = 64)),
+ CONSTRAINT account_merges_wallet_h_payto_check CHECK ((length(wallet_h_payto) = 32))
+)
+PARTITION BY HASH (purse_pub);
--
--- Name: COLUMN auditors.auditor_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE account_merges; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.auditors.auditor_pub IS 'Public key of the auditor.';
+COMMENT ON TABLE exchange.account_merges IS 'Merge requests where a purse- and account-owner requested merging the purse into the account';
--
--- Name: COLUMN auditors.auditor_url; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN account_merges.reserve_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.auditors.auditor_url IS 'The base URL of the auditor.';
+COMMENT ON COLUMN exchange.account_merges.reserve_pub IS 'public key of the target reserve';
--
--- Name: COLUMN auditors.is_active; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN account_merges.reserve_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.auditors.is_active IS 'true if we are currently supporting the use of this auditor.';
+COMMENT ON COLUMN exchange.account_merges.reserve_sig IS 'signature by the reserve private key affirming the merge, of type TALER_SIGNATURE_WALLET_ACCOUNT_MERGE';
--
--- Name: COLUMN auditors.last_change; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN account_merges.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.auditors.last_change IS 'Latest time when active status changed. Used to detect replays of old messages.';
+COMMENT ON COLUMN exchange.account_merges.purse_pub IS 'public key of the purse';
--
--- Name: auditors_auditor_uuid_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: account_merges_account_merge_request_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.auditors ALTER COLUMN auditor_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.auditors_auditor_uuid_seq
+ALTER TABLE exchange.account_merges ALTER COLUMN account_merge_request_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.account_merges_account_merge_request_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -5747,198 +5683,257 @@ ALTER TABLE public.auditors ALTER COLUMN auditor_uuid ADD GENERATED BY DEFAULT A
--
--- Name: auth_group; Type: TABLE; Schema: public; Owner: -
+-- Name: account_merges_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.auth_group (
- id integer NOT NULL,
- name character varying(150) NOT NULL
+CREATE TABLE exchange.account_merges_default (
+ account_merge_request_serial_id bigint NOT NULL,
+ reserve_pub bytea NOT NULL,
+ reserve_sig bytea NOT NULL,
+ purse_pub bytea NOT NULL,
+ wallet_h_payto bytea NOT NULL,
+ CONSTRAINT account_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
+ CONSTRAINT account_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32)),
+ CONSTRAINT account_merges_reserve_sig_check CHECK ((length(reserve_sig) = 64)),
+ CONSTRAINT account_merges_wallet_h_payto_check CHECK ((length(wallet_h_payto) = 32))
);
+ALTER TABLE ONLY exchange.account_merges ATTACH PARTITION exchange.account_merges_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: auth_group_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: aggregation_tracking; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE SEQUENCE public.auth_group_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
+CREATE TABLE exchange.aggregation_tracking (
+ aggregation_serial_id bigint NOT NULL,
+ deposit_serial_id bigint NOT NULL,
+ wtid_raw bytea NOT NULL
+)
+PARTITION BY HASH (deposit_serial_id);
--
--- Name: auth_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: TABLE aggregation_tracking; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER SEQUENCE public.auth_group_id_seq OWNED BY public.auth_group.id;
+COMMENT ON TABLE exchange.aggregation_tracking IS 'mapping from wire transfer identifiers (WTID) to deposits (and back)';
--
--- Name: auth_group_permissions; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN aggregation_tracking.wtid_raw; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.auth_group_permissions (
- id bigint NOT NULL,
- group_id integer NOT NULL,
- permission_id integer NOT NULL
-);
+COMMENT ON COLUMN exchange.aggregation_tracking.wtid_raw IS 'identifier of the wire transfer';
--
--- Name: auth_group_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: aggregation_tracking_aggregation_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-CREATE SEQUENCE public.auth_group_permissions_id_seq
+ALTER TABLE exchange.aggregation_tracking ALTER COLUMN aggregation_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.aggregation_tracking_aggregation_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
- CACHE 1;
+ CACHE 1
+);
--
--- Name: auth_group_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: aggregation_tracking_default; Type: TABLE; Schema: exchange; Owner: -
--
-ALTER SEQUENCE public.auth_group_permissions_id_seq OWNED BY public.auth_group_permissions.id;
+CREATE TABLE exchange.aggregation_tracking_default (
+ aggregation_serial_id bigint NOT NULL,
+ deposit_serial_id bigint NOT NULL,
+ wtid_raw bytea NOT NULL
+);
+ALTER TABLE ONLY exchange.aggregation_tracking ATTACH PARTITION exchange.aggregation_tracking_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: auth_permission; Type: TABLE; Schema: public; Owner: -
+-- Name: aggregation_transient; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.auth_permission (
- id integer NOT NULL,
- name character varying(255) NOT NULL,
- content_type_id integer NOT NULL,
- codename character varying(100) NOT NULL
-);
+CREATE TABLE exchange.aggregation_transient (
+ amount_val bigint NOT NULL,
+ amount_frac integer NOT NULL,
+ wire_target_h_payto bytea,
+ merchant_pub bytea,
+ exchange_account_section text NOT NULL,
+ wtid_raw bytea NOT NULL,
+ CONSTRAINT aggregation_transient_merchant_pub_check CHECK ((length(merchant_pub) = 32)),
+ CONSTRAINT aggregation_transient_wire_target_h_payto_check CHECK ((length(wire_target_h_payto) = 32)),
+ CONSTRAINT aggregation_transient_wtid_raw_check CHECK ((length(wtid_raw) = 32))
+)
+PARTITION BY HASH (wire_target_h_payto);
--
--- Name: auth_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: TABLE aggregation_transient; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE SEQUENCE public.auth_permission_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
+COMMENT ON TABLE exchange.aggregation_transient IS 'aggregations currently happening (lacking wire_out, usually because the amount is too low); this table is not replicated';
--
--- Name: auth_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: COLUMN aggregation_transient.amount_val; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER SEQUENCE public.auth_permission_id_seq OWNED BY public.auth_permission.id;
+COMMENT ON COLUMN exchange.aggregation_transient.amount_val IS 'Sum of all of the aggregated deposits (without deposit fees)';
--
--- Name: auth_user; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN aggregation_transient.wtid_raw; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.auth_user (
- id integer NOT NULL,
- password character varying(128) NOT NULL,
- last_login timestamp with time zone,
- is_superuser boolean NOT NULL,
- username character varying(150) NOT NULL,
- first_name character varying(150) NOT NULL,
- last_name character varying(150) NOT NULL,
- email character varying(254) NOT NULL,
- is_staff boolean NOT NULL,
- is_active boolean NOT NULL,
- date_joined timestamp with time zone NOT NULL
+COMMENT ON COLUMN exchange.aggregation_transient.wtid_raw IS 'identifier of the wire transfer';
+
+
+--
+-- Name: aggregation_transient_default; Type: TABLE; Schema: exchange; Owner: -
+--
+
+CREATE TABLE exchange.aggregation_transient_default (
+ amount_val bigint NOT NULL,
+ amount_frac integer NOT NULL,
+ wire_target_h_payto bytea,
+ merchant_pub bytea,
+ exchange_account_section text NOT NULL,
+ wtid_raw bytea NOT NULL,
+ CONSTRAINT aggregation_transient_merchant_pub_check CHECK ((length(merchant_pub) = 32)),
+ CONSTRAINT aggregation_transient_wire_target_h_payto_check CHECK ((length(wire_target_h_payto) = 32)),
+ CONSTRAINT aggregation_transient_wtid_raw_check CHECK ((length(wtid_raw) = 32))
);
+ALTER TABLE ONLY exchange.aggregation_transient ATTACH PARTITION exchange.aggregation_transient_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: auth_user_groups; Type: TABLE; Schema: public; Owner: -
+-- Name: auditor_denom_sigs; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.auth_user_groups (
- id bigint NOT NULL,
- user_id integer NOT NULL,
- group_id integer NOT NULL
+CREATE TABLE exchange.auditor_denom_sigs (
+ auditor_denom_serial bigint NOT NULL,
+ auditor_uuid bigint NOT NULL,
+ denominations_serial bigint NOT NULL,
+ auditor_sig bytea,
+ CONSTRAINT auditor_denom_sigs_auditor_sig_check CHECK ((length(auditor_sig) = 64))
);
--
--- Name: auth_user_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: TABLE auditor_denom_sigs; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE SEQUENCE public.auth_user_groups_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
+COMMENT ON TABLE exchange.auditor_denom_sigs IS 'Table with auditor signatures on exchange denomination keys.';
+
+
+--
+-- Name: COLUMN auditor_denom_sigs.auditor_uuid; Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON COLUMN exchange.auditor_denom_sigs.auditor_uuid IS 'Identifies the auditor.';
+
+
+--
+-- Name: COLUMN auditor_denom_sigs.denominations_serial; Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON COLUMN exchange.auditor_denom_sigs.denominations_serial IS 'Denomination the signature is for.';
--
--- Name: auth_user_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: COLUMN auditor_denom_sigs.auditor_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER SEQUENCE public.auth_user_groups_id_seq OWNED BY public.auth_user_groups.id;
+COMMENT ON COLUMN exchange.auditor_denom_sigs.auditor_sig IS 'Signature of the auditor, of purpose TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS.';
--
--- Name: auth_user_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: auditor_denom_sigs_auditor_denom_serial_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-CREATE SEQUENCE public.auth_user_id_seq
+ALTER TABLE exchange.auditor_denom_sigs ALTER COLUMN auditor_denom_serial ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.auditor_denom_sigs_auditor_denom_serial_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
- CACHE 1;
+ CACHE 1
+);
--
--- Name: auth_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: auditors; Type: TABLE; Schema: exchange; Owner: -
--
-ALTER SEQUENCE public.auth_user_id_seq OWNED BY public.auth_user.id;
+CREATE TABLE exchange.auditors (
+ auditor_uuid bigint NOT NULL,
+ auditor_pub bytea NOT NULL,
+ auditor_name character varying NOT NULL,
+ auditor_url character varying NOT NULL,
+ is_active boolean NOT NULL,
+ last_change bigint NOT NULL,
+ CONSTRAINT auditors_auditor_pub_check CHECK ((length(auditor_pub) = 32))
+);
--
--- Name: auth_user_user_permissions; Type: TABLE; Schema: public; Owner: -
+-- Name: TABLE auditors; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.auth_user_user_permissions (
- id bigint NOT NULL,
- user_id integer NOT NULL,
- permission_id integer NOT NULL
-);
+COMMENT ON TABLE exchange.auditors IS 'Table with auditors the exchange uses or has used in the past. Entries never expire as we need to remember the last_change column indefinitely.';
--
--- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: COLUMN auditors.auditor_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE SEQUENCE public.auth_user_user_permissions_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
+COMMENT ON COLUMN exchange.auditors.auditor_pub IS 'Public key of the auditor.';
+
+
+--
+-- Name: COLUMN auditors.auditor_url; Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON COLUMN exchange.auditors.auditor_url IS 'The base URL of the auditor.';
+
+
+--
+-- Name: COLUMN auditors.is_active; Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON COLUMN exchange.auditors.is_active IS 'true if we are currently supporting the use of this auditor.';
+
+
+--
+-- Name: COLUMN auditors.last_change; Type: COMMENT; Schema: exchange; Owner: -
+--
+
+COMMENT ON COLUMN exchange.auditors.last_change IS 'Latest time when active status changed. Used to detect replays of old messages.';
--
--- Name: auth_user_user_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+-- Name: auditors_auditor_uuid_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER SEQUENCE public.auth_user_user_permissions_id_seq OWNED BY public.auth_user_user_permissions.id;
+ALTER TABLE exchange.auditors ALTER COLUMN auditor_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.auditors_auditor_uuid_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
--
--- Name: close_requests; Type: TABLE; Schema: public; Owner: -
+-- Name: close_requests; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.close_requests (
+CREATE TABLE exchange.close_requests (
+ close_request_serial_id bigint NOT NULL,
reserve_pub bytea NOT NULL,
close_timestamp bigint NOT NULL,
reserve_sig bytea NOT NULL,
@@ -5951,38 +5946,53 @@ PARTITION BY HASH (reserve_pub);
--
--- Name: TABLE close_requests; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE close_requests; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.close_requests IS 'Explicit requests by a reserve owner to close a reserve immediately';
+COMMENT ON TABLE exchange.close_requests IS 'Explicit requests by a reserve owner to close a reserve immediately';
--
--- Name: COLUMN close_requests.close_timestamp; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN close_requests.close_timestamp; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.close_requests.close_timestamp IS 'When the request was created by the client';
+COMMENT ON COLUMN exchange.close_requests.close_timestamp IS 'When the request was created by the client';
--
--- Name: COLUMN close_requests.reserve_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN close_requests.reserve_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.close_requests.reserve_sig IS 'Signature affirming that the reserve is to be closed';
+COMMENT ON COLUMN exchange.close_requests.reserve_sig IS 'Signature affirming that the reserve is to be closed';
--
--- Name: COLUMN close_requests.close_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN close_requests.close_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.close_requests.close_val IS 'Balance of the reserve at the time of closing, to be wired to the associated bank account (minus the closing fee)';
+COMMENT ON COLUMN exchange.close_requests.close_val IS 'Balance of the reserve at the time of closing, to be wired to the associated bank account (minus the closing fee)';
--
--- Name: close_requests_default; Type: TABLE; Schema: public; Owner: -
+-- Name: close_requests_close_request_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-CREATE TABLE public.close_requests_default (
+ALTER TABLE exchange.close_requests ALTER COLUMN close_request_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.close_requests_close_request_serial_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
+
+
+--
+-- Name: close_requests_default; Type: TABLE; Schema: exchange; Owner: -
+--
+
+CREATE TABLE exchange.close_requests_default (
+ close_request_serial_id bigint NOT NULL,
reserve_pub bytea NOT NULL,
close_timestamp bigint NOT NULL,
reserve_sig bytea NOT NULL,
@@ -5991,14 +6001,14 @@ CREATE TABLE public.close_requests_default (
CONSTRAINT close_requests_reserve_pub_check CHECK ((length(reserve_pub) = 32)),
CONSTRAINT close_requests_reserve_sig_check CHECK ((length(reserve_sig) = 64))
);
-ALTER TABLE ONLY public.close_requests ATTACH PARTITION public.close_requests_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.close_requests ATTACH PARTITION exchange.close_requests_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: contracts; Type: TABLE; Schema: public; Owner: -
+-- Name: contracts; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.contracts (
+CREATE TABLE exchange.contracts (
contract_serial_id bigint NOT NULL,
purse_pub bytea NOT NULL,
pub_ckey bytea NOT NULL,
@@ -6013,46 +6023,46 @@ PARTITION BY HASH (purse_pub);
--
--- Name: TABLE contracts; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE contracts; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.contracts IS 'encrypted contracts associated with purses';
+COMMENT ON TABLE exchange.contracts IS 'encrypted contracts associated with purses';
--
--- Name: COLUMN contracts.purse_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN contracts.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.contracts.purse_pub IS 'public key of the purse that the contract is associated with';
+COMMENT ON COLUMN exchange.contracts.purse_pub IS 'public key of the purse that the contract is associated with';
--
--- Name: COLUMN contracts.pub_ckey; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN contracts.pub_ckey; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.contracts.pub_ckey IS 'Public ECDH key used to encrypt the contract, to be used with the purse private key for decryption';
+COMMENT ON COLUMN exchange.contracts.pub_ckey IS 'Public ECDH key used to encrypt the contract, to be used with the purse private key for decryption';
--
--- Name: COLUMN contracts.contract_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN contracts.contract_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.contracts.contract_sig IS 'signature over the encrypted contract by the purse contract key';
+COMMENT ON COLUMN exchange.contracts.contract_sig IS 'signature over the encrypted contract by the purse contract key';
--
--- Name: COLUMN contracts.e_contract; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN contracts.e_contract; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.contracts.e_contract IS 'AES-GCM encrypted contract terms (contains gzip compressed JSON after decryption)';
+COMMENT ON COLUMN exchange.contracts.e_contract IS 'AES-GCM encrypted contract terms (contains gzip compressed JSON after decryption)';
--
--- Name: contracts_contract_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: contracts_contract_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.contracts ALTER COLUMN contract_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.contracts_contract_serial_id_seq
+ALTER TABLE exchange.contracts ALTER COLUMN contract_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.contracts_contract_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6062,10 +6072,10 @@ ALTER TABLE public.contracts ALTER COLUMN contract_serial_id ADD GENERATED BY DE
--
--- Name: contracts_default; Type: TABLE; Schema: public; Owner: -
+-- Name: contracts_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.contracts_default (
+CREATE TABLE exchange.contracts_default (
contract_serial_id bigint NOT NULL,
purse_pub bytea NOT NULL,
pub_ckey bytea NOT NULL,
@@ -6076,14 +6086,14 @@ CREATE TABLE public.contracts_default (
CONSTRAINT contracts_pub_ckey_check CHECK ((length(pub_ckey) = 32)),
CONSTRAINT contracts_purse_pub_check CHECK ((length(purse_pub) = 32))
);
-ALTER TABLE ONLY public.contracts ATTACH PARTITION public.contracts_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.contracts ATTACH PARTITION exchange.contracts_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: cs_nonce_locks; Type: TABLE; Schema: public; Owner: -
+-- Name: cs_nonce_locks; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.cs_nonce_locks (
+CREATE TABLE exchange.cs_nonce_locks (
cs_nonce_lock_serial_id bigint NOT NULL,
nonce bytea NOT NULL,
op_hash bytea NOT NULL,
@@ -6095,39 +6105,39 @@ PARTITION BY HASH (nonce);
--
--- Name: TABLE cs_nonce_locks; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE cs_nonce_locks; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.cs_nonce_locks IS 'ensures a Clause Schnorr client nonce is locked for use with an operation identified by a hash';
+COMMENT ON TABLE exchange.cs_nonce_locks IS 'ensures a Clause Schnorr client nonce is locked for use with an operation identified by a hash';
--
--- Name: COLUMN cs_nonce_locks.nonce; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN cs_nonce_locks.nonce; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.cs_nonce_locks.nonce IS 'actual nonce submitted by the client';
+COMMENT ON COLUMN exchange.cs_nonce_locks.nonce IS 'actual nonce submitted by the client';
--
--- Name: COLUMN cs_nonce_locks.op_hash; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN cs_nonce_locks.op_hash; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.cs_nonce_locks.op_hash IS 'hash (RC for refresh, blind coin hash for withdraw) the nonce may be used with';
+COMMENT ON COLUMN exchange.cs_nonce_locks.op_hash IS 'hash (RC for refresh, blind coin hash for withdraw) the nonce may be used with';
--
--- Name: COLUMN cs_nonce_locks.max_denomination_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN cs_nonce_locks.max_denomination_serial; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.cs_nonce_locks.max_denomination_serial IS 'Maximum number of a CS denomination serial the nonce could be used with, for GC';
+COMMENT ON COLUMN exchange.cs_nonce_locks.max_denomination_serial IS 'Maximum number of a CS denomination serial the nonce could be used with, for GC';
--
--- Name: cs_nonce_locks_cs_nonce_lock_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: cs_nonce_locks_cs_nonce_lock_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.cs_nonce_locks ALTER COLUMN cs_nonce_lock_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.cs_nonce_locks_cs_nonce_lock_serial_id_seq
+ALTER TABLE exchange.cs_nonce_locks ALTER COLUMN cs_nonce_lock_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.cs_nonce_locks_cs_nonce_lock_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6137,10 +6147,10 @@ ALTER TABLE public.cs_nonce_locks ALTER COLUMN cs_nonce_lock_serial_id ADD GENER
--
--- Name: cs_nonce_locks_default; Type: TABLE; Schema: public; Owner: -
+-- Name: cs_nonce_locks_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.cs_nonce_locks_default (
+CREATE TABLE exchange.cs_nonce_locks_default (
cs_nonce_lock_serial_id bigint NOT NULL,
nonce bytea NOT NULL,
op_hash bytea NOT NULL,
@@ -6148,14 +6158,14 @@ CREATE TABLE public.cs_nonce_locks_default (
CONSTRAINT cs_nonce_locks_nonce_check CHECK ((length(nonce) = 32)),
CONSTRAINT cs_nonce_locks_op_hash_check CHECK ((length(op_hash) = 64))
);
-ALTER TABLE ONLY public.cs_nonce_locks ATTACH PARTITION public.cs_nonce_locks_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.cs_nonce_locks ATTACH PARTITION exchange.cs_nonce_locks_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: denomination_revocations; Type: TABLE; Schema: public; Owner: -
+-- Name: denomination_revocations; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.denomination_revocations (
+CREATE TABLE exchange.denomination_revocations (
denom_revocations_serial_id bigint NOT NULL,
denominations_serial bigint NOT NULL,
master_sig bytea NOT NULL,
@@ -6164,18 +6174,18 @@ CREATE TABLE public.denomination_revocations (
--
--- Name: TABLE denomination_revocations; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE denomination_revocations; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.denomination_revocations IS 'remembering which denomination keys have been revoked';
+COMMENT ON TABLE exchange.denomination_revocations IS 'remembering which denomination keys have been revoked';
--
--- Name: denomination_revocations_denom_revocations_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: denomination_revocations_denom_revocations_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.denomination_revocations ALTER COLUMN denom_revocations_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.denomination_revocations_denom_revocations_serial_id_seq
+ALTER TABLE exchange.denomination_revocations ALTER COLUMN denom_revocations_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.denomination_revocations_denom_revocations_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6185,10 +6195,10 @@ ALTER TABLE public.denomination_revocations ALTER COLUMN denom_revocations_seria
--
--- Name: denominations; Type: TABLE; Schema: public; Owner: -
+-- Name: denominations; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.denominations (
+CREATE TABLE exchange.denominations (
denominations_serial bigint NOT NULL,
denom_pub_hash bytea NOT NULL,
denom_type integer DEFAULT 1 NOT NULL,
@@ -6215,39 +6225,39 @@ CREATE TABLE public.denominations (
--
--- Name: TABLE denominations; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE denominations; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.denominations IS 'Main denominations table. All the valid denominations the exchange knows about.';
+COMMENT ON TABLE exchange.denominations IS 'Main denominations table. All the valid denominations the exchange knows about.';
--
--- Name: COLUMN denominations.denominations_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN denominations.denominations_serial; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.denominations.denominations_serial IS 'needed for exchange-auditor replication logic';
+COMMENT ON COLUMN exchange.denominations.denominations_serial IS 'needed for exchange-auditor replication logic';
--
--- Name: COLUMN denominations.denom_type; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN denominations.denom_type; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.denominations.denom_type IS 'determines cipher type for blind signatures used with this denomination; 0 is for RSA';
+COMMENT ON COLUMN exchange.denominations.denom_type IS 'determines cipher type for blind signatures used with this denomination; 0 is for RSA';
--
--- Name: COLUMN denominations.age_mask; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN denominations.age_mask; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.denominations.age_mask IS 'bitmask with the age restrictions that are being used for this denomination; 0 if denomination does not support the use of age restrictions';
+COMMENT ON COLUMN exchange.denominations.age_mask IS 'bitmask with the age restrictions that are being used for this denomination; 0 if denomination does not support the use of age restrictions';
--
--- Name: denominations_denominations_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: denominations_denominations_serial_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.denominations ALTER COLUMN denominations_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.denominations_denominations_serial_seq
+ALTER TABLE exchange.denominations ALTER COLUMN denominations_serial ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.denominations_denominations_serial_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6257,67 +6267,10 @@ ALTER TABLE public.denominations ALTER COLUMN denominations_serial ADD GENERATED
--
--- Name: deposit_confirmations; Type: TABLE; Schema: public; Owner: -
+-- Name: deposits; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.deposit_confirmations (
- master_pub bytea NOT NULL,
- serial_id bigint NOT NULL,
- h_contract_terms bytea NOT NULL,
- h_extensions bytea NOT NULL,
- h_wire bytea NOT NULL,
- exchange_timestamp bigint NOT NULL,
- refund_deadline bigint NOT NULL,
- wire_deadline bigint NOT NULL,
- amount_without_fee_val bigint NOT NULL,
- amount_without_fee_frac integer NOT NULL,
- coin_pub bytea NOT NULL,
- merchant_pub bytea NOT NULL,
- exchange_sig bytea NOT NULL,
- exchange_pub bytea NOT NULL,
- master_sig bytea NOT NULL,
- CONSTRAINT deposit_confirmations_coin_pub_check CHECK ((length(coin_pub) = 32)),
- CONSTRAINT deposit_confirmations_exchange_pub_check CHECK ((length(exchange_pub) = 32)),
- CONSTRAINT deposit_confirmations_exchange_sig_check CHECK ((length(exchange_sig) = 64)),
- CONSTRAINT deposit_confirmations_h_contract_terms_check CHECK ((length(h_contract_terms) = 64)),
- CONSTRAINT deposit_confirmations_h_contract_terms_check1 CHECK ((length(h_contract_terms) = 64)),
- CONSTRAINT deposit_confirmations_h_wire_check CHECK ((length(h_wire) = 64)),
- CONSTRAINT deposit_confirmations_master_sig_check CHECK ((length(master_sig) = 64)),
- CONSTRAINT deposit_confirmations_merchant_pub_check CHECK ((length(merchant_pub) = 32))
-);
-
-
---
--- Name: TABLE deposit_confirmations; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.deposit_confirmations IS 'deposit confirmation sent to us by merchants; we must check that the exchange reported these properly.';
-
-
---
--- Name: deposit_confirmations_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.deposit_confirmations_serial_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: deposit_confirmations_serial_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.deposit_confirmations_serial_id_seq OWNED BY public.deposit_confirmations.serial_id;
-
-
---
--- Name: deposits; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.deposits (
+CREATE TABLE exchange.deposits (
deposit_serial_id bigint NOT NULL,
shard bigint NOT NULL,
coin_pub bytea NOT NULL,
@@ -6347,66 +6300,66 @@ PARTITION BY HASH (coin_pub);
--
--- Name: TABLE deposits; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE deposits; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.deposits IS 'Deposits we have received and for which we need to make (aggregate) wire transfers (and manage refunds).';
+COMMENT ON TABLE exchange.deposits IS 'Deposits we have received and for which we need to make (aggregate) wire transfers (and manage refunds).';
--
--- Name: COLUMN deposits.shard; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.shard; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.shard IS 'Used for load sharding in the materialized indices. Should be set based on merchant_pub. 64-bit value because we need an *unsigned* 32-bit value.';
+COMMENT ON COLUMN exchange.deposits.shard IS 'Used for load sharding in the materialized indices. Should be set based on merchant_pub. 64-bit value because we need an *unsigned* 32-bit value.';
--
--- Name: COLUMN deposits.known_coin_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.known_coin_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.known_coin_id IS 'Used for garbage collection';
+COMMENT ON COLUMN exchange.deposits.known_coin_id IS 'Used for garbage collection';
--
--- Name: COLUMN deposits.wire_salt; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.wire_salt; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.wire_salt IS 'Salt used when hashing the payto://-URI to get the h_wire';
+COMMENT ON COLUMN exchange.deposits.wire_salt IS 'Salt used when hashing the payto://-URI to get the h_wire';
--
--- Name: COLUMN deposits.wire_target_h_payto; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.wire_target_h_payto; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.wire_target_h_payto IS 'Identifies the target bank account and KYC status';
+COMMENT ON COLUMN exchange.deposits.wire_target_h_payto IS 'Identifies the target bank account and KYC status';
--
--- Name: COLUMN deposits.done; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.done; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.done IS 'Set to TRUE once we have included this deposit in some aggregate wire transfer to the merchant';
+COMMENT ON COLUMN exchange.deposits.done IS 'Set to TRUE once we have included this deposit in some aggregate wire transfer to the merchant';
--
--- Name: COLUMN deposits.extension_blocked; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.extension_blocked; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.extension_blocked IS 'True if the aggregation of the deposit is currently blocked by some extension mechanism. Used to filter out deposits that must not be processed by the canonical deposit logic.';
+COMMENT ON COLUMN exchange.deposits.extension_blocked IS 'True if the aggregation of the deposit is currently blocked by some extension mechanism. Used to filter out deposits that must not be processed by the canonical deposit logic.';
--
--- Name: COLUMN deposits.extension_details_serial_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN deposits.extension_details_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.deposits.extension_details_serial_id IS 'References extensions table, NULL if extensions are not used';
+COMMENT ON COLUMN exchange.deposits.extension_details_serial_id IS 'References extensions table, NULL if extensions are not used';
--
--- Name: deposits_by_ready; Type: TABLE; Schema: public; Owner: -
+-- Name: deposits_by_ready; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.deposits_by_ready (
+CREATE TABLE exchange.deposits_by_ready (
wire_deadline bigint NOT NULL,
shard bigint NOT NULL,
coin_pub bytea NOT NULL,
@@ -6417,31 +6370,31 @@ PARTITION BY RANGE (wire_deadline);
--
--- Name: TABLE deposits_by_ready; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE deposits_by_ready; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.deposits_by_ready IS 'Enables fast lookups for deposits_get_ready, auto-populated via TRIGGER below';
+COMMENT ON TABLE exchange.deposits_by_ready IS 'Enables fast lookups for deposits_get_ready, auto-populated via TRIGGER below';
--
--- Name: deposits_by_ready_default; Type: TABLE; Schema: public; Owner: -
+-- Name: deposits_by_ready_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.deposits_by_ready_default (
+CREATE TABLE exchange.deposits_by_ready_default (
wire_deadline bigint NOT NULL,
shard bigint NOT NULL,
coin_pub bytea NOT NULL,
deposit_serial_id bigint,
CONSTRAINT deposits_by_ready_coin_pub_check CHECK ((length(coin_pub) = 32))
);
-ALTER TABLE ONLY public.deposits_by_ready ATTACH PARTITION public.deposits_by_ready_default DEFAULT;
+ALTER TABLE ONLY exchange.deposits_by_ready ATTACH PARTITION exchange.deposits_by_ready_default DEFAULT;
--
--- Name: deposits_default; Type: TABLE; Schema: public; Owner: -
+-- Name: deposits_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.deposits_default (
+CREATE TABLE exchange.deposits_default (
deposit_serial_id bigint NOT NULL,
shard bigint NOT NULL,
coin_pub bytea NOT NULL,
@@ -6467,15 +6420,15 @@ CREATE TABLE public.deposits_default (
CONSTRAINT deposits_wire_salt_check CHECK ((length(wire_salt) = 16)),
CONSTRAINT deposits_wire_target_h_payto_check CHECK ((length(wire_target_h_payto) = 32))
);
-ALTER TABLE ONLY public.deposits ATTACH PARTITION public.deposits_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.deposits ATTACH PARTITION exchange.deposits_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: deposits_deposit_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: deposits_deposit_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.deposits ALTER COLUMN deposit_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.deposits_deposit_serial_id_seq
+ALTER TABLE exchange.deposits ALTER COLUMN deposit_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.deposits_deposit_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6485,10 +6438,10 @@ ALTER TABLE public.deposits ALTER COLUMN deposit_serial_id ADD GENERATED BY DEFA
--
--- Name: deposits_for_matching; Type: TABLE; Schema: public; Owner: -
+-- Name: deposits_for_matching; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.deposits_for_matching (
+CREATE TABLE exchange.deposits_for_matching (
refund_deadline bigint NOT NULL,
merchant_pub bytea NOT NULL,
coin_pub bytea NOT NULL,
@@ -6500,17 +6453,17 @@ PARTITION BY RANGE (refund_deadline);
--
--- Name: TABLE deposits_for_matching; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE deposits_for_matching; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.deposits_for_matching IS 'Enables fast lookups for deposits_iterate_matching, auto-populated via TRIGGER below';
+COMMENT ON TABLE exchange.deposits_for_matching IS 'Enables fast lookups for deposits_iterate_matching, auto-populated via TRIGGER below';
--
--- Name: deposits_for_matching_default; Type: TABLE; Schema: public; Owner: -
+-- Name: deposits_for_matching_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.deposits_for_matching_default (
+CREATE TABLE exchange.deposits_for_matching_default (
refund_deadline bigint NOT NULL,
merchant_pub bytea NOT NULL,
coin_pub bytea NOT NULL,
@@ -6518,86 +6471,14 @@ CREATE TABLE public.deposits_for_matching_default (
CONSTRAINT deposits_for_matching_coin_pub_check CHECK ((length(coin_pub) = 32)),
CONSTRAINT deposits_for_matching_merchant_pub_check CHECK ((length(merchant_pub) = 32))
);
-ALTER TABLE ONLY public.deposits_for_matching ATTACH PARTITION public.deposits_for_matching_default DEFAULT;
+ALTER TABLE ONLY exchange.deposits_for_matching ATTACH PARTITION exchange.deposits_for_matching_default DEFAULT;
--
--- Name: django_content_type; Type: TABLE; Schema: public; Owner: -
+-- Name: exchange_sign_keys; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.django_content_type (
- id integer NOT NULL,
- app_label character varying(100) NOT NULL,
- model character varying(100) NOT NULL
-);
-
-
---
--- Name: django_content_type_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.django_content_type_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: django_content_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.django_content_type_id_seq OWNED BY public.django_content_type.id;
-
-
---
--- Name: django_migrations; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.django_migrations (
- id bigint NOT NULL,
- app character varying(255) NOT NULL,
- name character varying(255) NOT NULL,
- applied timestamp with time zone NOT NULL
-);
-
-
---
--- Name: django_migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.django_migrations_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: django_migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.django_migrations_id_seq OWNED BY public.django_migrations.id;
-
-
---
--- Name: django_session; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.django_session (
- session_key character varying(40) NOT NULL,
- session_data text NOT NULL,
- expire_date timestamp with time zone NOT NULL
-);
-
-
---
--- Name: exchange_sign_keys; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.exchange_sign_keys (
+CREATE TABLE exchange.exchange_sign_keys (
esk_serial bigint NOT NULL,
exchange_pub bytea NOT NULL,
master_sig bytea NOT NULL,
@@ -6610,53 +6491,53 @@ CREATE TABLE public.exchange_sign_keys (
--
--- Name: TABLE exchange_sign_keys; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE exchange_sign_keys; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.exchange_sign_keys IS 'Table with master public key signatures on exchange online signing keys.';
+COMMENT ON TABLE exchange.exchange_sign_keys IS 'Table with master public key signatures on exchange online signing keys.';
--
--- Name: COLUMN exchange_sign_keys.exchange_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN exchange_sign_keys.exchange_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.exchange_sign_keys.exchange_pub IS 'Public online signing key of the exchange.';
+COMMENT ON COLUMN exchange.exchange_sign_keys.exchange_pub IS 'Public online signing key of the exchange.';
--
--- Name: COLUMN exchange_sign_keys.master_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN exchange_sign_keys.master_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.exchange_sign_keys.master_sig IS 'Signature affirming the validity of the signing key of purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.';
+COMMENT ON COLUMN exchange.exchange_sign_keys.master_sig IS 'Signature affirming the validity of the signing key of purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.';
--
--- Name: COLUMN exchange_sign_keys.valid_from; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN exchange_sign_keys.valid_from; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.exchange_sign_keys.valid_from IS 'Time when this online signing key will first be used to sign messages.';
+COMMENT ON COLUMN exchange.exchange_sign_keys.valid_from IS 'Time when this online signing key will first be used to sign messages.';
--
--- Name: COLUMN exchange_sign_keys.expire_sign; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN exchange_sign_keys.expire_sign; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.exchange_sign_keys.expire_sign IS 'Time when this online signing key will no longer be used to sign.';
+COMMENT ON COLUMN exchange.exchange_sign_keys.expire_sign IS 'Time when this online signing key will no longer be used to sign.';
--
--- Name: COLUMN exchange_sign_keys.expire_legal; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN exchange_sign_keys.expire_legal; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.exchange_sign_keys.expire_legal IS 'Time when this online signing key legally expires.';
+COMMENT ON COLUMN exchange.exchange_sign_keys.expire_legal IS 'Time when this online signing key legally expires.';
--
--- Name: exchange_sign_keys_esk_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: exchange_sign_keys_esk_serial_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.exchange_sign_keys ALTER COLUMN esk_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.exchange_sign_keys_esk_serial_seq
+ALTER TABLE exchange.exchange_sign_keys ALTER COLUMN esk_serial ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.exchange_sign_keys_esk_serial_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6666,10 +6547,10 @@ ALTER TABLE public.exchange_sign_keys ALTER COLUMN esk_serial ADD GENERATED BY D
--
--- Name: extension_details; Type: TABLE; Schema: public; Owner: -
+-- Name: extension_details; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.extension_details (
+CREATE TABLE exchange.extension_details (
extension_details_serial_id bigint NOT NULL,
extension_options character varying
)
@@ -6677,36 +6558,36 @@ PARTITION BY HASH (extension_details_serial_id);
--
--- Name: TABLE extension_details; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE extension_details; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.extension_details IS 'Extensions that were provided with deposits (not yet used).';
+COMMENT ON TABLE exchange.extension_details IS 'Extensions that were provided with deposits (not yet used).';
--
--- Name: COLUMN extension_details.extension_options; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN extension_details.extension_options; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.extension_details.extension_options IS 'JSON object with options set that the exchange needs to consider when executing a deposit. Supported details depend on the extensions supported by the exchange.';
+COMMENT ON COLUMN exchange.extension_details.extension_options IS 'JSON object with options set that the exchange needs to consider when executing a deposit. Supported details depend on the extensions supported by the exchange.';
--
--- Name: extension_details_default; Type: TABLE; Schema: public; Owner: -
+-- Name: extension_details_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.extension_details_default (
+CREATE TABLE exchange.extension_details_default (
extension_details_serial_id bigint NOT NULL,
extension_options character varying
);
-ALTER TABLE ONLY public.extension_details ATTACH PARTITION public.extension_details_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.extension_details ATTACH PARTITION exchange.extension_details_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: extension_details_extension_details_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: extension_details_extension_details_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.extension_details ALTER COLUMN extension_details_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.extension_details_extension_details_serial_id_seq
+ALTER TABLE exchange.extension_details ALTER COLUMN extension_details_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.extension_details_extension_details_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6716,10 +6597,10 @@ ALTER TABLE public.extension_details ALTER COLUMN extension_details_serial_id AD
--
--- Name: extensions; Type: TABLE; Schema: public; Owner: -
+-- Name: extensions; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.extensions (
+CREATE TABLE exchange.extensions (
extension_id bigint NOT NULL,
name character varying NOT NULL,
config bytea
@@ -6727,32 +6608,32 @@ CREATE TABLE public.extensions (
--
--- Name: TABLE extensions; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE extensions; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.extensions IS 'Configurations of the activated extensions';
+COMMENT ON TABLE exchange.extensions IS 'Configurations of the activated extensions';
--
--- Name: COLUMN extensions.name; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN extensions.name; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.extensions.name IS 'Name of the extension';
+COMMENT ON COLUMN exchange.extensions.name IS 'Name of the extension';
--
--- Name: COLUMN extensions.config; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN extensions.config; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.extensions.config IS 'Configuration of the extension as JSON-blob, maybe NULL';
+COMMENT ON COLUMN exchange.extensions.config IS 'Configuration of the extension as JSON-blob, maybe NULL';
--
--- Name: extensions_extension_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: extensions_extension_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.extensions ALTER COLUMN extension_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.extensions_extension_id_seq
+ALTER TABLE exchange.extensions ALTER COLUMN extension_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.extensions_extension_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6762,10 +6643,10 @@ ALTER TABLE public.extensions ALTER COLUMN extension_id ADD GENERATED BY DEFAULT
--
--- Name: global_fee; Type: TABLE; Schema: public; Owner: -
+-- Name: global_fee; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.global_fee (
+CREATE TABLE exchange.global_fee (
global_fee_serial bigint NOT NULL,
start_date bigint NOT NULL,
end_date bigint NOT NULL,
@@ -6787,25 +6668,25 @@ CREATE TABLE public.global_fee (
--
--- Name: TABLE global_fee; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE global_fee; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.global_fee IS 'list of the global fees of this exchange, by date';
+COMMENT ON TABLE exchange.global_fee IS 'list of the global fees of this exchange, by date';
--
--- Name: COLUMN global_fee.global_fee_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN global_fee.global_fee_serial; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.global_fee.global_fee_serial IS 'needed for exchange-auditor replication logic';
+COMMENT ON COLUMN exchange.global_fee.global_fee_serial IS 'needed for exchange-auditor replication logic';
--
--- Name: global_fee_global_fee_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: global_fee_global_fee_serial_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.global_fee ALTER COLUMN global_fee_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.global_fee_global_fee_serial_seq
+ALTER TABLE exchange.global_fee ALTER COLUMN global_fee_serial ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.global_fee_global_fee_serial_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6815,10 +6696,11 @@ ALTER TABLE public.global_fee ALTER COLUMN global_fee_serial ADD GENERATED BY DE
--
--- Name: history_requests; Type: TABLE; Schema: public; Owner: -
+-- Name: history_requests; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.history_requests (
+CREATE TABLE exchange.history_requests (
+ history_request_serial_id bigint NOT NULL,
reserve_pub bytea NOT NULL,
request_timestamp bigint NOT NULL,
reserve_sig bytea NOT NULL,
@@ -6831,38 +6713,39 @@ PARTITION BY HASH (reserve_pub);
--
--- Name: TABLE history_requests; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE history_requests; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.history_requests IS 'Paid history requests issued by a client against a reserve';
+COMMENT ON TABLE exchange.history_requests IS 'Paid history requests issued by a client against a reserve';
--
--- Name: COLUMN history_requests.request_timestamp; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN history_requests.request_timestamp; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.history_requests.request_timestamp IS 'When was the history request made';
+COMMENT ON COLUMN exchange.history_requests.request_timestamp IS 'When was the history request made';
--
--- Name: COLUMN history_requests.reserve_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN history_requests.reserve_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.history_requests.reserve_sig IS 'Signature approving payment for the history request';
+COMMENT ON COLUMN exchange.history_requests.reserve_sig IS 'Signature approving payment for the history request';
--
--- Name: COLUMN history_requests.history_fee_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN history_requests.history_fee_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.history_requests.history_fee_val IS 'History fee approved by the signature';
+COMMENT ON COLUMN exchange.history_requests.history_fee_val IS 'History fee approved by the signature';
--
--- Name: history_requests_default; Type: TABLE; Schema: public; Owner: -
+-- Name: history_requests_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.history_requests_default (
+CREATE TABLE exchange.history_requests_default (
+ history_request_serial_id bigint NOT NULL,
reserve_pub bytea NOT NULL,
request_timestamp bigint NOT NULL,
reserve_sig bytea NOT NULL,
@@ -6871,21 +6754,35 @@ CREATE TABLE public.history_requests_default (
CONSTRAINT history_requests_reserve_pub_check CHECK ((length(reserve_pub) = 32)),
CONSTRAINT history_requests_reserve_sig_check CHECK ((length(reserve_sig) = 64))
);
-ALTER TABLE ONLY public.history_requests ATTACH PARTITION public.history_requests_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.history_requests ATTACH PARTITION exchange.history_requests_default FOR VALUES WITH (modulus 1, remainder 0);
+
+
+--
+-- Name: history_requests_history_request_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
+--
+
+ALTER TABLE exchange.history_requests ALTER COLUMN history_request_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.history_requests_history_request_serial_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
--
--- Name: known_coins; Type: TABLE; Schema: public; Owner: -
+-- Name: known_coins; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.known_coins (
+CREATE TABLE exchange.known_coins (
known_coin_id bigint NOT NULL,
denominations_serial bigint NOT NULL,
coin_pub bytea NOT NULL,
age_commitment_hash bytea,
denom_sig bytea NOT NULL,
- remaining_val bigint NOT NULL,
- remaining_frac integer NOT NULL,
+ remaining_val bigint DEFAULT 0 NOT NULL,
+ remaining_frac integer DEFAULT 0 NOT NULL,
CONSTRAINT known_coins_age_commitment_hash_check CHECK ((length(age_commitment_hash) = 32)),
CONSTRAINT known_coins_coin_pub_check CHECK ((length(coin_pub) = 32))
)
@@ -6893,71 +6790,71 @@ PARTITION BY HASH (coin_pub);
--
--- Name: TABLE known_coins; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE known_coins; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.known_coins IS 'information about coins and their signatures, so we do not have to store the signatures more than once if a coin is involved in multiple operations';
+COMMENT ON TABLE exchange.known_coins IS 'information about coins and their signatures, so we do not have to store the signatures more than once if a coin is involved in multiple operations';
--
--- Name: COLUMN known_coins.denominations_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN known_coins.denominations_serial; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.known_coins.denominations_serial IS 'Denomination of the coin, determines the value of the original coin and applicable fees for coin-specific operations.';
+COMMENT ON COLUMN exchange.known_coins.denominations_serial IS 'Denomination of the coin, determines the value of the original coin and applicable fees for coin-specific operations.';
--
--- Name: COLUMN known_coins.coin_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN known_coins.coin_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.known_coins.coin_pub IS 'EdDSA public key of the coin';
+COMMENT ON COLUMN exchange.known_coins.coin_pub IS 'EdDSA public key of the coin';
--
--- Name: COLUMN known_coins.age_commitment_hash; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN known_coins.age_commitment_hash; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.known_coins.age_commitment_hash IS 'Optional hash of the age commitment for age restrictions as per DD 24 (active if denom_type has the respective bit set)';
+COMMENT ON COLUMN exchange.known_coins.age_commitment_hash IS 'Optional hash of the age commitment for age restrictions as per DD 24 (active if denom_type has the respective bit set)';
--
--- Name: COLUMN known_coins.denom_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN known_coins.denom_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.known_coins.denom_sig IS 'This is the signature of the exchange that affirms that the coin is a valid coin. The specific signature type depends on denom_type of the denomination.';
+COMMENT ON COLUMN exchange.known_coins.denom_sig IS 'This is the signature of the exchange that affirms that the coin is a valid coin. The specific signature type depends on denom_type of the denomination.';
--
--- Name: COLUMN known_coins.remaining_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN known_coins.remaining_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.known_coins.remaining_val IS 'Value of the coin that remains to be spent';
+COMMENT ON COLUMN exchange.known_coins.remaining_val IS 'Value of the coin that remains to be spent';
--
--- Name: known_coins_default; Type: TABLE; Schema: public; Owner: -
+-- Name: known_coins_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.known_coins_default (
+CREATE TABLE exchange.known_coins_default (
known_coin_id bigint NOT NULL,
denominations_serial bigint NOT NULL,
coin_pub bytea NOT NULL,
age_commitment_hash bytea,
denom_sig bytea NOT NULL,
- remaining_val bigint NOT NULL,
- remaining_frac integer NOT NULL,
+ remaining_val bigint DEFAULT 0 NOT NULL,
+ remaining_frac integer DEFAULT 0 NOT NULL,
CONSTRAINT known_coins_age_commitment_hash_check CHECK ((length(age_commitment_hash) = 32)),
CONSTRAINT known_coins_coin_pub_check CHECK ((length(coin_pub) = 32))
);
-ALTER TABLE ONLY public.known_coins ATTACH PARTITION public.known_coins_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.known_coins ATTACH PARTITION exchange.known_coins_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: known_coins_known_coin_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: known_coins_known_coin_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.known_coins ALTER COLUMN known_coin_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.known_coins_known_coin_id_seq
+ALTER TABLE exchange.known_coins ALTER COLUMN known_coin_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.known_coins_known_coin_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -6967,274 +6864,124 @@ ALTER TABLE public.known_coins ALTER COLUMN known_coin_id ADD GENERATED BY DEFAU
--
--- Name: merchant_accounts; Type: TABLE; Schema: public; Owner: -
+-- Name: kyc_alerts; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_accounts (
- account_serial bigint NOT NULL,
- merchant_serial bigint NOT NULL,
- h_wire bytea NOT NULL,
- salt bytea NOT NULL,
- payto_uri character varying NOT NULL,
- active boolean NOT NULL,
- CONSTRAINT merchant_accounts_h_wire_check CHECK ((length(h_wire) = 64)),
- CONSTRAINT merchant_accounts_salt_check CHECK ((length(salt) = 16))
+CREATE TABLE exchange.kyc_alerts (
+ h_payto bytea NOT NULL,
+ trigger_type integer NOT NULL,
+ CONSTRAINT kyc_alerts_h_payto_check CHECK ((length(h_payto) = 32))
);
--
--- Name: TABLE merchant_accounts; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE kyc_alerts; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_accounts IS 'bank accounts of the instances';
+COMMENT ON TABLE exchange.kyc_alerts IS 'alerts about completed KYC events reliably notifying other components (even if they are not running)';
--
--- Name: COLUMN merchant_accounts.h_wire; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN kyc_alerts.h_payto; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_accounts.h_wire IS 'salted hash of payto_uri';
+COMMENT ON COLUMN exchange.kyc_alerts.h_payto IS 'hash of the payto://-URI for which the KYC status changed';
--
--- Name: COLUMN merchant_accounts.salt; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN kyc_alerts.trigger_type; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_accounts.salt IS 'salt used when hashing payto_uri into h_wire';
+COMMENT ON COLUMN exchange.kyc_alerts.trigger_type IS 'identifies the receiver of the alert, as the same h_payto may require multiple components to be notified';
--
--- Name: COLUMN merchant_accounts.payto_uri; Type: COMMENT; Schema: public; Owner: -
+-- Name: legitimizations; Type: TABLE; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_accounts.payto_uri IS 'payto URI of a merchant bank account';
-
-
---
--- Name: COLUMN merchant_accounts.active; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_accounts.active IS 'true if we actively use this bank account, false if it is just kept around for older contracts to refer to';
-
-
---
--- Name: merchant_accounts_account_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_accounts ALTER COLUMN account_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_accounts_account_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: merchant_contract_terms; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_contract_terms (
- order_serial bigint NOT NULL,
- merchant_serial bigint NOT NULL,
- order_id character varying NOT NULL,
- contract_terms bytea NOT NULL,
- h_contract_terms bytea NOT NULL,
- creation_time bigint NOT NULL,
- pay_deadline bigint NOT NULL,
- refund_deadline bigint NOT NULL,
- paid boolean DEFAULT false NOT NULL,
- wired boolean DEFAULT false NOT NULL,
- fulfillment_url character varying,
- session_id character varying DEFAULT ''::character varying NOT NULL,
- claim_token bytea NOT NULL,
- CONSTRAINT merchant_contract_terms_claim_token_check CHECK ((length(claim_token) = 16)),
- CONSTRAINT merchant_contract_terms_h_contract_terms_check CHECK ((length(h_contract_terms) = 64))
-);
-
-
---
--- Name: TABLE merchant_contract_terms; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_contract_terms IS 'Contracts are orders that have been claimed by a wallet';
-
-
---
--- Name: COLUMN merchant_contract_terms.merchant_serial; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.merchant_serial IS 'Identifies the instance offering the contract';
-
-
---
--- Name: COLUMN merchant_contract_terms.order_id; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.order_id IS 'Not a foreign key into merchant_orders because paid contracts persist after expiration';
-
-
---
--- Name: COLUMN merchant_contract_terms.contract_terms; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.contract_terms IS 'These contract terms include the wallet nonce';
-
-
---
--- Name: COLUMN merchant_contract_terms.h_contract_terms; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.h_contract_terms IS 'Hash over contract_terms';
-
-
---
--- Name: COLUMN merchant_contract_terms.pay_deadline; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.pay_deadline IS 'How long is the offer valid. After this time, the order can be garbage collected';
-
-
---
--- Name: COLUMN merchant_contract_terms.refund_deadline; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.refund_deadline IS 'By what times do refunds have to be approved (useful to reject refund requests)';
-
-
---
--- Name: COLUMN merchant_contract_terms.paid; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_contract_terms.paid IS 'true implies the customer paid for this contract; order should be DELETEd from merchant_orders once paid is set to release merchant_order_locks; paid remains true even if the payment was later refunded';
+CREATE TABLE exchange.legitimizations (
+ legitimization_serial_id bigint NOT NULL,
+ h_payto bytea NOT NULL,
+ expiration_time bigint DEFAULT 0 NOT NULL,
+ provider_section character varying NOT NULL,
+ provider_user_id character varying,
+ provider_legitimization_id character varying,
+ CONSTRAINT legitimizations_h_payto_check CHECK ((length(h_payto) = 32))
+)
+PARTITION BY HASH (h_payto);
--
--- Name: COLUMN merchant_contract_terms.wired; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE legitimizations; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_contract_terms.wired IS 'true implies the exchange wired us the full amount for all non-refunded payments under this contract';
+COMMENT ON TABLE exchange.legitimizations IS 'List of legitimizations (required and completed) by account and provider';
--
--- Name: COLUMN merchant_contract_terms.fulfillment_url; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN legitimizations.legitimization_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_contract_terms.fulfillment_url IS 'also included in contract_terms, but we need it here to SELECT on it during repurchase detection; can be NULL if the contract has no fulfillment URL';
+COMMENT ON COLUMN exchange.legitimizations.legitimization_serial_id IS 'unique ID for this legitimization process at the exchange';
--
--- Name: COLUMN merchant_contract_terms.session_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN legitimizations.h_payto; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_contract_terms.session_id IS 'last session_id from we confirmed the paying client to use, empty string for none';
+COMMENT ON COLUMN exchange.legitimizations.h_payto IS 'foreign key linking the entry to the wire_targets table, NOT a primary key (multiple legitimizations are possible per wire target)';
--
--- Name: COLUMN merchant_contract_terms.claim_token; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN legitimizations.expiration_time; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_contract_terms.claim_token IS 'Token optionally used to access the status of the order. All zeros (not NULL) if not used';
+COMMENT ON COLUMN exchange.legitimizations.expiration_time IS 'in the future if the respective KYC check was passed successfully';
--
--- Name: merchant_deposit_to_transfer; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN legitimizations.provider_section; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_deposit_to_transfer (
- deposit_serial bigint NOT NULL,
- coin_contribution_value_val bigint NOT NULL,
- coin_contribution_value_frac integer NOT NULL,
- credit_serial bigint NOT NULL,
- execution_time bigint NOT NULL,
- signkey_serial bigint NOT NULL,
- exchange_sig bytea NOT NULL,
- CONSTRAINT merchant_deposit_to_transfer_exchange_sig_check CHECK ((length(exchange_sig) = 64))
-);
+COMMENT ON COLUMN exchange.legitimizations.provider_section IS 'Configuration file section with details about this provider';
--
--- Name: TABLE merchant_deposit_to_transfer; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN legitimizations.provider_user_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_deposit_to_transfer IS 'Mapping of deposits to (possibly unconfirmed) wire transfers; NOTE: not used yet';
+COMMENT ON COLUMN exchange.legitimizations.provider_user_id IS 'Identifier for the user at the provider that was used for the legitimization. NULL if provider is unaware.';
--
--- Name: COLUMN merchant_deposit_to_transfer.execution_time; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN legitimizations.provider_legitimization_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_deposit_to_transfer.execution_time IS 'Execution time as claimed by the exchange, roughly matches time seen by merchant';
+COMMENT ON COLUMN exchange.legitimizations.provider_legitimization_id IS 'Identifier for the specific legitimization process at the provider. NULL if legitimization was not started.';
--
--- Name: merchant_deposits; Type: TABLE; Schema: public; Owner: -
+-- Name: legitimizations_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_deposits (
- deposit_serial bigint NOT NULL,
- order_serial bigint,
- deposit_timestamp bigint NOT NULL,
- coin_pub bytea NOT NULL,
- exchange_url character varying NOT NULL,
- amount_with_fee_val bigint NOT NULL,
- amount_with_fee_frac integer NOT NULL,
- deposit_fee_val bigint NOT NULL,
- deposit_fee_frac integer NOT NULL,
- refund_fee_val bigint NOT NULL,
- refund_fee_frac integer NOT NULL,
- wire_fee_val bigint NOT NULL,
- wire_fee_frac integer NOT NULL,
- signkey_serial bigint NOT NULL,
- exchange_sig bytea NOT NULL,
- account_serial bigint NOT NULL,
- CONSTRAINT merchant_deposits_coin_pub_check CHECK ((length(coin_pub) = 32)),
- CONSTRAINT merchant_deposits_exchange_sig_check CHECK ((length(exchange_sig) = 64))
+CREATE TABLE exchange.legitimizations_default (
+ legitimization_serial_id bigint NOT NULL,
+ h_payto bytea NOT NULL,
+ expiration_time bigint DEFAULT 0 NOT NULL,
+ provider_section character varying NOT NULL,
+ provider_user_id character varying,
+ provider_legitimization_id character varying,
+ CONSTRAINT legitimizations_h_payto_check CHECK ((length(h_payto) = 32))
);
+ALTER TABLE ONLY exchange.legitimizations ATTACH PARTITION exchange.legitimizations_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: TABLE merchant_deposits; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_deposits IS 'Refunds approved by the merchant (backoffice) logic, excludes abort refunds';
-
-
---
--- Name: COLUMN merchant_deposits.deposit_timestamp; Type: COMMENT; Schema: public; Owner: -
+-- Name: legitimizations_legitimization_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_deposits.deposit_timestamp IS 'Time when the exchange generated the deposit confirmation';
-
-
---
--- Name: COLUMN merchant_deposits.wire_fee_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_deposits.wire_fee_val IS 'We MAY want to see if we should try to get this via merchant_exchange_wire_fees (not sure, may be too complicated with the date range, etc.)';
-
-
---
--- Name: COLUMN merchant_deposits.signkey_serial; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_deposits.signkey_serial IS 'Online signing key of the exchange on the deposit confirmation';
-
-
---
--- Name: COLUMN merchant_deposits.exchange_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_deposits.exchange_sig IS 'Signature of the exchange over the deposit confirmation';
-
-
---
--- Name: merchant_deposits_deposit_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_deposits ALTER COLUMN deposit_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_deposits_deposit_serial_seq
+ALTER TABLE exchange.legitimizations ALTER COLUMN legitimization_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.legitimizations_legitimization_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -7244,183 +6991,135 @@ ALTER TABLE public.merchant_deposits ALTER COLUMN deposit_serial ADD GENERATED B
--
--- Name: merchant_exchange_signing_keys; Type: TABLE; Schema: public; Owner: -
+-- Name: partner_accounts; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_exchange_signing_keys (
- signkey_serial bigint NOT NULL,
- master_pub bytea NOT NULL,
- exchange_pub bytea NOT NULL,
- start_date bigint NOT NULL,
- expire_date bigint NOT NULL,
- end_date bigint NOT NULL,
- master_sig bytea NOT NULL,
- CONSTRAINT merchant_exchange_signing_keys_exchange_pub_check CHECK ((length(exchange_pub) = 32)),
- CONSTRAINT merchant_exchange_signing_keys_master_pub_check CHECK ((length(master_pub) = 32)),
- CONSTRAINT merchant_exchange_signing_keys_master_sig_check CHECK ((length(master_sig) = 64))
+CREATE TABLE exchange.partner_accounts (
+ payto_uri character varying NOT NULL,
+ partner_serial_id bigint,
+ partner_master_sig bytea,
+ last_seen bigint NOT NULL,
+ CONSTRAINT partner_accounts_partner_master_sig_check CHECK ((length(partner_master_sig) = 64))
);
--
--- Name: TABLE merchant_exchange_signing_keys; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE partner_accounts; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_exchange_signing_keys IS 'Here we store proofs of the exchange online signing keys being signed by the exchange master key';
+COMMENT ON TABLE exchange.partner_accounts IS 'Table with bank accounts of the partner exchange. Entries never expire as we need to remember the signature for the auditor.';
--
--- Name: COLUMN merchant_exchange_signing_keys.master_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partner_accounts.payto_uri; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_exchange_signing_keys.master_pub IS 'Master public key of the exchange with these online signing keys';
+COMMENT ON COLUMN exchange.partner_accounts.payto_uri IS 'payto URI (RFC 8905) with the bank account of the partner exchange.';
--
--- Name: merchant_exchange_signing_keys_signkey_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: COLUMN partner_accounts.partner_master_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER TABLE public.merchant_exchange_signing_keys ALTER COLUMN signkey_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_exchange_signing_keys_signkey_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
+COMMENT ON COLUMN exchange.partner_accounts.partner_master_sig IS 'Signature of purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS by the partner master public key';
--
--- Name: merchant_exchange_wire_fees; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN partner_accounts.last_seen; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_exchange_wire_fees (
- wirefee_serial bigint NOT NULL,
- master_pub bytea NOT NULL,
- h_wire_method bytea NOT NULL,
+COMMENT ON COLUMN exchange.partner_accounts.last_seen IS 'Last time we saw this account as being active at the partner exchange. Used to select the most recent entry, and to detect when we should check again.';
+
+
+--
+-- Name: partners; Type: TABLE; Schema: exchange; Owner: -
+--
+
+CREATE TABLE exchange.partners (
+ partner_serial_id bigint NOT NULL,
+ partner_master_pub bytea NOT NULL,
start_date bigint NOT NULL,
end_date bigint NOT NULL,
- wire_fee_val bigint NOT NULL,
- wire_fee_frac integer NOT NULL,
- closing_fee_val bigint NOT NULL,
- closing_fee_frac integer NOT NULL,
+ next_wad bigint DEFAULT 0 NOT NULL,
+ wad_frequency bigint NOT NULL,
wad_fee_val bigint NOT NULL,
wad_fee_frac integer NOT NULL,
master_sig bytea NOT NULL,
- CONSTRAINT merchant_exchange_wire_fees_h_wire_method_check CHECK ((length(h_wire_method) = 64)),
- CONSTRAINT merchant_exchange_wire_fees_master_pub_check CHECK ((length(master_pub) = 32)),
- CONSTRAINT merchant_exchange_wire_fees_master_sig_check CHECK ((length(master_sig) = 64))
+ partner_base_url text NOT NULL,
+ CONSTRAINT partners_master_sig_check CHECK ((length(master_sig) = 64)),
+ CONSTRAINT partners_partner_master_pub_check CHECK ((length(partner_master_pub) = 32))
);
--
--- Name: TABLE merchant_exchange_wire_fees; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE partners; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_exchange_wire_fees IS 'Here we store proofs of the wire fee structure of the various exchanges';
+COMMENT ON TABLE exchange.partners IS 'exchanges we do wad transfers to';
--
--- Name: COLUMN merchant_exchange_wire_fees.master_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.partner_master_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_exchange_wire_fees.master_pub IS 'Master public key of the exchange with these wire fees';
-
-
---
--- Name: merchant_exchange_wire_fees_wirefee_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_exchange_wire_fees ALTER COLUMN wirefee_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_exchange_wire_fees_wirefee_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: merchant_instances; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_instances (
- merchant_serial bigint NOT NULL,
- merchant_pub bytea NOT NULL,
- auth_hash bytea,
- auth_salt bytea,
- merchant_id character varying NOT NULL,
- merchant_name character varying NOT NULL,
- address bytea NOT NULL,
- jurisdiction bytea NOT NULL,
- default_max_deposit_fee_val bigint NOT NULL,
- default_max_deposit_fee_frac integer NOT NULL,
- default_max_wire_fee_val bigint NOT NULL,
- default_max_wire_fee_frac integer NOT NULL,
- default_wire_fee_amortization integer NOT NULL,
- default_wire_transfer_delay bigint NOT NULL,
- default_pay_delay bigint NOT NULL,
- CONSTRAINT merchant_instances_auth_hash_check CHECK ((length(auth_hash) = 64)),
- CONSTRAINT merchant_instances_auth_salt_check CHECK ((length(auth_salt) = 32)),
- CONSTRAINT merchant_instances_merchant_pub_check CHECK ((length(merchant_pub) = 32))
-);
+COMMENT ON COLUMN exchange.partners.partner_master_pub IS 'offline master public key of the partner';
--
--- Name: TABLE merchant_instances; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.start_date; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_instances IS 'all the instances supported by this backend';
+COMMENT ON COLUMN exchange.partners.start_date IS 'starting date of the partnership';
--
--- Name: COLUMN merchant_instances.auth_hash; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.end_date; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_instances.auth_hash IS 'hash used for merchant back office Authorization, NULL for no check';
+COMMENT ON COLUMN exchange.partners.end_date IS 'end date of the partnership';
--
--- Name: COLUMN merchant_instances.auth_salt; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.next_wad; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_instances.auth_salt IS 'salt to use when hashing Authorization header before comparing with auth_hash';
+COMMENT ON COLUMN exchange.partners.next_wad IS 'at what time should we do the next wad transfer to this partner (frequently updated); set to forever after the end_date';
--
--- Name: COLUMN merchant_instances.merchant_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.wad_frequency; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_instances.merchant_id IS 'identifier of the merchant as used in the base URL (required)';
+COMMENT ON COLUMN exchange.partners.wad_frequency IS 'how often do we promise to do wad transfers';
--
--- Name: COLUMN merchant_instances.merchant_name; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.wad_fee_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_instances.merchant_name IS 'legal name of the merchant as a simple string (required)';
+COMMENT ON COLUMN exchange.partners.wad_fee_val IS 'how high is the fee for a wallet to be added to a wad to this partner';
--
--- Name: COLUMN merchant_instances.address; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.master_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_instances.address IS 'physical address of the merchant as a Location in JSON format (required)';
+COMMENT ON COLUMN exchange.partners.master_sig IS 'signature of our master public key affirming the partnership, of purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS';
--
--- Name: COLUMN merchant_instances.jurisdiction; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN partners.partner_base_url; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_instances.jurisdiction IS 'jurisdiction of the merchant as a Location in JSON format (required)';
+COMMENT ON COLUMN exchange.partners.partner_base_url IS 'base URL of the REST API for this partner';
--
--- Name: merchant_instances_merchant_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: partners_partner_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.merchant_instances ALTER COLUMN merchant_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_instances_merchant_serial_seq
+ALTER TABLE exchange.partners ALTER COLUMN partner_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.partners_partner_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -7430,160 +7129,67 @@ ALTER TABLE public.merchant_instances ALTER COLUMN merchant_serial ADD GENERATED
--
--- Name: merchant_inventory; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_inventory (
- product_serial bigint NOT NULL,
- merchant_serial bigint NOT NULL,
- product_id character varying NOT NULL,
- description character varying NOT NULL,
- description_i18n bytea NOT NULL,
- unit character varying NOT NULL,
- image bytea NOT NULL,
- taxes bytea NOT NULL,
- price_val bigint NOT NULL,
- price_frac integer NOT NULL,
- total_stock bigint NOT NULL,
- total_sold bigint DEFAULT 0 NOT NULL,
- total_lost bigint DEFAULT 0 NOT NULL,
- address bytea NOT NULL,
- next_restock bigint NOT NULL,
- minimum_age integer DEFAULT 0 NOT NULL
-);
-
-
---
--- Name: TABLE merchant_inventory; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_inventory IS 'products offered by the merchant (may be incomplete, frontend can override)';
-
-
---
--- Name: COLUMN merchant_inventory.description; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.description IS 'Human-readable product description';
-
-
---
--- Name: COLUMN merchant_inventory.description_i18n; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.description_i18n IS 'JSON map from IETF BCP 47 language tags to localized descriptions';
-
-
---
--- Name: COLUMN merchant_inventory.unit; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.unit IS 'Unit of sale for the product (liters, kilograms, packages)';
-
-
---
--- Name: COLUMN merchant_inventory.image; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.image IS 'NOT NULL, but can be 0 bytes; must contain an ImageDataUrl';
-
-
---
--- Name: COLUMN merchant_inventory.taxes; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.taxes IS 'JSON array containing taxes the merchant pays, must be JSON, but can be just "[]"';
-
-
---
--- Name: COLUMN merchant_inventory.price_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.price_val IS 'Current price of one unit of the product';
-
-
---
--- Name: COLUMN merchant_inventory.total_stock; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory.total_stock IS 'A value of -1 is used for unlimited (electronic good), may never be lowered';
-
-
---
--- Name: COLUMN merchant_inventory.total_sold; Type: COMMENT; Schema: public; Owner: -
+-- Name: prewire; Type: TABLE; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_inventory.total_sold IS 'Number of products sold, must be below total_stock, non-negative, may never be lowered';
+CREATE TABLE exchange.prewire (
+ prewire_uuid bigint NOT NULL,
+ wire_method text NOT NULL,
+ finished boolean DEFAULT false NOT NULL,
+ failed boolean DEFAULT false NOT NULL,
+ buf bytea NOT NULL
+)
+PARTITION BY HASH (prewire_uuid);
--
--- Name: COLUMN merchant_inventory.total_lost; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE prewire; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_inventory.total_lost IS 'Number of products that used to be in stock but were lost (spoiled, damaged), may never be lowered; total_stock >= total_sold + total_lost must always hold';
+COMMENT ON TABLE exchange.prewire IS 'pre-commit data for wire transfers we are about to execute';
--
--- Name: COLUMN merchant_inventory.address; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN prewire.finished; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_inventory.address IS 'JSON formatted Location of where the product is stocked';
+COMMENT ON COLUMN exchange.prewire.finished IS 'set to TRUE once bank confirmed receiving the wire transfer request';
--
--- Name: COLUMN merchant_inventory.next_restock; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN prewire.failed; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_inventory.next_restock IS 'GNUnet absolute time indicating when the next restock is expected. 0 for unknown.';
+COMMENT ON COLUMN exchange.prewire.failed IS 'set to TRUE if the bank responded with a non-transient failure to our transfer request';
--
--- Name: COLUMN merchant_inventory.minimum_age; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN prewire.buf; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_inventory.minimum_age IS 'Minimum age of the customer in years, to be used if an exchange supports the age restriction extension.';
+COMMENT ON COLUMN exchange.prewire.buf IS 'serialized data to send to the bank to execute the wire transfer';
--
--- Name: merchant_inventory_locks; Type: TABLE; Schema: public; Owner: -
+-- Name: prewire_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_inventory_locks (
- product_serial bigint NOT NULL,
- lock_uuid bytea NOT NULL,
- total_locked bigint NOT NULL,
- expiration bigint NOT NULL,
- CONSTRAINT merchant_inventory_locks_lock_uuid_check CHECK ((length(lock_uuid) = 16))
+CREATE TABLE exchange.prewire_default (
+ prewire_uuid bigint NOT NULL,
+ wire_method text NOT NULL,
+ finished boolean DEFAULT false NOT NULL,
+ failed boolean DEFAULT false NOT NULL,
+ buf bytea NOT NULL
);
+ALTER TABLE ONLY exchange.prewire ATTACH PARTITION exchange.prewire_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: TABLE merchant_inventory_locks; Type: COMMENT; Schema: public; Owner: -
+-- Name: prewire_prewire_uuid_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_inventory_locks IS 'locks on inventory helt by shopping carts; note that locks MAY not be honored if merchants increase total_lost for inventory';
-
-
---
--- Name: COLUMN merchant_inventory_locks.total_locked; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory_locks.total_locked IS 'how many units of the product does this lock reserve';
-
-
---
--- Name: COLUMN merchant_inventory_locks.expiration; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_inventory_locks.expiration IS 'when does this lock automatically expire (if no order is created)';
-
-
---
--- Name: merchant_inventory_product_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_inventory ALTER COLUMN product_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_inventory_product_serial_seq
+ALTER TABLE exchange.prewire ALTER COLUMN prewire_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.prewire_prewire_uuid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -7593,103 +7199,86 @@ ALTER TABLE public.merchant_inventory ALTER COLUMN product_serial ADD GENERATED
--
--- Name: merchant_keys; Type: TABLE; Schema: public; Owner: -
+-- Name: profit_drains; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_keys (
- merchant_priv bytea NOT NULL,
- merchant_serial bigint NOT NULL,
- CONSTRAINT merchant_keys_merchant_priv_check CHECK ((length(merchant_priv) = 32))
-);
-
-
---
--- Name: TABLE merchant_keys; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_keys IS 'private keys of instances that have not been deleted';
-
-
---
--- Name: merchant_kyc; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_kyc (
- kyc_serial_id bigint NOT NULL,
- kyc_timestamp bigint NOT NULL,
- kyc_ok boolean DEFAULT false NOT NULL,
- exchange_sig bytea,
- exchange_pub bytea,
- exchange_kyc_serial bigint DEFAULT 0 NOT NULL,
- account_serial bigint NOT NULL,
- exchange_url character varying NOT NULL,
- CONSTRAINT merchant_kyc_exchange_pub_check CHECK ((length(exchange_pub) = 32)),
- CONSTRAINT merchant_kyc_exchange_sig_check CHECK ((length(exchange_sig) = 64))
+CREATE TABLE exchange.profit_drains (
+ profit_drain_serial_id bigint NOT NULL,
+ wtid bytea NOT NULL,
+ account_section character varying NOT NULL,
+ payto_uri character varying NOT NULL,
+ trigger_date bigint NOT NULL,
+ amount_val bigint NOT NULL,
+ amount_frac bigint NOT NULL,
+ master_sig bytea NOT NULL,
+ executed boolean DEFAULT false NOT NULL,
+ CONSTRAINT profit_drains_master_sig_check CHECK ((length(master_sig) = 64)),
+ CONSTRAINT profit_drains_wtid_check CHECK ((length(wtid) = 32))
);
--
--- Name: TABLE merchant_kyc; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE profit_drains; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_kyc IS 'Status of the KYC process of a merchant account at an exchange';
+COMMENT ON TABLE exchange.profit_drains IS 'transactions to be performed to move profits from the escrow account of the exchange to a regular account';
--
--- Name: COLUMN merchant_kyc.kyc_timestamp; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.wtid; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.kyc_timestamp IS 'Last time we checked our KYC status at the exchange. Useful to re-check if the status is very stale. Also the timestamp used for the exchange signature (if present).';
+COMMENT ON COLUMN exchange.profit_drains.wtid IS 'randomly chosen nonce, unique to prevent double-submission';
--
--- Name: COLUMN merchant_kyc.kyc_ok; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.account_section; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.kyc_ok IS 'true if the KYC check was passed successfully';
+COMMENT ON COLUMN exchange.profit_drains.account_section IS 'specifies the configuration section in the taler-exchange-drain configuration with the wire account to drain';
--
--- Name: COLUMN merchant_kyc.exchange_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.payto_uri; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.exchange_sig IS 'signature of the exchange affirming the KYC passed (or NULL if exchange does not require KYC or not kyc_ok)';
+COMMENT ON COLUMN exchange.profit_drains.payto_uri IS 'specifies the account to be credited';
--
--- Name: COLUMN merchant_kyc.exchange_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.trigger_date; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.exchange_pub IS 'public key used with exchange_sig (or NULL if exchange_sig is NULL)';
+COMMENT ON COLUMN exchange.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';
--
--- Name: COLUMN merchant_kyc.exchange_kyc_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.amount_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.exchange_kyc_serial IS 'Number to use in the KYC-endpoints of the exchange to check the KYC status or begin the KYC process. 0 if we do not know it yet.';
+COMMENT ON COLUMN exchange.profit_drains.amount_val IS 'amount to be transferred';
--
--- Name: COLUMN merchant_kyc.account_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.master_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.account_serial IS 'Which bank account of the merchant is the KYC status for';
+COMMENT ON COLUMN exchange.profit_drains.master_sig IS 'EdDSA signature of type TALER_SIGNATURE_MASTER_DRAIN_PROFIT';
--
--- Name: COLUMN merchant_kyc.exchange_url; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN profit_drains.executed; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_kyc.exchange_url IS 'Which exchange base URL is this KYC status valid for';
+COMMENT ON COLUMN exchange.profit_drains.executed IS 'set to TRUE by taler-exchange-drain on execution of the transaction, not replicated to auditor';
--
--- Name: merchant_kyc_kyc_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: profit_drains_profit_drain_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.merchant_kyc ALTER COLUMN kyc_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_kyc_kyc_serial_id_seq
+ALTER TABLE exchange.profit_drains ALTER COLUMN profit_drain_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.profit_drains_profit_drain_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -7699,212 +7288,129 @@ ALTER TABLE public.merchant_kyc ALTER COLUMN kyc_serial_id ADD GENERATED BY DEFA
--
--- Name: merchant_order_locks; Type: TABLE; Schema: public; Owner: -
+-- Name: purse_actions; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_order_locks (
- product_serial bigint NOT NULL,
- total_locked bigint NOT NULL,
- order_serial bigint NOT NULL
+CREATE TABLE exchange.purse_actions (
+ purse_pub bytea NOT NULL,
+ action_date bigint NOT NULL,
+ partner_serial_id bigint,
+ CONSTRAINT purse_actions_purse_pub_check CHECK ((length(purse_pub) = 32))
);
--
--- Name: TABLE merchant_order_locks; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE purse_actions; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_order_locks IS 'locks on orders awaiting claim and payment; note that locks MAY not be honored if merchants increase total_lost for inventory';
+COMMENT ON TABLE exchange.purse_actions IS 'purses awaiting some action by the router';
--
--- Name: COLUMN merchant_order_locks.total_locked; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_actions.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_order_locks.total_locked IS 'how many units of the product does this lock reserve';
+COMMENT ON COLUMN exchange.purse_actions.purse_pub IS 'public (contract) key of the purse';
--
--- Name: merchant_orders; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN purse_actions.action_date; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_orders (
- order_serial bigint NOT NULL,
- merchant_serial bigint NOT NULL,
- order_id character varying NOT NULL,
- claim_token bytea NOT NULL,
- h_post_data bytea NOT NULL,
- pay_deadline bigint NOT NULL,
- creation_time bigint NOT NULL,
- contract_terms bytea NOT NULL,
- CONSTRAINT merchant_orders_claim_token_check CHECK ((length(claim_token) = 16)),
- CONSTRAINT merchant_orders_h_post_data_check CHECK ((length(h_post_data) = 64))
-);
+COMMENT ON COLUMN exchange.purse_actions.action_date IS 'when is the purse ready for action';
--
--- Name: TABLE merchant_orders; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_actions.partner_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_orders IS 'Orders we offered to a customer, but that have not yet been claimed';
+COMMENT ON COLUMN exchange.purse_actions.partner_serial_id IS 'wad target of an outgoing wire transfer, 0 for local, NULL if the purse is unmerged and thus the target is still unknown';
--
--- Name: COLUMN merchant_orders.merchant_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: purse_deposits; Type: TABLE; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_orders.merchant_serial IS 'Identifies the instance offering the contract';
+CREATE TABLE exchange.purse_deposits (
+ purse_deposit_serial_id bigint NOT NULL,
+ partner_serial_id bigint,
+ purse_pub bytea NOT NULL,
+ coin_pub bytea NOT NULL,
+ amount_with_fee_val bigint NOT NULL,
+ amount_with_fee_frac integer NOT NULL,
+ coin_sig bytea NOT NULL,
+ CONSTRAINT purse_deposits_coin_sig_check CHECK ((length(coin_sig) = 64)),
+ CONSTRAINT purse_deposits_purse_pub_check CHECK ((length(purse_pub) = 32))
+)
+PARTITION BY HASH (purse_pub);
--
--- Name: COLUMN merchant_orders.claim_token; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE purse_deposits; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_orders.claim_token IS 'Token optionally used to authorize the wallet to claim the order. All zeros (not NULL) if not used';
+COMMENT ON TABLE exchange.purse_deposits IS 'Requests depositing coins into a purse';
--
--- Name: COLUMN merchant_orders.h_post_data; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_deposits.partner_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_orders.h_post_data IS 'Hash of the POST request that created this order, for idempotency checks';
+COMMENT ON COLUMN exchange.purse_deposits.partner_serial_id IS 'identifies the partner exchange, NULL in case the target purse lives at this exchange';
--
--- Name: COLUMN merchant_orders.pay_deadline; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_deposits.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_orders.pay_deadline IS 'How long is the offer valid. After this time, the order can be garbage collected';
+COMMENT ON COLUMN exchange.purse_deposits.purse_pub IS 'Public key of the purse';
--
--- Name: COLUMN merchant_orders.contract_terms; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_deposits.coin_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_orders.contract_terms IS 'Claiming changes the contract_terms, hence we have no hash of the terms in this table';
+COMMENT ON COLUMN exchange.purse_deposits.coin_pub IS 'Public key of the coin being deposited';
--
--- Name: merchant_orders_order_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: COLUMN purse_deposits.amount_with_fee_val; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER TABLE public.merchant_orders ALTER COLUMN order_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_orders_order_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
+COMMENT ON COLUMN exchange.purse_deposits.amount_with_fee_val IS 'Total amount being deposited';
--
--- Name: merchant_refund_proofs; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN purse_deposits.coin_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_refund_proofs (
- refund_serial bigint NOT NULL,
- exchange_sig bytea NOT NULL,
- signkey_serial bigint NOT NULL,
- CONSTRAINT merchant_refund_proofs_exchange_sig_check CHECK ((length(exchange_sig) = 64))
-);
+COMMENT ON COLUMN exchange.purse_deposits.coin_sig IS 'Signature of the coin affirming the deposit into the purse, of type TALER_SIGNATURE_PURSE_DEPOSIT';
--
--- Name: TABLE merchant_refund_proofs; Type: COMMENT; Schema: public; Owner: -
+-- Name: purse_deposits_default; Type: TABLE; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_refund_proofs IS 'Refunds confirmed by the exchange (not all approved refunds are grabbed by the wallet)';
-
-
---
--- Name: merchant_refunds; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_refunds (
- refund_serial bigint NOT NULL,
- order_serial bigint NOT NULL,
- rtransaction_id bigint NOT NULL,
- refund_timestamp bigint NOT NULL,
+CREATE TABLE exchange.purse_deposits_default (
+ purse_deposit_serial_id bigint NOT NULL,
+ partner_serial_id bigint,
+ purse_pub bytea NOT NULL,
coin_pub bytea NOT NULL,
- reason character varying NOT NULL,
- refund_amount_val bigint NOT NULL,
- refund_amount_frac integer NOT NULL
-);
-
-
---
--- Name: COLUMN merchant_refunds.rtransaction_id; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_refunds.rtransaction_id IS 'Needed for uniqueness in case a refund is increased for the same order';
-
-
---
--- Name: COLUMN merchant_refunds.refund_timestamp; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_refunds.refund_timestamp IS 'Needed for grouping of refunds in the wallet UI; has no semantics in the protocol (only for UX), but should be from the time when the merchant internally approved the refund';
-
-
---
--- Name: merchant_refunds_refund_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_refunds ALTER COLUMN refund_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_refunds_refund_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: merchant_tip_pickup_signatures; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_tip_pickup_signatures (
- pickup_serial bigint NOT NULL,
- coin_offset integer NOT NULL,
- blind_sig bytea NOT NULL
-);
-
-
---
--- Name: TABLE merchant_tip_pickup_signatures; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_tip_pickup_signatures IS 'blind signatures we got from the exchange during the tip pickup';
-
-
---
--- Name: merchant_tip_pickups; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_tip_pickups (
- pickup_serial bigint NOT NULL,
- tip_serial bigint NOT NULL,
- pickup_id bytea NOT NULL,
- amount_val bigint NOT NULL,
- amount_frac integer NOT NULL,
- CONSTRAINT merchant_tip_pickups_pickup_id_check CHECK ((length(pickup_id) = 64))
+ amount_with_fee_val bigint NOT NULL,
+ amount_with_fee_frac integer NOT NULL,
+ coin_sig bytea NOT NULL,
+ CONSTRAINT purse_deposits_coin_sig_check CHECK ((length(coin_sig) = 64)),
+ CONSTRAINT purse_deposits_purse_pub_check CHECK ((length(purse_pub) = 32))
);
+ALTER TABLE ONLY exchange.purse_deposits ATTACH PARTITION exchange.purse_deposits_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: TABLE merchant_tip_pickups; Type: COMMENT; Schema: public; Owner: -
+-- Name: purse_deposits_purse_deposit_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_tip_pickups IS 'tips that have been picked up';
-
-
---
--- Name: merchant_tip_pickups_pickup_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_tip_pickups ALTER COLUMN pickup_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_tip_pickups_pickup_serial_seq
+ALTER TABLE exchange.purse_deposits ALTER COLUMN purse_deposit_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.purse_deposits_purse_deposit_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -7914,497 +7420,89 @@ ALTER TABLE public.merchant_tip_pickups ALTER COLUMN pickup_serial ADD GENERATED
--
--- Name: merchant_tip_reserve_keys; Type: TABLE; Schema: public; Owner: -
+-- Name: purse_merges; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_tip_reserve_keys (
- reserve_serial bigint NOT NULL,
- reserve_priv bytea NOT NULL,
- exchange_url character varying NOT NULL,
- payto_uri character varying,
- CONSTRAINT merchant_tip_reserve_keys_reserve_priv_check CHECK ((length(reserve_priv) = 32))
-);
-
-
---
--- Name: COLUMN merchant_tip_reserve_keys.payto_uri; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tip_reserve_keys.payto_uri IS 'payto:// URI used to fund the reserve, may be NULL once reserve is funded';
-
-
---
--- Name: merchant_tip_reserves; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_tip_reserves (
- reserve_serial bigint NOT NULL,
+CREATE TABLE exchange.purse_merges (
+ purse_merge_request_serial_id bigint NOT NULL,
+ partner_serial_id bigint,
reserve_pub bytea NOT NULL,
- merchant_serial bigint NOT NULL,
- creation_time bigint NOT NULL,
- expiration bigint NOT NULL,
- merchant_initial_balance_val bigint NOT NULL,
- merchant_initial_balance_frac integer NOT NULL,
- exchange_initial_balance_val bigint DEFAULT 0 NOT NULL,
- exchange_initial_balance_frac integer DEFAULT 0 NOT NULL,
- tips_committed_val bigint DEFAULT 0 NOT NULL,
- tips_committed_frac integer DEFAULT 0 NOT NULL,
- tips_picked_up_val bigint DEFAULT 0 NOT NULL,
- tips_picked_up_frac integer DEFAULT 0 NOT NULL,
- CONSTRAINT merchant_tip_reserves_reserve_pub_check CHECK ((length(reserve_pub) = 32))
-);
-
-
---
--- Name: TABLE merchant_tip_reserves; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_tip_reserves IS 'private keys of reserves that have not been deleted';
-
-
---
--- Name: COLUMN merchant_tip_reserves.expiration; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tip_reserves.expiration IS 'FIXME: EXCHANGE API needs to tell us when reserves close if we are to compute this';
-
-
---
--- Name: COLUMN merchant_tip_reserves.merchant_initial_balance_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tip_reserves.merchant_initial_balance_val IS 'Set to the initial balance the merchant told us when creating the reserve';
-
-
---
--- Name: COLUMN merchant_tip_reserves.exchange_initial_balance_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tip_reserves.exchange_initial_balance_val IS 'Set to the initial balance the exchange told us when we queried the reserve status';
-
-
---
--- Name: COLUMN merchant_tip_reserves.tips_committed_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tip_reserves.tips_committed_val IS 'Amount of outstanding approved tips that have not been picked up';
-
-
---
--- Name: COLUMN merchant_tip_reserves.tips_picked_up_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tip_reserves.tips_picked_up_val IS 'Total amount tips that have been picked up from this reserve';
-
-
---
--- Name: merchant_tip_reserves_reserve_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_tip_reserves ALTER COLUMN reserve_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_tip_reserves_reserve_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: merchant_tips; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_tips (
- tip_serial bigint NOT NULL,
- reserve_serial bigint NOT NULL,
- tip_id bytea NOT NULL,
- justification character varying NOT NULL,
- next_url character varying NOT NULL,
- expiration bigint NOT NULL,
- amount_val bigint NOT NULL,
- amount_frac integer NOT NULL,
- picked_up_val bigint DEFAULT 0 NOT NULL,
- picked_up_frac integer DEFAULT 0 NOT NULL,
- was_picked_up boolean DEFAULT false NOT NULL,
- CONSTRAINT merchant_tips_tip_id_check CHECK ((length(tip_id) = 64))
-);
-
-
---
--- Name: TABLE merchant_tips; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_tips IS 'tips that have been authorized';
-
-
---
--- Name: COLUMN merchant_tips.reserve_serial; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tips.reserve_serial IS 'Reserve from which this tip is funded';
-
-
---
--- Name: COLUMN merchant_tips.expiration; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tips.expiration IS 'by when does the client have to pick up the tip';
-
-
---
--- Name: COLUMN merchant_tips.amount_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tips.amount_val IS 'total transaction cost for all coins including withdraw fees';
-
-
---
--- Name: COLUMN merchant_tips.picked_up_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_tips.picked_up_val IS 'Tip amount left to be picked up';
-
-
---
--- Name: merchant_tips_tip_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.merchant_tips ALTER COLUMN tip_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_tips_tip_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: merchant_transfer_signatures; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_transfer_signatures (
- credit_serial bigint NOT NULL,
- signkey_serial bigint NOT NULL,
- wire_fee_val bigint NOT NULL,
- wire_fee_frac integer NOT NULL,
- credit_amount_val bigint NOT NULL,
- credit_amount_frac integer NOT NULL,
- execution_time bigint NOT NULL,
- exchange_sig bytea NOT NULL,
- CONSTRAINT merchant_transfer_signatures_exchange_sig_check CHECK ((length(exchange_sig) = 64))
-);
-
-
---
--- Name: TABLE merchant_transfer_signatures; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_transfer_signatures IS 'table represents the main information returned from the /transfer request to the exchange.';
-
-
---
--- Name: COLUMN merchant_transfer_signatures.credit_amount_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_transfer_signatures.credit_amount_val IS 'actual value of the (aggregated) wire transfer, excluding the wire fee, according to the exchange';
-
-
---
--- Name: COLUMN merchant_transfer_signatures.execution_time; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_transfer_signatures.execution_time IS 'Execution time as claimed by the exchange, roughly matches time seen by merchant';
-
-
---
--- Name: merchant_transfer_to_coin; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.merchant_transfer_to_coin (
- deposit_serial bigint NOT NULL,
- credit_serial bigint NOT NULL,
- offset_in_exchange_list bigint NOT NULL,
- exchange_deposit_value_val bigint NOT NULL,
- exchange_deposit_value_frac integer NOT NULL,
- exchange_deposit_fee_val bigint NOT NULL,
- exchange_deposit_fee_frac integer NOT NULL
-);
-
-
---
--- Name: TABLE merchant_transfer_to_coin; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.merchant_transfer_to_coin IS 'Mapping of (credit) transfers to (deposited) coins';
-
-
---
--- Name: COLUMN merchant_transfer_to_coin.exchange_deposit_value_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_transfer_to_coin.exchange_deposit_value_val IS 'Deposit value as claimed by the exchange, should match our values in merchant_deposits minus refunds';
-
-
---
--- Name: COLUMN merchant_transfer_to_coin.exchange_deposit_fee_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.merchant_transfer_to_coin.exchange_deposit_fee_val IS 'Deposit value as claimed by the exchange, should match our values in merchant_deposits';
+ purse_pub bytea NOT NULL,
+ merge_sig bytea NOT NULL,
+ merge_timestamp bigint NOT NULL,
+ CONSTRAINT purse_merges_merge_sig_check CHECK ((length(merge_sig) = 64)),
+ CONSTRAINT purse_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
+ CONSTRAINT purse_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32))
+)
+PARTITION BY HASH (purse_pub);
--
--- Name: merchant_transfers; Type: TABLE; Schema: public; Owner: -
+-- Name: TABLE purse_merges; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.merchant_transfers (
- credit_serial bigint NOT NULL,
- exchange_url character varying NOT NULL,
- wtid bytea,
- credit_amount_val bigint NOT NULL,
- credit_amount_frac integer NOT NULL,
- account_serial bigint NOT NULL,
- verified boolean DEFAULT false NOT NULL,
- confirmed boolean DEFAULT false NOT NULL,
- CONSTRAINT merchant_transfers_wtid_check CHECK ((length(wtid) = 32))
-);
+COMMENT ON TABLE exchange.purse_merges IS 'Merge requests where a purse-owner requested merging the purse into the account';
--
--- Name: TABLE merchant_transfers; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_merges.partner_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.merchant_transfers IS 'table represents the information provided by the (trusted) merchant about incoming wire transfers';
+COMMENT ON COLUMN exchange.purse_merges.partner_serial_id IS 'identifies the partner exchange, NULL in case the target reserve lives at this exchange';
--
--- Name: COLUMN merchant_transfers.credit_amount_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_merges.reserve_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_transfers.credit_amount_val IS 'actual value of the (aggregated) wire transfer, excluding the wire fee, according to the merchant';
+COMMENT ON COLUMN exchange.purse_merges.reserve_pub IS 'public key of the target reserve';
--
--- Name: COLUMN merchant_transfers.verified; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_merges.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_transfers.verified IS 'true once we got an acceptable response from the exchange for this transfer';
+COMMENT ON COLUMN exchange.purse_merges.purse_pub IS 'public key of the purse';
--
--- Name: COLUMN merchant_transfers.confirmed; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_merges.merge_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.merchant_transfers.confirmed IS 'true once the merchant confirmed that this transfer was received';
+COMMENT ON COLUMN exchange.purse_merges.merge_sig IS 'signature by the purse private key affirming the merge, of type TALER_SIGNATURE_WALLET_PURSE_MERGE';
--
--- Name: merchant_transfers_credit_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: COLUMN purse_merges.merge_timestamp; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER TABLE public.merchant_transfers ALTER COLUMN credit_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.merchant_transfers_credit_serial_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
+COMMENT ON COLUMN exchange.purse_merges.merge_timestamp IS 'when was the merge message signed';
--
--- Name: partner_accounts; Type: TABLE; Schema: public; Owner: -
+-- Name: purse_merges_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.partner_accounts (
- payto_uri character varying NOT NULL,
+CREATE TABLE exchange.purse_merges_default (
+ purse_merge_request_serial_id bigint NOT NULL,
partner_serial_id bigint,
- partner_master_sig bytea,
- last_seen bigint NOT NULL,
- CONSTRAINT partner_accounts_partner_master_sig_check CHECK ((length(partner_master_sig) = 64))
-);
-
-
---
--- Name: TABLE partner_accounts; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.partner_accounts IS 'Table with bank accounts of the partner exchange. Entries never expire as we need to remember the signature for the auditor.';
-
-
---
--- Name: COLUMN partner_accounts.payto_uri; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partner_accounts.payto_uri IS 'payto URI (RFC 8905) with the bank account of the partner exchange.';
-
-
---
--- Name: COLUMN partner_accounts.partner_master_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partner_accounts.partner_master_sig IS 'Signature of purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS by the partner master public key';
-
-
---
--- Name: COLUMN partner_accounts.last_seen; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partner_accounts.last_seen IS 'Last time we saw this account as being active at the partner exchange. Used to select the most recent entry, and to detect when we should check again.';
-
-
---
--- Name: partners; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.partners (
- partner_serial_id bigint NOT NULL,
- partner_master_pub bytea NOT NULL,
- start_date bigint NOT NULL,
- end_date bigint NOT NULL,
- wad_frequency bigint NOT NULL,
- wad_fee_val bigint NOT NULL,
- wad_fee_frac integer NOT NULL,
- master_sig bytea NOT NULL,
- partner_base_url text NOT NULL,
- CONSTRAINT partners_master_sig_check CHECK ((length(master_sig) = 64)),
- CONSTRAINT partners_partner_master_pub_check CHECK ((length(partner_master_pub) = 32))
-);
-
-
---
--- Name: TABLE partners; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.partners IS 'exchanges we do wad transfers to';
-
-
---
--- Name: COLUMN partners.partner_master_pub; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.partner_master_pub IS 'offline master public key of the partner';
-
-
---
--- Name: COLUMN partners.start_date; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.start_date IS 'starting date of the partnership';
-
-
---
--- Name: COLUMN partners.end_date; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.end_date IS 'end date of the partnership';
-
-
---
--- Name: COLUMN partners.wad_frequency; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.wad_frequency IS 'how often do we promise to do wad transfers';
-
-
---
--- Name: COLUMN partners.wad_fee_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.wad_fee_val IS 'how high is the fee for a wallet to be added to a wad to this partner';
-
-
---
--- Name: COLUMN partners.master_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.master_sig IS 'signature of our master public key affirming the partnership, of purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS';
-
-
---
--- Name: COLUMN partners.partner_base_url; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.partners.partner_base_url IS 'base URL of the REST API for this partner';
-
-
---
--- Name: partners_partner_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-ALTER TABLE public.partners ALTER COLUMN partner_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.partners_partner_serial_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
--- Name: prewire; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.prewire (
- prewire_uuid bigint NOT NULL,
- wire_method text NOT NULL,
- finished boolean DEFAULT false NOT NULL,
- failed boolean DEFAULT false NOT NULL,
- buf bytea NOT NULL
-)
-PARTITION BY HASH (prewire_uuid);
-
-
---
--- Name: TABLE prewire; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.prewire IS 'pre-commit data for wire transfers we are about to execute';
-
-
---
--- Name: COLUMN prewire.finished; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.prewire.finished IS 'set to TRUE once bank confirmed receiving the wire transfer request';
-
-
---
--- Name: COLUMN prewire.failed; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.prewire.failed IS 'set to TRUE if the bank responded with a non-transient failure to our transfer request';
-
-
---
--- Name: COLUMN prewire.buf; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.prewire.buf IS 'serialized data to send to the bank to execute the wire transfer';
-
-
---
--- Name: prewire_default; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.prewire_default (
- prewire_uuid bigint NOT NULL,
- wire_method text NOT NULL,
- finished boolean DEFAULT false NOT NULL,
- failed boolean DEFAULT false NOT NULL,
- buf bytea NOT NULL
+ reserve_pub bytea NOT NULL,
+ purse_pub bytea NOT NULL,
+ merge_sig bytea NOT NULL,
+ merge_timestamp bigint NOT NULL,
+ CONSTRAINT purse_merges_merge_sig_check CHECK ((length(merge_sig) = 64)),
+ CONSTRAINT purse_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
+ CONSTRAINT purse_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32))
);
-ALTER TABLE ONLY public.prewire ATTACH PARTITION public.prewire_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.purse_merges ATTACH PARTITION exchange.purse_merges_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: prewire_prewire_uuid_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: purse_merges_purse_merge_request_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.prewire ALTER COLUMN prewire_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.prewire_prewire_uuid_seq
+ALTER TABLE exchange.purse_merges ALTER COLUMN purse_merge_request_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.purse_merges_purse_merge_request_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -8414,89 +7512,49 @@ ALTER TABLE public.prewire ALTER COLUMN prewire_uuid ADD GENERATED BY DEFAULT AS
--
--- Name: purse_deposits; Type: TABLE; Schema: public; Owner: -
+-- Name: purse_refunds; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.purse_deposits (
- purse_deposit_serial_id bigint NOT NULL,
- partner_serial_id bigint,
+CREATE TABLE exchange.purse_refunds (
+ purse_refunds_serial_id bigint NOT NULL,
purse_pub bytea NOT NULL,
- coin_pub bytea NOT NULL,
- amount_with_fee_val bigint NOT NULL,
- amount_with_fee_frac integer NOT NULL,
- coin_sig bytea NOT NULL,
- CONSTRAINT purse_deposits_coin_sig_check CHECK ((length(coin_sig) = 64)),
- CONSTRAINT purse_deposits_purse_pub_check CHECK ((length(purse_pub) = 32))
+ CONSTRAINT purse_refunds_purse_pub_check CHECK ((length(purse_pub) = 32))
)
PARTITION BY HASH (purse_pub);
--
--- Name: TABLE purse_deposits; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON TABLE public.purse_deposits IS 'Requests depositing coins into a purse';
-
-
---
--- Name: COLUMN purse_deposits.partner_serial_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE purse_refunds; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_deposits.partner_serial_id IS 'identifies the partner exchange, NULL in case the target purse lives at this exchange';
+COMMENT ON TABLE exchange.purse_refunds IS 'Purses that were refunded due to expiration';
--
--- Name: COLUMN purse_deposits.purse_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_refunds.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_deposits.purse_pub IS 'Public key of the purse';
+COMMENT ON COLUMN exchange.purse_refunds.purse_pub IS 'Public key of the purse';
--
--- Name: COLUMN purse_deposits.coin_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: purse_refunds_default; Type: TABLE; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_deposits.coin_pub IS 'Public key of the coin being deposited';
-
-
---
--- Name: COLUMN purse_deposits.amount_with_fee_val; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.purse_deposits.amount_with_fee_val IS 'Total amount being deposited';
-
-
---
--- Name: COLUMN purse_deposits.coin_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.purse_deposits.coin_sig IS 'Signature of the coin affirming the deposit into the purse, of type TALER_SIGNATURE_PURSE_DEPOSIT';
-
-
---
--- Name: purse_deposits_default; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.purse_deposits_default (
- purse_deposit_serial_id bigint NOT NULL,
- partner_serial_id bigint,
+CREATE TABLE exchange.purse_refunds_default (
+ purse_refunds_serial_id bigint NOT NULL,
purse_pub bytea NOT NULL,
- coin_pub bytea NOT NULL,
- amount_with_fee_val bigint NOT NULL,
- amount_with_fee_frac integer NOT NULL,
- coin_sig bytea NOT NULL,
- CONSTRAINT purse_deposits_coin_sig_check CHECK ((length(coin_sig) = 64)),
- CONSTRAINT purse_deposits_purse_pub_check CHECK ((length(purse_pub) = 32))
+ CONSTRAINT purse_refunds_purse_pub_check CHECK ((length(purse_pub) = 32))
);
-ALTER TABLE ONLY public.purse_deposits ATTACH PARTITION public.purse_deposits_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.purse_refunds ATTACH PARTITION exchange.purse_refunds_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: purse_deposits_purse_deposit_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: purse_refunds_purse_refunds_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.purse_deposits ALTER COLUMN purse_deposit_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.purse_deposits_purse_deposit_serial_id_seq
+ALTER TABLE exchange.purse_refunds ALTER COLUMN purse_refunds_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.purse_refunds_purse_refunds_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -8506,183 +7564,147 @@ ALTER TABLE public.purse_deposits ALTER COLUMN purse_deposit_serial_id ADD GENER
--
--- Name: purse_merges; Type: TABLE; Schema: public; Owner: -
+-- Name: purse_requests; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.purse_merges (
- purse_merge_request_serial_id bigint NOT NULL,
- partner_serial_id bigint,
- reserve_pub bytea NOT NULL,
+CREATE TABLE exchange.purse_requests (
+ purse_requests_serial_id bigint NOT NULL,
purse_pub bytea NOT NULL,
- merge_sig bytea NOT NULL,
- merge_timestamp bigint NOT NULL,
- CONSTRAINT purse_merges_merge_sig_check CHECK ((length(merge_sig) = 64)),
- CONSTRAINT purse_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
- CONSTRAINT purse_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32))
+ merge_pub bytea NOT NULL,
+ purse_creation bigint NOT NULL,
+ purse_expiration bigint NOT NULL,
+ h_contract_terms bytea NOT NULL,
+ age_limit integer NOT NULL,
+ flags integer NOT NULL,
+ refunded boolean DEFAULT false NOT NULL,
+ finished boolean DEFAULT false NOT NULL,
+ in_reserve_quota boolean DEFAULT false NOT NULL,
+ amount_with_fee_val bigint NOT NULL,
+ amount_with_fee_frac integer NOT NULL,
+ purse_fee_val bigint NOT NULL,
+ purse_fee_frac integer NOT NULL,
+ balance_val bigint DEFAULT 0 NOT NULL,
+ balance_frac integer DEFAULT 0 NOT NULL,
+ purse_sig bytea NOT NULL,
+ CONSTRAINT purse_requests_h_contract_terms_check CHECK ((length(h_contract_terms) = 64)),
+ CONSTRAINT purse_requests_merge_pub_check CHECK ((length(merge_pub) = 32)),
+ CONSTRAINT purse_requests_purse_pub_check CHECK ((length(purse_pub) = 32)),
+ CONSTRAINT purse_requests_purse_sig_check CHECK ((length(purse_sig) = 64))
)
PARTITION BY HASH (purse_pub);
--
--- Name: TABLE purse_merges; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE purse_requests; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.purse_merges IS 'Merge requests where a purse-owner requested merging the purse into the account';
+COMMENT ON TABLE exchange.purse_requests IS 'Requests establishing purses, associating them with a contract but without a target reserve';
--
--- Name: COLUMN purse_merges.partner_serial_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.purse_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_merges.partner_serial_id IS 'identifies the partner exchange, NULL in case the target reserve lives at this exchange';
+COMMENT ON COLUMN exchange.purse_requests.purse_pub IS 'Public key of the purse';
--
--- Name: COLUMN purse_merges.reserve_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.purse_creation; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_merges.reserve_pub IS 'public key of the target reserve';
+COMMENT ON COLUMN exchange.purse_requests.purse_creation IS 'Local time when the purse was created. Determines applicable purse fees.';
--
--- Name: COLUMN purse_merges.purse_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.purse_expiration; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_merges.purse_pub IS 'public key of the purse';
-
-
---
--- Name: COLUMN purse_merges.merge_sig; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.purse_merges.merge_sig IS 'signature by the purse private key affirming the merge, of type TALER_SIGNATURE_WALLET_PURSE_MERGE';
-
-
---
--- Name: COLUMN purse_merges.merge_timestamp; Type: COMMENT; Schema: public; Owner: -
---
-
-COMMENT ON COLUMN public.purse_merges.merge_timestamp IS 'when was the merge message signed';
-
-
---
--- Name: purse_merges_default; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.purse_merges_default (
- purse_merge_request_serial_id bigint NOT NULL,
- partner_serial_id bigint,
- reserve_pub bytea NOT NULL,
- purse_pub bytea NOT NULL,
- merge_sig bytea NOT NULL,
- merge_timestamp bigint NOT NULL,
- CONSTRAINT purse_merges_merge_sig_check CHECK ((length(merge_sig) = 64)),
- CONSTRAINT purse_merges_purse_pub_check CHECK ((length(purse_pub) = 32)),
- CONSTRAINT purse_merges_reserve_pub_check CHECK ((length(reserve_pub) = 32))
-);
-ALTER TABLE ONLY public.purse_merges ATTACH PARTITION public.purse_merges_default FOR VALUES WITH (modulus 1, remainder 0);
+COMMENT ON COLUMN exchange.purse_requests.purse_expiration IS 'When the purse is set to expire';
--
--- Name: purse_merges_purse_merge_request_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.h_contract_terms; Type: COMMENT; Schema: exchange; Owner: -
--
-ALTER TABLE public.purse_merges ALTER COLUMN purse_merge_request_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.purse_merges_purse_merge_request_serial_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
+COMMENT ON COLUMN exchange.purse_requests.h_contract_terms IS 'Hash of the contract the parties are to agree to';
--
--- Name: purse_requests; Type: TABLE; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.flags; Type: COMMENT; Schema: exchange; Owner: -
--
-CREATE TABLE public.purse_requests (
- purse_requests_serial_id bigint NOT NULL,
- purse_pub bytea NOT NULL,
- merge_pub bytea NOT NULL,
- purse_expiration bigint NOT NULL,
- h_contract_terms bytea NOT NULL,
- age_limit integer NOT NULL,
- amount_with_fee_val bigint NOT NULL,
- amount_with_fee_frac integer NOT NULL,
- balance_val bigint DEFAULT 0 NOT NULL,
- balance_frac integer DEFAULT 0 NOT NULL,
- purse_sig bytea NOT NULL,
- CONSTRAINT purse_requests_h_contract_terms_check CHECK ((length(h_contract_terms) = 64)),
- CONSTRAINT purse_requests_merge_pub_check CHECK ((length(merge_pub) = 32)),
- CONSTRAINT purse_requests_purse_pub_check CHECK ((length(purse_pub) = 32)),
- CONSTRAINT purse_requests_purse_sig_check CHECK ((length(purse_sig) = 64))
-)
-PARTITION BY HASH (purse_pub);
+COMMENT ON COLUMN exchange.purse_requests.flags IS 'see the enum TALER_WalletAccountMergeFlags';
--
--- Name: TABLE purse_requests; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.refunded; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.purse_requests IS 'Requests establishing purses, associating them with a contract but without a target reserve';
+COMMENT ON COLUMN exchange.purse_requests.refunded IS 'set to TRUE if the purse could not be merged and thus all deposited coins were refunded';
--
--- Name: COLUMN purse_requests.purse_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.finished; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_requests.purse_pub IS 'Public key of the purse';
+COMMENT ON COLUMN exchange.purse_requests.finished IS 'set to TRUE once the purse has been merged (into reserve or wad) or the coins were refunded (transfer aborted)';
--
--- Name: COLUMN purse_requests.purse_expiration; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.in_reserve_quota; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_requests.purse_expiration IS 'When the purse is set to expire';
+COMMENT ON COLUMN exchange.purse_requests.in_reserve_quota IS 'set to TRUE if this purse currently counts against the number of free purses in the respective reserve';
--
--- Name: COLUMN purse_requests.h_contract_terms; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.amount_with_fee_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_requests.h_contract_terms IS 'Hash of the contract the parties are to agree to';
+COMMENT ON COLUMN exchange.purse_requests.amount_with_fee_val IS 'Total amount expected to be in the purse';
--
--- Name: COLUMN purse_requests.amount_with_fee_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.purse_fee_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_requests.amount_with_fee_val IS 'Total amount expected to be in the purse';
+COMMENT ON COLUMN exchange.purse_requests.purse_fee_val IS 'Purse fee the client agreed to pay from the reserve (accepted by the exchange at the time the purse was created). Zero if in_reserve_quota is TRUE.';
--
--- Name: COLUMN purse_requests.balance_val; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.balance_val; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_requests.balance_val IS 'Total amount actually in the purse';
+COMMENT ON COLUMN exchange.purse_requests.balance_val IS 'Total amount actually in the purse';
--
--- Name: COLUMN purse_requests.purse_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN purse_requests.purse_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.purse_requests.purse_sig IS 'Signature of the purse affirming the purse parameters, of type TALER_SIGNATURE_PURSE_REQUEST';
+COMMENT ON COLUMN exchange.purse_requests.purse_sig IS 'Signature of the purse affirming the purse parameters, of type TALER_SIGNATURE_PURSE_REQUEST';
--
--- Name: purse_requests_default; Type: TABLE; Schema: public; Owner: -
+-- Name: purse_requests_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.purse_requests_default (
+CREATE TABLE exchange.purse_requests_default (
purse_requests_serial_id bigint NOT NULL,
purse_pub bytea NOT NULL,
merge_pub bytea NOT NULL,
+ purse_creation bigint NOT NULL,
purse_expiration bigint NOT NULL,
h_contract_terms bytea NOT NULL,
age_limit integer NOT NULL,
+ flags integer NOT NULL,
+ refunded boolean DEFAULT false NOT NULL,
+ finished boolean DEFAULT false NOT NULL,
+ in_reserve_quota boolean DEFAULT false NOT NULL,
amount_with_fee_val bigint NOT NULL,
amount_with_fee_frac integer NOT NULL,
+ purse_fee_val bigint NOT NULL,
+ purse_fee_frac integer NOT NULL,
balance_val bigint DEFAULT 0 NOT NULL,
balance_frac integer DEFAULT 0 NOT NULL,
purse_sig bytea NOT NULL,
@@ -8691,15 +7713,15 @@ CREATE TABLE public.purse_requests_default (
CONSTRAINT purse_requests_purse_pub_check CHECK ((length(purse_pub) = 32)),
CONSTRAINT purse_requests_purse_sig_check CHECK ((length(purse_sig) = 64))
);
-ALTER TABLE ONLY public.purse_requests ATTACH PARTITION public.purse_requests_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.purse_requests ATTACH PARTITION exchange.purse_requests_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: purse_requests_purse_requests_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: purse_requests_purse_requests_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.purse_requests ALTER COLUMN purse_requests_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.purse_requests_purse_requests_serial_id_seq
+ALTER TABLE exchange.purse_requests ALTER COLUMN purse_requests_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.purse_requests_purse_requests_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -8709,10 +7731,10 @@ ALTER TABLE public.purse_requests ALTER COLUMN purse_requests_serial_id ADD GENE
--
--- Name: recoup; Type: TABLE; Schema: public; Owner: -
+-- Name: recoup; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.recoup (
+CREATE TABLE exchange.recoup (
recoup_uuid bigint NOT NULL,
coin_pub bytea NOT NULL,
coin_sig bytea NOT NULL,
@@ -8729,45 +7751,45 @@ PARTITION BY HASH (coin_pub);
--
--- Name: TABLE recoup; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE recoup; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.recoup IS 'Information about recoups that were executed between a coin and a reserve. In this type of recoup, the amount is credited back to the reserve from which the coin originated.';
+COMMENT ON TABLE exchange.recoup IS 'Information about recoups that were executed between a coin and a reserve. In this type of recoup, the amount is credited back to the reserve from which the coin originated.';
--
--- Name: COLUMN recoup.coin_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup.coin_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup.coin_pub IS 'Coin that is being debited in the recoup. Do not CASCADE ON DROP on the coin_pub, as we may keep the coin alive!';
+COMMENT ON COLUMN exchange.recoup.coin_pub IS 'Coin that is being debited in the recoup. Do not CASCADE ON DROP on the coin_pub, as we may keep the coin alive!';
--
--- Name: COLUMN recoup.coin_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup.coin_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup.coin_sig IS 'Signature by the coin affirming the recoup, of type TALER_SIGNATURE_WALLET_COIN_RECOUP';
+COMMENT ON COLUMN exchange.recoup.coin_sig IS 'Signature by the coin affirming the recoup, of type TALER_SIGNATURE_WALLET_COIN_RECOUP';
--
--- Name: COLUMN recoup.coin_blind; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup.coin_blind; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup.coin_blind IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the withdraw operation.';
+COMMENT ON COLUMN exchange.recoup.coin_blind IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the withdraw operation.';
--
--- Name: COLUMN recoup.reserve_out_serial_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup.reserve_out_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup.reserve_out_serial_id IS 'Identifies the h_blind_ev of the recouped coin and provides the link to the credited reserve.';
+COMMENT ON COLUMN exchange.recoup.reserve_out_serial_id IS 'Identifies the h_blind_ev of the recouped coin and provides the link to the credited reserve.';
--
--- Name: recoup_by_reserve; Type: TABLE; Schema: public; Owner: -
+-- Name: recoup_by_reserve; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.recoup_by_reserve (
+CREATE TABLE exchange.recoup_by_reserve (
reserve_out_serial_id bigint NOT NULL,
coin_pub bytea,
CONSTRAINT recoup_by_reserve_coin_pub_check CHECK ((length(coin_pub) = 32))
@@ -8776,29 +7798,29 @@ PARTITION BY HASH (reserve_out_serial_id);
--
--- Name: TABLE recoup_by_reserve; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE recoup_by_reserve; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.recoup_by_reserve IS 'Information in this table is strictly redundant with that of recoup, but saved by a different primary key for fast lookups by reserve_out_serial_id.';
+COMMENT ON TABLE exchange.recoup_by_reserve IS 'Information in this table is strictly redundant with that of recoup, but saved by a different primary key for fast lookups by reserve_out_serial_id.';
--
--- Name: recoup_by_reserve_default; Type: TABLE; Schema: public; Owner: -
+-- Name: recoup_by_reserve_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.recoup_by_reserve_default (
+CREATE TABLE exchange.recoup_by_reserve_default (
reserve_out_serial_id bigint NOT NULL,
coin_pub bytea,
CONSTRAINT recoup_by_reserve_coin_pub_check CHECK ((length(coin_pub) = 32))
);
-ALTER TABLE ONLY public.recoup_by_reserve ATTACH PARTITION public.recoup_by_reserve_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.recoup_by_reserve ATTACH PARTITION exchange.recoup_by_reserve_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: recoup_default; Type: TABLE; Schema: public; Owner: -
+-- Name: recoup_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.recoup_default (
+CREATE TABLE exchange.recoup_default (
recoup_uuid bigint NOT NULL,
coin_pub bytea NOT NULL,
coin_sig bytea NOT NULL,
@@ -8811,15 +7833,15 @@ CREATE TABLE public.recoup_default (
CONSTRAINT recoup_coin_pub_check CHECK ((length(coin_pub) = 32)),
CONSTRAINT recoup_coin_sig_check CHECK ((length(coin_sig) = 64))
);
-ALTER TABLE ONLY public.recoup ATTACH PARTITION public.recoup_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.recoup ATTACH PARTITION exchange.recoup_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: recoup_recoup_uuid_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: recoup_recoup_uuid_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.recoup ALTER COLUMN recoup_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.recoup_recoup_uuid_seq
+ALTER TABLE exchange.recoup ALTER COLUMN recoup_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.recoup_recoup_uuid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -8829,10 +7851,10 @@ ALTER TABLE public.recoup ALTER COLUMN recoup_uuid ADD GENERATED BY DEFAULT AS I
--
--- Name: recoup_refresh; Type: TABLE; Schema: public; Owner: -
+-- Name: recoup_refresh; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.recoup_refresh (
+CREATE TABLE exchange.recoup_refresh (
recoup_refresh_uuid bigint NOT NULL,
coin_pub bytea NOT NULL,
known_coin_id bigint NOT NULL,
@@ -8850,45 +7872,45 @@ PARTITION BY HASH (coin_pub);
--
--- Name: TABLE recoup_refresh; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE recoup_refresh; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.recoup_refresh IS 'Table of coins that originated from a refresh operation and that were recouped. Links the (fresh) coin to the melted operation (and thus the old coin). A recoup on a refreshed coin credits the old coin and debits the fresh coin.';
+COMMENT ON TABLE exchange.recoup_refresh IS 'Table of coins that originated from a refresh operation and that were recouped. Links the (fresh) coin to the melted operation (and thus the old coin). A recoup on a refreshed coin credits the old coin and debits the fresh coin.';
--
--- Name: COLUMN recoup_refresh.coin_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup_refresh.coin_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup_refresh.coin_pub IS 'Refreshed coin of a revoked denomination where the residual value is credited to the old coin. Do not CASCADE ON DROP on the coin_pub, as we may keep the coin alive!';
+COMMENT ON COLUMN exchange.recoup_refresh.coin_pub IS 'Refreshed coin of a revoked denomination where the residual value is credited to the old coin. Do not CASCADE ON DROP on the coin_pub, as we may keep the coin alive!';
--
--- Name: COLUMN recoup_refresh.known_coin_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup_refresh.known_coin_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup_refresh.known_coin_id IS 'FIXME: (To be) used for garbage collection (in the future)';
+COMMENT ON COLUMN exchange.recoup_refresh.known_coin_id IS 'FIXME: (To be) used for garbage collection (in the future)';
--
--- Name: COLUMN recoup_refresh.coin_blind; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup_refresh.coin_blind; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup_refresh.coin_blind IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the refresh operation.';
+COMMENT ON COLUMN exchange.recoup_refresh.coin_blind IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the refresh operation.';
--
--- Name: COLUMN recoup_refresh.rrc_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN recoup_refresh.rrc_serial; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.recoup_refresh.rrc_serial IS 'Link to the refresh operation. Also identifies the h_blind_ev of the recouped coin (as h_coin_ev).';
+COMMENT ON COLUMN exchange.recoup_refresh.rrc_serial IS 'Link to the refresh operation. Also identifies the h_blind_ev of the recouped coin (as h_coin_ev).';
--
--- Name: recoup_refresh_default; Type: TABLE; Schema: public; Owner: -
+-- Name: recoup_refresh_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.recoup_refresh_default (
+CREATE TABLE exchange.recoup_refresh_default (
recoup_refresh_uuid bigint NOT NULL,
coin_pub bytea NOT NULL,
known_coin_id bigint NOT NULL,
@@ -8902,15 +7924,15 @@ CREATE TABLE public.recoup_refresh_default (
CONSTRAINT recoup_refresh_coin_pub_check CHECK ((length(coin_pub) = 32)),
CONSTRAINT recoup_refresh_coin_sig_check CHECK ((length(coin_sig) = 64))
);
-ALTER TABLE ONLY public.recoup_refresh ATTACH PARTITION public.recoup_refresh_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.recoup_refresh ATTACH PARTITION exchange.recoup_refresh_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: recoup_refresh_recoup_refresh_uuid_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: recoup_refresh_recoup_refresh_uuid_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.recoup_refresh ALTER COLUMN recoup_refresh_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.recoup_refresh_recoup_refresh_uuid_seq
+ALTER TABLE exchange.recoup_refresh ALTER COLUMN recoup_refresh_uuid ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.recoup_refresh_recoup_refresh_uuid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -8920,10 +7942,10 @@ ALTER TABLE public.recoup_refresh ALTER COLUMN recoup_refresh_uuid ADD GENERATED
--
--- Name: refresh_commitments; Type: TABLE; Schema: public; Owner: -
+-- Name: refresh_commitments; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.refresh_commitments (
+CREATE TABLE exchange.refresh_commitments (
melt_serial_id bigint NOT NULL,
rc bytea NOT NULL,
old_coin_pub bytea NOT NULL,
@@ -8938,38 +7960,38 @@ PARTITION BY HASH (rc);
--
--- Name: TABLE refresh_commitments; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE refresh_commitments; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.refresh_commitments IS 'Commitments made when melting coins and the gamma value chosen by the exchange.';
+COMMENT ON TABLE exchange.refresh_commitments IS 'Commitments made when melting coins and the gamma value chosen by the exchange.';
--
--- Name: COLUMN refresh_commitments.rc; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_commitments.rc; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_commitments.rc IS 'Commitment made by the client, hash over the various client inputs in the cut-and-choose protocol';
+COMMENT ON COLUMN exchange.refresh_commitments.rc IS 'Commitment made by the client, hash over the various client inputs in the cut-and-choose protocol';
--
--- Name: COLUMN refresh_commitments.old_coin_pub; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_commitments.old_coin_pub; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_commitments.old_coin_pub IS 'Coin being melted in the refresh process.';
+COMMENT ON COLUMN exchange.refresh_commitments.old_coin_pub IS 'Coin being melted in the refresh process.';
--
--- Name: COLUMN refresh_commitments.noreveal_index; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_commitments.noreveal_index; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_commitments.noreveal_index IS 'The gamma value chosen by the exchange in the cut-and-choose protocol';
+COMMENT ON COLUMN exchange.refresh_commitments.noreveal_index IS 'The gamma value chosen by the exchange in the cut-and-choose protocol';
--
--- Name: refresh_commitments_default; Type: TABLE; Schema: public; Owner: -
+-- Name: refresh_commitments_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.refresh_commitments_default (
+CREATE TABLE exchange.refresh_commitments_default (
melt_serial_id bigint NOT NULL,
rc bytea NOT NULL,
old_coin_pub bytea NOT NULL,
@@ -8980,15 +8002,15 @@ CREATE TABLE public.refresh_commitments_default (
CONSTRAINT refresh_commitments_old_coin_sig_check CHECK ((length(old_coin_sig) = 64)),
CONSTRAINT refresh_commitments_rc_check CHECK ((length(rc) = 64))
);
-ALTER TABLE ONLY public.refresh_commitments ATTACH PARTITION public.refresh_commitments_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.refresh_commitments ATTACH PARTITION exchange.refresh_commitments_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: refresh_commitments_melt_serial_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: refresh_commitments_melt_serial_id_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.refresh_commitments ALTER COLUMN melt_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.refresh_commitments_melt_serial_id_seq
+ALTER TABLE exchange.refresh_commitments ALTER COLUMN melt_serial_id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.refresh_commitments_melt_serial_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -8998,10 +8020,10 @@ ALTER TABLE public.refresh_commitments ALTER COLUMN melt_serial_id ADD GENERATED
--
--- Name: refresh_revealed_coins; Type: TABLE; Schema: public; Owner: -
+-- Name: refresh_revealed_coins; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.refresh_revealed_coins (
+CREATE TABLE exchange.refresh_revealed_coins (
rrc_serial bigint NOT NULL,
melt_serial_id bigint NOT NULL,
freshcoin_index integer NOT NULL,
@@ -9018,66 +8040,66 @@ PARTITION BY HASH (melt_serial_id);
--
--- Name: TABLE refresh_revealed_coins; Type: COMMENT; Schema: public; Owner: -
+-- Name: TABLE refresh_revealed_coins; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON TABLE public.refresh_revealed_coins IS 'Revelations about the new coins that are to be created during a melting session.';
+COMMENT ON TABLE exchange.refresh_revealed_coins IS 'Revelations about the new coins that are to be created during a melting session.';
--
--- Name: COLUMN refresh_revealed_coins.rrc_serial; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.rrc_serial; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.rrc_serial IS 'needed for exchange-auditor replication logic';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.rrc_serial IS 'needed for exchange-auditor replication logic';
--
--- Name: COLUMN refresh_revealed_coins.melt_serial_id; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.melt_serial_id; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.melt_serial_id IS 'Identifies the refresh commitment (rc) of the melt operation.';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.melt_serial_id IS 'Identifies the refresh commitment (rc) of the melt operation.';
--
--- Name: COLUMN refresh_revealed_coins.freshcoin_index; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.freshcoin_index; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.freshcoin_index IS 'index of the fresh coin being created (one melt operation may result in multiple fresh coins)';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.freshcoin_index IS 'index of the fresh coin being created (one melt operation may result in multiple fresh coins)';
--
--- Name: COLUMN refresh_revealed_coins.coin_ev; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.coin_ev; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.coin_ev IS 'envelope of the new coin to be signed';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.coin_ev IS 'envelope of the new coin to be signed';
--
--- Name: COLUMN refresh_revealed_coins.h_coin_ev; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.h_coin_ev; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.h_coin_ev IS 'hash of the envelope of the new coin to be signed (for lookups)';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.h_coin_ev IS 'hash of the envelope of the new coin to be signed (for lookups)';
--
--- Name: COLUMN refresh_revealed_coins.ev_sig; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.ev_sig; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.ev_sig IS 'exchange signature over the envelope';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.ev_sig IS 'exchange signature over the envelope';
--
--- Name: COLUMN refresh_revealed_coins.ewv; Type: COMMENT; Schema: public; Owner: -
+-- Name: COLUMN refresh_revealed_coins.ewv; Type: COMMENT; Schema: exchange; Owner: -
--
-COMMENT ON COLUMN public.refresh_revealed_coins.ewv IS 'exchange contributed values in the creation of the fresh coin (see /csr)';
+COMMENT ON COLUMN exchange.refresh_revealed_coins.ewv IS 'exchange contributed values in the creation of the fresh coin (see /csr)';
--
--- Name: refresh_revealed_coins_default; Type: TABLE; Schema: public; Owner: -
+-- Name: refresh_revealed_coins_default; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.refresh_revealed_coins_default (
+CREATE TABLE exchange.refresh_revealed_coins_default (
rrc_serial bigint NOT NULL,
melt_serial_id bigint NOT NULL,
freshcoin_index integer NOT NULL,
@@ -9090,15 +8112,15 @@ CREATE TABLE public.refresh_revealed_coins_default (
CONSTRAINT refresh_revealed_coins_h_coin_ev_check CHECK ((length(h_coin_ev) = 64)),
CONSTRAINT refresh_revealed_coins_link_sig_check CHECK ((length(link_sig) = 64))
);
-ALTER TABLE ONLY public.refresh_revealed_coins ATTACH PARTITION public.refresh_revealed_coins_default FOR VALUES WITH (modulus 1, remainder 0);
+ALTER TABLE ONLY exchange.refresh_revealed_coins ATTACH PARTITION exchange.refresh_revealed_coins_default FOR VALUES WITH (modulus 1, remainder 0);
--
--- Name: refresh_revealed_coins_rrc_serial_seq; Type: SEQUENCE; Schema: public; Owner: -
+-- Name: refresh_revealed_coins_rrc_serial_seq; Type: SEQUENCE; Schema: exchange; Owner: -
--
-ALTER TABLE public.refresh_revealed_coins ALTER COLUMN rrc_serial ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.refresh_revealed_coins_rrc_serial_seq
+ALTER TABLE exchange.refresh_revealed_coins ALTER COLUMN rrc_serial ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME exchange.refresh_revealed_coins_rrc_serial_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -9108,10 +8130,10 @@ ALTER TABLE public.refresh_revealed_coins ALTER COLUMN rrc_serial ADD GENERATED
--
--- Name: refresh_transfer_keys; Type: TABLE; Schema: public; Owner: -
+-- Name: refresh_transfer_keys; Type: TABLE; Schema: exchange; Owner: -
--
-CREATE TABLE public.refresh_transfer_keys (
+CREATE TABLE exchange.refresh_transfer_keys (
rtc_serial bigint NOT NULL,
melt_serial_id bigint NOT NULL,
transfer_pu