Exemplo n.º 1
0
 public MyNoSqlWriterWrapper(
     IMyNoSqlServerDataWriter <TEntity> writer,
     ILogFactory logFactory)
 {
     _writer = writer;
     _log    = logFactory.CreateLog(this);
 }
Exemplo n.º 2
0
 public ClientWalletService(ILogger <ClientWalletService> logger, IMyNoSqlServerDataWriter <ClientWalletNoSqlEntity> writer,
                            DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder)
 {
     _logger = logger;
     _writer = writer;
     _dbContextOptionsBuilder = dbContextOptionsBuilder;
 }
 public BitGoWalletsService(ILogger <BitGoWalletsService> logger,
                            IMyNoSqlServerDataWriter <BitGoWalletNoSqlEntity> writer, SymmetricEncryptionService encryptionService)
 {
     _logger            = logger;
     _writer            = writer;
     _encryptionService = encryptionService;
 }
Exemplo n.º 4
0
 public ClientWalletService(ILogger <ClientWalletService> logger, IMyNoSqlServerDataWriter <ClientWalletNoSqlEntity> writer,
                            DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder, IServiceBusPublisher <ClientWalletUpdateMessage> publisher)
 {
     _logger = logger;
     _writer = writer;
     _dbContextOptionsBuilder = dbContextOptionsBuilder;
     _publisher = publisher;
 }
 public QuotePublisher(IPublisher <BidAsk> publisher, IPublisher <IBidAsk> candlePublisher, IMyNoSqlServerDataWriter <BidAskNoSql> writer, ILogger <QuotePublisher> logger)
 {
     _publisher       = publisher;
     _candlePublisher = candlePublisher;
     _writer          = writer;
     _logger          = logger;
     _timer           = new MyTaskTimer(nameof(QuotePublisher), TimeSpan.FromMilliseconds(WriterDelayMs), logger, DoProcess);
 }
Exemplo n.º 6
0
 public SmsService(ILogger <SmsProviderService> logger,
                   ISmsProviderManager smsProviderManager,
                   IMyNoSqlServerDataWriter <TemplateMyNoSqlEntity> templateWriter)
 {
     _logger             = logger;
     _smsProviderManager = smsProviderManager;
     _templateWriter     = templateWriter;
 }
 public LpWalletManager(
     ILogger <LpWalletManager> logger,
     IMyNoSqlServerDataWriter <LpWalletNoSql> noSqlDataWriter,
     IWalletBalanceService walletBalanceService)
 {
     _logger               = logger;
     _noSqlDataWriter      = noSqlDataWriter;
     _walletBalanceService = walletBalanceService;
 }
Exemplo n.º 8
0
 public BitGoUsersService(ILogger <BitGoUsersService> logger,
                          IMyNoSqlServerDataWriter <BitGoUserNoSqlEntity> writer,
                          IBitGoClientService bitGoClientService, SymmetricEncryptionService encryptionService)
 {
     _logger             = logger;
     _writer             = writer;
     _bitGoClientService = bitGoClientService;
     _encryptionService  = encryptionService;
 }
 public KycProfileRepository(
     IMyNoSqlServerDataWriter <KycProfileNoSqlEntity> cache,
     DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder,
     ILogger <KycProfileRepository> logger, KycStatusSetter statusSetter)
 {
     _cache = cache;
     _dbContextOptionsBuilder = dbContextOptionsBuilder;
     _logger       = logger;
     _statusSetter = statusSetter;
 }
 public ValidatorsController(IMyNoSqlServerDataWriter <ValidatorLinkEntity> validationWriter,
                             IMyNoSqlServerDataReader <ValidatorLinkEntity> validationReader,
                             IMyNoSqlServerDataWriter <PingMessageMyNoSqlEntity> pingMessageWriter,
                             ILogger <ValidatorsController> logger)
 {
     _validationWriter  = validationWriter;
     _validationReader  = validationReader;
     _pingMessageWriter = pingMessageWriter;
     _logger            = logger;
 }
Exemplo n.º 11
0
 public TransfersService(IMyNoSqlServerDataReader <ApprovalRequestMyNoSqlEntity> approvalRequestReader,
                         IMyNoSqlServerDataWriter <ApprovalRequestMyNoSqlEntity> approvalRequestWriter,
                         IMyNoSqlServerDataReader <ValidatorLinkEntity> validatorLinkReader,
                         ILogger <TransfersService> logger)
 {
     _approvalRequestReader = approvalRequestReader;
     _approvalRequestWriter = approvalRequestWriter;
     _validatorLinkReader   = validatorLinkReader;
     _logger = logger;
 }
