link new coin fields, auto filled

This commit is contained in:
Tanguy Pruvot 2016-05-11 21:28:08 +02:00
parent a7bae2ddc7
commit 4eaab8c05d
10 changed files with 25 additions and 25 deletions

View file

@ -156,14 +156,6 @@ void coind_init(YAAMP_COIND *coind)
//sprintf(account, "default");
}
// todo: db field
if(!strcmp(coind->symbol, "XVG") || !strcmp(coind->symbol2, "XVG")) {
coind->multialgos = true;
}
if(!strcmp(coind->symbol, "DGB") || !strcmp(coind->symbol2, "DGB")) {
coind->multialgos = true;
}
bool valid = coind_validate_address(coind);
if(valid) return;

View file

@ -142,7 +142,7 @@ void db_update_coinds(YAAMP_DB *db)
db_query(db, "SELECT id, name, rpchost, rpcport, rpcuser, rpcpasswd, rpcencoding, master_wallet, reward, price, "
"hassubmitblock, txmessage, enable, auto_ready, algo, pool_ttf, charity_address, charity_amount, charity_percent, "
"reward_mul, symbol, auxpow, actual_ttf, network_ttf, usememorypool, hasmasternodes, algo, symbol2, "
"rpccurl, rpcssl, rpccert, account "
"rpccurl, rpcssl, rpccert, account, multialgos "
"FROM coins WHERE enable AND auto_ready AND algo='%s' ORDER BY index_avg", g_stratum_algo);
MYSQL_RES *result = mysql_store_result(&db->mysql);
@ -239,6 +239,7 @@ void db_update_coinds(YAAMP_DB *db)
if(row[30]) strcpy(coind->rpc.cert, row[30]);
if(row[31]) strcpy(coind->account, row[31]);
if(row[32]) coind->multialgos = atoi(row[32]);
// force the right rpcencoding for DCR
if(!strcmp(coind->symbol, "DCR") && strcmp(coind->rpcencoding, "DCR"))

View file

@ -23,7 +23,6 @@ define('YAAMP_PAYMENTS_MINI', 0.001);
define('YAAMP_ALLOW_EXCHANGE', false);
define('YIIMP_PUBLIC_EXPLORER', true);
define('YIIMP_WATCH_CURRENCIES', 'BTC,DCR,XVC'); // track history
define('YIIMP_FIAT_ALTERNATIVE', 'EUR'); // USD is main
define('YAAMP_USE_NICEHASH_API', false);

View file

@ -72,7 +72,9 @@ function BackendCoinsUpdate()
$coin->errors = isset($info['errors'])? $info['errors']: '';
$coin->txfee = isset($info['paytxfee'])? $info['paytxfee']: '';
$coin->connections = isset($info['connections'])? $info['connections']: '';
$coin->multialgos = (int) isset($info['pow_algo_id']);
$coin->balance = isset($info['balance'])? $info['balance']: 0;
$coin->stake = isset($info['stake'])? $info['stake']: 0;
$coin->mint = dboscalar("select sum(amount) from blocks where coin_id=$coin->id and category='immature'");
if(empty($coin->master_wallet))

View file

