diff --git a/cronjobs/payouts.php b/cronjobs/payouts.php index 58960e725..6d8b1403e 100755 --- a/cronjobs/payouts.php +++ b/cronjobs/payouts.php @@ -46,7 +46,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.'); @@ -65,13 +65,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'); @@ -111,7 +111,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']); @@ -126,14 +126,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'); diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 780ec62dd..6a573a86e 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -187,11 +187,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! diff --git a/public/include/pages/account/edit.inc.php b/public/include/pages/account/edit.inc.php index 3b5753034..c50ebee1a 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; diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index e6b601bbe..f0778cdc0 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'], diff --git a/public/templates/mpos/account/edit/default.tpl b/public/templates/mpos/account/edit/default.tpl index 920a36f15..267852bc5 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