From 698edb0152a57b5a0ca303b96685c8ac265b50d4 Mon Sep 17 00:00:00 2001 From: nicoschtein Date: Sun, 8 Dec 2013 23:50:01 -0200 Subject: [PATCH 1/6] Added txfee_manual and txfee_auto to config file Added txfee_manual and txfee_auto to config file so you can set two different transaction fees for manual and auto payouts --- public/include/config/global.inc.dist.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 28a7bf96e..6d371ca6d 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -168,11 +168,15 @@ * a default value here which is applied to both manual and auto payouts. * If this is not set, no fee is applied in the transactions history but * the user might still see them when the coins arrive. + * You can set two different transaction fees for manual and auto payouts. * * Default: - * txfee = 0.1 + * txfee_auto = 0.1 + * txfee_manual = 0.1 + **/ -$config['txfee'] = 0.1; +$config['txfee_auto'] = 0.1; +$config['txfee_manual'] = 0.1; // Payout a block bonus to block finders, default: 0 (disabled) // This bonus is paid by the pool operator, it is not deducted from the block payout! From 5725e4d24877c48eec95569e64d5237991056778 Mon Sep 17 00:00:00 2001 From: nicoschtein Date: Sun, 8 Dec 2013 23:52:05 -0200 Subject: [PATCH 2/6] Changed txfee to txfee_manual --- cronjobs/manual_payout.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cronjobs/manual_payout.php b/cronjobs/manual_payout.php index b0c909ea7..22033b651 100755 --- a/cronjobs/manual_payout.php +++ b/cronjobs/manual_payout.php @@ -45,7 +45,7 @@ $dBalance = $aBalance['confirmed']; $aData['coin_address'] = $user->getCoinAddress($aData['account_id']); $aData['username'] = $user->getUserName($aData['account_id']); - if ($dBalance > $config['txfee']) { + if ($dBalance > $config['txfee_manual']) { // To ensure we don't run this transaction again, lets mark it completed if (!$oPayout->setProcessed($aData['id'])) { $log->logFatal('unable to mark transactions ' . $aData['id'] . ' as processed.'); @@ -64,13 +64,13 @@ continue; } try { - $txid = $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee']); + $txid = $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee_manual']); } catch (BitcoinClientException $e) { $log->logError('Failed to send requested balance to coin address, please check payout process'); continue; } - if ($transaction->addTransaction($aData['account_id'], $dBalance - $config['txfee'], 'Debit_MP', NULL, $aData['coin_address'], $txid) && $transaction->addTransaction($aData['account_id'], $config['txfee'], 'TXFee', NULL, $aData['coin_address'])) { + if ($transaction->addTransaction($aData['account_id'], $dBalance - $config['txfee_manual'], 'Debit_MP', NULL, $aData['coin_address'], $txid) && $transaction->addTransaction($aData['account_id'], $config['txfee_manual'], 'TXFee', NULL, $aData['coin_address'])) { // Mark all older transactions as archived if (!$transaction->setArchived($aData['account_id'], $transaction->insert_id)) $log->logError('Failed to mark transactions for #' . $aData['account_id'] . ' prior to #' . $transaction->insert_id . ' as archived'); From 88cff15564f54bce4a06ced712d7bfbc217409b3 Mon Sep 17 00:00:00 2001 From: nicoschtein Date: Sun, 8 Dec 2013 23:55:29 -0200 Subject: [PATCH 3/6] Changed txfee to txfee_auto --- cronjobs/auto_payout.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cronjobs/auto_payout.php b/cronjobs/auto_payout.php index 239afdc17..6dc0b4637 100755 --- a/cronjobs/auto_payout.php +++ b/cronjobs/auto_payout.php @@ -51,7 +51,7 @@ $log->logInfo("\t" . $aUserData['id'] . "\t" . $aUserData['username'] . "\t" . $dBalance . "\t" . $aUserData['ap_threshold'] . "\t\t" . $aUserData['coin_address']); // Only run if balance meets threshold and can pay the potential transaction fee - if ($dBalance > $aUserData['ap_threshold'] && $dBalance > $config['txfee']) { + if ($dBalance > $aUserData['ap_threshold'] && $dBalance > $config['txfee_auto']) { // Validate address against RPC try { $aStatus = $bitcoin->validateaddress($aUserData['coin_address']); @@ -66,14 +66,14 @@ // Send balance, fees are reduced later by RPC Server try { - $txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee']); + $txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee_auto']); } catch (BitcoinClientException $e) { $log->logError('Failed to send requested balance to coin address, please check payout process'); continue; } // Create transaction record - if ($transaction->addTransaction($aUserData['id'], $dBalance - $config['txfee'], 'Debit_AP', NULL, $aUserData['coin_address'], $txid) && $transaction->addTransaction($aUserData['id'], $config['txfee'], 'TXFee', NULL, $aUserData['coin_address'])) { + if ($transaction->addTransaction($aUserData['id'], $dBalance - $config['txfee_auto'], 'Debit_AP', NULL, $aUserData['coin_address'], $txid) && $transaction->addTransaction($aUserData['id'], $config['txfee_auto'], 'TXFee', NULL, $aUserData['coin_address'])) { // Mark all older transactions as archived if (!$transaction->setArchived($aUserData['id'], $transaction->insert_id)) $log->logError('Failed to mark transactions for user #' . $aUserData['id'] . ' prior to #' . $transaction->insert_id . ' as archived'); From e566013ed432c1031888594201ebabc406677bd0 Mon Sep 17 00:00:00 2001 From: nicoschtein Date: Sun, 8 Dec 2013 23:56:11 -0200 Subject: [PATCH 4/6] Changed txfee to txfee_manual --- public/templates/mpos/account/edit/default.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mpos/account/edit/default.tpl b/public/templates/mpos/account/edit/default.tpl index 3704cf67f..8883386eb 100644 --- a/public/templates/mpos/account/edit/default.tpl +++ b/public/templates/mpos/account/edit/default.tpl @@ -71,7 +71,7 @@

