exchange

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

commit b054c969cbd84f7ed0f61da3db6a8168b944318f
parent cf358f9546c89d9a52c444d18def703547a9d223
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 23 Apr 2022 19:01:28 +0200

-add more accounting fields to reserve table

Diffstat:
Msrc/exchangedb/common-0001.sql | 6+++++-
Msrc/exchangedb/exchange-0001-part.sql | 10+++++++++-
Msrc/lib/exchange_api_purse_create_with_merge.c | 6+++---
3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/exchangedb/common-0001.sql b/src/exchangedb/common-0001.sql @@ -106,6 +106,10 @@ BEGIN ',reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)' ',current_balance_val INT8 NOT NULL' ',current_balance_frac INT4 NOT NULL' + ',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)' ',expiration_date INT8 NOT NULL' ',gc_date INT8 NOT NULL' ') %s ;' @@ -2331,7 +2335,7 @@ BEGIN 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 ; diff --git a/src/exchangedb/exchange-0001-part.sql b/src/exchangedb/exchange-0001-part.sql @@ -99,7 +99,15 @@ COMMENT ON TABLE reserves COMMENT ON COLUMN reserves.reserve_pub IS 'EdDSA public key of the reserve. Knowledge of the private key implies ownership over the balance.'; COMMENT ON COLUMN reserves.current_balance_val - IS 'Current balance remaining with the reserve'; + IS 'Current balance remaining with the reserve.'; +COMMENT ON COLUMN reserves.purses_active + IS 'Number of purses that were created by this reserve that are not expired and not fully paid.'; +COMMENT ON COLUMN reserves.purses_allowed + IS 'Number of purses that this reserve is allowed to have active at most.'; +COMMENT ON COLUMN reserves.kyc_required + IS 'True if a KYC check must have been passed before withdrawing from this reserve. Set to true once a reserve received a P2P payment.'; +COMMENT ON COLUMN reserves.kyc_passed + IS 'True once KYC was passed for this reserve. The KYC details are then available via the wire_targets table under the key of wire_target_h_payto which is to be derived from the reserve_pub and the base URL of this exchange.'; COMMENT ON COLUMN reserves.expiration_date IS 'Used to trigger closing of reserves that have not been drained after some time'; COMMENT ON COLUMN reserves.gc_date diff --git a/src/lib/exchange_api_purse_create_with_merge.c b/src/lib/exchange_api_purse_create_with_merge.c @@ -345,7 +345,7 @@ TALER_EXCHANGE_purse_create_with_merge ( GNUNET_free (pcm); return NULL; } - TALER_wallet_purse_create_sign (purse_expiration, + TALER_wallet_purse_create_sign (pcm->purse_expiration, &pcm->h_contract_terms, &merge_pub, min_age, @@ -359,7 +359,7 @@ TALER_EXCHANGE_purse_create_with_merge ( &merge_sig); TALER_wallet_account_merge_sign (merge_timestamp, &pcm->purse_pub, - purse_expiration, + pcm->purse_expiration, &pcm->h_contract_terms, &pcm->purse_value_after_fees, min_age, @@ -416,7 +416,7 @@ TALER_EXCHANGE_purse_create_with_merge ( GNUNET_JSON_pack_timestamp ("merge_timestamp", merge_timestamp), GNUNET_JSON_pack_timestamp ("purse_expiration", - purse_expiration)); + pcm->purse_expiration)); GNUNET_assert (NULL != create_with_merge_obj); GNUNET_free (econtract); eh = TALER_EXCHANGE_curl_easy_get_ (pcm->url);