public SmartContractsController(IBroadcasterManager broadcasterManager,
                                 IBlockStore blockStore,
                                 ConcurrentChain chain,
                                 CSharpContractDecompiler contractDecompiler,
                                 IDateTimeProvider dateTimeProvider,
                                 ILoggerFactory loggerFactory,
                                 Network network,
                                 IStateRepositoryRoot stateRoot,
                                 IWalletManager walletManager,
                                 ISerializer serializer,
                                 IReceiptRepository receiptRepository,
                                 ILocalExecutor localExecutor,
                                 ISmartContractTransactionService smartContractTransactionService)
 {
     this.stateRoot          = stateRoot;
     this.contractDecompiler = contractDecompiler;
     this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
     this.network            = network;
     this.chain              = chain;
     this.blockStore         = blockStore;
     this.walletManager      = walletManager;
     this.broadcasterManager = broadcasterManager;
     this.serializer         = serializer;
     this.receiptRepository  = receiptRepository;
     this.localExecutor      = localExecutor;
     this.smartContractTransactionService = smartContractTransactionService;
 }
Exemple #2
0
 public SmartContractsController(IBroadcasterManager broadcasterManager,
                                 IBlockStore blockStore,
                                 ConcurrentChain chain,
                                 IConsensusManager consensus,
                                 IDateTimeProvider dateTimeProvider,
                                 ILoggerFactory loggerFactory,
                                 Network network,
                                 IStateRepositoryRoot stateRoot,
                                 IWalletManager walletManager,
                                 IWalletTransactionHandler walletTransactionHandler,
                                 IAddressGenerator addressGenerator,
                                 ISerializer serializer,
                                 IReceiptRepository receiptRepository,
                                 ICallDataSerializer callDataSerializer,
                                 IMethodParameterStringSerializer methodParameterStringSerializer,
                                 ILocalExecutor localExecutor)
 {
     this.stateRoot = stateRoot;
     this.walletTransactionHandler = walletTransactionHandler;
     this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
     this.network            = network;
     this.coinType           = (CoinType)network.Consensus.CoinType;
     this.chain              = chain;
     this.blockStore         = blockStore;
     this.walletManager      = walletManager;
     this.broadcasterManager = broadcasterManager;
     this.addressGenerator   = addressGenerator;
     this.serializer         = serializer;
     this.receiptRepository  = receiptRepository;
     this.callDataSerializer = callDataSerializer;
     this.methodParameterStringSerializer = methodParameterStringSerializer;
     this.localExecutor = localExecutor;
 }
 public SmartContractsController(IBroadcasterManager broadcasterManager,
                                 IBlockStore blockStore,
                                 ChainIndexer chainIndexer,
                                 CSharpContractDecompiler contractDecompiler,
                                 ILoggerFactory loggerFactory,
                                 Network network,
                                 IStateRepositoryRoot stateRoot,
                                 IWalletManager walletManager,
                                 ISerializer serializer,
                                 IContractPrimitiveSerializer primitiveSerializer,
                                 IReceiptRepository receiptRepository,
                                 ILocalExecutor localExecutor,
                                 ISmartContractTransactionService smartContractTransactionService,
                                 IConnectionManager connectionManager)
 {
     this.stateRoot                       = stateRoot;
     this.contractDecompiler              = contractDecompiler;
     this.logger                          = loggerFactory.CreateLogger(this.GetType().FullName);
     this.network                         = network;
     this.chainIndexer                    = chainIndexer;
     this.blockStore                      = blockStore;
     this.walletManager                   = walletManager;
     this.broadcasterManager              = broadcasterManager;
     this.serializer                      = serializer;
     this.primitiveSerializer             = primitiveSerializer;
     this.receiptRepository               = receiptRepository;
     this.localExecutor                   = localExecutor;
     this.smartContractTransactionService = smartContractTransactionService;
     this.connectionManager               = connectionManager;
 }
