public function actionIndex() { if (isset($_COOKIE['mainbtc'])) { return; } if (!LimitRequest('explorer')) { return; } $id = getiparam('id'); $coin = getdbo('db_coins', $id); $height = getparam('height'); if ($coin && intval($height) > 0) { $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); $hash = $remote->getblockhash(intval($height)); } else { $hash = getparam('hash'); } $txid = getparam('txid'); if ($coin && !empty($txid) && ctype_alnum($txid)) { $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); $tx = $remote->getrawtransaction($txid, 1); $hash = $tx['blockhash']; } if ($coin && !empty($hash) && ctype_alnum($hash)) { $this->render('block', array('coin' => $coin, 'hash' => substr($hash, 0, 64))); } else { if ($coin) { $this->render('coin', array('coin' => $coin)); } else { $this->render('index'); } } }
public function actionStop() { if (!$this->admin) { return; } $id = getiparam('id'); $nicehash = getdbo('db_nicehash', $id); if (!$nicehash) { return; } $nicehash->active = false; $nicehash->save(); $this->goback(); }
public function actionUpdate() { if (!$this->admin) { return; } $coin = getdbo('db_coins', getiparam('id')); if (isset($_POST['db_coins'])) { $coin->attributes = $_POST['db_coins']; if ($coin->save()) { $this->redirect(array('index')); } } $this->render('_form', array('coin' => $coin, 'update' => true)); }
public function actionSellto() { if (!$this->admin) { return; } $market = getdbo('db_markets', getiparam('id')); $coin = getdbo('db_coins', $market->coinid); $amount = getparam('amount'); $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); $info = $remote->getinfo(); if (!$info || !$info['balance']) { return false; } $deposit_info = $remote->validateaddress($market->deposit_address); if (!$deposit_info || !isset($deposit_info['isvalid']) || !$deposit_info['isvalid']) { user()->setFlash('error', "invalid address {$coin->name}, {$market->deposit_address}"); $this->redirect(array('site/coin', 'id' => $coin->id)); } $amount = min($amount, $info['balance'] - $info['paytxfee']); // $amount = max($amount, $info['balance'] - $info['paytxfee']); $amount = round($amount, 8); debuglog("selling ({$market->deposit_address}, {$amount})"); $tx = $remote->sendtoaddress($market->deposit_address, $amount); if (!$tx) { user()->setFlash('error', $remote->error); $this->redirect(array('site/coin', 'id' => $coin->id)); } $exchange = new db_exchange(); $exchange->market = $market->name; $exchange->coinid = $coin->id; $exchange->send_time = time(); $exchange->quantity = $amount; $exchange->price_estimate = $coin->price; $exchange->status = 'waiting'; $exchange->tx = $tx; $exchange->save(); $this->redirect(array('site/coin', 'id' => $coin->id)); }
public function actionOrderDialog() { $renter = getrenterparam(getparam('address')); if (!$renter) { return; } $a = 'x11'; $server = ''; $username = ''; $password = '******'; $percent = ''; $price = ''; $speed = ''; $id = 0; $job = getdbo('db_jobs', getiparam('id')); if ($job) { $id = $job->id; $a = $job->algo; $server = "{$job->host}:{$job->port}"; $username = $job->username; $password = $job->password; $percent = $job->percent; $price = mbitcoinvaluetoa($job->price); $speed = $job->speed / 1000000; } echo <<<end <form id='order-edit-form' action='/renting/ordersave' method='post'> <input type="hidden" value='{$id}' name="order_id"> <input type="hidden" value='{$renter->id}' name="order_renterid"> <input type="hidden" value='{$renter->address}' name="order_address"> \t\t <p>Enter your job information below and click Submit when you are ready.</p> \t\t <table cellspacing=10 width=100%> <tr><td>Algo:</td><td><select class="main-text-input" name="order_algo"> end; foreach (yaamp_get_algos() as $algo) { if (!controller()->admin && $algo == 'sha256') { continue; } if (!controller()->admin && $algo == 'scryptn') { continue; } $selected = $algo == $a ? 'selected' : ''; echo "<option {$selected} value='{$algo}'>{$algo}</option>"; } echo <<<end </select></td></tr> <tr><td>Server:</td><td><input type="text" value='{$server}' name="order_host" class="main-text-input" placeholder="stratum.server.com:3333"></td></tr> <tr><td>Username:</td><td><input type="text" value='{$username}' name="order_username" class="main-text-input" placeholder="wallet_address"></td></tr> <tr><td>Password:</td><td><input type="text" value='{$password}' name="order_password" class="main-text-input"></td></tr> <tr><td>Max Price<br><span style='font-size: .8em;'>(mBTC/mh/day)</span>:</td><td><input type="text" value='{$price}' name="order_price" class="main-text-input" placeholder=""></td></tr> <tr><td width=110>Max Hashrate<br><span style='font-size: .8em;'>(Mh/s)</span>:</td><td><input type="text" value='{$speed}' name="order_speed" class="main-text-input" placeholder=""></td></tr> end; if (controller()->admin) { echo "<tr><td>Percent:</td><td><input type=text value='{$percent}' name=order_percent class=main-text-input></td></tr>"; } echo "</table></form>"; }
public function actionRunExchange() { $id = getiparam('id'); $balance = getdbo('db_balances', $id); if ($balance) { switch ($balance->name) { case 'cryptsy': doCryptsyTrading(true); updateCryptsyMarkets(); break; case 'bittrex': doBittrexTrading(true); updateBittrexMarkets(); break; case 'c-cex': doCCexTrading(true); updateCCexMarkets(); break; case 'yobit': doYobitTrading(true); updateYobitMarkets(); break; case 'bleutrade': doBleutradeTrading(true); updateBleutradeMarkets(); break; case 'poloniex': doPoloniexTrading(true); updatePoloniexMarkets(); break; } } debuglog("runexchange done"); $this->redirect("/site/common"); }
<?php $id = getiparam('id'); if ($id) { $db_blocks = getdbolist('db_blocks', "coin_id=:id order by time desc limit 250", array(':id' => $id)); } else { $db_blocks = getdbolist('db_blocks', "1 order by time desc limit 250"); } echo "<table class='dataGrid'>"; //showTableSorter('maintable'); echo "<thead>"; echo "<tr>"; echo "<th width=20></th>"; echo "<th>Name</th>"; echo "<th>Time</th>"; echo "<th>Height</th>"; echo "<th>Amount</th>"; echo "<th>Status</th>"; echo "<th>Difficulty</th>"; echo "<th>Found Diff</th>"; echo "<th>Blockhash</th>"; echo "</tr>"; echo "</thead><tbody>"; foreach ($db_blocks as $db_block) { if (!$db_block->coin_id) { continue; } $coin = getdbo('db_coins', $db_block->coin_id); if (!$coin) { continue; }