@ -84,10 +84,16 @@ function BackendPricesUpdate()
function BackendWatchMarkets($marketname=NULL)
{
$watched = explode(',', YIIMP_WATCH_CURRENCIES);
// temporary to fill new coin 'watch' field
if (defined('YIIMP_WATCH_CURRENCIES')) {
$watched = explode(',', YIIMP_WATCH_CURRENCIES);
foreach ($watched as $symbol) {
dborun("UPDATE coins SET watch=1 WHERE symbol=:sym", array(':sym'=>$symbol));
}
}
$coins = new db_coins;
$coins = $coins->findAllByAttributes(array('symbol'=>$watched));
$coins = $coins->findAllByAttributes(array('watched'=>1));
foreach ($coins as $coin)
{
// track btc/usd for history analysis
@ -288,7 +294,7 @@ function updateKrakenMarkets($force = false)
$coin = getdbosql('db_coins', "symbol='{$symbol}'");
if(!$coin) continue;
if(!$coin->installed && !yaamp_watched_coin($coin->symbol)) continue;
if(!$coin->installed && !$coin->watch) continue;
$fees = reset($data['fees']);
$feepct = is_array($fees) ? end($fees) : null;
@ -586,7 +592,7 @@ function updateCCexMarkets()
$coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol'=>$symbol));
if (!$coin) continue;
if (!$coin->installed && !yaamp_watched_coin($coin->symbol)) continue;
if (!$coin->installed && !$coin->watch) continue;
$market = getdbosql('db_markets', "coinid={$coin->id} AND name LIKE '$exchange%' $sqlFilter");
if (!$market) continue;
@ -763,7 +769,7 @@ function updateYobitMarkets()
$market->save();
if ($market->deleted || $market->disabled) continue;
if (!$coin->installed && !yaamp_watched_coin($coin->symbol)) continue;
if (!$coin->installed && !$coin->watch) continue;
$pair = strtolower($coin->symbol).'_btc';
@ -854,7 +860,7 @@ function updateAlcurexMarkets()
{
$coin = getdbo('db_coins', $market->coinid);
if(!$coin) continue;
if (!$coin->installed && !yaamp_watched_coin($coin->symbol)) continue;
if (!$coin->installed && !$coin->watch) continue;
if (market_get($exchange, $coin->symbol, "disabled")) {
$market->disabled = 1;

View file

@ -248,11 +248,6 @@ function yaamp_hashrate_step()
return 300;
}
function yaamp_watched_coin($symbol)
{
return (strpos(",".YIIMP_WATCH_CURRENCIES.",", ",$symbol,") !== false);
}
function yaamp_profitability($coin)
{
if(!$coin->difficulty) return 0;

View file

@ -12,7 +12,6 @@ if (!defined('YAAMP_DBUSER')) define('YAAMP_DBUSER', 'root');
if (!defined('YAAMP_DBPASSWORD')) define('YAAMP_DBPASSWORD', '');
if (!defined('YIIMP_PUBLIC_EXPLORER')) define('YIIMP_PUBLIC_EXPLORER', true);
if (!defined('YIIMP_WATCH_CURRENCIES')) define('YIIMP_WATCH_CURRENCIES', 'BTC');
if (!defined('YIIMP_FIAT_ALTERNATIVE')) define('YIIMP_FIAT_ALTERNATIVE', 'EUR');
if (!defined('YAAMP_FEES_MINING')) define('YAAMP_FEES_MINING', 0.5);

View file

@ -81,8 +81,8 @@ foreach($coins as $coin)
if($coin->rpcssl) echo '<span title="RPC over SSL"> s</span>';
else echo ' &nbsp;';
if(yaamp_watched_coin($coin->symbol))
echo '<span title="Monitored (history)"> m</span>';
if($coin->watch)
echo '<span title="Watched (history)"> w</span>';
if($coin->block_height < $coin->target_height) {
$percent = round($coin->block_height*100/$coin->target_height, 2);

View file

@ -150,7 +150,7 @@ END;
JavascriptReady("main_refresh();");
if (yaamp_watched_coin($coin->symbol)) {
if ($coin->watch) {
$this->renderPartial('coin_market_graph', array('coin'=>$coin));
JavascriptReady("$(window).resize(graph_resized);");
}

View file

@ -129,6 +129,12 @@ echo CUFHtml::activeCheckBox($coin, 'installed');
echo '<p class="formHint2">Required to be visible in the Wallets board</p>';
echo CUFHtml::closeCtrlHolder();
echo CUFHtml::openActiveCtrlHolder($coin, 'watch');
echo CUFHtml::activeLabelEx($coin, 'watch');
echo CUFHtml::activeCheckBox($coin, 'watch');
echo '<p class="formHint2">Track balance and markets history</p>';
echo CUFHtml::closeCtrlHolder();
echo CUFHtml::openActiveCtrlHolder($coin, 'auxpow');
echo CUFHtml::activeLabelEx($coin, 'auxpow');
echo CUFHtml::activeCheckBox($coin, 'auxpow');