public ConsumerServicesBackgroundProcessor( IAccountService accountService, IRefundClaimant refundClaimant, IDepositConfirmationService depositConfirmationService, IGasPriceService gasPriceService, IBlockProcessor blockProcessor, IDepositDetailsRepository depositRepository, IConsumerNotifier consumerNotifier, ILogManager logManager, IPriceService priceService, bool useDepositTimer = false, IEthJsonRpcClientProxy?ethJsonRpcClientProxy = null, uint depositTimer = 10000) { _accountService = accountService; _refundClaimant = refundClaimant; _depositConfirmationService = depositConfirmationService; _gasPriceService = gasPriceService; _blockProcessor = blockProcessor; _consumerNotifier = consumerNotifier; _priceService = priceService; _depositRepository = depositRepository; _useDepositTimer = useDepositTimer; _ethJsonRpcClientProxy = ethJsonRpcClientProxy; _depositTimerPeriod = depositTimer; _logger = logManager.GetClassLogger(); _gasPriceService.UpdateGasPriceAsync(); _priceService.UpdateAsync(_currencies); }
public ConsumerServicesBackgroundProcessor(IAccountService accountService, IRefundClaimant refundClaimant, IDepositConfirmationService depositConfirmationService, IBlockProcessor blockProcessor, IDepositDetailsRepository depositRepository, IConsumerNotifier consumerNotifier, ILogManager logManager, uint tryClaimRefundsIntervalMilliseconds = 60000) { _accountService = accountService; _refundClaimant = refundClaimant; _depositConfirmationService = depositConfirmationService; _blockProcessor = blockProcessor; _depositRepository = depositRepository; _consumerNotifier = consumerNotifier; _logger = logManager.GetClassLogger(); _timer = new Timer(tryClaimRefundsIntervalMilliseconds); }
public void Setup() { Prepare(); _claimedRefundTransactionHash = TestItem.KeccakA; _refundService = Substitute.For <IRefundService>(); _refundService.ClaimRefund(Arg.Any <Address>(), Arg.Any <RefundClaim>()) .Returns(_claimedRefundTransactionHash); _refundService.ClaimEarlyRefund(Arg.Any <Address>(), Arg.Any <EarlyRefundClaim>()) .Returns(_claimedRefundTransactionHash); _depositRepository = Substitute.For <IDepositDetailsRepository>(); _transactionVerifier = Substitute.For <ITransactionVerifier>(); _transactionVerifier.Verify(Arg.Any <TxReceipt>()).Returns(new TransactionVerifierResult(true, 1, 1)); _refundClaimant = new RefundClaimant(_refundService, _bridge, _depositRepository, _transactionVerifier, LimboLogs.Instance); }
public void Setup() { Prepare(); _claimedRefundTransactionHash = TestItem.KeccakA; _refundService = Substitute.For <IRefundService>(); _refundService.ClaimRefundAsync(Arg.Any <Address>(), Arg.Any <RefundClaim>(), Arg.Any <UInt256>()) .Returns(_claimedRefundTransactionHash); _refundService.ClaimEarlyRefundAsync(Arg.Any <Address>(), Arg.Any <EarlyRefundClaim>(), Arg.Any <UInt256>()) .Returns(_claimedRefundTransactionHash); _depositRepository = Substitute.For <IDepositDetailsRepository>(); _transactionVerifier = Substitute.For <ITransactionVerifier>(); _transactionVerifier.VerifyAsync(Arg.Any <NdmTransaction>()) .Returns(new TransactionVerifierResult(true, 1, 1)); _gasPriceService = Substitute.For <IGasPriceService>(); _timestamper = Timestamper.Default; _refundClaimant = new RefundClaimant(_refundService, _ndmBridge, _depositRepository, _transactionVerifier, _gasPriceService, _timestamper, LimboLogs.Instance); }
public void Setup() { DataAssetProvider provider = new DataAssetProvider(_providerAddress, "provider"); _asset = new DataAsset(Keccak.Compute("1"), "name", "desc", 1, DataAssetUnitType.Unit, 1000, 10000, new DataAssetRules(new DataAssetRule(1)), provider, state: DataAssetState.Published); _deposit = new Deposit(Keccak.Zero, 1, 2, 3); _details = new DepositDetails(_deposit, _asset, Address.Zero, new byte[0], 1, new TransactionInfo[0]); IAccountService accountService = Substitute.For <IAccountService>(); IRefundClaimant refundClaimant = Substitute.For <IRefundClaimant>(); IDepositConfirmationService depositConfirmationService = Substitute.For <IDepositConfirmationService>(); IEthPriceService ethPriceService = Substitute.For <IEthPriceService>(); IGasPriceService gasPriceService = Substitute.For <IGasPriceService>(); _blockProcessor = Substitute.For <IBlockProcessor>(); IConsumerNotifier notifier = new ConsumerNotifier(Substitute.For <INdmNotifier>()); IDepositDetailsRepository repository = new DepositDetailsInMemoryRepository(new DepositsInMemoryDb()); repository.AddAsync(_details); _processor = new ConsumerServicesBackgroundProcessor(accountService, refundClaimant, depositConfirmationService, ethPriceService, gasPriceService, _blockProcessor, repository, notifier, LimboLogs.Instance); }
public ConsumerServicesBackgroundProcessor(IAccountService accountService, IRefundClaimant refundClaimant, IDepositConfirmationService depositConfirmationService, IBlockProcessor blockProcessor, IDepositDetailsRepository depositRepository, IConsumerNotifier consumerNotifier, ILogManager logManager, uint tryClaimRefundsIntervalMilliseconds = 60000, bool useDepositTimer = false, IEthJsonRpcClientProxy ethJsonRpcClientProxy = null, uint depositTimer = 10000) { _accountService = accountService; _refundClaimant = refundClaimant; _depositConfirmationService = depositConfirmationService; _blockProcessor = blockProcessor; _depositRepository = depositRepository; _consumerNotifier = consumerNotifier; _useDepositTimer = useDepositTimer; _ethJsonRpcClientProxy = ethJsonRpcClientProxy; _logger = logManager.GetClassLogger(); _refundClaimTimer = new Timer(tryClaimRefundsIntervalMilliseconds); if (_useDepositTimer) { _depositTimer = new Timer(depositTimer); } }