示例#1
0
        /// <summary>
        /// 存币交易分析处理
        /// </summary>
        /// <param name="successBlock"></param>
        private static void ProcessDepositTx(BlockMsg successBlock)
        {
            if (successBlock == null || successBlock.Transactions == null || !successBlock.Transactions.Any())
            {
                return;
            }
            List <DepositList> toInsert = new List <DepositList>();

            successBlock.Transactions.ForEach(x =>
            {
                if (x.DepositTime > 0 && x.Outputs != null && x.Outputs.Any())
                {
                    x.Outputs.ForEach(o =>
                    {
                        var receiverId = AccountIdHelper.CreateAccountAddressByPublicKeyHash(
                            Base16.Decode(
                                Script.GetPublicKeyHashFromLockScript(o.LockScript)
                                ));
                        var dep = new DepositList()
                        {
                            Address         = receiverId,
                            Amount          = o.Amount,
                            ExpireTime      = x.DepositTime,
                            IsExpired       = x.DepositTime < Time.EpochTime ? 1:0,
                            TransactionHash = x.Hash
                        };
                        toInsert.Add(dep);
                    });
                }
            });
            if (toInsert.Any())
            {
                new RewardListComponent().InsertDeposit(toInsert);
            }
        }
示例#2
0
        /// <summary>
        /// 返回当前所有未到期的存币记录
        /// </summary>
        /// <returns></returns>
        public List <DepositList> GetAllNotExpiredDeposit()
        {
            //存币至少1个币才计算在内
            string SQL_STATEMENT = $"SELECT * FROM depositlist WHERE IsExpired=0 AND {Time.EpochTime} < ExpireTime   AND Amount > 99999999;";

            List <DepositList> result = null;

            using (MySqlConnection conn = new MySqlConnection(CacheConnectionString))
                using (MySqlCommand cmd = new MySqlCommand(SQL_STATEMENT, conn))
                {
                    cmd.Connection.Open();
                    cmd.CommandTimeout = 1200;
                    using (MySqlDataReader dr = cmd.ExecuteReader())
                    {
                        result = new List <DepositList>();

                        while (dr.Read())
                        {
                            DepositList deposit = new DepositList();
                            deposit.Id = GetDataValue <long>(dr, "Id");
                            deposit.TransactionHash = GetDataValue <string>(dr, "TransactionHash");
                            deposit.Amount          = GetDataValue <long>(dr, "Amount");
                            deposit.ExpireTime      = GetDataValue <long>(dr, "ExpireTime");
                            deposit.Address         = GetDataValue <string>(dr, "Address");
                            deposit.IsExpired       = GetDataValue <int>(dr, "IsExpired");
                            result.Add(deposit);
                        }
                    }
                }

            return(result);
        }
示例#3
0
        public HttpResponseMessage GetSiteStats()
        {
            HomeModel homemodel = new HomeModel();

            homemodel.LaunchDate = DateTime.Parse("01/05/2020").ToShortDateString();             //DateTime.Today.AddDays(-95).ToShortDateString();
            TimeSpan dt = DateTime.Now - DateTime.Parse(homemodel.LaunchDate);

            if (dt.Days > 0)
            {
                homemodel.RunningDays = dt.Days.ToString();
            }
            else
            {
                homemodel.RunningDays = "0";
            }

            int[] StatusIds          = { (int)Status.Completed };
            int[] TranscationTypeIds = { (int)TransactionType.Purchase };
            var   totalfundinglist   = _transactionService.GetAllTransactions(0, 0, null, null, StatusIds, TranscationTypeIds, 0, int.MaxValue).OrderByDescending(x => x.TransactionDate).Take(10);

            homemodel.TotalSiteDeposit = _transactionService.GetAllTransactions(0, 0, null, null, StatusIds, TranscationTypeIds, 0, int.MaxValue).Select(x => x.Amount).Sum().ToString();
            int[] WithTranscationTypeIds = { (int)TransactionType.Withdrawal };
            var   totalWithdrawallist    = _transactionService.GetAllTransactions(0, 0, null, null, StatusIds, WithTranscationTypeIds, 0, int.MaxValue).OrderByDescending(x => x.TransactionDate).Take(10);

            homemodel.TotalSiteWithdrawal = _transactionService.GetAllTransactions(0, 0, null, null, StatusIds, WithTranscationTypeIds, 0, int.MaxValue).Select(x => x.Amount).Sum().ToString();
            homemodel.TotalCustomer       = _customerService.GetAllCustomers(0, 0, int.MaxValue).Count().ToString();
            var yestarday = DateTime.Now.AddHours(-24);

            homemodel.OnlineVistors = _customerService.GetAllCustomers(0, 0, int.MaxValue).Where(x => x.CreatedOnUtc > yestarday).Count().ToString();
            var withdrawals = totalWithdrawallist.OrderByDescending(x => x.TransactionDate).ToList();

            foreach (var d in withdrawals)
            {
                WithdrawalList w = new WithdrawalList();
                w.Email             = d.Customer.Email;
                w.AmountRaw         = d.Amount.ToString() + _workContext.WorkingCurrency.CurrencyCode;
                w.TransDate         = d.TransactionDate.ToShortDateString();
                w.PaymentMethodIcon = d.ProcessorId + ".svg";
                homemodel.Last10Withdrawal.Add(w);
            }

            var deposits = totalfundinglist.OrderByDescending(x => x.TransactionDate).ToList();

            foreach (var d in deposits)
            {
                DepositList w = new DepositList();
                w.Email             = d.Customer.Email;
                w.AmountRaw         = d.Amount.ToString() + _workContext.WorkingCurrency.CurrencyCode;
                w.TransDate         = d.TransactionDate.ToShortDateString();
                w.PaymentMethodIcon = d.ProcessorId + ".svg";
                homemodel.Last10Deposit.Add(w);
            }
            homemodel.plans = _planService.GetAllPackage().ToList();

            return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success", data = homemodel }));
        }
示例#4
0
        private void Print()
        {
            LoadDeposits();

            var myDataSet       = new ReportDataSet();
            var serNo           = 1;
            var selectedCompany = new CompanyService(true).GetCompany();

            string datecaption = ReportUtility.GetEthCalendar(FilterStartDate, true) + "(" +
                                 FilterStartDate.ToShortDateString() + ")";

            if (FilterStartDate.Day != FilterEndDate.Day || FilterStartDate.Month != FilterEndDate.Month || FilterStartDate.Year != FilterEndDate.Year)
            {
                datecaption = "ከ " + datecaption + " እስከ " + ReportUtility.GetEthCalendar(FilterEndDate, true) + "(" +
                              FilterEndDate.ToShortDateString() + ")";
            }
            var returned = "";

            if (SelectedCpoType.Value != 1)
            {
                returned = "የተመለሰበት ቀን";
            }

            foreach (var rentalPaymentDTO in RentDeposits)
            {
                var rentee = rentalPaymentDTO.Contrat.Rentee.DisplayName;
                if (rentee.Length > 20)
                {
                    rentee = rentee.Substring(0, 18) + "...";
                }
                myDataSet.RentalPayment.Rows.Add(
                    serNo,
                    SelectedCpoType.Display,
                    datecaption,
                    rentalPaymentDTO.DepositedDateStringAmharicFormatted,
                    rentalPaymentDTO.Contrat.Room.Number,
                    rentee,
                    "",
                    0.0, 0.0, 0.0,
                    0.0, 0.0,
                    rentalPaymentDTO.TotalDepositAmount,
                    rentalPaymentDTO.ReturnedDateStringAmharicFormatted,
                    0, 0.0, returned, "", "", "", selectedCompany.Header, null, "");
                serNo++;
            }

            var myReport4 = new DepositList();

            myReport4.SetDataSource(myDataSet);

            var report = new ReportViewerCommon(myReport4);

            report.Show();
        }
示例#5
0
        public void Main()
        {
            /* FYI: c++ full node message enum
             * enum MSG_TYPE
             * {
             *  MSG_SYS,
             *  MSG_ACCOUNT,
             *  MSG_TX,
             *  MSG_BLOCK,
             *  MSG_TOPIC,
             *  MSG_EXPLORER,
             *  MSG_EXCHANGE
             * };
             *
             * enum MSG_CMD
             * {
             *  SYS_PING,
             *  SYS_PONG,
             *  SYS_INFO,
             *
             *  ACCOUNT_IMPORT = 0,
             *  ACCOUNT_TOP100,
             *  ACCOUNT_PROBE,
             *  ACCOUNT_QUERY,
             *  ACCOUNT_HISTORY,
             *
             *  TX_CMD = 0,
             *
             *  BLOCK_SYNC = 0,
             *
             *  TOPIC_QUESTION_PROBE = 0,
             *  TOPIC_DETAIL_PROBE,
             *  TOPIC_LIST,
             *  TOPIC_ANSWER_LIST,
             *
             *  EXPLORER_MAIN_PAGE = 0,
             *  EXPLORER_NEXT_PAGE,
             *  EXPLORER_BLOCK_PAGE,
             *  EXPLORER_TX_PAGE,
             *  EXPLORER_ACCOUNT_PAGE,
             *  EXPLORER_QUERY,
             *
             *  EXCHANGE_LOGIN = 0,
             *  EXCHANGE_NOTIFY_DEPOSIT,
             *  EXCHANGE_DEPOSIT_TX_PROBE,
             *  EXCHANGE_WITHDRAW_TX_PROBE,
             *  EXCHANGE_LOCK,
             *  EXCHANGE_UNLOCK,
             *  EXCHANGE_CHANGE_KEY,
             *  EXCHANGE_LIST_DEPOSIT,
             *  EXCHANGE_LIST_WITHDRAW,
             *  EXCHANGE_IS_LOCKED,
             *  EXCHANGE_INFO
             * };
             */


            // connect to your full node
            m_wsock = new ClientWebSocket();
            var conn_task = m_wsock.ConnectAsync(new Uri("ws://your_full_node.com:19050"), m_cancel_token);

            conn_task.Wait();


            // login to your full node, use your own account and password
            string login_password       = "******";
            string exchange_account_b64 = "YXNrY29pbg==";
            uint   exchange_account_id  = 3;

            JObject obj = new JObject();

            obj.Add("msg_type", 6);
            obj.Add("msg_cmd", 0);
            obj.Add("msg_id", ++m_cur_msg_id);
            obj.Add("account_id", exchange_account_id);
            obj.Add("account_b64", exchange_account_b64);
            obj.Add("password", login_password);
            string obj_str = JsonConvert.SerializeObject(obj);

            byte[] arr       = System.Text.Encoding.Default.GetBytes(obj_str);
            var    send_task = m_wsock.SendAsync(new ArraySegment <byte>(arr), WebSocketMessageType.Text, true, m_cancel_token);

            send_task.Wait();

            while (true)
            {
                byte[] recv_arr            = new byte[100 * 1024];
                var    recv_task           = m_wsock.ReceiveAsync(new ArraySegment <byte>(recv_arr), m_cancel_token);
                WebSocketReceiveResult res = recv_task.Result;
                byte[] data_arr            = new byte[res.Count];
                Array.Copy(recv_arr, data_arr, res.Count);
                string recv_str    = System.Text.Encoding.Default.GetString(data_arr);
                var    recv_obj    = (JObject)JsonConvert.DeserializeObject(recv_str);
                uint   recv_msg_id = (uint)recv_obj.Property("msg_id");

                if (recv_msg_id == m_cur_msg_id)
                {
                    if (recv_obj.Property("err_code") == null)
                    {
                        Console.WriteLine("login ok");
                    }
                    else
                    {
                        Console.WriteLine("login failed");
                    }
                    break;
                }
            }

            Console.WriteLine("askcoin connector started.");

            DepositList dl = ListDeposits("234");

            //string txid = SendTo("12", 100);
            //Console.WriteLine("txid: {0}", txid);

            Console.Read();
        }
示例#6
0
        /// <summary>
        /// Returns a list of deposits. It must return pending and confirmed deposits. Ideally confirmed deposits
        /// should be returned only once, but if they are returned multiple times then it's okay (i.e. they won't be
        /// credited multiple times). Pending deposits can be returned in multiple invocations until they become confirmed.
        /// BatchId is an identifier that is passed between calls to ListDeposits. Each call includes the last returned
        /// BatchId (as part of DepositList object). It can be any string, but it usually is the block ID of the last
        /// processed block.
        /// </summary>
        /// <returns>Batch ID of the previous call, or null on the first time</returns>
        public DepositList ListDeposits(string batchId)
        {
            ulong block_id;
            bool  result = ulong.TryParse(batchId, out block_id);

            if (!result)
            {
                Console.WriteLine("failed");
            }
            Console.WriteLine("block_id: {0}", block_id);
            JObject obj = new JObject();

            obj.Add("msg_type", 6);
            obj.Add("msg_cmd", 7);
            obj.Add("msg_id", ++m_cur_msg_id);
            obj.Add("required_confirms", m_required_confirms);
            obj.Add("block_id", block_id);

            DepositList dlist = new DepositList();

            dlist.Deposits = new List <Deposit>();

            string obj_str = JsonConvert.SerializeObject(obj);

            byte[] arr       = System.Text.Encoding.Default.GetBytes(obj_str);
            var    send_task = m_wsock.SendAsync(new ArraySegment <byte>(arr), WebSocketMessageType.Text, true, m_cancel_token);

            send_task.Wait();


            while (true)
            {
                byte[] recv_arr            = new byte[500 * 1024];
                var    recv_task           = m_wsock.ReceiveAsync(new ArraySegment <byte>(recv_arr), m_cancel_token);
                WebSocketReceiveResult res = recv_task.Result;
                byte[] data_arr            = new byte[res.Count];
                Array.Copy(recv_arr, data_arr, res.Count);
                string recv_str = System.Text.Encoding.Default.GetString(data_arr);
                Console.WriteLine(recv_str);
                var  recv_obj    = (JObject)JsonConvert.DeserializeObject(recv_str);
                uint recv_msg_id = (uint)recv_obj.Property("msg_id");

                if (recv_msg_id == m_cur_msg_id)
                {
                    var deposits_json = recv_obj["deposits"];
                    dlist.BatchId = (string)recv_obj["batchId"];

                    Console.WriteLine("batchId: {0}", dlist.BatchId);

                    foreach (var dobj in deposits_json)
                    {
                        JObject deposit_obj = (JObject)dobj;
                        //Console.WriteLine(deposit_obj);
                        Deposit dp = new Deposit();

                        if (deposit_obj["memo"] != null)
                        {
                            dp.Address = (string)deposit_obj["memo"];
                        }

                        dp.Amount        = (decimal)deposit_obj["amount"];
                        dp.Confirmations = (int)deposit_obj["confirms"];
                        dp.Confirmed     = (bool)deposit_obj["confirmed"];
                        dp.TxId          = (string)deposit_obj["tx_id"];
                        dlist.Deposits.Add(dp);
                    }

                    Console.WriteLine("listdeposits ok");
                    break;
                }
            }

            return(dlist);
        }
示例#7
0
        public ActionResult Index()
        {
            ////var task = new ScheduleTask
            ////{
            ////	CronExpression = "0 */24 * * *",
            ////	Type = "SmartStore.Services.Boards.CheckBlockChainTransactionStatus, SmartStore.Services",//typeof("SmartStore.Services.Hyip.SendROITask,SmartStore.Services").AssemblyQualifiedNameWithoutVersion(),
            ////	Enabled = false,
            ////	StopOnError = false,
            ////	IsHidden = false
            ////};

            ////task.Name = string.Concat("Check Blockchain Transaction Status", " Task");
            ////_scheduleTaskService.InsertTask(task);
            if (Request["r"] != null)
            {
                System.Web.HttpCookie cookie = new System.Web.HttpCookie("3x1btcreferral", Request["r"].ToSafe());
                HttpContext.Response.Cookies.Remove("3x1btcreferral");
                HttpContext.Response.SetCookie(cookie);
            }
            var       reff         = Request.Cookies["3x1btcreferral"];
            var       customer     = _services.WorkContext.CurrentCustomer;
            var       isAdmin      = customer.IsAdmin();
            var       isRegistered = isAdmin || customer.IsRegistered();
            HomeModel homemodel    = new HomeModel();

            homemodel.LaunchDate = DateTime.Parse("04/15/2020").ToShortDateString();             //DateTime.Today.AddDays(-95).ToShortDateString();
            TimeSpan dt = DateTime.Now - DateTime.Parse(homemodel.LaunchDate);

            if (dt.Days > 0)
            {
                homemodel.RunningDays = dt.Days.ToString();
            }
            else
            {
                homemodel.RunningDays = "0";
            }
            var customers = _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-_customerSettings.Value.OnlineCustomerMinutes),
                                                                null, 0, _adminAreaSettings.GridPageSize);

            homemodel.OnlineVistors = customers.TotalCount.ToString();
            int[] StatusIds          = { (int)Status.Completed };
            int[] TranscationTypeIds = { (int)TransactionType.Purchase };
            var   totalfundinglist   = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, TranscationTypeIds, 0, int.MaxValue).OrderByDescending(x => x.TransactionDate).Take(10);

            homemodel.TotalSiteDeposit = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, TranscationTypeIds, 0, int.MaxValue).Select(x => x.Amount).Sum().ToString();
            int[] WithTranscationTypeIds = { (int)TransactionType.Withdrawal };
            var   totalWithdrawallist    = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, WithTranscationTypeIds, 0, int.MaxValue).OrderByDescending(x => x.TransactionDate).Take(10);

            homemodel.TotalSiteWithdrawal = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, WithTranscationTypeIds, 0, int.MaxValue).Select(x => x.Amount).Sum().ToString();

            var withdrawals = totalWithdrawallist.OrderByDescending(x => x.TransactionDate).ToList();

            foreach (var d in withdrawals)
            {
                WithdrawalList w = new WithdrawalList();
                w.Email             = "GM-" + d.Customer.Id;
                w.AmountRaw         = d.Amount.ToString() + _workContext.WorkingCurrency.CurrencyCode;
                w.TransDate         = d.TransactionDate.ToShortDateString();
                w.PaymentMethodIcon = d.ProcessorId + ".svg";
                homemodel.Last10Withdrawal.Add(w);
            }

            var deposits = totalfundinglist.OrderByDescending(x => x.TransactionDate).ToList();

            foreach (var d in deposits)
            {
                DepositList w = new DepositList();
                w.Email             = "GM-" + d.Customer.Id;
                w.AmountRaw         = d.Amount.ToString() + _workContext.WorkingCurrency.CurrencyCode;
                w.TransDate         = d.TransactionDate.ToShortDateString();
                w.PaymentMethodIcon = d.ProcessorId + ".svg";
                homemodel.Last10Deposit.Add(w);
            }
            homemodel.plans  = _planService.GetAllPackage().ToList();
            ViewBag.SiteName = "3x1 BTC";
            return(View(homemodel));
        }
示例#8
0
        public ActionResult Index()
        {
            //string domainName = HttpContext.Request.Url.GetLeftPart(UriPartial.Authority);
            //if(domainName == "http://bahtbucket.net"|| domainName == "https://bahtbucket.net"
            //	|| domainName == "https://www.bahtbucket.net"
            //	|| domainName == "http://www.bahtbucket.net" || domainName == "http://localhost:53161" || domainName == "http://localhost" || domainName == "http://localhost:81")
            //{

            //}
            //else
            //{
            //	return Content("Invalid License, call us on +91-9737443888");
            //}
            //var task = new ScheduleTask
            //{
            //	CronExpression = "0 */24 * * *",
            //	Type = "SmartStore.Services.Hyip.CheckWithdrawalStatusTask, SmartStore.Services",//typeof("SmartStore.Services.Hyip.SendROITask,SmartStore.Services").AssemblyQualifiedNameWithoutVersion(),
            //	Enabled = false,
            //	StopOnError = false,
            //	IsHidden = false
            //};

            //task.Name = string.Concat("Check Withdrawal Status", " Task");
            //_scheduleTaskService.InsertTask(task);
            if (Request["r"] != null)
            {
                HttpCookie cookie = new HttpCookie("mthreferral", Request["r"].ToSafe());
                HttpContext.Response.Cookies.Remove("mthreferral");
                HttpContext.Response.SetCookie(cookie);
            }
            var reff = Request.Cookies["mthreferral"];
            //var customers = _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-_customerSettings.Value.OnlineCustomerMinutes),
            //	null, 0, _adminAreaSettings.GridPageSize);

            var       customers = _customerService.GetAllCustomers(null, null, null, null, null, null, null, 0, 0, null, null, null, false, null, 0, int.MaxValue, false);
            HomeModel homemodel = new HomeModel();

            homemodel.LaunchDate = DateTime.Parse("08/01/2019").ToShortDateString();             //DateTime.Today.AddDays(-95).ToShortDateString();
            TimeSpan dt = DateTime.Now - DateTime.Parse(homemodel.LaunchDate);

            homemodel.RunningDays   = dt.Days.ToString();
            homemodel.OnlineVistors = customers.Count().ToString();
            homemodel.TotalCustomer = customers.Where(x => x.Email != null).Count().ToString();
            int[] StatusIds          = { (int)Status.Completed };
            int[] TranscationTypeIds = { (int)TransactionType.Purchase };
            var   totalfundinglist   = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, TranscationTypeIds, 0, int.MaxValue).OrderByDescending(x => x.TransactionDate).Take(10);

            homemodel.TotalSiteDeposit = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, TranscationTypeIds, 0, int.MaxValue).Select(x => x.Amount).Sum().ToString();
            int[] WithTranscationTypeIds = { (int)TransactionType.Withdrawal };
            var   totalWithdrawallist    = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, WithTranscationTypeIds, 0, int.MaxValue).OrderByDescending(x => x.TransactionDate).Take(10);

            homemodel.TotalSiteWithdrawal = _transcationService.GetAllTransactions(0, 0, null, null, StatusIds, WithTranscationTypeIds, 0, int.MaxValue).Select(x => x.Amount).Sum().ToString();

            var withdrawals = totalWithdrawallist.OrderByDescending(x => x.TransactionDate).ToList();

            foreach (var d in withdrawals)
            {
                WithdrawalList w = new WithdrawalList();
                w.Email             = "AP-" + d.Customer.Id;
                w.AmountRaw         = d.Amount.ToString() + _workContext.WorkingCurrency.CurrencyCode;
                w.TransDate         = d.TransactionDate.ToShortDateString();
                w.PaymentMethodIcon = d.ProcessorId + ".svg";
                homemodel.Last10Withdrawal.Add(w);
            }

            var deposits = totalfundinglist.OrderByDescending(x => x.TransactionDate).ToList();

            foreach (var d in deposits)
            {
                DepositList w = new DepositList();
                w.Email             = "AP-" + d.Customer.Id;
                w.AmountRaw         = d.Amount.ToString() + _workContext.WorkingCurrency.CurrencyCode;
                w.TransDate         = d.TransactionDate.ToShortDateString();
                w.PaymentMethodIcon = d.ProcessorId + ".svg";
                homemodel.Last10Deposit.Add(w);
            }
            homemodel.plans  = _planService.GetAllPackage().ToList();
            ViewBag.SiteName = "AlienProfit";
            return(View(homemodel));
        }