コード例 #1
0
 private function __construct($add_coins = false, $init_feebee_account = false)
 {
     $this->my_all_coins = my_all_coins::get();
     if ($add_coins != false) {
         $this->initCoins($add_coins);
     } else {
         $add_coins = array();
         $add_coins[0] = "Bitcoin";
         $add_coins[1] = "Bitcrystal";
         $add_coins[2] = "Bitcrystalx";
         $this->initCoins($add_coins);
     }
     $this->my_all_coins->build();
     if ($init_feebee_account != true) {
         $init_feebee_account = false;
     }
     $this->initFeeBeeAccount($init_feebee_account);
     $instance_id = 0;
     $select_instance_id = 0;
     $tmp = $this->my_all_coins->get_last_w_coins_settings();
     $this->w_coins_settings = $tmp[0];
     $tmp = $this->my_all_coins->getCoins();
     $this->coins = $tmp[0];
     $tmp = $this->my_all_coins->getCoinsNames();
     $this->coins_names = $tmp[0];
     $tmp = $this->my_all_coins->getCoinsNamesPrefix();
     $this->coins_names_prefix = $tmp[0];
     $this->coins_count = count($this->coins_names);
     $this->my_w = $this->w_coins_settings[0];
     $this->coins["create_feebee_account"] = $this->my_w->coins["create_feebee_account"];
     $this->coins_names[0] = $this->my_w->coins["coin_name_1"];
     $this->coins_names[1] = $this->my_w->coins["coin_name_2"];
     $this->coins_names[2] = $this->my_w->coins["coin_name_3"];
     $this->coins_names_prefix[0] = $this->my_w->coins["coin_prefix_1"];
     $this->coins_names_prefix[1] = $this->my_w->coins["coin_prefix_2"];
     $this->coins_names_prefix[2] = $this->my_w->coins["coin_prefix_3"];
     $this->coins[$this->coins_names[0]] = array();
     $this->coins[$this->coins_names[0]]["enabled"] = false;
     $this->coins[$this->coins_names[0]]["daemon"] = false;
     $this->coins[$this->coins_names[0]]["rpcsettings"] = array();
     $this->coins[$this->coins_names[0]]["fee"] = $this->my_w->coins["coin_fee_1"];
     $this->coins[$this->coins_names[0]]["FEEBEE"] = $this->my_w->coins["coin_feebee_1"];
     $this->coins[$this->coins_names[0]]["buy_fee"] = $this->my_w->coins["coin_buy_fee_1"];
     $this->coins[$this->coins_names[0]]["sell_fee"] = $this->my_w->coins["coin_sell_fee_1"];
     $this->coins[$this->coins_names[1]] = array();
     $this->coins[$this->coins_names[1]]["enabled"] = false;
     $this->coins[$this->coins_names[1]]["daemon"] = false;
     $this->coins[$this->coins_names[1]]["rpcsettings"] = array();
     $this->coins[$this->coins_names[1]]["fee"] = $this->my_w->coins["coin_fee_2"];
     $this->coins[$this->coins_names[1]]["FEEBEE"] = $this->my_w->coins["coin_feebee_2"];
     $this->coins[$this->coins_names[1]]["buy_fee"] = $this->my_w->coins["coin_buy_fee_2"];
     $this->coins[$this->coins_names[1]]["sell_fee"] = $this->my_w->coins["coin_sell_fee_2"];
     $this->coins[$this->coins_names[2]] = array();
     $this->coins[$this->coins_names[2]]["enabled"] = false;
     $this->coins[$this->coins_names[2]]["daemon"] = false;
     $this->coins[$this->coins_names[2]]["rpcsettings"] = array();
     $this->coins[$this->coins_names[2]]["fee"] = $this->my_w->coins["coin_fee_3"];
     $this->coins[$this->coins_names[2]]["FEEBEE"] = $this->my_w->coins["coin_feebee_3"];
     $this->coins[$this->coins_names[2]]["buy_fee"] = $this->my_w->coins["coin_buy_fee_3"];
     $this->coins[$this->coins_names[2]]["sell_fee"] = $this->my_w->coins["coin_sell_fee_3"];
     $coin0rpc = $this->my_w->coins[$this->coins_names[0]]["rpcsettings"];
     $coin1rpc = $this->my_w->coins[$this->coins_names[1]]["rpcsettings"];
     $coin2rpc = $this->my_w->coins[$this->coins_names[2]]["rpcsettings"];
     $this->coins[$this->coins_names[0]]["rpcsettings"]["user"] = $coin0rpc["user"];
     $this->coins[$this->coins_names[0]]["rpcsettings"]["pass"] = $coin0rpc["pass"];
     $this->coins[$this->coins_names[0]]["rpcsettings"]["host"] = $coin0rpc["host"];
     $this->coins[$this->coins_names[0]]["rpcsettings"]["port"] = $coin0rpc["port"];
     $this->coins[$this->coins_names[0]]["rpcsettings"]["walletpassphrase"] = $coin0rpc["walletpassphrase"];
     $this->coins[$this->coins_names[0]]["rpcsettings"]["walletpassphrase_timeout"] = $coin0rpc["walletpassphrase_timeout"];
     $this->coins[$this->coins_names[1]]["rpcsettings"]["user"] = $coin1rpc["user"];
     $this->coins[$this->coins_names[1]]["rpcsettings"]["pass"] = $coin1rpc["pass"];
     $this->coins[$this->coins_names[1]]["rpcsettings"]["host"] = $coin1rpc["host"];
     $this->coins[$this->coins_names[1]]["rpcsettings"]["port"] = $coin1rpc["port"];
     $this->coins[$this->coins_names[1]]["rpcsettings"]["walletpassphrase"] = $coin1rpc["walletpassphrase"];
     $this->coins[$this->coins_names[1]]["rpcsettings"]["walletpassphrase_timeout"] = $coin1rpc["walletpassphrase_timeout"];
     $this->coins[$this->coins_names[2]]["rpcsettings"]["user"] = $coin2rpc["user"];
     $this->coins[$this->coins_names[2]]["rpcsettings"]["pass"] = $coin2rpc["pass"];
     $this->coins[$this->coins_names[2]]["rpcsettings"]["host"] = $coin2rpc["host"];
     $this->coins[$this->coins_names[2]]["rpcsettings"]["port"] = $coin2rpc["port"];
     $this->coins[$this->coins_names[2]]["rpcsettings"]["walletpassphrase"] = $coin2rpc["walletpassphrase"];
     $this->coins[$this->coins_names[2]]["rpcsettings"]["walletpassphrase_timeout"] = $coin2rpc["walletpassphrase_timeout"];
     $this->enabled_coins = array();
     $this->enabled_coins[0] = $this->coins_names[0];
     $this->enabled_coins[1] = $this->coins_names[1];
     $this->enabled_coins[2] = $this->coins_names[2];
     $this->is_enabled_coins = false;
     $this->is_enabled_default_coins = false;
     $this->current_trade_coin_names = array();
     $this->current_trade_coin_names[0] = $this->coins_names[0];
     $this->current_trade_coin_names[1] = $this->coins_names[1];
     $this->current_trade_coin_names_prefix = array();
     $this->current_trade_coin_names_prefix[0] = $this->coins_names_prefix[0];
     $this->current_trade_coin_names_prefix[1] = $this->coins_names_prefix[1];
     $this->current_trade_from_coin_prefix = $this->coins_names_prefix[0];
     $this->current_trade_from_coin_name = $this->coins_names[0];
     $this->current_trade_to_coin_prefix = $this->coins_names_prefix[1];
     $this->current_trade_to_coin_name = $this->coins_names[1];
     $this->trade_coins = array();
     $this->trade_coins["BTCRY"] = array();
     $this->trade_coins["BTCRY"]["BTC"] = $this->current_trade_from_coin_prefix;
     $this->trade_coins["BTCRY"]["BTCRYX"] = $this->current_trade_to_coin_prefix;
     $this->trade_coins["BTCRY"]["BTCS"] = $this->current_trade_from_coin_name;
     $this->trade_coins["BTCRY"]["BTCRYXS"] = $this->current_trade_to_coin_name;
     $this->trade_coins["BTCRYX"] = array();
     $this->trade_coins["BTCRYX"]["BTC"] = $this->current_trade_from_coin_prefix;
     $this->trade_coins["BTCRYX"]["BTCRYX"] = $this->current_trade_to_coin_prefix;
     $this->trade_coins["BTCRYX"]["BTCS"] = $this->current_trade_from_coin_name;
     $this->trade_coins["BTCRYX"]["BTCRYXS"] = $this->current_trade_to_coin_name;
     for ($i = 3; $i < $this->coins_count; $i += 3) {
         $this->my_w = $this->w_coins_settings[floor($i / 3)];
         $this->coins_names[0 + $i] = $this->my_w->coins["coin_name_1"];
         $this->coins_names[1 + $i] = $this->my_w->coins["coin_name_2"];
         $this->coins_names[2 + $i] = $this->my_w->coins["coin_name_3"];
         $this->coins_names_prefix[0 + $i] = $this->my_w->coins["coin_prefix_1"];
         $this->coins_names_prefix[1 + $i] = $this->my_w->coins["coin_prefix_2"];
         $this->coins_names_prefix[2 + $i] = $this->my_w->coins["coin_prefix_3"];
         $this->coins[$this->coins_names[0 + $i]] = array();
         $this->coins[$this->coins_names[0 + $i]]["enabled"] = false;
         $this->coins[$this->coins_names[0 + $i]]["daemon"] = false;
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"] = array();
         $this->coins[$this->coins_names[0 + $i]]["fee"] = $this->my_w->coins["coin_fee_1"];
         $this->coins[$this->coins_names[0 + $i]]["FEEBEE"] = $this->my_w->coins["coin_feebee_1"];
         $this->coins[$this->coins_names[0 + $i]]["buy_fee"] = $this->my_w->coins["coin_buy_fee_1"];
         $this->coins[$this->coins_names[0 + $i]]["sell_fee"] = $this->my_w->coins["coin_sell_fee_1"];
         $this->coins[$this->coins_names[1 + $i]] = array();
         $this->coins[$this->coins_names[1 + $i]]["enabled"] = false;
         $this->coins[$this->coins_names[1 + $i]]["daemon"] = false;
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"] = array();
         $this->coins[$this->coins_names[1 + $i]]["fee"] = $this->my_w->coins["coin_fee_2"];
         $this->coins[$this->coins_names[1 + $i]]["FEEBEE"] = $this->my_w->coins["coin_feebee_2"];
         $this->coins[$this->coins_names[1 + $i]]["buy_fee"] = $this->my_w->coins["coin_buy_fee_2"];
         $this->coins[$this->coins_names[1 + $i]]["sell_fee"] = $this->my_w->coins["coin_sell_fee_2"];
         $this->coins[$this->coins_names[2 + $i]] = array();
         $this->coins[$this->coins_names[2 + $i]]["enabled"] = false;
         $this->coins[$this->coins_names[2 + $i]]["daemon"] = false;
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"] = array();
         $this->coins[$this->coins_names[2 + $i]]["fee"] = $this->my_w->coins["coin_fee_3"];
         $this->coins[$this->coins_names[2 + $i]]["FEEBEE"] = $this->my_w->coins["coin_feebee_3"];
         $this->coins[$this->coins_names[2 + $i]]["buy_fee"] = $this->my_w->coins["coin_buy_fee_3"];
         $this->coins[$this->coins_names[2 + $i]]["sell_fee"] = $this->my_w->coins["coin_sell_fee_3"];
         $coin0rpc = $this->my_w->coins[$this->coins_names[0 + $i]]["rpcsettings"];
         $coin1rpc = $this->my_w->coins[$this->coins_names[1 + $i]]["rpcsettings"];
         $coin2rpc = $this->my_w->coins[$this->coins_names[2 + $i]]["rpcsettings"];
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"]["user"] = $coin0rpc["user"];
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"]["pass"] = $coin0rpc["pass"];
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"]["host"] = $coin0rpc["host"];
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"]["port"] = $coin0rpc["port"];
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"]["walletpassphrase"] = $coin0rpc["walletpassphrase"];
         $this->coins[$this->coins_names[0 + $i]]["rpcsettings"]["walletpassphrase_timeout"] = $coin0rpc["walletpassphrase_timeout"];
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"]["user"] = $coin1rpc["user"];
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"]["pass"] = $coin1rpc["pass"];
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"]["host"] = $coin1rpc["host"];
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"]["port"] = $coin1rpc["port"];
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"]["walletpassphrase"] = $coin1rpc["walletpassphrase"];
         $this->coins[$this->coins_names[1 + $i]]["rpcsettings"]["walletpassphrase_timeout"] = $coin1rpc["walletpassphrase_timeout"];
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"]["user"] = $coin2rpc["user"];
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"]["pass"] = $coin2rpc["pass"];
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"]["host"] = $coin2rpc["host"];
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"]["port"] = $coin2rpc["port"];
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"]["walletpassphrase"] = $coin2rpc["walletpassphrase"];
         $this->coins[$this->coins_names[2 + $i]]["rpcsettings"]["walletpassphrase_timeout"] = $coin2rpc["walletpassphrase_timeout"];
         $this->enabled_coins[0 + $i] = $this->coins_names[0 + $i];
         $this->enabled_coins[1 + $i] = $this->coins_names[1 + $i];
         $this->enabled_coins[2 + $i] = $this->coins_names[2 + $i];
     }
     $this->my_w = $this->w_coins_settings[0];
     $this->enabled_coins_count = count($this->enabled_coins);
     $this->enable_default_coins();
 }
コード例 #2
0
 public static function get()
 {
     if (self::$SINGLETON == NULL) {
         self::$SINGLETON = new my_all_coins();
     }
     return self::$SINGLETON;
 }