Merge pull request #1412 from nicoschtein/patch-13
Issue 875 - Manual and Auto TXFee (REBASED again..)
This commit is contained in:
commit
7d8d5d3c04
@ -47,7 +47,7 @@ if ($setting->getValue('disable_manual_payouts') != 1) {
|
|||||||
$dBalance = $aBalance['confirmed'];
|
$dBalance = $aBalance['confirmed'];
|
||||||
$aData['coin_address'] = $user->getCoinAddress($aData['account_id']);
|
$aData['coin_address'] = $user->getCoinAddress($aData['account_id']);
|
||||||
$aData['username'] = $user->getUserName($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
|
// To ensure we don't run this transaction again, lets mark it completed
|
||||||
if (!$oPayout->setProcessed($aData['id'])) {
|
if (!$oPayout->setProcessed($aData['id'])) {
|
||||||
$log->logFatal('unable to mark transactions ' . $aData['id'] . ' as processed.');
|
$log->logFatal('unable to mark transactions ' . $aData['id'] . ' as processed.');
|
||||||
@ -66,13 +66,13 @@ if ($setting->getValue('disable_manual_payouts') != 1) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$txid = $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee']);
|
$txid = $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee_manual']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$log->logError('Failed to send requested balance to coin address, please check payout process. Does the wallet cover the amount?');
|
$log->logError('Failed to send requested balance to coin address, please check payout process. Does the wallet cover the amount?');
|
||||||
continue;
|
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
|
// Mark all older transactions as archived
|
||||||
if (!$transaction->setArchived($aData['account_id'], $transaction->insert_id))
|
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');
|
$log->logError('Failed to mark transactions for #' . $aData['account_id'] . ' prior to #' . $transaction->insert_id . ' as archived');
|
||||||
@ -115,7 +115,7 @@ if ($setting->getValue('disable_auto_payouts') != 1) {
|
|||||||
$log->logInfo("\t" . $aUserData['id'] . "\t" . $aUserData['username'] . "\t" . $dBalance . "\t" . $aUserData['ap_threshold'] . "\t\t" . $aUserData['coin_address']);
|
$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
|
// 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
|
// Validate address against RPC
|
||||||
try {
|
try {
|
||||||
$aStatus = $bitcoin->validateaddress($aUserData['coin_address']);
|
$aStatus = $bitcoin->validateaddress($aUserData['coin_address']);
|
||||||
@ -130,14 +130,14 @@ if ($setting->getValue('disable_auto_payouts') != 1) {
|
|||||||
|
|
||||||
// Send balance, fees are reduced later by RPC Server
|
// Send balance, fees are reduced later by RPC Server
|
||||||
try {
|
try {
|
||||||
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee']);
|
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee_auto']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$log->logError('Failed to send requested balance to coin address, please check payout process. Does the wallet cover the amount?');
|
$log->logError('Failed to send requested balance to coin address, please check payout process. Does the wallet cover the amount?');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create transaction record
|
// 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
|
// Mark all older transactions as archived
|
||||||
if (!$transaction->setArchived($aUserData['id'], $transaction->insert_id))
|
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');
|
$log->logError('Failed to mark transactions for user #' . $aUserData['id'] . ' prior to #' . $transaction->insert_id . ' as archived');
|
||||||
|
|||||||
@ -7,7 +7,7 @@ if (!defined('SECURITY')) die('Hacking attempt');
|
|||||||
* This is used in the version check to ensure you run the latest version of the configuration file.
|
* This is used in the version check to ensure you run the latest version of the configuration file.
|
||||||
* Once you upgraded your config, change the version here too.
|
* Once you upgraded your config, change the version here too.
|
||||||
**/
|
**/
|
||||||
$config['version'] = '0.0.2';
|
$config['version'] = '0.0.3';
|
||||||
|
|
||||||
// Our include directory for additional features
|
// Our include directory for additional features
|
||||||
define('INCLUDE_DIR', BASEPATH . 'include');
|
define('INCLUDE_DIR', BASEPATH . 'include');
|
||||||
@ -231,11 +231,15 @@ $config['coindiffchangetarget'] = 2016;
|
|||||||
* a default value here which is applied to both manual and auto payouts.
|
* 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
|
* If this is not set, no fee is applied in the transactions history but
|
||||||
* the user might still see them when the coins arrive.
|
* the user might still see them when the coins arrive.
|
||||||
|
* You can set two different transaction fees for manual and auto payouts.
|
||||||
*
|
*
|
||||||
* Default:
|
* 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)
|
// 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!
|
// This bonus is paid by the pool operator, it is not deducted from the block payout!
|
||||||
|
|||||||
@ -23,7 +23,7 @@ if ($user->isAuthenticated()) {
|
|||||||
} else {
|
} else {
|
||||||
$aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
$aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
||||||
$dBalance = $aBalance['confirmed'];
|
$dBalance = $aBalance['confirmed'];
|
||||||
if ($dBalance > $config['txfee']) {
|
if ($dBalance > $config['txfee_manual']) {
|
||||||
if (!$oPayout->isPayoutActive($_SESSION['USERDATA']['id'])) {
|
if (!$oPayout->isPayoutActive($_SESSION['USERDATA']['id'])) {
|
||||||
if ($iPayoutId = $oPayout->createPayout($_SESSION['USERDATA']['id'])) {
|
if ($iPayoutId = $oPayout->createPayout($_SESSION['USERDATA']['id'])) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Created new manual payout request with ID #' . $iPayoutId);
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Created new manual payout request with ID #' . $iPayoutId);
|
||||||
@ -34,7 +34,7 @@ if ($user->isAuthenticated()) {
|
|||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'You already have one active manual payout request.', 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'You already have one active manual payout request.', 'TYPE' => 'errormsg');
|
||||||
}
|
}
|
||||||
} else {
|
} 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;
|
break;
|
||||||
|
|||||||
@ -83,7 +83,8 @@ $aGlobal = array(
|
|||||||
'price' => array( 'currency' => $config['price']['currency'] ),
|
'price' => array( 'currency' => $config['price']['currency'] ),
|
||||||
'targetdiff' => $config['difficulty'],
|
'targetdiff' => $config['difficulty'],
|
||||||
'currency' => $config['currency'],
|
'currency' => $config['currency'],
|
||||||
'txfee' => $config['txfee'],
|
'txfee_manual' => $config['txfee_manual'],
|
||||||
|
'txfee_auto' => $config['txfee_auto'],
|
||||||
'payout_system' => $config['payout_system'],
|
'payout_system' => $config['payout_system'],
|
||||||
'ap_threshold' => array(
|
'ap_threshold' => array(
|
||||||
'min' => $config['ap_threshold']['min'],
|
'min' => $config['ap_threshold']['min'],
|
||||||
|
|||||||
@ -71,7 +71,7 @@
|
|||||||
</header>
|
</header>
|
||||||
<div class="module_content">
|
<div class="module_content">
|
||||||
<p style="padding-left:30px; padding-redight:30px; font-size:10px;">
|
<p style="padding-left:30px; padding-redight:30px; font-size:10px;">
|
||||||
Please note: a {if $GLOBAL.config.txfee > 0.00001}{$GLOBAL.config.txfee}{else}{$GLOBAL.config.txfee|number_format:"8"}{/if} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments
|
Please note: a {if $GLOBAL.config.txfee_manual > 0.00001}{$GLOBAL.config.txfee_manual}{else}{$GLOBAL.config.txfee_manual|number_format:"8"}{/if} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments
|
||||||
</p>
|
</p>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>Account Balance</label>
|
<label>Account Balance</label>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user