/// <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="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); }