예제 #1
0
        private void NCNotify(object sender, ApplicationExecutedEventArgs e)
        {
            var a = e.Notifications[0].ScriptHash;
            var b = UInt160.Parse(NnsResolverAddrScripthash);
            var c = UInt160.Parse("c191b3e4030b9105e59c6bb56ec0d1273cd43284");

            //DataRow r = dt.NewRow();
            //r[0] = a;
            //r[1] = b;
            //dt.Rows.Add(r);

            if ((a == b) || (a == c))
            {
                var e2 = e.Notifications;
                foreach (NotifyEventArgs notify in e2)
                {
                    string    scripthash = notify.ScriptHash.ToString();
                    StackItem s          = notify.State;
                    string    key        = (s as Neo.VM.Types.Array)[0].GetString();
                    string    value      = (s as Neo.VM.Types.Array)[1].GetByteArray().ToHexString();

                    var r = dt.NewRow();
                    r[0] = scripthash;
                    r[1] = key;
                    r[2] = value;
                    r[3] = DateTime.Now;
                    dt.Rows.Add(r);

                    //MessageBox.Show("0x" + value, key);
                }
            }
            //plugin_nns.api.SignAndShowInformation(tx);
            //plugin_nns.api.CurrentWallet;
        }
예제 #2
0
        private async void HandleNotifications(object sender, ApplicationExecutedEventArgs e)
        {
            var gameContractExecutions = e.ExecutionResults
                                         .Where(x => x.Notifications.Any(n => n.ScriptHash == this.contractHash))
                                         .ToList();

            foreach (var item in gameContractExecutions)
            {
                await this.ProcessNotifications(item.Notifications);
            }
        }
예제 #3
0
        private void LevelDBBlockchain_ApplicationExecuted(object sender, ApplicationExecutedEventArgs e)
        {
            JObject json = new JObject();

            json["txid"]          = e.Transaction.Hash.ToString();
            json["vmstate"]       = e.VMState;
            json["gas_consumed"]  = e.GasConsumed.ToString();
            json["stack"]         = e.Stack.Select(p => p.ToParameter().ToJson()).ToArray();
            json["notifications"] = e.Notifications.Select(p =>
            {
                JObject notification     = new JObject();
                notification["contract"] = p.ScriptHash.ToString();
                notification["state"]    = p.State.ToParameter().ToJson();
                return(notification);
            }).ToArray();
            Directory.CreateDirectory(Settings.Default.Paths.ApplicationLogs);
            string path = Path.Combine(Settings.Default.Paths.ApplicationLogs, $"{e.Transaction.Hash}.json");

            File.WriteAllText(path, json.ToString());
        }