From 3f29ab706faff6d778fb1ece6e78d2c8c131a4d8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 22 Jan 2020 11:17:19 -0800 Subject: [PATCH] check against issued supply instead of current supply (#24) --- build/dgoods/dgoods.abi | 27 +++++++++++++++++++++++++++ build/dgoods/dgoods.wasm | Bin 89328 -> 90710 bytes src/dgoods.cpp | 6 +++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/build/dgoods/dgoods.abi b/build/dgoods/dgoods.abi index bc1748b..1ed7c53 100644 --- a/build/dgoods/dgoods.abi +++ b/build/dgoods/dgoods.abi @@ -335,6 +335,28 @@ } ] }, + { + "name": "logsale", + "base": "", + "fields": [ + { + "name": "dgood_ids", + "type": "uint64[]" + }, + { + "name": "seller", + "type": "name" + }, + { + "name": "buyer", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + } + ] + }, { "name": "setconfig", "base": "", @@ -469,6 +491,11 @@ "type": "logcall", "ricardian_contract": "" }, + { + "name": "logsale", + "type": "logsale", + "ricardian_contract": "" + }, { "name": "setconfig", "type": "setconfig", diff --git a/build/dgoods/dgoods.wasm b/build/dgoods/dgoods.wasm index c4bcfcecee1372d8cd5647d8855b8efdd307f20f..0066415799dd5ce1cc1de1972417ec28b14b5865 100755 GIT binary patch delta 3775 zcmaJ^4RBP|6@KTw_p&e9-Q*!88&e5)ADMO&L6{PEDHCm83doPvfQ3S5I`(I(_-Iia zu}nL|rZdbKTTt|tE*7w0<;Nl#yTAfLx>k#T0b&c7BD8@5jR+3KcA#K8{my+$+i_|M z`|iExo_p^3`OZ1-UEEh|f~^m}!6 z`eHhk&))Mm(Q#Ei;{^R7B&qB@Q}Wwpe&Es{^Xu;4R7UOjY4dhf(dK;Rq78&$Teiif zKj%MOysCmucQU}seY^`VrIo6 zGfRsi_=)Ur!@sCz@0l@tuaLICy2o%^(xL}*X*ZgCMaCQpa<38KIaa;B=it3X=3|28 z-WPJs%9u=SG~1I7_Ew0%mw|7jg(2;>Y{uM(%{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src/dgoods.cpp index 193fd09..4410405 100644 --- a/src/dgoods.cpp +++ b/src/dgoods.cpp @@ -128,7 +128,7 @@ ACTION dgoods::issue(const name& to, if (dgood_stats.max_supply.amount != 0) { // check cannot issue more than max supply, careful of overflow of uint - check( quantity.amount <= (dgood_stats.max_supply.amount - dgood_stats.current_supply.amount), "Cannot issue more than max supply" ); + check( quantity.amount <= (dgood_stats.max_supply.amount - dgood_stats.issued_supply.amount), "Cannot issue more than max supply" ); } if (dgood_stats.fungible == false) { @@ -394,9 +394,9 @@ ACTION dgoods::freezemaxsup(const name& category, const name& token_name) { const auto& dgood_stats = stats_table.get( token_name.value, "Token with category and token_name does not exist" ); check(dgood_stats.max_issue_window != time_point_sec(0), "can't freeze max supply unless time based minting"); - check(dgood_stats.current_supply.amount != 0, "need to issue at least one token before freezing"); + check(dgood_stats.issued_supply.amount != 0, "need to issue at least one token before freezing"); stats_table.modify( dgood_stats, same_payer, [&]( auto& s ) { - s.max_supply = dgood_stats.current_supply; + s.max_supply = dgood_stats.issued_supply; s.max_issue_window = time_point_sec(0); }); }