private void Initialize() { NewStorage(); var transactionManager = new TransactionManager(_dataStore, _logger); var transactionTraceManager = new TransactionTraceManager(_dataStore); _functionMetadataService = new FunctionMetadataService(_dataStore, _logger); var chainManagerBasic = new ChainManagerBasic(_dataStore); ChainService = new ChainService(chainManagerBasic, new BlockManagerBasic(_dataStore), transactionManager, transactionTraceManager, _dataStore, StateStore); _smartContractRunnerFactory = new SmartContractRunnerFactory(); var runner = new SmartContractRunner("../../../../AElf.Runtime.CSharp.Tests.TestContract/bin/Debug/netstandard2.0/"); _smartContractRunnerFactory.AddRunner(0, runner); _chainCreationService = new ChainCreationService(ChainService, new SmartContractService(new SmartContractManager(_dataStore), _smartContractRunnerFactory, StateStore, _functionMetadataService), _logger); SmartContractManager = new SmartContractManager(_dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, StateStore, _functionMetadataService); ChainService = new ChainService(new ChainManagerBasic(_dataStore), new BlockManagerBasic(_dataStore), new TransactionManager(_dataStore), new TransactionTraceManager(_dataStore), _dataStore, StateStore); }
public Benchmarks(IStateStore stateStore, IChainCreationService chainCreationService, IChainContextService chainContextService, ISmartContractService smartContractService, ILogger logger, IFunctionMetadataService functionMetadataService, BenchmarkOptions options, IExecutingService executingService) { ChainId = Hash.Generate(); _stateStore = stateStore; _chainCreationService = chainCreationService; _smartContractService = smartContractService; _logger = logger; _options = options; _executingService = executingService; _servicePack = new ServicePack { ChainContextService = chainContextService, SmartContractService = _smartContractService, ResourceDetectionService = new ResourceUsageDetectionService(functionMetadataService), StateStore = _stateStore }; _dataGenerater = new TransactionDataGenerator(options); byte[] code; using (FileStream file = File.OpenRead(Path.GetFullPath(options.DllDir + "/" + options.ContractDll))) { code = file.ReadFully(); } _contractHash = Prepare(code).Result; }
public TicketScanRequestHandler(IBlockStoreService blockStoreService, ILogger <TicketScanRequestHandler> logger, IMediator mediator, ISmartContractService smartContractService, ITicketChecker ticketChecker) { _blockStoreService = blockStoreService; _logger = logger; _mediator = mediator; _smartContractService = smartContractService; _ticketChecker = ticketChecker; }
public SimpleExecutingService(ISmartContractService smartContractService, ITransactionTraceManager transactionTraceManager, IStateStore stateStore, IChainContextService chainContextService) { _smartContractService = smartContractService; _transactionTraceManager = transactionTraceManager; _chainContextService = chainContextService; _stateStore = stateStore; }
public TrustManagementService(ApplicationDbContext context, IIpfsService ipfsService, ISmartContractService smartContractService, IStatisticService statisticService, IRateService rateService, ILogger <ITrustManagementService> logger) { this.context = context; this.ipfsService = ipfsService; this.smartContractService = smartContractService; this.statisticService = statisticService; this.rateService = rateService; this.logger = logger; }
public SmartContractBridgeService(ISmartContractService smartContractService, IBlockchainService blockchainService, ISmartContractAddressService smartContractAddressService, IBlockchainStateManager blockchainStateManager) { _smartContractService = smartContractService; _blockchainService = blockchainService; _smartContractAddressService = smartContractAddressService; _blockchainStateManager = blockchainStateManager; Logger = NullLogger <SmartContractBridgeService> .Instance; }
public ContractSignedController(IMapper mapper , ISmartContractSignedService service , ISmartContractService contractService , ICompanyService companyService , ICustomerService customerService) { _mapper = mapper; _service = service; _contractService = contractService; _companyService = companyService; _customerService = customerService; }
public async Task FetchReceipt_400_ReturnsNull() { // Arrange _httpTest.RespondWith(status: 400); _smartContractService = new SmartContractService(_nodeOptions.Object, _logger.Object); // Act var result = await _smartContractService.FetchReceiptAsync <int>("hx78s8dj3uuiwejfuew98f8wef8"); // Assert Assert.That(result, Is.Null); }
public async Task FetchReceipts_500_LogsErrorReturnsNull() { // Arrange _httpTest.RespondWith(status: 500); _smartContractService = new SmartContractService(_nodeOptions.Object, _logger.Object); // Act var result = await _smartContractService.FetchReceiptsAsync <Ticket>(); // Assert _logger.VerifyLog(LogLevel.Error); Assert.That(result, Is.Null); }
public ContractTest(IStateStore stateStore, IChainCreationService chainCreationService, IChainService chainService, ITransactionManager transactionManager, ISmartContractManager smartContractManager, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory) { _stateStore = stateStore; _chainCreationService = chainCreationService; _chainService = chainService; _transactionManager = transactionManager; _smartContractManager = smartContractManager; _chainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; _smartContractService = new SmartContractService(_smartContractManager, _smartContractRunnerFactory, stateStore, _functionMetadataService); }
public MockSetup(IStateStore stateStore, IChainCreationService chainCreationService, IDataStore dataStore, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory) { StateStore = stateStore; _chainCreationService = chainCreationService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; _smartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(_smartContractManager, _smartContractRunnerFactory, stateStore, _functionMetadataService); Task.Factory.StartNew(async() => { await DeploySampleContracts(); }).Unwrap().Wait(); }
public MockSetup(IDataStore dataStore, IChainCreationService chainCreationService, IChainService chainService, IActorEnvironment actorEnvironment, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory, ILogger logger, IStateStore stateStore, HashManager hashManager, TransactionManager transactionManager) { _logger = logger; _stateStore = stateStore; ActorEnvironment = actorEnvironment; if (!ActorEnvironment.Initialized) { ActorEnvironment.InitActorSystem(); } _hashManager = hashManager; _transactionManager = transactionManager; _chainCreationService = chainCreationService; _chainService = chainService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, functionMetadataService); Task.Factory.StartNew(async() => { await DeploySampleContracts(); }).Unwrap().Wait(); ServicePack = new ServicePack() { ChainContextService = chainContextService, SmartContractService = SmartContractService, ResourceDetectionService = new NewMockResourceUsageDetectionService(), StateStore = _stateStore }; // These are only required for workertest // other tests use ActorEnvironment var workers = new[] { "/user/worker1", "/user/worker2" }; Worker1 = Sys.ActorOf(Props.Create <Worker>(), "worker1"); Worker2 = Sys.ActorOf(Props.Create <Worker>(), "worker2"); Router = Sys.ActorOf(Props.Empty.WithRouter(new TrackedGroup(workers)), "router"); Worker1.Tell(new LocalSerivcePack(ServicePack)); Worker2.Tell(new LocalSerivcePack(ServicePack)); Requestor = Sys.ActorOf(AElf.Execution.Execution.Requestor.Props(Router)); }
public async Task FetchReceipt_200_ReturnsResponse() { // Arrange var receipt = new Receipt <int, object> { ReturnValue = 5 }; _httpTest.RespondWithJson(receipt, status: 200); _smartContractService = new SmartContractService(_nodeOptions.Object, _logger.Object); // Act var result = await _smartContractService.FetchReceiptAsync <int>("hx78s8dj3uuiwejfuew98f8wef8"); // Assert var expected = JsonConvert.SerializeObject(receipt); var actual = JsonConvert.SerializeObject(result); Assert.That(actual, Is.EqualTo(expected)); }
public BlockChainTests_MockSetup(IDataStore dataStore, IChainCreationService chainCreationService, IChainService chainService, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory, ILogger logger, IStateStore stateStore, HashManager hashManager, TransactionManager transactionManager) { _logger = logger; _stateStore = stateStore; _hashManager = hashManager; _transactionManager = transactionManager; _chainCreationService = chainCreationService; ChainService = chainService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, functionMetadataService); Task.Factory.StartNew(async() => { await DeploySampleContracts(); }).Unwrap().Wait(); }
public MockSetup(IStateStore stateStore, IChainCreationService chainCreationService, IDataStore dataStore, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory) { StateStore = stateStore; _chainCreationService = chainCreationService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, _functionMetadataService); ServicePack = new ServicePack() { ChainContextService = chainContextService, SmartContractService = SmartContractService, ResourceDetectionService = null, StateStore = StateStore }; }
public async Task FetchReceipts_200_ReturnsResponse() { // Arrange var receipts = new Receipt <object, Ticket>[] { new Receipt <object, Ticket> { Logs = new LogDto <Ticket>[] { new LogDto <Ticket> { Log = new Ticket { Address = Address.Zero, Seat = new Seat { Number = 2, Letter = 'D' }, Price = 249500000, Secret = new byte[16], CustomerIdentifier = new byte[32] } } } } }; _httpTest.RespondWithJson(receipts, status: 200); _smartContractService = new SmartContractService(_nodeOptions.Object, _logger.Object); // Act var result = await _smartContractService.FetchReceiptsAsync <Ticket>(); // Assert var expected = JsonConvert.SerializeObject(receipts); var actual = JsonConvert.SerializeObject(result); Assert.That(actual, Is.EqualTo(expected)); }
public TemplatesController(ISmartContractService smartContractService, IUserService userService) { _smartContractService = smartContractService; _userService = userService; }
public ChainCreationService(IChainService chainService, ISmartContractService smartContractService, ILogger logger) { _chainService = chainService; _smartContractService = smartContractService; _logger = logger; }
public TransactionExecutingService(ISmartContractService smartContractService, IChainContext chain) { _smartContractService = smartContractService; _chainContext = chain; }
public SmartContractController() { smartContractService = new SmartContractService(Settings.SiriusDbContext); }
public SmartContractFunctions(ILogger <SmartContractFunctions> logger, ISmartContractService service) { _logger = logger; _service = service; }
public SmartContractsController(IMapper mapper , ISmartContractService service) { _mapper = mapper; _service = service; }
public SmartContractController(ISmartContractService contracts) { this.contracts = contracts; }
public ConsensusBlockValidationFilter(ISmartContractService smartContractService) { _smartContractService = smartContractService; _logger = LogManager.GetLogger(nameof(ConsensusBlockValidationFilter)); }