/// <summary> /// Constructor. /// </summary> /// <param name="transactionExecutorFactory">Transaction execution</param> /// <param name="faucetDataManager">Data manager for faucet.</param> /// <param name="ethereumAccountBalanceSource">Balance source for Ethereum/ERC20 tokens.</param> /// <param name="contractInfoRegistry">Registry of contracts.</param> /// <param name="houseFundingIpWhiteList">IP Whitelist for faucet/funding operations.</param> /// <param name="executionEnvironment">The Execution Environment.</param> /// <param name="faucetConfiguration">Faucet configuration.</param> /// <param name="ethereumAccountManager">Ethereum account manager</param> /// <param name="logger">Logging.</param> public FaucetManager(ITransactionExecutorFactory transactionExecutorFactory, IFaucetDataManager faucetDataManager, IEthereumAccountBalanceSource ethereumAccountBalanceSource, IContractInfoRegistry contractInfoRegistry, IWhiteListedIpAddressIdentifier houseFundingIpWhiteList, ExecutionEnvironment executionEnvironment, IFaucetConfiguration faucetConfiguration, IEthereumAccountManager ethereumAccountManager, ILogger <FaucetManager> logger) { if (contractInfoRegistry == null) { throw new ArgumentNullException(nameof(contractInfoRegistry)); } if (faucetConfiguration == null) { throw new ArgumentNullException(nameof(faucetConfiguration)); } this._faucetDataManager = faucetDataManager ?? throw new ArgumentNullException(nameof(faucetDataManager)); this._ethereumAccountBalanceSource = ethereumAccountBalanceSource ?? throw new ArgumentNullException(nameof(ethereumAccountBalanceSource)); this._transactionExecutorFactory = transactionExecutorFactory ?? throw new ArgumentNullException(nameof(transactionExecutorFactory)); this._fundingWhiteList = houseFundingIpWhiteList ?? throw new ArgumentNullException(nameof(houseFundingIpWhiteList)); this._executionEnvironment = executionEnvironment; this._ethereumAccountManager = ethereumAccountManager ?? throw new ArgumentNullException(nameof(ethereumAccountManager)); this._nativeCurrencyLimits = new Limits <EthereumAmount>(amountToIssue: faucetConfiguration.NativeCurrencyToGive, faucetConfiguration.NativeCurrencyToGive / 2); this._tokenCurrencyLimits = new Limits <Token>(amountToIssue: faucetConfiguration.TokenToGive, faucetConfiguration.TokenToGive / 2); this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); this._tokenContract = (Erc20TokenContractInfo)contractInfoRegistry.FindContractInfo(WellKnownContracts.Token); this._faucetContract = contractInfoRegistry.FindContractInfo(WellKnownContracts.Faucet); }
/// <summary> /// Constructor /// </summary> /// <param name="ethereumNetworkConfigurationManager">Ethereum network configuration manager.</param> /// <param name="ethereumAccountWatcher">Ethereum Account Watcher.</param> /// <param name="contractInfoRegistry">Contract info registry</param> /// <param name="alertDispatcher">Alert dispatcher.</param> /// <param name="faucetBalanceConfiguration">Faucet balance configuration</param> /// <param name="logger">Logger.</param> public DrainedFaucetAlerter(IEthereumNetworkConfigurationManager ethereumNetworkConfigurationManager, IEthereumAccountBalanceWatcher ethereumAccountWatcher, IContractInfoRegistry contractInfoRegistry, IAlertDispatcher alertDispatcher, IFaucetBalanceConfiguration faucetBalanceConfiguration, ILogger <DrainedFaucetAlerter> logger) { this._ethereumNetworkConfigurationManager = ethereumNetworkConfigurationManager ?? throw new ArgumentNullException(nameof(ethereumNetworkConfigurationManager)); this._ethereumAccountWatcher = ethereumAccountWatcher ?? throw new ArgumentNullException(nameof(ethereumAccountWatcher)); this._contractInfoRegistry = contractInfoRegistry ?? throw new ArgumentNullException(nameof(contractInfoRegistry)); this._alertDispatcher = alertDispatcher ?? throw new ArgumentNullException(nameof(alertDispatcher)); this._faucetBalanceConfiguration = faucetBalanceConfiguration ?? throw new ArgumentNullException(nameof(faucetBalanceConfiguration)); this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); this._tokenContract = (Erc20TokenContractInfo)contractInfoRegistry.FindContractInfo(WellKnownContracts.Token); this._watchedContracts = new ConcurrentDictionary <NetworkAccount, SubscriptionToken>(); }
/// <summary> /// Constructor. /// </summary> /// <param name="transactionExecutorFactory">Transaction execution</param> /// <param name="faucetDataManager">Data manager for faucet.</param> /// <param name="ethereumAccountBalanceSource">Balance source for Ethereum/ERC20 tokens.</param> /// <param name="contractInfoRegistry">Registry of contracts.</param> /// <param name="houseFundingIpWhiteList">IP Whitelist for faucet/funding operations.</param> /// <param name="executionEnvironment">The Execution Environment.</param> /// <param name="faucetConfiguration">Faucet configuration.</param> /// <param name="ethereumAccountManager">Ethereum account manager</param> /// <param name="logger">Logging.</param> public FaucetManager(ITransactionExecutorFactory transactionExecutorFactory, IFaucetDataManager faucetDataManager, IEthereumAccountBalanceSource ethereumAccountBalanceSource, IContractInfoRegistry contractInfoRegistry, IWhiteListedIpAddressIdentifier houseFundingIpWhiteList, ExecutionEnvironment executionEnvironment, IFaucetConfiguration faucetConfiguration, IEthereumAccountManager ethereumAccountManager, ILogger <FaucetManager> logger) { if (contractInfoRegistry == null) { throw new ArgumentNullException(nameof(contractInfoRegistry)); } if (faucetConfiguration == null) { throw new ArgumentNullException(nameof(faucetConfiguration)); } this._faucetDataManager = faucetDataManager ?? throw new ArgumentNullException(nameof(faucetDataManager)); this._ethereumAccountBalanceSource = ethereumAccountBalanceSource ?? throw new ArgumentNullException(nameof(ethereumAccountBalanceSource)); this._transactionExecutorFactory = transactionExecutorFactory ?? throw new ArgumentNullException(nameof(transactionExecutorFactory)); this._fundingWhiteList = houseFundingIpWhiteList ?? throw new ArgumentNullException(nameof(houseFundingIpWhiteList)); this._executionEnvironment = executionEnvironment; this._ethereumAccountManager = ethereumAccountManager; this._ethToGive = faucetConfiguration.EthToGive; this._tokenToGiven = faucetConfiguration.TokenToGive; this._maximumRecipientEthBalance = this._ethToGive / 2; this._maximumRecipientTokenBalance = this._tokenToGiven / 2; this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); this._tokenContract = (Erc20TokenContractInfo)contractInfoRegistry.FindContractInfo(WellKnownContracts.Token); this._faucetContract = contractInfoRegistry.FindContractInfo(WellKnownContracts.Faucet); }