mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-20 18:09:54 +00:00
Fix some LiveCoin error checking (#100)
* Fix some LiveCoin error checking * Correct LiveCoin withdrawl fee * Fix typo in LiveCoin trading call * Log returned data not address (tofix)
This commit is contained in:
parent
a30feff2d2
commit
05950ffd93
3 changed files with 14 additions and 13 deletions
|
@ -1068,16 +1068,14 @@ function updateLiveCoinMarkets()
|
|||
$data = $livecoin->getDepositAddress($coin->symbol);
|
||||
if(!empty($data) && objSafeVal($data, 'wallet', '') != '') {
|
||||
$addr = arraySafeVal($data, 'wallet');
|
||||
if (!empty($addr) && $addr != $market->deposit_address) {
|
||||
if (strpos($addr, 'Error') !== false)
|
||||
$market->message = $addr;
|
||||
else {
|
||||
if (!empty($addr)) {
|
||||
$market->deposit_address = $addr;
|
||||
// delimiter "::" for memo / payment id
|
||||
$market->message = null;
|
||||
debuglog("$exchange: deposit address for {$coin->symbol} updated");
|
||||
}
|
||||
$market->save();
|
||||
} else {
|
||||
debuglog("$exchange: Failed to update deposit address, ".json_decode($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ function doLiveCoinTrading($quick = false)
|
|||
sleep(1);
|
||||
|
||||
$res = $livecoin->sellLimit($pair, $sellprice, $amount);
|
||||
if (!$res->success == 'true' && $res->added == 'true') {
|
||||
if (!($res->success === TRUE && $res->added === TRUE)) {
|
||||
debuglog('LiveCoin: Sell failed');
|
||||
continue;
|
||||
}
|
||||
|
@ -247,15 +247,16 @@ function doLiveCoinTrading($quick = false)
|
|||
}
|
||||
|
||||
/* Withdrawals */
|
||||
$btcaddr = YAAMP_BTCADDRESS;
|
||||
$withdraw_min = exchange_get($exchange, 'withdraw_min_btc', EXCH_AUTO_WITHDRAW);
|
||||
$withdraw_fee = exchange_get($exchange, 'withdraw_fee_btc', 0.0002);
|
||||
$withdraw_fee = exchange_get($exchange, 'withdraw_fee_btc', 0.0005);
|
||||
if (floatval($withdraw_min) > 0 && $savebalance->balance >= ($withdraw_min + $withdraw_fee)) {
|
||||
$amount = $savebalance->balance - $withdraw_fee;
|
||||
debuglog("$exchange: withdraw $amount BTC to $btcaddr");
|
||||
sleep(1);
|
||||
$res = $livecoin->withdrawCoin($amount, 'BTC', $btcaddr);
|
||||
debuglog("$exchange: withdraw ".json_encode($res));
|
||||
if ($res) {
|
||||
if (!$res->fault) {
|
||||
$withdraw = new db_withdraws;
|
||||
$withdraw->market = 'livecoin';
|
||||
$withdraw->address = $btcaddr;
|
||||
|
@ -265,6 +266,8 @@ function doLiveCoinTrading($quick = false)
|
|||
$withdraw->save();
|
||||
$savebalance->balance = 0;
|
||||
$savebalance->save();
|
||||
} else {
|
||||
debuglog("$exchange: Withdraw Failed ".json_encode($res));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ class CronjobController extends CommonController
|
|||
doBittrexTrading();
|
||||
doCryptopiaTrading();
|
||||
doKrakenTrading();
|
||||
doLivecoinTrading();
|
||||
doLiveCoinTrading();
|
||||
doPoloniexTrading();
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue