aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrien Hopkins <[email protected]>2022-06-16 09:17:24 -0500
committerAdrien Hopkins <[email protected]>2022-06-16 09:17:24 -0500
commit8361c2d400145a13d9ba24299ceb7293e69d3d43 (patch)
tree9d8c41deafebd231f126c3d8558d42f6fc0df1e4
parenta9caa15ac75a6ce2939ffd90a0a2040434095d84 (diff)
downloadcoinos-server-8361c2d400145a13d9ba24299ceb7293e69d3d43.tar.gz
coinos-server-8361c2d400145a13d9ba24299ceb7293e69d3d43.zip
Separated Bitcoin and Liquid conversion fee credits
-rw-r--r--routes/bitcoin/receive.js2
-rw-r--r--routes/bitcoin/send.js4
-rw-r--r--routes/liquid/receive.js2
-rw-r--r--routes/liquid/send.js5
4 files changed, 6 insertions, 7 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 8f5d5842..45dadbbe 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -195,7 +195,7 @@ setInterval(async () => {
{ transaction }
);
// get the # of fee credits you would need to pay off this amount of bitcoin
- await account.increment({ fee_credits: computeConversionFee(total) }, { transaction });
+ await account.increment({ btc_credits: computeConversionFee(total) }, { transaction });
await account.reload({ transaction });
await p.save({ transaction });
diff --git a/routes/bitcoin/send.js b/routes/bitcoin/send.js
index a566c6f0..884c0db1 100644
--- a/routes/bitcoin/send.js
+++ b/routes/bitcoin/send.js
@@ -67,9 +67,9 @@ module.exports = ah(async (req, res) => {
}
// use user's credits to reduce fee, if available
- let conversionFeeDeduction = Math.min(account.fee_credits, conversionFee);
+ let conversionFeeDeduction = Math.min(account.btc_credits, conversionFee);
if (conversionFeeDeduction) {
- await account.decrement({ fee_credits: conversionFeeDeduction }, { transaction });
+ await account.decrement({ btc_credits: conversionFeeDeduction }, { transaction });
await account.reload({ transaction });
conversionFee -= conversionFeeDeduction;
}
diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js
index 5c0ca98e..2bd86805 100644
--- a/routes/liquid/receive.js
+++ b/routes/liquid/receive.js
@@ -343,7 +343,7 @@ setInterval(async () => {
{ pending: Math.min(p.account.pending, total) },
{ transaction }
);
- await p.account.increment({ fee_credits: computeConversionFee(total) }, { transaction });
+ await p.account.increment({ liquid_credits: computeConversionFee(total) }, { transaction });
await p.account.reload({ transaction });
await p.save({ transaction });
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index 3e8ac946..5cda8ba5 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -131,10 +131,9 @@ sendLiquid = async ({ asset, amount, user, address, memo, tx, limit }) => {
}
// use user's credits to reduce fee, if available
- console.log(account.fee_credits);
- let conversionFeeDeduction = Math.min(account.fee_credits, conversionFee);
+ let conversionFeeDeduction = Math.min(account.liquid_credits, conversionFee);
if (conversionFeeDeduction) {
- await account.decrement({ fee_credits: conversionFeeDeduction }, { transaction });
+ await account.decrement({ liquid_credits: conversionFeeDeduction }, { transaction });
await account.reload({ transaction });
conversionFee -= conversionFeeDeduction;
}