Exemplo n.º 12
0
 public BalancesSubscriber(
     string connectionString,
     string exchangeName,
     IMyNoSqlServerDataWriter <BalanceEntity> writer,
     ILogFactory logFactory)
 {
     _connectionString = connectionString;
     _exchangeName     = exchangeName;
     _writer           = writer;
     _logFactory       = logFactory;
 }
Exemplo n.º 13
0
 public OrderbooksSubscriber(
     string connectionString,
     string exchangeName,
     IMyNoSqlServerDataWriter <OrderbookEntity> orderbookWriter,
     ILogFactory logFactory)
 {
     _connectionString = connectionString;
     _exchangeName     = exchangeName;
     _orderbookWriter  = orderbookWriter;
     _logFactory       = logFactory;
 }
Exemplo n.º 14
0
 public SessionService(
     IMyNoSqlServerDataReader <SessionEntity> sessionsReader,
     IMyNoSqlServerDataWriter <SessionEntity> sessionsWriter,
     IClientSessionsClient clientSessionsClient,
     int expirationTimeInMins
     )
 {
     _sessionsReader       = sessionsReader;
     _sessionsWriter       = sessionsWriter;
     _clientSessionsClient = clientSessionsClient;
     _expirationTimeInMins = expirationTimeInMins;
 }
Exemplo n.º 15
0
 public ValidatorsService(
     IMyNoSqlServerDataWriter <ApprovalRequestMyNoSqlEntity> dataWriter,
     IMyNoSqlServerDataReader <ApprovalRequestMyNoSqlEntity> dataReader,
     IMyNoSqlServerDataReader <ValidatorLinkEntity> validatorLinkReader,
     IPushNotificator pushNotificator,
     ILogger <ValidatorsService> logger)
 {
     _dataWriter          = dataWriter;
     _dataReader          = dataReader;
     _validatorLinkReader = validatorLinkReader;
     _pushNotificator     = pushNotificator;
     _logger = logger;
 }
Exemplo n.º 16
0
 public CandlesSubscriber(
     string connectionString,
     string exchangeName,
     IMyNoSqlServerDataWriter <CandleEntity> candlesWriter,
     IMapper mapper,
     ILogFactory logFactory)
 {
     _connectionString = connectionString;
     _exchangeName     = exchangeName;
     _candlesWriter    = candlesWriter;
     _mapper           = mapper;
     _logFactory       = logFactory;
 }
Exemplo n.º 17
0
 public InvitesService(AuthConfig authConfig,
                       IMyNoSqlServerDataReader <ValidatorLinkEntity> validatorLinkReader,
                       IMyNoSqlServerDataWriter <ValidatorLinkEntity> validatorLinkWriter,
                       IMyNoSqlServerDataReader <PingMessageMyNoSqlEntity> pingMessageReader,
                       IMyNoSqlServerDataWriter <PingMessageMyNoSqlEntity> pingMessageWriter,
                       ILogger <InvitesService> logger)
 {
     _authConfig          = authConfig;
     _validatorLinkReader = validatorLinkReader;
     _validatorLinkWriter = validatorLinkWriter;
     _pingMessageReader   = pingMessageReader;
     _pingMessageWriter   = pingMessageWriter;
     _logger = logger;
 }
Exemplo n.º 18
0
 public SessionService(
     IMyNoSqlServerDataReader <SessionEntity> sessionsReader,
     IMyNoSqlServerDataWriter <SessionEntity> sessionsWriter,
     IMyNoSqlServerDataReader <RegistrationTokenEntity> registrationTokenReader,
     IMyNoSqlServerDataWriter <RegistrationTokenEntity> registrationTokenWriter,
     SessionConfig sessionConfig
     )
 {
     _registrationTokenWriter = registrationTokenWriter;
     _sessionsReader          = sessionsReader;
     _sessionsWriter          = sessionsWriter;
     _registrationTokenReader = registrationTokenReader;
     _sessionConfig           = sessionConfig;
 }
 public AuthorizationService(
     ILogger <AuthorizationService> logger, SettingsModel settings,
     IMyNoSqlServerDataWriter <SpotSessionNoSql> writer,
     IClientRegistrationService clientRegistrationService,
     IClientWalletService clientWalletService,
     ISessionAuditService sessionAuditService)
 {
     _logger   = logger;
     _settings = settings;
     _writer   = writer;
     _clientRegistrationService = clientRegistrationService;
     _clientWalletService       = clientWalletService;
     _sessionAuditService       = sessionAuditService;
 }
