Ejemplo n.º 1
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 blockRepository              = new BlockRepository();
            var transactionRepository        = new TransactionRepository();
            var addressTransactionRepository = new AddressTransactionRepository();
            var contractRepository           = new ContractRepository();
            var logRepository     = new TransactionLogRepository();
            var vmStackRepository = new TransactionVMStackRepository();

            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, transactionRepository);
            }
            else
            {
                transactionProcessor.ContractTransactionProcessor.EnabledVmProcessing = false;
                _procesor = new BlockProcessor(_web3, blockRepository, transactionProcessor, transactionRepository);
            }
        }
Ejemplo n.º 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);
            }
        }