Ejemplo n.º 1
0
 public EthRpcModule(
     IJsonRpcConfig rpcConfig,
     IBlockchainBridge blockchainBridge,
     IBlockFinder blockFinder,
     IStateReader stateReader,
     ITxPool txPool,
     ITxSender txSender,
     IWallet wallet,
     IReceiptFinder receiptFinder,
     ILogManager logManager,
     ISpecProvider specProvider,
     IGasPriceOracle gasPriceOracle,
     IEthSyncingInfo ethSyncingInfo,
     IFeeHistoryOracle feeHistoryOracle)
 {
     _logger           = logManager.GetClassLogger();
     _rpcConfig        = rpcConfig ?? throw new ArgumentNullException(nameof(rpcConfig));
     _blockchainBridge = blockchainBridge ?? throw new ArgumentNullException(nameof(blockchainBridge));
     _blockFinder      = blockFinder ?? throw new ArgumentNullException(nameof(blockFinder));
     _stateReader      = stateReader ?? throw new ArgumentNullException(nameof(stateReader));
     _txPoolBridge     = txPool ?? throw new ArgumentNullException(nameof(txPool));
     _txSender         = txSender ?? throw new ArgumentNullException(nameof(txSender));
     _wallet           = wallet ?? throw new ArgumentNullException(nameof(wallet));
     _receiptFinder    = receiptFinder ?? throw new ArgumentNullException(nameof(receiptFinder));;
     _specProvider     = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _gasPriceOracle   = gasPriceOracle ?? throw new ArgumentNullException(nameof(gasPriceOracle));
     _ethSyncingInfo   = ethSyncingInfo ?? throw new ArgumentNullException(nameof(ethSyncingInfo));
     _feeHistoryOracle = feeHistoryOracle ?? throw new ArgumentNullException(nameof(feeHistoryOracle));
 }
Ejemplo n.º 2
0
 public EthModuleFactory(
     ITxPool txPool,
     ITxSender txSender,
     IWallet wallet,
     IBlockTree blockTree,
     IJsonRpcConfig config,
     ILogManager logManager,
     IStateReader stateReader,
     IBlockchainBridgeFactory blockchainBridgeFactory,
     ISpecProvider specProvider,
     IReceiptStorage receiptStorage,
     IGasPriceOracle gasPriceOracle,
     IEthSyncingInfo ethSyncingInfo)
 {
     _txPool                  = txPool ?? throw new ArgumentNullException(nameof(txPool));
     _txSender                = txSender ?? throw new ArgumentNullException(nameof(txSender));
     _wallet                  = wallet ?? throw new ArgumentNullException(nameof(wallet));
     _rpcConfig               = config ?? throw new ArgumentNullException(nameof(config));
     _logManager              = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _stateReader             = stateReader ?? throw new ArgumentNullException(nameof(stateReader));
     _blockchainBridgeFactory = blockchainBridgeFactory ?? throw new ArgumentNullException(nameof(blockchainBridgeFactory));
     _specProvider            = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _ethSyncingInfo          = ethSyncingInfo ?? throw new ArgumentNullException(nameof(ethSyncingInfo));
     _receiptStorage          = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
     _gasPriceOracle          = gasPriceOracle ?? throw new ArgumentNullException(nameof(gasPriceOracle));
     _blockTree               = blockTree.AsReadOnly();
 }
Ejemplo n.º 3
0
 public TxGasPriceSender(
     ITxSender txSender,
     IGasPriceOracle gasPriceOracle,
     uint percentDelta = TxGasPriceSenderConstants.DefaultPercentMultiplier)
 {
     _txSender       = txSender ?? throw new ArgumentNullException(nameof(txSender));
     _gasPriceOracle = gasPriceOracle ?? throw new ArgumentNullException(nameof(gasPriceOracle));
     _percentDelta   = percentDelta;
 }
        public void SendTransaction_sets_correct_gas_price(ulong gasEstimate, uint percentDelta, ulong expectedGasPrice)
        {
            IGasPriceOracle gasPriceOracle = Substitute.For <IGasPriceOracle>();

            gasPriceOracle.GetGasPriceEstimate().Returns(gasEstimate);
            ITxSender        txSender         = Substitute.For <ITxSender>();
            TxGasPriceSender txGasPriceSender = new(txSender, gasPriceOracle, percentDelta);
            Transaction      transaction      = Build.A.Transaction.WithGasPrice(0).TestObject;

            txGasPriceSender.SendTransaction(transaction, TxHandlingOptions.None);
            Assert.AreEqual((UInt256)expectedGasPrice, transaction.GasPrice);
        }
