diff options
| author | Adrien Hopkins <[email protected]> | 2022-06-13 09:40:07 -0500 |
|---|---|---|
| committer | Adrien Hopkins <[email protected]> | 2022-06-13 09:40:07 -0500 |
| commit | 2498ed9a93405c999c9336e0cb18a187716c1d03 (patch) | |
| tree | 5c4e9d264fb8e7eb60253309279bbb2ca035a976 | |
| parent | 52716276db81bf8b9559cc2b361927d7be836897 (diff) | |
| download | coinos-server-2498ed9a93405c999c9336e0cb18a187716c1d03.tar.gz coinos-server-2498ed9a93405c999c9336e0cb18a187716c1d03.zip | |
Withdrawal fee credits will be given for receiving Bitcoin/Liquid
| -rw-r--r-- | routes/bitcoin/receive.js | 4 | ||||
| -rw-r--r-- | routes/liquid/receive.js | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js index 5d8e21e7..5025a809 100644 --- a/routes/bitcoin/receive.js +++ b/routes/bitcoin/receive.js @@ -21,6 +21,9 @@ const network = const queue = {}; const seen = []; +// used to calculate how many credits to give +const withdrawalFeeMultiplier = 0.01; + zmqRawTx.on("message", async (topic, message, sequence) => { const hex = message.toString("hex"); let tx = bitcoin.Transaction.fromHex(message); @@ -192,6 +195,7 @@ setInterval(async () => { { pending: Math.min(account.pending, total) }, { transaction } ); + await account.increment({ fee_credits: total * withdrawalFeeMultiplier }, { transaction }); await account.reload({ transaction }); await p.save({ transaction }); diff --git a/routes/liquid/receive.js b/routes/liquid/receive.js index 0ee3e0c6..6d4c128b 100644 --- a/routes/liquid/receive.js +++ b/routes/liquid/receive.js @@ -13,6 +13,9 @@ const network = config.liquid.network === "mainnet" ? "liquid" : config.liquid.network ]; +// used to calculate how many credits to give +const withdrawalFeeMultiplier = 0.01; + const getAccount = async (params, transaction) => { let account = await db.Account.findOne({ where: params, @@ -340,6 +343,7 @@ setInterval(async () => { { pending: Math.min(p.account.pending, total) }, { transaction } ); + await account.increment({ fee_credits: total * withdrawalFeeMultiplier }, { transaction }); await p.account.reload({ transaction }); await p.save({ transaction }); |
