public BlockchainIndexingService(
     IEthereumNodeJobClient ethereumNodeJobClient,
     IIndexingStateRepository indexingStateRepository,
     IRabbitPublisher <EthereumWalletLinkingStatusChangeCompletedEvent>
     walletLinkingStatusChangeCompletedPublisher,
     IRabbitPublisher <TransferToExternalCompletedEvent> transferToExternalCompletedPublisher,
     IRabbitPublisher <TransferToInternalDetectedEvent> transferToInternalDetectedPublisher,
     IRabbitPublisher <SeizeToInternalDetectedEvent> seizeToInternalDetectedPublisher,
     int blockConfirmationLevel,
     ILogFactory logFactory,
     int?blockBatchSize = null)
 {
     _ethereumNodeJobClient   = ethereumNodeJobClient;
     _indexingStateRepository = indexingStateRepository;
     _walletLinkingStatusChangeCompletedPublisher = walletLinkingStatusChangeCompletedPublisher;
     _transferToExternalCompletedPublisher        = transferToExternalCompletedPublisher;
     _transferToInternalDetectedPublisher         = transferToInternalDetectedPublisher;
     _seizeToInternalDetectedPublisher            = seizeToInternalDetectedPublisher;
     _blockConfirmationLevel            = blockConfirmationLevel;
     _blockBatchSize                    = blockBatchSize;
     _publicAccountLinkedEventSignature =
         $"0x{ABITypedRegistry.GetEvent<PublicAccountLinkedEventDTO>().Sha3Signature}";
     _publicAccountUnlinkedEventSignature =
         $"0x{ABITypedRegistry.GetEvent<PublicAccountUnlinkedEventDTO>().Sha3Signature}";
     _transferredFromInternalNetworkEventSignature =
         $"0x{ABITypedRegistry.GetEvent<TransferredFromInternalNetworkEventDTO>().Sha3Signature}";
     _transferredToInternalNetworkEventSignature =
         $"0x{ABITypedRegistry.GetEvent<TransferredToInternalNetworkEventDTO>().Sha3Signature}";
     _publicAccountUnlinkedEventSignature =
         $"0x{ABITypedRegistry.GetEvent<PublicAccountUnlinkedEventDTO>().Sha3Signature}";
     _seizeFromEventSignature =
         $"0x{ABITypedRegistry.GetEvent<SeizeFromEventDTO>().Sha3Signature}";
     _eventTopicDecoder = new EventTopicDecoder();
     _log = logFactory.CreateLog(this);
 }
 public BlockchainIndexingService(
     ILogFactory logFactory,
     IWeb3 web3,
     IIndexingStateRepository indexingStateRepository,
     ITransactionRepository transactionRepository)
 {
     _log  = logFactory.CreateLog(this);
     _web3 = web3;
     _indexingStateRepository = indexingStateRepository;
     _transactionRepository   = transactionRepository;
 }
Exemple #3
0
        public BlockchainIndexingService(
            IRabbitPublisher <CustomerRegisteredInBlockchainEvent> customerRegisteredInBlockchainEventPublishingService,
            IRabbitPublisher <MintEvent> mintEventPublishingService,
            IRabbitPublisher <TransferEvent> transferEventPublishingService,
            IIndexingStateRepository indexingStateRepository,
            ILogFactory logFactory,
            IRabbitPublisher <TransactionFailedInBlockchainEvent> transactionFailedInBlockchainEventPublishingService,
            IRabbitPublisher <TransactionCompletedInBlockchainEvent> transactionCompletedInBlockchainEventPublishingService,
            IRabbitPublisher <UndecodedEvent> undecodedEventPublishingService,
            IRabbitPublisher <StakeIncreasedEvent> stakeIncreasedPublishingService,
            IRabbitPublisher <StakeReleasedEvent> stakeReleasedPublishingService,
            IRabbitPublisher <FeeCollectedEvent> feeCollectedPublishingService,
            IRabbitPublisher <SeizedFromEvent> seizedFromPublishingService,
            IEthNodeClient ethNodeClient,
            IReadOnlyList <string> knownAddresses)
        {
            _customerRegisteredInBlockchainEventPublishingService = customerRegisteredInBlockchainEventPublishingService;
            _mintEventPublishingService     = mintEventPublishingService;
            _transferEventPublishingService = transferEventPublishingService;
            _indexingStateRepository        = indexingStateRepository;
            _log = logFactory.CreateLog(this);
            _transactionFailedInBlockchainEventPublishingService    = transactionFailedInBlockchainEventPublishingService;
            _transactionCompletedInBlockchainEventPublishingService = transactionCompletedInBlockchainEventPublishingService;
            _undecodedEventPublishingService = undecodedEventPublishingService;
            _stakeIncreasedPublishingService = stakeIncreasedPublishingService;
            _stakeReleasedPublishingService  = stakeReleasedPublishingService;
            _feeCollectedPublishingService   = feeCollectedPublishingService;
            _seizedFromPublishingService     = seizedFromPublishingService;
            _ethNodeClient  = ethNodeClient;
            _knownAddresses = new HashSet <string>(knownAddresses.Select(o => o.ToLower()));

            _retryPolicy = Policy
                           .Handle <RpcClientTimeoutException>()
                           .WaitAndRetryAsync(
                DefaultRetryCount,
                attempt => TimeSpan.FromSeconds(Math.Pow(2, attempt)),
                (ex, _) => _log.Error(ex, "Querying transaction node with retry"));
        }