Exemplo n.º 20
0
 public QuotesFeedSubscriber(
     IDatabase database,
     ILogFactory logFactory,
     string connectionString,
     string exchangeName,
     IMyNoSqlServerDataWriter <Price> priceWriter
     )
 {
     _database         = database;
     _logFactory       = logFactory;
     _connectionString = connectionString;
     _exchangeName     = exchangeName;
     _priceWriter      = priceWriter;
     _log = logFactory.CreateLog(this);
 }
        public SmsProviderManager(ILogger <SmsProviderManager> logger,
                                  SettingsModel settingsModel,
                                  IMyNoSqlServerDataWriter <ProviderRouteMyNoSqlEntity> writer,
                                  DbContextOptionsBuilder <SmsSenderDbContext> dbContextOptionsBuilder)
        {
            _logger = logger;
            _writer = writer;
            _dbContextOptionsBuilder = dbContextOptionsBuilder;

            foreach (var(providerName, provider) in settingsModel.SmsProviders)
            {
                var clientFactory = new SmsSenderClientFactory(provider.GrpcUrl);
                _serviceImplementations[providerName] = clientFactory.GetSmsDeliveryService();
            }
        }
Exemplo n.º 22
0
 public OrdersSubscriber(
     string connectionString,
     string exchangeName,
     IMyNoSqlServerDataWriter <OrderEntity> orderWriter,
     IMyNoSqlServerDataWriter <TradeEntity> tradeWriter,
     IMapper mapper,
     ILogFactory logFactory)
 {
     _connectionString = connectionString;
     _exchangeName     = exchangeName;
     _orderWriter      = orderWriter;
     _tradeWriter      = tradeWriter;
     _mapper           = mapper;
     _logFactory       = logFactory;
 }
 public ClientAccountManager(IPersonalData personalData, IAuthService authService, IClientWalletService clientWalletService,
                             IMyNoSqlServerDataWriter <ClientProfileEntity> clientProfileDataWriter, IMarketDataService marketDataService,
                             IMyNoSqlServerDataReader <ClientProfileEntity> clientProfileDataReader,
                             ICashInOutProcessor cashInOutProcessor,
                             ILogger <ClientAccountManager> logger)
 {
     _personalData            = personalData;
     _authService             = authService;
     _clientWalletService     = clientWalletService;
     _clientProfileDataWriter = clientProfileDataWriter;
     _marketDataService       = marketDataService;
     _clientProfileDataReader = clientProfileDataReader;
     _cashInOutProcessor      = cashInOutProcessor;
     _logger = logger;
 }
 public PublishTransactionService(ILogger <PublishTransactionService> logger,
                                  IAssetMapper assetMapper,
                                  IServiceBusPublisher <SignalBitGoSessionStateUpdate> sessionPublisher,
                                  IMyNoSqlServerDataReader <BitGoWalletNoSqlEntity> myNoSqlServerWalletDataReader,
                                  IMyNoSqlServerDataWriter <ApiKeyVolumeNoSqlEntity> myNoSqlServerApiKeyDataWriter,
                                  SymmetricEncryptionService encryptionService,
                                  IBitGoClientService bitGoClientService)
 {
     _logger           = logger;
     _assetMapper      = assetMapper;
     _sessionPublisher = sessionPublisher;
     _myNoSqlServerWalletDataReader = myNoSqlServerWalletDataReader;
     _myNoSqlServerApiKeyDataWriter = myNoSqlServerApiKeyDataWriter;
     _encryptionService             = encryptionService;
     _bitGoClientService            = bitGoClientService;
 }
 public InitService(
     IDatabase database,
     ILykkeMarketProfile marketProfileClient,
     ICandleshistoryservice candlesHistoryClient,
     IMyNoSqlServerDataWriter <Ticker> tickerWriter,
     IMyNoSqlServerDataWriter <Price> priceWriter,
     TimeSpan marketDataInterval
     )
 {
     _database             = database;
     _marketProfileClient  = marketProfileClient;
     _candlesHistoryClient = candlesHistoryClient;
     _tickerWriter         = tickerWriter;
     _priceWriter          = priceWriter;
     _marketDataInterval   = marketDataInterval;
 }
Exemplo n.º 26
0
        public static async Task <TEntity> TryGetAsync <TEntity>(this IMyNoSqlServerDataWriter <TEntity> writer, string partitionKey, string rowKey) where TEntity : IMyNoSqlDbEntity, new()
        {
            try
            {
                var entity = await writer.GetAsync(partitionKey, rowKey);

                return(entity);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("Row not found"))
                {
                    return(default(TEntity));
                }

                throw;
            }
        }
