From a9b485feccf2bf1b0e6fdd698d382d9435ac49e5 Mon Sep 17 00:00:00 2001 From: Christian Grieger Date: Sat, 23 Nov 2019 10:34:42 +0100 Subject: [PATCH 01/12] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5b16faf..f490d37 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,4 @@ walletnotify=/path/to/your/bot/folder/transaction.sh %s ## Projects using the bot - Feel free to contact me to get added - Limitless (VIP) - Discord: https://discord.gg/wtz6QYX - Website: http://vip.limitlessvip.co.za/ +- BAREcoin (BARE) - https://discord.gg/nB9rKe8 - Website: https://bare.network/ From 2c226841a82346bc4abbee43c6b6e8ac8f1dc0a1 Mon Sep 17 00:00:00 2001 From: Christian Grieger Date: Sat, 23 Nov 2019 10:36:35 +0100 Subject: [PATCH 02/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f490d37..42a514d 100644 --- a/README.md +++ b/README.md @@ -75,4 +75,4 @@ walletnotify=/path/to/your/bot/folder/transaction.sh %s ## Projects using the bot - Feel free to contact me to get added - Limitless (VIP) - Discord: https://discord.gg/wtz6QYX - Website: http://vip.limitlessvip.co.za/ -- BAREcoin (BARE) - https://discord.gg/nB9rKe8 - Website: https://bare.network/ +- BARE Coin (BARE) - Discord: https://discord.gg/xmQbzNH - Website: https://bare.network/ From e3bd3c2e24f61b40810c159bfeb9da60739f878e Mon Sep 17 00:00:00 2001 From: Christian Grieger Date: Wed, 4 Mar 2020 23:17:05 +0100 Subject: [PATCH 03/12] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 6d78f9382675dc7564f517111f4599cce890bb8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}(4f5FRf}aki?u2P8Q9(%T*uN}-oZ(Ej5Pkn_Kbf%M|K7PL~j@`0ki=?q7pVdEdC+XPdX(H*V053W{eV2 z(2zqB7gOHc@D>@Mv-98thInen@Z|iCvqNjALEW1 zt*v!CYUTUtchh$BSurMhABK<}hL7Q?3ict=I zhqXoQK@m0-(S{0_Vh9_K?aKN24r_}x9E3|ggqvBo3`LmPaeQUmLHHKAWCoal=M2o) zYMb8w&Hv~B&x5$e3@`&9iUHBw2sV1SCHJ;YZI0erg?fZaLVmTyhY&Q(Q;fd!6fdG0 a!FELkqVKS_h%G4mBVcIYf*E*K2JQhx8(!rA From 74a324d5b25b037d4fbcda28f1494ec003a16dfb Mon Sep 17 00:00:00 2001 From: Travis Date: Fri, 24 Apr 2020 10:50:52 -0400 Subject: [PATCH 04/12] Allow Multi-deposits in single Txid --- Cryptocurrency-crypto-bot.sql | 2 +- README.md | 1 + functions/command.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cryptocurrency-crypto-bot.sql b/Cryptocurrency-crypto-bot.sql index 6d01edb..9600721 100644 --- a/Cryptocurrency-crypto-bot.sql +++ b/Cryptocurrency-crypto-bot.sql @@ -45,7 +45,7 @@ CREATE TABLE `deposits` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `address` varchar(60) NOT NULL, `amount` decimal(32,8) NOT NULL, - `txid` varchar(64) NOT NULL, + `txid` varchar(125) NOT NULL, `confirmations` int(11) NOT NULL, `credited` tinyint(1) unsigned NOT NULL, `datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/README.md b/README.md index 42a514d..a86cb54 100644 --- a/README.md +++ b/README.md @@ -76,3 +76,4 @@ walletnotify=/path/to/your/bot/folder/transaction.sh %s ## Projects using the bot - Feel free to contact me to get added - Limitless (VIP) - Discord: https://discord.gg/wtz6QYX - Website: http://vip.limitlessvip.co.za/ - BARE Coin (BARE) - Discord: https://discord.gg/xmQbzNH - Website: https://bare.network/ +- Coin Pool Services - Discord: https://discord.gg/eWB5z2E - Website: https://coinpoolservices.com/ diff --git a/functions/command.js b/functions/command.js index 5e72178..e3ec830 100755 --- a/functions/command.js +++ b/functions/command.js @@ -791,7 +791,7 @@ module.exports = { var deposit_category = latestDeposits[i].category; var deposit_amount = Big(latestDeposits[i].amount).toString(); var deposit_confirmations = latestDeposits[i].confirmations; - var deposit_txid = latestDeposits[i].txid; + var deposit_txid = latestDeposits[i].txid + ' ' + deposit_address; var deposit_generated = latestDeposits[i].generated; // Check if its a stake so not use it if(deposit_category === 'receive' && !deposit_generated && deposit_confirmations < config.wallet.minConfirmationsDeposit){ var creditDeposit = await transaction.transaction_add_update_deposits_on_db(deposit_address,Big(deposit_amount).toString(),deposit_confirmations,deposit_txid); From a31b124dc1a46ce37b844b076f3f60903596e015 Mon Sep 17 00:00:00 2001 From: Kristian Kramer Date: Sat, 11 Jul 2020 23:13:07 -0600 Subject: [PATCH 05/12] Update projects using the bot Add Beyondcoin to the list of projects using the bot. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a86cb54..845440f 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,4 @@ walletnotify=/path/to/your/bot/folder/transaction.sh %s - Limitless (VIP) - Discord: https://discord.gg/wtz6QYX - Website: http://vip.limitlessvip.co.za/ - BARE Coin (BARE) - Discord: https://discord.gg/xmQbzNH - Website: https://bare.network/ - Coin Pool Services - Discord: https://discord.gg/eWB5z2E - Website: https://coinpoolservices.com/ +- Beyondcoin (BYND) - Discord: https://discord.gg/j3BUcJU - Website: https://beyondcoin.io From d2d276c49d534464ae32ad62b676f28e222b3656 Mon Sep 17 00:00:00 2001 From: Kristian Kramer Date: Sun, 12 Jul 2020 10:45:04 -0600 Subject: [PATCH 06/12] Add an option to allow the bot to respond in any server --- config.js | 1 + functions/check.js | 16 ++++++++++------ index.js | 7 +++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/config.js b/config.js index e0d81cb..53abbb6 100755 --- a/config.js +++ b/config.js @@ -14,6 +14,7 @@ module.exports = { "moderatorIDs": [ "XXX" ], // This discrod user IDs are able to use moderator commands and bypass cooldowns "vipGroupName": "Dev Team", // Users of this group are able to use vip commands and bypass cooldowns "respondChannelIDs": [ "XXX" ], // Discord server channel IDs the bot does listen to + "allowAllChannels": false, // If enabled the bot will be able to reply in all channels making it essentially a public bot "commandIgnor": ["battle","cversion","destroy","gift","kill","lock","me","rez","top","use","me","cstart","cstop","cstart","jackpot","summary","shop","activate","mention","claim"], // commands to ignor because of other bots "stakePoolChannelID": "XXX", // If staking is configured use this channel to broadcast stake pool payouts "allowDM": true, // Allow or disable direct messages for commands to the bot with true or false diff --git a/functions/check.js b/functions/check.js index 6ce9ac9..434adec 100755 --- a/functions/check.js +++ b/functions/check.js @@ -13,6 +13,7 @@ try{ const Big = require('big.js'); // https://github.com/MikeMcl/big.js -> http://mikemcl.github.io/big.js/ const rp = require('request-promise'); +const { bot } = require('../config'); /* ------------------------------------------------------------------------------ */ // // // // // // // // // // // // // // // // // // // // // // // // // // // // @@ -116,14 +117,17 @@ module.exports = { }, /* ------------------------------------------------------------------------------ */ - // Check if the channel is a valid channel to repond to + // Check if the channel is a valid channel to respond to or if open to all channels /* ------------------------------------------------------------------------------ */ - check_respond_channel: function(channelID){ - var respondChannelIDs = {}; - for (var i = 0 ; i < config.bot.respondChannelIDs.length ; ++i) - respondChannelIDs[config.bot.respondChannelIDs[i]] = true; - return respondChannelIDs[channelID]; + if (config.bot.allowAllChannels == true) { + return; + } else if(config.bot.allowAllChannels == false) { + var respondChannelIDs = {}; + for (var i = 0 ; i < config.bot.respondChannelIDs.length ; ++i) + respondChannelIDs[config.bot.respondChannelIDs[i]] = true; + return respondChannelIDs[channelID]; + } }, /* ------------------------------------------------------------------------------ */ diff --git a/index.js b/index.js index fc3f0f4..fef236c 100755 --- a/index.js +++ b/index.js @@ -119,8 +119,11 @@ if(messageContent.startsWith(config.bot.commandPrefix)){ } // If its not a dm message check if its a valid channel for commands - if(!check.check_respond_channel(channelID) && messageType !== 'dm') - return; + if(config.bot.allowAllChannels == "true") + return; + else if(config.bot.allowAllChannels == false) + if(!check.check_respond_channel(channelID) && messageType !== 'dm') + return; // Check if admin mode is enabled and only allow commands from admins if(config.bot.adminMode && userRole != 3){ From 21fc9034d2881963aab9c09d14b14f7f64156a48 Mon Sep 17 00:00:00 2001 From: dzypher <65742350+getdzypher@users.noreply.github.com> Date: Tue, 4 Aug 2020 06:23:57 +0800 Subject: [PATCH 07/12] Added Shroud Protocol --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 845440f..939ba29 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,4 @@ walletnotify=/path/to/your/bot/folder/transaction.sh %s - BARE Coin (BARE) - Discord: https://discord.gg/xmQbzNH - Website: https://bare.network/ - Coin Pool Services - Discord: https://discord.gg/eWB5z2E - Website: https://coinpoolservices.com/ - Beyondcoin (BYND) - Discord: https://discord.gg/j3BUcJU - Website: https://beyondcoin.io +- Shroud Protocol (SHROUD) - Discord: https://discord.gg/7U8chR4 - Website: https://shroudx.org From c8ef33b576b345d4d0e894f206d556e4499f8642 Mon Sep 17 00:00:00 2001 From: MadCatMining Date: Mon, 18 Jan 2021 14:13:50 +0100 Subject: [PATCH 08/12] Change code to work with BlackCoin forks staking pool Added / replaced / changed parts of code for Bot to be able to handle BlackCoin and it's forks staking pool. WARNING: these changes probably broke original code functions!!! Do not use on any other coins without prior testing!!! --- functions/command.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/functions/command.js b/functions/command.js index e3ec830..8ccef0d 100755 --- a/functions/command.js +++ b/functions/command.js @@ -866,18 +866,28 @@ module.exports = { } }else{ // If stake - var transaction_amount = Big(getTransaction.amount).toString(); + var block = getTransaction.blockhash; + var blockhash = String(block); + log.log_write_console(blockhash); + + var getBlock = await wallet.wallet_get_block(blockhash); + var getMint = getBlock.mint; + var mint = String(getMint); + log.log_write_console(getMint); + + var transaction_amount = Big(getBlock.mint).toString(); + var transaction_fee = getTransaction.fee; - var transaction_stake_amount = Big(transaction_amount).plus(transaction_fee); + var transaction_stake_amount = Big(transaction_amount); var transaction_stake = 1; //log.log_write_console('AMOUNT: '+transaction_amount+' - FEE: '+transaction_fee+' STAKE AMOUNT: '+Big(transaction_stake_amount).toString()); // Update transaction on db var updateTransaction = await transaction.transaction_update_stake_transaction(transaction_txid,Big(transaction_stake_amount).toString(),transaction_stake); if(updateTransaction){ countTransactionsToCheck++; - } - } - } + } + } + } if(i == transactionsToCheck.length-1 && manuallyFired == 1) chat.chat_reply(msg,'embed',userName,messageType,config.colors.special,false,config.messages.getstakes.manually,[[config.messages.getstakes.transactions,countTransactionsToCheck,false]],false,false,false,false,false); if(i == transactionsToCheck.length-1 && manuallyFired == 0) @@ -2262,4 +2272,4 @@ module.exports = { } } -}; \ No newline at end of file +}; From 7ab46d7dce7cb0942f4e0c07001ad8c3c6c5db65 Mon Sep 17 00:00:00 2001 From: MadCatMining Date: Mon, 18 Jan 2021 14:15:56 +0100 Subject: [PATCH 09/12] Change code to work with BlackCoin forks staking pool Added / replaced / changed parts of code for Bot to be able to handle BlackCoin and it's forks staking pool. WARNING: these changes probably broke original code functions!!! Do not use on any other coins without prior testing!!! --- functions/wallet.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/functions/wallet.js b/functions/wallet.js index 1b0a89f..ad42fa7 100755 --- a/functions/wallet.js +++ b/functions/wallet.js @@ -139,6 +139,29 @@ module.exports = { }); }); }, + + /* ------------------------------------------------------------------------------ */ + // Get block + /* ------------------------------------------------------------------------------ */ + + wallet_get_block: function(blockhash){ + return new Promise((resolve, reject)=>{ + coinClient.getBlock(blockhash, function(error, result) { + if(error){ + var errorMessage = "wallet_get_block: Wallet query problem. (getBlock)"; + if(config.bot.errorLogging){ + log.log_write_file(errorMessage); + log.log_write_file(error); + } + log.log_write_console(errorMessage); + log.log_write_console(error); + resolve(false); + }else{ + resolve(result); + } + }); + }); + }, /* ------------------------------------------------------------------------------ */ // Get balance @@ -186,4 +209,4 @@ module.exports = { }); } -}; \ No newline at end of file +}; From fcabeee7657acda4a1f65c0d7dd0224a6e075cd0 Mon Sep 17 00:00:00 2001 From: MadCatMining Date: Thu, 21 Jan 2021 08:22:40 +0100 Subject: [PATCH 10/12] Stake calculations & Bogus Tx exclusion Code adjustment for the calculations of stake amount (mint) received and to be distributed between pool participants. WARNING: Now code does not take into account if a non-DB wallet addresses receives a stake reward! ALL STAKE REWARDS of the BOT wallet are counted as a POOL REWARD! Also also part of added code excludes a Bogus (Reorg'ed) Tx's (met at DiminutiveVaultCoin (DIMI)) gets pushed into database as a "stake" by the original code but has no value and non-existent on the chain after Reorg. --- functions/command.js | 50 ++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/functions/command.js b/functions/command.js index 8ccef0d..d0df80b 100755 --- a/functions/command.js +++ b/functions/command.js @@ -287,8 +287,9 @@ module.exports = { } // Calculate how much of the stake balance belongs to the users stake balance // Rest balance belongs to wallet as its not market as stake from the users var down = 0; - var totalStakeForStakers = Big(totalUserStakeBalance).div(walletBalance); - totalStakeForStakers = Big(totalStakeForStakers).times(totalStakeSum).round(8, down); + // All stakes minus bot owner fee will be distributed between stake pool participants. + // Original calculations produce inconsistent ammounts for BlackCoin/NovaCoin forks + totalStakeForStakers = Big(totalStakeSum).minus(totalStakeSumMinusOwnerPercentage).round(8, down); // Debug log if(config.staking.debug){ log.log_write_console(config.messages.log.stakecredit5+' '+totalUserStakeBalance); @@ -859,33 +860,50 @@ module.exports = { log.log_write_console('no stake'); var transaction_amount = 0; var transaction_stake = 0; + // Update transaction on db var updateTransaction = await transaction.transaction_update_stake_transaction(transaction_txid,Big(transaction_amount).toString(),transaction_stake); if(updateTransaction){ countTransactionsToCheck++; } + + // Below changes implemented for BlackCoin/NovaCoin forks to allow stake amount (mint) to be grabbed from "getblock" rpc call by, in first place grabbing a "blockhash" from output of transaction + // in question through "gettransaction" rpc call. + }else{ // If stake var block = getTransaction.blockhash; var blockhash = String(block); log.log_write_console(blockhash); - var getBlock = await wallet.wallet_get_block(blockhash); - var getMint = getBlock.mint; - var mint = String(getMint); - log.log_write_console(getMint); + if(blockhash == String(undefined)){ + log.log_write_console('bogus stake'); + var transaction_amount = 0; + var transaction_stake = 0; + // Update transaction on db + var updateTransaction = await transaction.transaction_update_stake_transaction(transaction_txid,Big(transaction_amount).toString(),transaction_stake); + if(updateTransaction){ + countTransactionsToCheck++; + } + }else{ + var getBlock = await wallet.wallet_get_block(blockhash); - var transaction_amount = Big(getBlock.mint).toString(); + var getMint = getBlock.mint; + var mint = String(getMint); + log.log_write_console(getMint); - var transaction_fee = getTransaction.fee; - var transaction_stake_amount = Big(transaction_amount); - var transaction_stake = 1; - //log.log_write_console('AMOUNT: '+transaction_amount+' - FEE: '+transaction_fee+' STAKE AMOUNT: '+Big(transaction_stake_amount).toString()); - // Update transaction on db - var updateTransaction = await transaction.transaction_update_stake_transaction(transaction_txid,Big(transaction_stake_amount).toString(),transaction_stake); - if(updateTransaction){ - countTransactionsToCheck++; - } + var transaction_amount = Big(getBlock.mint).toString(); + + var transaction_fee = getTransaction.fee; + var transaction_stake_amount = Big(transaction_amount); + var transaction_stake = 1; + //log.log_write_console('AMOUNT: '+transaction_amount+' - FEE: '+transaction_fee+' STAKE AMOUNT: '+Big(transaction_stake_amount).toString()); + // Update transaction on db + var updateTransaction = await transaction.transaction_update_stake_transaction(transaction_txid,Big(transaction_stake_amount).toString(),transaction_stake); + if(updateTransaction){ + countTransactionsToCheck++; + } + } } } if(i == transactionsToCheck.length-1 && manuallyFired == 1) From 46beca47f1be9f27ce6751ea7eee962e78bd4306 Mon Sep 17 00:00:00 2001 From: MadCatMining Date: Thu, 21 Jan 2021 08:25:38 +0100 Subject: [PATCH 11/12] Typo in a comment --- functions/command.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/command.js b/functions/command.js index d0df80b..e83cc73 100755 --- a/functions/command.js +++ b/functions/command.js @@ -288,7 +288,7 @@ module.exports = { // Calculate how much of the stake balance belongs to the users stake balance // Rest balance belongs to wallet as its not market as stake from the users var down = 0; // All stakes minus bot owner fee will be distributed between stake pool participants. - // Original calculations produce inconsistent ammounts for BlackCoin/NovaCoin forks + // Original calculations produce inconsistent amounts for BlackCoin/NovaCoin forks totalStakeForStakers = Big(totalStakeSum).minus(totalStakeSumMinusOwnerPercentage).round(8, down); // Debug log if(config.staking.debug){ From 35a00b6831715ecee108ad8e95437088314ffcf2 Mon Sep 17 00:00:00 2001 From: MadCatMining Date: Thu, 21 Jan 2021 08:33:23 +0100 Subject: [PATCH 12/12] Update READ.ME Added info about this branch --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 939ba29..f66f865 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Cryptocurrency-crypto-bot is an open-source Node.js wallet bot for Discord. +## This version has adjustments to work with BlackCoin / NovaCoin forks. +#### Currently in use with DiminutiveVaultCoin (DIMI) and InfiniLooP (IL8P) + ### Preview pictures