Example #1
0
 protected override void NotifyToChildrenAsChanged()
 {
     //https://api.ethermine.org//miner/:miner/currentStats
     //{"status":"OK","data":[{"worker":"3090-2","time":1621352400,"lastSeen":1621352367,"reportedHashrate":433797908,"currentHashrate":411547659.92833334,"validShares":343,"invalidShares":0,"staleShares":3,"averageHashrate":415222961.9435879},{"worker":"3090-5li","time":1621352400,"lastSeen":1621352367,"reportedHashrate":707161209,"currentHashrate":661196443.3458333,"validShares":549,"invalidShares":0,"staleShares":8,"averageHashrate":692508591.4666438},{"worker":"melih-kktc","time":1621352400,"lastSeen":1621352366,"reportedHashrate":1260949519,"currentHashrate":1247647384.7508333,"validShares":1036,"invalidShares":0,"staleShares":15,"averageHashrate":1220588015.0897803},{"worker":"melih-rigrig-1","time":1621352400,"lastSeen":1621352361,"reportedHashrate":406673131,"currentHashrate":460880884.27416664,"validShares":385,"invalidShares":0,"staleShares":2,"averageHashrate":397732136.68556714},{"worker":"melih-rigrig-1-redminer","time":1621352400,"lastSeen":1621352365,"reportedHashrate":258040846,"currentHashrate":265635850.07416666,"validShares":222,"invalidShares":0,"staleShares":1,"averageHashrate":245787065.04707173}]}
     if (!HasError() && HasText())
     {
         if (m_address != null && m_address.Length > 0)
         {
             DefaultWalletAddress wallet = new DefaultWalletAddress(m_address);
             result             = JsonUtility.FromJson <Json_Result>(GetText());
             isConverted        = true;
             m_minerInformation = new EtherMinerOrgMinerInfo(wallet);
             m_minerInformation.SetPaid(result.data.unpaid, result.data.unconfirmed);
             m_minerInformation.SetEstimationWin(result.data.coinsPerMin, result.data.usdPerMin, result.data.btcPerMin);
             m_minerInformation.SetActiveWorker(result.data.activeWorkers);
             EtherMineOrgWorkerFrame frame = new EtherMineOrgWorkerFrame();
             frame.SetWorkerRef(new EhterMineWorkerRef(new DefaultWorkerFromWalletID(wallet, "")));
             frame.SetTime(result.data.time);
             frame.SetTimeLastSeen(result.data.time);
             frame.SetShares(result.data.validShares, result.data.invalidShares, result.data.staleShares);
             frame.SetHashRate(result.data.currentHashrate, result.data.reportedHashrate, result.data.averageHashrate);
             m_minerInformation.SetCurrentStateAsFrame(frame);
         }
     }
     else
     {
         isConverted = false;
     }
 }
    public void PushLastSaveToFile()
    {
        if (m_minerObserved == null)
        {
            return;
        }
        if (m_minerObserved.m_minerInfo == null)
        {
            return;
        }
        if (m_minerObserved.m_minerInfo.HasError() || !m_minerObserved.m_minerInfo.HasText())
        {
            return;
        }
        if (!m_minerObserved.m_minerInfo.isConverted)
        {
            return;
        }
        EtherMinerOrgMinerInfo miner = m_minerObserved.m_minerInfo.GetMinerInfo();

        AbstractMinerInfo minerinfo = new AbstractMinerInfo();

        minerinfo.m_address            = miner.GetWallet().GetAddress();
        minerinfo.m_timestampInSeconds = miner.GetFrameStatistic().GetTimestamp();
        minerinfo.m_averageHashrate    = miner.GetFrameStatistic().GetAverageHashRate();
        minerinfo.m_hardwareHashrate   = miner.GetFrameStatistic().GetReportedHashRate();
        minerinfo.m_serverHashrate     = miner.GetFrameStatistic().GetCurrentHashRate();
        minerinfo.m_validShares        = miner.GetFrameStatistic().GetValideShares();
        minerinfo.m_invalidShares      = miner.GetFrameStatistic().GetInvalideShares();
        minerinfo.m_staleShares        = miner.GetFrameStatistic().GetStaleShares();

        minerinfo.m_unpaidWei        = miner.GetUnpaidWai();
        minerinfo.m_bitcoinPerMinute = miner.GetBitcoinPerMinute();
        minerinfo.m_coinsPerMinute   = miner.GetCoinsPerMinutes();
        minerinfo.m_usdPerMinute     = miner.GetUsdPerMinutes();
        minerinfo.m_workerCount      = miner.GetActiveWorkers();


        m_poolSaveAndLoad.SaveMinerState(PoolManageByThisAPI.Ethermine, minerinfo);
        // AbstractMinerBasicInfo[] m_debugMinerKeys;
        //m_poolSaveAndLoad.ImportAllKeys(PoolManageByThisAPI.Ethermine.ToString(), miner.GetWallet().GetAddress(), new DateTime((int)year, (int)month, (int)day, (int)hour, (int)minute, 0, 0, DateTimeKind.Utc), DateTime.UtcNow, out m_debugMinerKeys);
    }
Example #3
0
    public void SetWith(EtherMinerOrgMinerInfo info)
    {
        if (info == null)
        {
            if (m_frameGeneral != null)
            {
                m_frameGeneral.SetWith(null);
            }
            if (m_hashRateEstimation != null)
            {
                m_hashRateEstimation.SetWith(0);
            }
            if (m_history != null)
            {
                m_history.SetWith(info.GetFameHistory());
            }
            if (m_unconfirmed != null)
            {
                m_unconfirmed.text = "";
            }
            if (m_unpaid != null)
            {
                m_unpaid.text = "";
            }
            if (m_dollarPerMinute != null)
            {
                m_dollarPerMinute.text = "";
            }
            if (m_bitcoinsPerMinute != null)
            {
                m_bitcoinsPerMinute.text = "";
            }
            if (m_coinsPerMinute != null)
            {
                m_coinsPerMinute.text = "";
            }
            if (m_activeWorker != null)
            {
                m_activeWorker.text = "";
            }
            return;
        }

        if (m_hashRateEstimation != null)
        {
            m_hashRateEstimation.SetWith(info.GetFrameStatistic().GetCurrentHashRate());
        }
        if (m_frameGeneral != null)
        {
            m_frameGeneral.SetWith(info.GetFrameStatistic());
        }
        if (m_address != null)
        {
            m_address.text = info.GetWallet().GetAddress();
        }
        if (m_dollarPerMinute != null)
        {
            m_dollarPerMinute.text = "" + info.GetUsdPerMinutes() * (60 * 24) + " $/day";
        }
        if (m_coinsPerMinute != null)
        {
            m_coinsPerMinute.text = "" + info.GetCoinsPerMinutes() * (60 * 24) + " ETH/day";
        }
        if (m_bitcoinsPerMinute != null)
        {
            m_bitcoinsPerMinute.text = "" + info.GetBitcoinPerMinute() * (60 * 24) + " BTC/day";
        }
        if (m_activeWorker != null)
        {
            m_activeWorker.text = "" + info.GetActiveWorkers() + " workers";
        }
        if (m_unconfirmed != null)
        {
            m_unconfirmed.text = "" + info.GetUnconfirmed() + " unconfirmed";
        }
        if (m_unpaid != null)
        {
            EthereumConverttion.ApproximateConvert(info.GetUnpaidWai(), out decimal value, EtherType.Wei, EtherType.Ether);

            m_unpaid.text = "" + value + " ETH Unpaid";
        }
    }