diff --git a/cronjobs/auto_payout.php b/cronjobs/auto_payout.php index ca33dc3f..366298e1 100755 --- a/cronjobs/auto_payout.php +++ b/cronjobs/auto_payout.php @@ -43,7 +43,7 @@ if (! empty($users)) { verbose($aUserData['id'] . "\t" . $aUserData['username'] . "\t" . $dBalance . "\t" . $aUserData['ap_threshold'] . "\t\t" . $aUserData['coin_address'] . "\t"); // Only run if balance meets threshold and can pay the potential transaction fee - if ($dBalance > $aUserData['ap_threshold'] && $dBalance > 0.1) { + if ($dBalance > $aUserData['ap_threshold'] && $dBalance > $config['txfee']) { // Validate address against RPC try { $bitcoin->validateaddress($aUserData['coin_address']); @@ -52,7 +52,7 @@ if (! empty($users)) { continue; } - // Send balance, fees are reduced later + // Send balance, fees are reduced later by RPC Server try { $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance); } catch (BitcoinClientException $e) { @@ -61,7 +61,7 @@ if (! empty($users)) { } // Create transaction record - if ($transaction->addTransaction($aUserData['id'], $dBalance, 'Debit_AP', NULL, $aUserData['coin_address'], 0.1)) { + if ($transaction->addTransaction($aUserData['id'], $dBalance, 'Debit_AP', NULL, $aUserData['coin_address'])) { // Notify user via mail $aMailData['email'] = $user->getUserEmail($user->getUserName($aUserData['id'])); $aMailData['subject'] = 'Auto Payout Completed'; @@ -76,7 +76,7 @@ if (! empty($users)) { } } else { - verbose("SKIPPED\n"); + verbose("INSUFF_TXFEE\n"); } } } else { diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index df743132..e8d12774 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -34,6 +34,8 @@ $config = array( 'slogan' => 'Resistance is futile', 'email' => 'test@example.com', // Mail address used for notifications ), + 'currency' => 'LTC', // Currency name to be used on website + 'txfee' => 0.1, // Default tx fee added by RPC server 'block_bonus' => 0, 'payout_system' => 'prop', // Set your payout here so template changes are activated 'archive_shares' => true, // Store accounted shares in archive table? diff --git a/public/include/pages/account/edit.inc.php b/public/include/pages/account/edit.inc.php index 345816a7..6726b7d9 100644 --- a/public/include/pages/account/edit.inc.php +++ b/public/include/pages/account/edit.inc.php @@ -21,8 +21,8 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST $aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']); $dBalance = $aBalance['confirmed']; $sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']); - // Ensure we can cover the potential transaction fee of 0.1 LTC with the balance - if ($dBalance > 0.1) { + // Ensure we can cover the potential transaction fee + if ($dBalance > $config['txfee']) { if ($bitcoin->can_connect() === true) { try { $bitcoin->validateaddress($sCoinAddress); @@ -31,7 +31,7 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST $continue = false; } if ($continue == true) { - // Send balance to address, mind 0.1 fee for transaction! + // Send balance to address, mind fee for transaction! try { if ($setting->getValue('auto_payout_active') == 0) { $bitcoin->sendtoaddress($sCoinAddress, $dBalance); @@ -40,7 +40,7 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST $continue = false; } } catch (BitcoinClientException $e) { - $_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send LTC, please contact site support immidiately', 'TYPE' => 'errormsg'); + $_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send ' . $config['currency'] . ', please contact site support immidiately', 'TYPE' => 'errormsg'); $continue = false; } } @@ -56,7 +56,7 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service', 'TYPE' => 'errormsg'); } } else { - $_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than 0.1 LTC to cover transaction fees', 'TYPE' => 'errormsg'); + $_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than ' . $config['txfee'] . ' ' . $conifg['currency'] . ' to cover transaction fees', 'TYPE' => 'errormsg'); } $setting->setValue('manual_payout_active', 0); } diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index 209f6a71..8ec1e882 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -18,6 +18,7 @@ if ($bitcoin->can_connect() === true){ $dDifficulty = 1; } +// Global data for Smarty $aGlobal = array( 'slogan' => $config['website']['slogan'], 'websitename' => $config['website']['name'], @@ -33,6 +34,8 @@ $aGlobal = array( 'blockexplorer' => $config['blockexplorer'], 'chaininfo' => $config['chaininfo'], 'config' => array( + 'currency' => $config['currency'], + 'txfee' => $config['txfee'], 'payout_system' => $config['payout_system'], 'ap_threshold' => array( 'min' => $config['ap_threshold']['min'], diff --git a/public/templates/mmcFE/account/edit/default.tpl b/public/templates/mmcFE/account/edit/default.tpl index 86f4f02d..f48ef67f 100644 --- a/public/templates/mmcFE/account/edit/default.tpl +++ b/public/templates/mmcFE/account/edit/default.tpl @@ -10,20 +10,20 @@