/// <summary> /// Constructor. /// </summary> /// <param name="ethereumBlockStatus">Ethereum block status.</param> /// <param name="dateTimeSource">Source of date/time.</param> public GameRoundTimeCalculator(IEthereumBlockStatus ethereumBlockStatus, IDateTimeSource dateTimeSource) { this._ethereumBlockStatus = ethereumBlockStatus ?? throw new ArgumentNullException(nameof(ethereumBlockStatus)); this._dateTimeSource = dateTimeSource ?? throw new ArgumentNullException(nameof(dateTimeSource)); this._blockStatus = new ConcurrentDictionary <EthereumNetwork, BlockStatus>(); this._ethereumBlockStatus.OnNewLatestBlock += (_, networkBlockHeader) => this.NewBlockReceived(networkBlockHeader); }
/// <summary> /// Constructor. /// </summary> /// <param name="faucetManager">The Faucet manager.</param> /// <param name="ethereumAccountManager">The Ethereum Account Manager</param> /// <param name="networkManager">Network manager</param> /// <param name="requestIpAddressManager">IP Address manager.</param> /// <param name="contractInfoRegistry">Contract info registry</param> /// <param name="ethereumBlockStatus">Ethereum Block Status</param> public FaucetController(IFaucetManager faucetManager, IEthereumAccountManager ethereumAccountManager, IEthereumNetworkRegistry networkManager, IRemoteIpAddressRetriever requestIpAddressManager, IContractInfoRegistry contractInfoRegistry, IEthereumBlockStatus ethereumBlockStatus) { this._faucetManager = faucetManager ?? throw new ArgumentNullException(nameof(faucetManager)); this._ethereumAccountManager = ethereumAccountManager ?? throw new ArgumentNullException(nameof(ethereumAccountManager)); this._networkManager = networkManager ?? throw new ArgumentNullException(nameof(networkManager)); this._remoteIpAddressRetriever = requestIpAddressManager ?? throw new ArgumentNullException(nameof(requestIpAddressManager)); this._ethereumBlockStatus = ethereumBlockStatus ?? throw new ArgumentNullException(nameof(ethereumBlockStatus)); this._faucetContractInfo = (contractInfoRegistry ?? throw new ArgumentNullException(nameof(contractInfoRegistry))).FindContractInfo(WellKnownContracts.Faucet); }
/// <summary> /// Constructor. /// </summary> /// <param name="ethereumNetworkConfigurationManager"></param> /// <param name="ethereumBlockStatus"></param> /// <param name="latestBlockRetriever">Retriever of the latest blocks.</param> /// <param name="dateTimeSource">Source of time</param> /// <param name="endGameService">Game ending.</param> /// <param name="logger">Logging</param> public EndGameBackgroundService(IEthereumNetworkConfigurationManager ethereumNetworkConfigurationManager, IEthereumBlockStatus ethereumBlockStatus, IEthereumLatestBlockRetriever latestBlockRetriever, IDateTimeSource dateTimeSource, IEndGameService endGameService, ILogger <EndGameBackgroundService> logger) : base(ethereumNetworkConfigurationManager: ethereumNetworkConfigurationManager, ethereumBlockStatus: ethereumBlockStatus, latestBlockRetriever: latestBlockRetriever, processUnchangedBlocks: false, dateTimeSource: dateTimeSource, sweepInterval: TimeSpan.FromSeconds(0.5), blockTriggeredService: new BackgroundService(endGameService), logger: logger) { }
/// <summary> /// Constructor /// </summary> /// <param name="ethereumNetworkRegistry">Ethereum network registry</param> /// <param name="groupNameGenerator">The group name generator</param> /// <param name="environment">Execution environment</param> /// <param name="subscriptionManager">Subscription manager</param> /// <param name="playerCountManager">Player counter.</param> /// <param name="gameRoundDataManager">Game Round Manager.</param> /// <param name="gameRoundTimeCalculator">Game round time calculator.</param> /// <param name="startRoundGameHistoryBuilder">Game Round history builder.</param> /// <param name="ethereumBlockStatus">Ethereum block status.</param> /// <param name="rateLimiter">Rate limiter</param> /// <param name="logger">Logger</param> public AuthenticatedHub(IEthereumNetworkRegistry ethereumNetworkRegistry, IGroupNameGenerator groupNameGenerator, ExecutionEnvironment environment, ISubscriptionManager subscriptionManager, IPlayerCountManager playerCountManager, IGameRoundDataManager gameRoundDataManager, IGameRoundTimeCalculator gameRoundTimeCalculator, IStartRoundGameHistoryBuilder startRoundGameHistoryBuilder, IEthereumBlockStatus ethereumBlockStatus, IRateLimiter rateLimiter, ILogger <AuthenticatedHub> logger) : base(ethereumNetworkRegistry: ethereumNetworkRegistry, groupNameGenerator: groupNameGenerator, environment: environment, subscriptionManager: subscriptionManager, logger: logger) { this._playerCountManager = playerCountManager ?? throw new ArgumentNullException(nameof(playerCountManager)); this._gameRoundDataManager = gameRoundDataManager ?? throw new ArgumentNullException(nameof(gameRoundDataManager)); this._gameRoundTimeCalculator = gameRoundTimeCalculator ?? throw new ArgumentNullException(nameof(gameRoundTimeCalculator)); this._startRoundGameHistoryBuilder = startRoundGameHistoryBuilder ?? throw new ArgumentNullException(nameof(startRoundGameHistoryBuilder)); this._ethereumBlockStatus = ethereumBlockStatus ?? throw new ArgumentNullException(nameof(ethereumBlockStatus)); this._rateLimiter = rateLimiter ?? throw new ArgumentNullException(nameof(rateLimiter)); }
/// <summary> /// Constructor /// </summary> /// <param name="ethereumAccountManager">The ethereum account manager.</param> /// <param name="gameManager">Game Manager.</param> /// <param name="gameRoundDataManager">Game round data manager.</param> /// <param name="ethereumBlockStatus">Ethereum block status.</param> /// <param name="gameManagerLockManager">Game contract lock manager.</param> /// <param name="contractInfoRegistry">The contract info registry.</param> /// <param name="gamesList">Game list.</param> /// <param name="playerCountManager">Player count manager.</param> /// <param name="logger">Logger</param> public StartGameService(IEthereumAccountManager ethereumAccountManager, IGameManager gameManager, IGameRoundDataManager gameRoundDataManager, IEthereumBlockStatus ethereumBlockStatus, IObjectLockManager <EthereumAddress> gameManagerLockManager, IContractInfoRegistry contractInfoRegistry, IGamesList gamesList, IPlayerCountManager playerCountManager, ILogger <StartGameService> logger) { this._ethereumAccountManager = ethereumAccountManager ?? throw new ArgumentNullException(nameof(ethereumAccountManager)); this._gameManager = gameManager ?? throw new ArgumentNullException(nameof(gameManager)); this._gameRoundDataManager = gameRoundDataManager ?? throw new ArgumentNullException(paramName: nameof(gameRoundDataManager)); this._ethereumBlockStatus = ethereumBlockStatus ?? throw new ArgumentNullException(nameof(ethereumBlockStatus)); this._gameManagerLockManager = gameManagerLockManager ?? throw new ArgumentNullException(nameof(gameManagerLockManager)); this._gamesList = gamesList ?? throw new ArgumentNullException(nameof(gamesList)); this._playerCountManager = playerCountManager ?? throw new ArgumentNullException(nameof(playerCountManager)); this._logger = logger ?? throw new ArgumentNullException(paramName: nameof(logger)); this._contractInfo = contractInfoRegistry.FindContractInfo(WellKnownContracts.GameManager); }