Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cronjobs/auto_payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions cronjobs/manual_payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand All @@ -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');
Expand Down
8 changes: 6 additions & 2 deletions public/include/config/global.inc.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
4 changes: 2 additions & 2 deletions public/include/pages/account/edit.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion public/include/smarty_globals.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion public/templates/mpos/account/edit/default.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</header>
<div class="module_content">
<p style="padding-left:30px; padding-redight:30px; font-size:10px;">
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
</p>
<fieldset>
<label>Account Balance</label>
Expand Down