private static void AddCatchAllForMaker(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Maker Monitor", PartitionId = partitionId }); var queue = repo.Add(new SubscriberQueueDto { Id = id.Next <SubscriberQueueDto>(), SubscriberId = subscriber.Id, Name = "subscriber-maker-dao" }); var makerDao = repo.Add( new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = subscriber.Id, Name = "MakerDAO", Abi = MAKER_DAO_ABI }); var anyEventSub = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id, ContractId = makerDao.Id, CatchAllContractEvents = true }); repo.Add(new EventSubscriptionAddressDto { EventSubscriptionId = anyEventSub.Id, Address = MAKER_CONTRACT_ADDRESS }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = anyEventSub.Id, HandlerType = EventHandlerType.Queue, Order = 1, SubscriberQueueId = queue.Id }); }
public static void AddMary(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Mary", PartitionId = partitionId }); var queue = repo.Add(new SubscriberQueueDto { Id = id.Next <SubscriberQueueDto>(), SubscriberId = subscriber.Id, Name = "subscriber-mary" }); var standardContract = repo.Add( new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = subscriber.Id, Name = "StandardContract", Abi = StandardContractAbi }); var anyEventSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id, ContractId = standardContract.Id, CatchAllContractEvents = true }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = anyEventSubscription.Id, HandlerType = EventHandlerType.Queue, Order = 1, SubscriberQueueId = queue.Id }); }
public static void AddCharlie(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Charlie", PartitionId = partitionId }); var repository = repo.Add(new SubscriberStorageDto { Id = id.Next <SubscriberStorageDto>(), SubscriberId = subscriber.Id, Name = "charlielogs" }); var contract = repo.Add(new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = subscriber.Id, Abi = StandardContractAbi, Name = "StandardContract" }); var catchAllSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id, ContractId = contract.Id, EventSignatures = new List <string>(new [] { TransferEventSignature }) }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAllSubscription.Id, HandlerType = EventHandlerType.Store, Order = 1, SubscriberRepositoryId = repository.Id }); }
public static void AddIan(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var indexer = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Ian", PartitionId = partitionId }); var searchIndex = repo.Add(new SubscriberSearchIndexDto { Id = id.Next <SubscriberSearchIndexDto>(), SubscriberId = indexer.Id, Name = "subscriber-transfer-ian" }); var contract = repo.Add(new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = indexer.Id, Abi = StandardContractAbi, Name = "StandardContract" }); var catchAllSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = indexer.Id, ContractId = contract.Id, EventSignatures = new List <string>(new [] { TransferEventSignature }) }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAllSubscription.Id, HandlerType = EventHandlerType.Index, Order = 2, SubscriberSearchIndexId = searchIndex.Id }); }
public static void AddHarry(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Harry", PartitionId = partitionId }); var queue = repo.Add(new SubscriberQueueDto { Id = id.Next <SubscriberQueueDto>(), SubscriberId = subscriber.Id, Name = "subscriber-harry" }); var standardContract = repo.Add( new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = subscriber.Id, Name = "StandardContract", Abi = StandardContractAbi }); var transferSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id, ContractId = standardContract.Id, EventSignatures = new List <string>(new[] { TransferEventSignature }) }); var getTransactionHandler = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferSubscription.Id, HandlerType = EventHandlerType.GetTransaction, Order = 0 }); var transferValueRunningTotalHandler = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferSubscription.Id, HandlerType = EventHandlerType.Aggregate, Order = 1 }); repo.Add(new EventAggregatorDto { Id = id.Next <EventAggregatorDto>(), EventHandlerId = transferValueRunningTotalHandler.Id, Destination = AggregatorDestination.EventSubscriptionState, Operation = AggregatorOperation.Sum, Source = AggregatorSource.EventParameter, EventParameterNumber = 3, OutputKey = "RunningTotalForTransferValue" }); var getTokenHandler = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferSubscription.Id, HandlerType = EventHandlerType.ContractQuery, Order = 2 }); repo.Add(new ContractQueryDto { Id = id.Next <ContractQueryDto>(), EventHandlerId = getTokenHandler.Id, ContractId = standardContract.Id, ContractAddressSource = ContractAddressSource.EventAddress, EventStateOutputName = "TokenName", FunctionSignature = "06fdde03" // name }); var getBalanceHandler = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferSubscription.Id, HandlerType = EventHandlerType.ContractQuery, Order = 3 }); var getBalanceQuery = repo.Add(new ContractQueryDto { Id = id.Next <ContractQueryDto>(), EventHandlerId = getBalanceHandler.Id, ContractId = 1, ContractAddressSource = ContractAddressSource.EventAddress, EventStateOutputName = "FromAddressCurrentBalance", FunctionSignature = "70a08231" // balanceOf }); repo.Add(new ContractQueryParameterDto { Id = id.Next <ContractQueryParameterDto>(), ContractQueryId = getBalanceQuery.Id, Order = 1, Source = EventValueSource.EventParameters, EventParameterNumber = 1 }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferSubscription.Id, HandlerType = EventHandlerType.Queue, Order = 4, SubscriberQueueId = queue.Id }); }
public static void AddGeorge(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "George", PartitionId = partitionId }); var queue = repo.Add(new SubscriberQueueDto { Id = id.Next <SubscriberQueueDto>(), SubscriberId = subscriber.Id, Name = "subscriber-george" }); var standardContract = repo.Add( new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = subscriber.Id, Name = "StandardContract", Abi = StandardContractAbi }); var transferEventSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id, ContractId = standardContract.Id, EventSignatures = new List <string>(new[] { TransferEventSignature }) }); var transferCountHandler = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferEventSubscription.Id, HandlerType = EventHandlerType.Aggregate, Order = 1 }); repo.Add(new EventAggregatorDto { Id = id.Next <EventAggregatorDto>(), EventHandlerId = transferCountHandler.Id, Destination = AggregatorDestination.EventSubscriptionState, Operation = AggregatorOperation.Count, OutputKey = "CurrentTransferCount" }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = transferEventSubscription.Id, HandlerType = EventHandlerType.Queue, Order = 2, SubscriberQueueId = queue.Id }); }
public static void AddNosey(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Nosey", PartitionId = partitionId }); var queue = repo.Add(new SubscriberQueueDto { Id = id.Next <SubscriberQueueDto>(), SubscriberId = subscriber.Id, Name = "subscriber-nosey" }); var catchAnyEventForAddressSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id }); repo.Add(new EventSubscriptionAddressDto { Id = id.Next <EventSubscriptionAddressDto>(), EventSubscriptionId = catchAnyEventForAddressSubscription.Id, Address = "0x924442a66cfd812308791872c4b242440c108e19" }); var txHashTracker = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAnyEventForAddressSubscription.Id, HandlerType = EventHandlerType.Aggregate, Order = 1 }); repo.Add(new EventAggregatorDto { EventHandlerId = txHashTracker.Id, Source = AggregatorSource.TransactionHash, Destination = AggregatorDestination.EventSubscriptionState, OutputKey = "AllTransactionHashes", Operation = AggregatorOperation.AddToList }); var blockTracker = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAnyEventForAddressSubscription.Id, HandlerType = EventHandlerType.Aggregate, Order = 2 }); repo.Add(new EventAggregatorDto { EventHandlerId = blockTracker.Id, Source = AggregatorSource.BlockNumber, Destination = AggregatorDestination.EventSubscriptionState, OutputKey = "AllBlockNumbers", Operation = AggregatorOperation.AddToList }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAnyEventForAddressSubscription.Id, HandlerType = EventHandlerType.Queue, Order = 2, SubscriberQueueId = queue.Id }); }
public static void AddEric(long partitionId, IdGenerator id, EventProcessingConfigContext repo) { var subscriber = repo.Add(new SubscriberDto { Id = id.Next <SubscriberDto>(), Disabled = false, Name = "Eric", PartitionId = partitionId }); var contract = repo.Add(new SubscriberContractDto { Id = id.Next <SubscriberContractDto>(), SubscriberId = subscriber.Id, Abi = StandardContractAbi, Name = "StandardContract" }); var catchAllTransfersSubscription = repo.Add( new EventSubscriptionDto { Id = id.Next <EventSubscriptionDto>(), SubscriberId = subscriber.Id, ContractId = contract.Id, EventSignatures = new List <string>(new [] { TransferEventSignature }) }); var ruleHandler = repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAllTransfersSubscription.Id, HandlerType = EventHandlerType.Rule, Order = 1 }); repo.Add(new EventRuleConfigurationDto { Id = id.Next <EventRuleConfigurationDto>(), EventHandlerId = ruleHandler.Id, Type = EventRuleType.Modulus, Source = EventRuleSource.EventSubscriptionState, SourceKey = "EventsHandled", Value = "10" }); var queue = repo.Add(new SubscriberQueueDto { Id = id.Next <SubscriberQueueDto>(), SubscriberId = subscriber.Id, Name = "subscriber-transfer-eric" }); repo.Add(new EventHandlerDto { Id = id.Next <EventHandlerDto>(), EventSubscriptionId = catchAllTransfersSubscription.Id, HandlerType = EventHandlerType.Queue, Order = 2, SubscriberQueueId = queue.Id }); }