- Please note: a {$GLOBAL.config.txfee} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments + Please note: a {$GLOBAL.config.txfee_manual} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments

From 99a93ae11e007b3b0b0187d69647596e26e68dc1 Mon Sep 17 00:00:00 2001 From: nicoschtein Date: Sun, 8 Dec 2013 23:59:26 -0200 Subject: [PATCH 5/6] Added txfee_manual and txfee_auto to config array --- public/include/smarty_globals.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index a9424836f..5fb8dcfdf 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -75,7 +75,8 @@ 'price' => array( 'currency' => $config['price']['currency'] ), 'targetdiff' => $config['difficulty'], 'currency' => $config['currency'], - 'txfee' => $config['txfee'], + 'txfee_manual' => $config['txfee_manual'], + 'txfee_auto' => $config['txfee_auto'], 'payout_system' => $config['payout_system'], 'ap_threshold' => array( 'min' => $config['ap_threshold']['min'], From 9dc2b8451bade29945f65dfae3d21eac283f349e Mon Sep 17 00:00:00 2001 From: nicoschtein Date: Mon, 9 Dec 2013 00:00:37 -0200 Subject: [PATCH 6/6] Changed txfee to txfee_manual --- public/include/pages/account/edit.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/include/pages/account/edit.inc.php b/public/include/pages/account/edit.inc.php index 006f98624..c631f968d 100644 --- a/public/include/pages/account/edit.inc.php +++ b/public/include/pages/account/edit.inc.php @@ -15,7 +15,7 @@ } else { $aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']); $dBalance = $aBalance['confirmed']; - if ($dBalance > $config['txfee']) { + if ($dBalance > $config['txfee_manual']) { if (!$oPayout->isPayoutActive($_SESSION['USERDATA']['id'])) { if ($iPayoutId = $oPayout->createPayout($_SESSION['USERDATA']['id'])) { $_SESSION['POPUP'][] = array('CONTENT' => 'Created new manual payout request with ID #' . $iPayoutId); @@ -26,7 +26,7 @@ $_SESSION['POPUP'][] = array('CONTENT' => 'You already have one active manual payout request.', 'TYPE' => 'errormsg'); } } else { - $_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than ' . $config['txfee'] . ' ' . $config['currency'] . ' to cover transaction fees', 'TYPE' => 'errormsg'); + $_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than ' . $config['txfee_manual'] . ' ' . $config['currency'] . ' to cover transaction fees', 'TYPE' => 'errormsg'); } } break;