Beispiel #1
0
        private async Task SyncTransactionsAsync(
            IEthplorerClient ethplorerClient,
            IBloxyClient bloxyClient,
            ITransactionRepository transactionService,
            IOperationRepository operationService,
            EthereumAddress contractAddress,
            DateTime startDate,
            DateTime endDate)
        {
            Console.WriteLine($"[{contractAddress}] Processing Batch: {startDate} -> {endDate}");

            await foreach (var transactionSummary in bloxyClient.ListTransactionsAsync(contractAddress, startDate, endDate))
            {
                var hash = new EthereumTransactionHash(transactionSummary.Hash);

                var transaction = await ethplorerClient.GetTransactionAsync(hash);

                if (transaction != null)
                {
                    Console.WriteLine($"[{contractAddress}] Discovering Hash {hash} with ({transaction.Operations.Count}) operations.");

                    var dynamoTransaction = MapTransaction(hash, contractAddress, transactionSummary, transaction);

                    await transactionService.UploadItemsAsync(dynamoTransaction);

                    var dynamoOperations = Enumerable.Range(0, transaction.Operations.Count)
                                           .Select(i => MapOperation(hash, transaction.Operations[i], i))
                                           .ToArray();

                    await operationService.UploadItemsAsync(dynamoOperations);
                }
            }

            Console.WriteLine($"[{contractAddress}] Finished Batch: {startDate} -> {endDate}");
        }
Beispiel #2
0
 public StakeService(
     IOptions <AppSettings> appSettings,
     IEtherClient etherClient,
     IGraphClient graphClient,
     IEthplorerClient ethplorerClient,
     IFundService fundService,
     ICurrencyConverter currencyConverter,
     IStakingPowerRepository stakingPowerRepository,
     ITransactionRepository transactionRepository,
     IOperationRepository operationRepository,
     IHttpContextAccessor httpContextAccessor,
     IScopedCancellationToken scopedCancellationToken)
     : base(appSettings, currencyConverter, transactionRepository, operationRepository, httpContextAccessor, scopedCancellationToken)
 {
     this.etherClient            = etherClient;
     this.graphClient            = graphClient;
     this.ethplorerClient        = ethplorerClient;
     this.fundService            = fundService;
     this.stakingPowerRepository = stakingPowerRepository;
 }
 public FundService(
     IOptions <AppSettings> appSettings,
     IInvictusClient invictusClient,
     IEthplorerClient ethplorerClient,
     ICoinGeckoClient coinGeckoClient,
     IGraphClient graphClient,
     ICurrencyConverter currencyConverter,
     IFundPerformanceRepository fundPerformanceRepository,
     ITransactionRepository transactionRepository,
     IOperationRepository operationRepository,
     IHttpContextAccessor httpContextAccessor,
     IScopedCancellationToken scopedCancellationToken)
     : base(appSettings, currencyConverter, transactionRepository, operationRepository, httpContextAccessor, scopedCancellationToken)
 {
     this.invictusClient            = invictusClient;
     this.ethplorerClient           = ethplorerClient;
     this.coinGeckoClient           = coinGeckoClient;
     this.graphClient               = graphClient;
     this.fundPerformanceRepository = fundPerformanceRepository;
 }