Exemple #4
0
 public SmartContractsController(IBroadcasterManager broadcasterManager,
                                 IBlockStore blockStore,
                                 ChainIndexer chainIndexer,
                                 CSharpContractDecompiler contractDecompiler,
                                 IDateTimeProvider dateTimeProvider,
                                 ILoggerFactory loggerFactory,
                                 Network network,
                                 IStateRepositoryRoot stateRoot,
                                 IWalletManager walletManager,
                                 ISerializer serializer,
                                 IReceiptRepository receiptRepository,
                                 ILocalExecutor localExecutor,
                                 ISmartContractTransactionService smartContractTransactionService,
                                 IConnectionManager connectionManager)
 {
     this.stateRoot          = stateRoot;
     this.contractDecompiler = contractDecompiler;
     this.logger             = loggerFactory.CreateLogger("Impleum.Bitcoin.Fullnode");
     this.network            = network;
     this.chainIndexer       = chainIndexer;
     this.blockStore         = blockStore;
     this.walletManager      = walletManager;
     this.broadcasterManager = broadcasterManager;
     this.serializer         = serializer;
     this.receiptRepository  = receiptRepository;
     this.localExecutor      = localExecutor;
     this.smartContractTransactionService = smartContractTransactionService;
     this.connectionManager = connectionManager;
 }
        public Unity3dController(ILoggerFactory loggerFactory, IAddressIndexer addressIndexer,
                                 IBlockStore blockStore, IChainState chainState, Network network, ICoinView coinView, WalletController walletController, ChainIndexer chainIndexer, INFTTransferIndexer NFTTransferIndexer,
                                 IStakeChain stakeChain = null,
                                 IContractPrimitiveSerializer primitiveSerializer = null, IStateRepositoryRoot stateRoot = null, IContractAssemblyCache contractAssemblyCache                   = null,
                                 IReceiptRepository receiptRepository             = null, ISmartContractTransactionService smartContractTransactionService = null, ILocalExecutor localExecutor = null)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.addressIndexer     = Guard.NotNull(addressIndexer, nameof(addressIndexer));
            this.blockStore         = Guard.NotNull(blockStore, nameof(blockStore));
            this.chainState         = Guard.NotNull(chainState, nameof(chainState));
            this.network            = Guard.NotNull(network, nameof(network));
            this.coinView           = Guard.NotNull(coinView, nameof(coinView));
            this.walletController   = Guard.NotNull(walletController, nameof(walletController));
            this.chainIndexer       = Guard.NotNull(chainIndexer, nameof(chainIndexer));
            this.stakeChain         = stakeChain;
            this.NFTTransferIndexer = NFTTransferIndexer;

            this.primitiveSerializer             = primitiveSerializer;
            this.stateRoot                       = stateRoot;
            this.contractAssemblyCache           = contractAssemblyCache;
            this.receiptRepository               = receiptRepository;
            this.smartContractTransactionService = smartContractTransactionService;
            this.localExecutor                   = localExecutor;
        }
        private static void InitializeLocalExecutor(ILocalExecutor executor, MethodBase methodFromHandle)
        {
            // Check if method expects IBluepathCommunicationFramework object
            var methodParameters = methodFromHandle.GetParameters();
            var communicationFrameworkObjectType = typeof(IBluepathCommunicationFramework);
            int? parameterIndex = -1;
            var parameterFound = false;
            Type returnType = null;

            foreach (var parameter in methodParameters)
            {
                parameterIndex++;
                if (parameter.ParameterType == communicationFrameworkObjectType)
                {
                    parameterFound = true;
                    break;
                }
            }

            if (methodFromHandle is MethodInfo)
            {
                returnType = ((MethodInfo)methodFromHandle).ReturnType;
            }

            executor.InitializeNonGeneric(
                (parameters) => methodFromHandle.Invoke(null, parameters),
                methodParameters.Length,
                parameterFound ? parameterIndex : null,
                methodParameters,
                returnType);
        }
        private static void DisposeExecutor(ILocalExecutor executor)
        {
            var sourcePort = RemoteExecutorService.GetPortNumberFromRequest();
            if (!Executors.ContainsKey(sourcePort))
            {
                throw new Exception(string.Format("There are no executors running on port '{0}'.", sourcePort));
            }

            var eid = executor.Eid;

            if (executor.ExecutorState == ExecutorState.Running)
            {
                throw new Exception("Can't dispose running executor.");
            }

            executor.Dispose();

            var removed = false;
            do
            {
                if (!Executors[sourcePort].ContainsKey(eid))
                {
                    break;
                }

                removed = Executors[sourcePort].TryRemove(eid, out executor);
            }
            while (!removed);
        }
 public BluepathCommunicationFramework(ILocalExecutor executor)
     : this()
 {
     this.executor = executor;
 }