public DepositWalletsBalanceProcessingPeriodicalHandler(
            ILogFactory logFactory,
            TimeSpan period,
            int batchSize,
            string blockchainType,
            IBlockchainApiClientProvider blockchainApiClientProvider,
            ICqrsEngine cqrsEngine,
            IAssetsServiceWithCache assetsService,
            IEnrolledBalanceRepository enrolledBalanceRepository,
            IHotWalletsProvider hotWalletsProvider,
            ICashinRepository cashinRepository,
            IDepositWalletLockRepository depositWalletLockRepository,
            IChaosKitty chaosKitty)
        {
            _logFactory                  = logFactory;
            _batchSize                   = batchSize;
            _blockchainType              = blockchainType;
            _blockchainApiClient         = blockchainApiClientProvider.Get(blockchainType);
            _cqrsEngine                  = cqrsEngine;
            _assetsService               = assetsService;
            _enrolledBalanceRepository   = enrolledBalanceRepository;
            _hotWalletsProvider          = hotWalletsProvider;
            _cashinRepository            = cashinRepository;
            _depositWalletLockRepository = depositWalletLockRepository;
            _chaosKitty                  = chaosKitty;

            _timer = new TimerTrigger(
                $"{nameof(DepositWalletsBalanceProcessingPeriodicalHandler)} : {blockchainType}",
                period,
                _logFactory);

            _timer.Triggered += ProcessBalancesAsync;
        }
Example #2
0
        public BalanceProcessor(
            string blockchainType,
            ILogFactory logFactory,
            IHotWalletsProvider hotWalletsProvider,
            IBlockchainApiClient blockchainApiClient,
            ICqrsEngine cqrsEngine,
            IEnrolledBalanceRepository enrolledBalanceRepository,
            IReadOnlyDictionary <string, Asset> assets,
            IReadOnlyDictionary <string, BlockchainAsset> blockchainAssets)
        {
            _blockchainType            = blockchainType;
            _log                       = logFactory.CreateLog(this);
            _hotWalletAddress          = hotWalletsProvider.GetHotWalletAddress(blockchainType);
            _blockchainApiClient       = blockchainApiClient;
            _cqrsEngine                = cqrsEngine;
            _enrolledBalanceRepository = enrolledBalanceRepository;
            _assets                    = assets;
            _blockchainAssets          = blockchainAssets;

            _warningAssets = new HashSet <string>();
        }