Ejemplo n.º 5
0
 public EthStatsIntegration(
     string name,
     string node,
     int port,
     string network,
     string protocol,
     string api,
     string client,
     string contact,
     bool canUpdateHistory,
     string secret,
     IEthStatsClient?ethStatsClient,
     IMessageSender?sender,
     ITxPool?txPool,
     IBlockTree?blockTree,
     IPeerManager?peerManager,
     IGasPriceOracle?gasPriceOracle,
     IEthSyncingInfo ethSyncingInfo,
     bool isMining,
     ILogManager?logManager)
 {
     _name             = name;
     _node             = node;
     _port             = port;
     _network          = network;
     _protocol         = protocol;
     _api              = api;
     _client           = client;
     _contact          = contact;
     _canUpdateHistory = canUpdateHistory;
     _secret           = secret;
     _ethStatsClient   = ethStatsClient ?? throw new ArgumentNullException(nameof(ethStatsClient));
     _sender           = sender ?? throw new ArgumentNullException(nameof(sender));
     _txPool           = txPool ?? throw new ArgumentNullException(nameof(txPool));
     _blockTree        = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     _peerManager      = peerManager ?? throw new ArgumentNullException(nameof(peerManager));
     _gasPriceOracle   = gasPriceOracle ?? throw new ArgumentNullException(nameof(gasPriceOracle));
     _ethSyncingInfo   = ethSyncingInfo ?? throw new ArgumentNullException(nameof(ethSyncingInfo));
     _isMining         = isMining;
     _logger           = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
 }
Ejemplo n.º 6
0
 public AuRaValidatorFactory(IAbiEncoder abiEncoder,
                             IStateProvider stateProvider,
                             ITransactionProcessor transactionProcessor,
                             IBlockTree blockTree,
                             IReadOnlyTxProcessorSource readOnlyTxProcessorSource,
                             IReceiptFinder receiptFinder,
                             IValidatorStore validatorStore,
                             IAuRaBlockFinalizationManager finalizationManager,
                             ITxSender txSender,
                             ITxPool txPool,
                             IMiningConfig miningConfig,
                             ILogManager logManager,
                             ISigner signer,
                             ISpecProvider specProvider,
                             IGasPriceOracle gasPriceOracle,
                             ReportingContractBasedValidator.Cache reportingValidatorCache,
                             long posdaoTransition, bool forSealing = false)
 {
     _stateProvider             = stateProvider;
     _abiEncoder                = abiEncoder;
     _transactionProcessor      = transactionProcessor;
     _readOnlyTxProcessorSource = readOnlyTxProcessorSource;
     _blockTree           = blockTree;
     _receiptFinder       = receiptFinder;
     _validatorStore      = validatorStore;
     _finalizationManager = finalizationManager;
     _txSender            = txSender;
     _txPool                  = txPool;
     _miningConfig            = miningConfig;
     _logManager              = logManager;
     _signer                  = signer;
     _reportingValidatorCache = reportingValidatorCache;
     _posdaoTransition        = posdaoTransition;
     _gasPriceOracle          = gasPriceOracle;
     _forSealing              = forSealing;
     _specProvider            = specProvider;
 }
Ejemplo n.º 7
0
 public ReportingContractBasedValidator(
     ContractBasedValidator contractValidator,
     IReportingValidatorContract reportingValidatorContract,
     long posdaoTransition,
     ITxSender txSender,
     ITxPool txPool,
     IMiningConfig miningConfig,
     IReadOnlyStateProvider stateProvider,
     Cache cache,
     ISpecProvider specProvider,
     IGasPriceOracle gasPriceOracle,
     ILogManager logManager)
 {
     _contractValidator = contractValidator ?? throw new ArgumentNullException(nameof(contractValidator));
     ValidatorContract  = reportingValidatorContract ?? throw new ArgumentNullException(nameof(reportingValidatorContract));
     _posdaoTransition  = posdaoTransition;
     _posdaoTxSender    = txSender ?? throw new ArgumentNullException(nameof(txSender));
     _stateProvider     = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider));
     _cache             = cache ?? throw new ArgumentNullException(nameof(cache));
     _specProvider      = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _nonPosdaoTxSender = new TxGasPriceSender(txSender, gasPriceOracle);
     _persistentReports = cache.PersistentReports;
     _logger            = logManager?.GetClassLogger <ReportingContractBasedValidator>() ?? throw new ArgumentNullException(nameof(logManager));
 }
Ejemplo n.º 8
0
 public Builder <T> WithGasPriceOracle(IGasPriceOracle gasPriceOracle)
 {
     _blockchain.GasPriceOracle = gasPriceOracle;
     return(this);
 }