Exemplo n.º 27
0
        public static async Task <bool> TryInsertAsync <TEntity>(this IMyNoSqlServerDataWriter <TEntity> writer, TEntity entity) where TEntity : IMyNoSqlDbEntity, new()
        {
            try
            {
                await writer.InsertAsync(entity);

                return(true);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("Call failed with status code 409 (Conflict)"))
                {
                    return(false);
                }

                throw;
            }
        }
 public ClientWalletService(
     IMyNoSqlServerDataReader <ClientWalletEntity> walletsReader,
     ILogger <ClientWalletService> logger,
     IMyNoSqlServerDataWriter <ClientWalletEntity> walletsWriter,
     IMyNoSqlServerDataReader <ClientWalletIndexByIdEntity> walletsByIdReader,
     IMyNoSqlServerDataWriter <ClientWalletIndexByIdEntity> walletsByIdWriter,
     IDbConnectionFactory dbConnectionFactory,
     IMarketDataService marketDataService
     )
 {
     _walletsReader       = walletsReader;
     _logger              = logger;
     _walletsWriter       = walletsWriter;
     _walletsByIdReader   = walletsByIdReader;
     _walletsByIdWriter   = walletsByIdWriter;
     _dbConnectionFactory = dbConnectionFactory;
     _marketDataService   = marketDataService;
 }
        public BitGoDepositAddressesGenerationJob(
            ILogger <BitGoDepositAddressesGenerationJob> logger,
            IBitGoAssetMapSettingsService bitGoAssetMapSettingsService,
            IMyNoSqlServerDataWriter <GeneratedDepositAddressEntity> dataWriter,
            DepositAddressGeneratorService depositAddressGeneratorService,
            IAssetsDictionaryClient assetsDictionaryClient,
            IAssetPaymentSettingsClient assetPaymentSettingsClient)
        {
            _logger = logger;
            _bitGoAssetMapSettingsService = bitGoAssetMapSettingsService;
            _dataWriter = dataWriter;
            _depositAddressGeneratorService = depositAddressGeneratorService;
            _assetsDictionaryClient         = assetsDictionaryClient;
            _assetPaymentSettingsClient     = assetPaymentSettingsClient;

            _timer = new MyTaskTimer(typeof(BitGoDepositAddressesGenerationJob),
                                     TimeSpan.FromSeconds(Program.ReloadedSettings(e => e.GenerateAddressesIntervalSec).Invoke()),
                                     logger, DoTime);
        }
        public OperationHistoryWriter(
            ILogger <OperationHistoryWriter> logger,
            DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder,
            IMyNoSqlServerDataWriter <OperationHistoryNoSqlEntity> writer,
            ISubscriber <IReadOnlyList <Withdrawal> > withdrawalSubscriber,
            ISubscriber <IReadOnlyList <Deposit> > depositSubscriber,
            ISubscriber <IReadOnlyList <SwapMessage> > swapSubscriber,
            ISubscriber <IReadOnlyList <Transfer> > transferSubscriber,
            ISubscriber <IReadOnlyList <ManualChangeBalanceMessage> > manualChangeSubscriber,
            ISubscriber <IReadOnlyList <PaidInterestRateMessage> > interestRateSubscriber,
            ISubscriber <IReadOnlyList <FeePaymentEntity> > feePaymentSubscriber,
            ISubscriber <IReadOnlyList <RewardPaymentMessage> > rewardSubscriber,
            ISubscriber <IReadOnlyList <SimplexIntention> > simplexSubscriber,
            ISubscriber <IReadOnlyList <InvestOrder> > investSubscriber,
            ISubscriber <IReadOnlyList <InitialFuturePayment> > futurePaymentSubscriber,
            ISubscriber <IReadOnlyList <ClientOfferAction> > clientOfferActionSubscriber,
            MyLocker locker, IConvertIndexPricesClient pricesClient)
        {
            _logger = logger;
            _dbContextOptionsBuilder = dbContextOptionsBuilder;
            _writer       = writer;
            _locker       = locker;
            _pricesClient = pricesClient;
            Program.Settings.MmWallets.Split(';').ToList();

            //subscriber.Subscribe(HandleEvents);
            withdrawalSubscriber.Subscribe(HandleWithdrawalUpdates);
            depositSubscriber.Subscribe(HandleDepositUpdates);
            swapSubscriber.Subscribe(HandleSwapUpdates);
            transferSubscriber.Subscribe(HandleTransferUpdates);
            manualChangeSubscriber.Subscribe(HandleManualChangeUpdates);
            interestRateSubscriber.Subscribe(HandleInterestRateUpdates);
            feePaymentSubscriber.Subscribe(HandleFeePaymentUpdates);
            rewardSubscriber.Subscribe(HandleRewardPaymentUpdates);
            simplexSubscriber.Subscribe(HandleNewSimplexUpdates);
            investSubscriber.Subscribe(HandleInvestOrdersUpdates);
            futurePaymentSubscriber.Subscribe(HandleFuturePayments);
            clientOfferActionSubscriber.Subscribe(HandleEarnClientOfferActionUpdates);

            _timer = new MyTaskTimer(nameof(OperationHistoryWriter), TimeSpan.FromSeconds(60), logger, DoTimer);
            _timer.Start();
        }