예제 #1
0
            public StorageProcessor(string url, int start, int end, string connectionString, string prefix, bool postVm = false)
            {
                this.start = start;
                this.end   = end;

                web3 = url.EndsWith(".ipc") ? new Web3(new IpcClient(url)) : new Web3(url);
                var tableSetup = new CloudTableSetup(connectionString);

                contractTable = tableSetup.GetContractsTable(prefix);
                var transactionsTable        = tableSetup.GetTransactionsTable(prefix);
                var addressTransactionsTable = tableSetup.GetAddressTransactionsTable(prefix);
                var blocksTable  = tableSetup.GetBlocksTable(prefix);
                var logTable     = tableSetup.GetTransactionsLogTable(prefix);
                var vmStackTable = tableSetup.GetTransactionsVmStackTable(prefix);

                //TODO FACTORY to process only contracts and other scenarios
                //This could be a base class
                if (postVm)
                {
                    procesor = new BlockVmStackPostProcessorService(web3, transactionsTable, addressTransactionsTable,
                                                                    contractTable, blocksTable, logTable, vmStackTable);
                }
                else
                {
                    procesor = new BlockProcessorService(web3, transactionsTable, addressTransactionsTable,
                                                         contractTable, blocksTable, logTable, vmStackTable);
                }
            }
예제 #2
0
        public StorageProcessor(string url, string connectionString, string prefix, bool postVm = false)
        {
            _web3 = url.EndsWith(".ipc") ? new Web3.Web3(new IpcClient(url)) : new Web3.Web3(url);
            var tableSetup = new CloudTableSetup(connectionString);

            _contractTable = tableSetup.GetContractsTable(prefix);
            var transactionsTable        = tableSetup.GetTransactionsTable(prefix);
            var addressTransactionsTable = tableSetup.GetAddressTransactionsTable(prefix);
            var blocksTable  = tableSetup.GetBlocksTable(prefix);
            var logTable     = tableSetup.GetTransactionsLogTable(prefix);
            var vmStackTable = tableSetup.GetTransactionsVmStackTable(prefix);

            var blockRepository              = new BlockRepository(blocksTable);
            var transactionRepository        = new TransactionRepository(transactionsTable);
            var addressTransactionRepository = new AddressTransactionRepository(addressTransactionsTable);
            var contractRepository           = new ContractRepository(_contractTable);
            var logRepository     = new TransactionLogRepository(logTable);
            var vmStackRepository = new TransactionVMStackRepository(vmStackTable);

            var contractTransactionProcessor = new ContractTransactionProcessor(_web3, contractRepository,
                                                                                transactionRepository, addressTransactionRepository, vmStackRepository, logRepository);
            var contractCreationTransactionProcessor = new ContractCreationTransactionProcessor(_web3, contractRepository,
                                                                                                transactionRepository, addressTransactionRepository);
            var valueTrasactionProcessor = new ValueTransactionProcessor(transactionRepository,
                                                                         addressTransactionRepository);

            var transactionProcessor = new TransactionProcessor(_web3, contractTransactionProcessor,
                                                                valueTrasactionProcessor, contractCreationTransactionProcessor);


            if (postVm)
            {
                _procesor = new BlockVmPostProcessor(_web3, blockRepository, transactionProcessor);
            }
            else
            {
                transactionProcessor.ContractTransactionProcessor.EnabledVmProcessing = false;
                _procesor = new BlockProcessor(_web3, blockRepository, transactionProcessor);
            }
        }