public BlockchainEventDecoder(IMapper mapper)
 {
     _mapper            = mapper;
     _eventTopicDecoder = new EventTopicDecoder();
     _publicAccountLinkedEventSignature   = $"0x{ABITypedRegistry.GetEvent<PublicAccountLinkedEventDTO>().Sha3Signature}";
     _publicAccountUnlinkedEventSignature = $"0x{ABITypedRegistry.GetEvent<PublicAccountUnlinkedEventDTO>().Sha3Signature}";
 }
 public EventMatcher(
     IEventAddressMatcher addressMatcher     = null,
     IEventParameterMatcher parameterMatcher = null)
     : base(null, addressMatcher, parameterMatcher)
 {
     Abis = new[] { ABITypedRegistry.GetEvent <TEvent>() };
 }
 public BlockchainEventDecoder(IMapper mapper)
 {
     _mapper            = mapper;
     _eventTopicDecoder = new EventTopicDecoder();
     _transferedFromPublicNetworkEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferredFromPublicNetworkEventDTO>().Sha3Signature}";
     _transferedToPublicNetworkEventSignature   = $"0x{ABITypedRegistry.GetEvent<TransferredToPublicNetworkEventDTO>().Sha3Signature}";
 }
        public static NewFilterInput CreateFilterInput <TEventDTO>(this TEventDTO eventDTO, string[] contractAddress, object[] filterTopic1, BlockParameter fromBlock = null,
                                                                   BlockParameter toBlock = null) where TEventDTO : IEventDTO
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI.CreateFilterInput(contractAddress, filterTopic1, fromBlock, toBlock));
        }
Beispiel #5
0
        public static bool IsFilterInputForEvent <TEventDTO>(string contractAddress,
                                                             NewFilterInput filterInput)
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI.IsFilterInputForEvent(contractAddress, filterInput));
        }
 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 BlockchainEventDecoder(IMapper mapper)
 {
     _eventTopicDecoder = new EventTopicDecoder();
     _transferReceivedEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferReceivedEventDTO>().Sha3Signature}";
     _transferAcceptedEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferAcceptedEventDTO>().Sha3Signature}";
     _transferRejectedEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferRejectedEventDTO>().Sha3Signature}";
     _mapper = mapper;
 }
        public static NewFilterInput CreateFilterInput <TEventDTO>(string contractAddress, object[] filterTopic1, object[] filterTopic2, object[] filterTopic3,
                                                                   BlockParameter fromBlock = null, BlockParameter toBlock = null)
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI.CreateFilterInput(contractAddress, filterTopic1, filterTopic2, filterTopic3, fromBlock,
                                              toBlock));
        }
Beispiel #9
0
        public void Filter_AddsAnEventSignatureBasedFilter()
        {
            var processor = new LogsProcessorBuilder(blockchainUrl: BLOCKCHAIN_URL)
                            .Filter <TestData.Contracts.StandardContract.TransferEvent>();

            Assert.Equal(
                ABITypedRegistry
                .GetEvent <TestData.Contracts.StandardContract.TransferEvent>()
                .Sha3Signature.EnsureHexPrefix(),
                processor.Filters[0].Topics[0]);
        }
        public void Assigns_Event_Signature_To_Topic0()
        {
            var filter = new FilterInputBuilder <TransferEvent>().Build();

            var eventAbi = ABITypedRegistry.GetEvent <TransferEvent>();

            Assert.Equal(eventAbi.Sha3Signature.EnsureHexPrefix(), filter.Topics.FirstOrDefault());

            Assert.False(filter.IsTopicFiltered(1));
            Assert.False(filter.IsTopicFiltered(2));
            Assert.False(filter.IsTopicFiltered(3));
        }
Beispiel #11
0
        public void Filter_SetsAnEventSignatureBasedFilter_WithContractAddresses()
        {
            string[] CONTRACT_ADDRESSES = new[] { "0x243e72b69141f6af525a9a5fd939668ee9f2b354", "0x343e72b69141f6af525a9a5fd939668ee9f2b354" };

            var processor = new LogsProcessorBuilder(blockchainUrl: BLOCKCHAIN_URL, contractAddresses: CONTRACT_ADDRESSES)
                            .Filter <TestData.Contracts.StandardContract.TransferEvent>();

            //should override and replace contract address filter with a new filter for contract address and event
            Assert.Single(processor.Filters);

            Assert.Equal(
                ABITypedRegistry
                .GetEvent <TestData.Contracts.StandardContract.TransferEvent>()
                .Sha3Signature.EnsureHexPrefix(),
                processor.Filters[0].Topics[0]);


            Assert.Equal(CONTRACT_ADDRESSES, processor.Filters[0].Address);
        }
        public UndecodedEventSubscriber(
            IPurchaseService purchaseService,
            IOperationsService operationsService,
            ISettingsService settingsService,
            string connectionString,
            string exchangeName,
            string queueName,
            ILogFactory logFactory)
            : base(connectionString, exchangeName, queueName, true, logFactory)
        {
            _purchaseService   = purchaseService;
            _operationsService = operationsService;
            _log = logFactory.CreateLog(this);

            _eventTopicDecoder = new EventTopicDecoder();

            _transferReceivedEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferReceivedEventDTO>().Sha3Signature}";
            _transferAcceptedEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferAcceptedEventDTO>().Sha3Signature}";
            _transferRejectedEventSignature = $"0x{ABITypedRegistry.GetEvent<TransferRejectedEventDTO>().Sha3Signature}";
            _contractAddress = settingsService.GetContractAddress();
        }
Beispiel #13
0
        public static List <EventLog <TEventDTO> > DecodeAllEvents <TEventDTO>(this FilterLog[] logs) where TEventDTO : new()
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(DecodeAllEvents <TEventDTO>(eventABI, logs));
        }
Beispiel #14
0
 public EventPrinter()
 {
     _eventName = ABITypedRegistry.GetEvent <TEvent>().Name;
 }
 public NewFilterInputBuilder()
 {
     _eventAbi = ABITypedRegistry.GetEvent <TEventDTo>();
     _topics   = new TopicFilterContainer <TEventDTo>();
 }
Beispiel #16
0
        public static bool IsLogForEvent <TEventDTO>(this FilterLog log)
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI.IsLogForEvent(log));
        }
Beispiel #17
0
        public static EventABI GetEventABI <TEventDTO>(this TEventDTO eventDTO) where TEventDTO : IEventDTO
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI);
        }
Beispiel #18
0
        public static TEventDTO DecodeEvent <TEventDTO>(this TEventDTO eventDTO, FilterLog log) where TEventDTO : IEventDTO
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(DecodeEvent <TEventDTO>(eventDTO, eventABI, log));
        }
Beispiel #19
0
        public static EventLog <TEventDTO> DecodeEvent <TEventDTO>(this FilterLog log) where TEventDTO : new()
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI.DecodeEvent <TEventDTO>(log));
        }
Beispiel #20
0
        public static List <EventLog <TEventDTO> > DecodeAllEvents <TEventDTO>(this JArray logs) where TEventDTO : new()
        {
            var eventABI = ABITypedRegistry.GetEvent <TEventDTO>();

            return(eventABI.DecodeAllEvents <TEventDTO>(logs));
        }