private async void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            button2.Enabled = false;
            Etherscan.SaveKeyOnRegistry(textBox1.Text);
            // Start the HandleFile method.
            await PerformCheckEthereum(this.m_mainForm);

            string           outputFile = @"Bounties\" + this.ProjectSelected + "\\";
            string           localData  = @"Bounties\" + this.ProjectSelected + "\\" + this.ProjectSelected + "SpreadSheet.xml";
            BountyFileLoader bl         = new BountyFileLoader(localData);
            DataViewer       view       = new DataViewer(ProjectSelected + "_results.xml", outputFile, bl, DataViewer.Kind.Eth);

            view.CreateHtmlOutputEthereum(outputFile);

            //view.ShowConnectionsPerCategory(CampaignSelected);
            System.Diagnostics.Process.Start(outputFile + "index.html");
            button1.Enabled = true;
            button2.Enabled = true;
        }
Beispiel #2
0
        public static async Task <bool> CheckAddressListEthereum(string projectName, Campaign campaign, IProgress <ProgressStatus> progressinfo, string etherscanKey)
        {
            int        counter   = 0;
            Etherscan  ethreScan = new Etherscan(etherscanKey);
            Connection connected = null;
            int        currentAddressProgress     = 0;
            int        totalAddress               = campaign.Partecipants.Count;
            int        currentTransactionProgress = 0;
            int        totalTransaction           = 0;
            string     runResults = "results.txt";

            System.IO.StreamWriter fileResult =
                new System.IO.StreamWriter(runResults);

            xmlBounty bountydata = new xmlBounty(projectName + "_results.xml");

            foreach (KeyValuePair <string, string> address in campaign.Partecipants)
            {
                await fileResult.WriteLineAsync(address.Value + " connected with:");

                string stringJson = ethreScan.GetTransactions(address.Key);

                JObject json         = JObject.Parse(stringJson);
                JArray  transactions = (JArray)json["result"];
                currentTransactionProgress = 0;
                totalTransaction           = transactions.Count;

                foreach (JObject element in json["result"])
                {
                    if (element["from"].Value <string>() == address.Key)
                    {
                        connected = ethreScan.CheckIfAnyTrasactionWithOtherAddress(campaign.Partecipants, element["to"].Value <string>());
                    }
                    else if (element["to"].Value <string>() == address.Key)
                    {
                        connected = ethreScan.CheckIfAnyTrasactionWithOtherAddress(campaign.Partecipants, element["from"].Value <string>());
                    }

                    if (connected.Result == true)
                    {
                        bountydata.AddUserEth(address.Value, address.Key);

                        fileResult.WriteLine(campaign.Partecipants[connected.Address] + " -> " + element["tokenName"].Value <string>() + "(" + element["tokenSymbol"].Value <string>() + ")" + "https://etherscan.io/tx/" + element["hash"].Value <string>() + " " + element["from"].Value <string>() + " " + element["to"].Value <string>());
                        //Console.WriteLine(addressList[connected.Address] + " -> " + element["tokenName"].Value<string>() + "(" + element["tokenSymbol"].Value<string>() + ")" + "https://etherscan.io/tx/" + element["hash"].Value<string>() + " " + element["from"].Value<string>() + " " + element["to"].Value<string>());
                        bountydata.AddUserEthConnection(address.Value, address.Key, campaign.Partecipants[connected.Address], connected.Address, campaign.Name, element);
                    }

                    currentTransactionProgress++;
                    ReportProgressStatus(progressinfo, totalTransaction, currentTransactionProgress,
                                         campaign.Name + " - Checked transactions " + currentTransactionProgress + "/" + totalTransaction,
                                         Report.Transaction);
                }
                currentAddressProgress++;
                ReportProgressStatus(progressinfo, totalAddress, currentAddressProgress,
                                     campaign.Name + " - Verified " + address.Key + " - " + currentAddressProgress + "/" + totalAddress,
                                     Report.Address);


                counter++;
            }

            fileResult.Close();


            return(true);
        }
 public Form1()
 {
     InitializeComponent();
     m_mainForm    = this;
     textBox1.Text = Etherscan.ReadKeyFromRegistry();
 }