示例#1
0
 public InternalTransactionExecutorFactory(IKeyEncodingStrategy keyEncodingStrategy,
                                           ILoggerFactory loggerFactory, Network network)
 {
     this.keyEncodingStrategy = keyEncodingStrategy;
     this.loggerFactory       = loggerFactory;
     this.network             = network;
 }
示例#2
0
 public SmartContractExceptionTests()
 {
     this.repository = new ContractStateRepositoryRoot(new NoDeleteSource<byte[], byte[]>(new MemoryDictionarySource()));
     this.keyEncodingStrategy = BasicKeyEncodingStrategy.Default;
     this.loggerFactory = new ExtendedLoggerFactory();
     this.loggerFactory.AddConsoleWithFilters();
     this.network = new SmartContractsRegTest();
 }
示例#3
0
        public MeteredPersistenceStrategy(IStateRepository stateDb, IGasMeter gasMeter, IKeyEncodingStrategy keyEncodingStrategy)
        {
            Guard.NotNull(stateDb, nameof(stateDb));
            Guard.NotNull(gasMeter, nameof(gasMeter));
            Guard.NotNull(gasMeter, nameof(keyEncodingStrategy));

            this.stateDb             = stateDb;
            this.gasMeter            = gasMeter;
            this.keyEncodingStrategy = keyEncodingStrategy;
        }
 public SmartContractExecutorTests()
 {
     this.keyEncodingStrategy = BasicKeyEncodingStrategy.Default;
     this.loggerFactory       = new ExtendedLoggerFactory();
     this.loggerFactory.AddConsoleWithFilters();
     this.network                   = new SmartContractsRegTest();
     this.refundProcessor           = new SmartContractResultRefundProcessor(this.loggerFactory);
     this.state                     = new ContractStateRepositoryRoot(new NoDeleteSource <byte[], byte[]>(new MemoryDictionarySource()));
     this.transferProcessor         = new SmartContractResultTransferProcessor(this.loggerFactory, this.network);
     this.validator                 = new SmartContractValidator(new ISmartContractValidator[] { });
     this.internalTxExecutorFactory = new InternalTransactionExecutorFactory(this.keyEncodingStrategy, loggerFactory, this.network);
     this.vm = new ReflectionVirtualMachine(this.internalTxExecutorFactory, loggerFactory);
 }
示例#5
0
        public ReflectionVirtualMachineTests()
        {
            this.network             = new SmartContractsRegTest();
            this.keyEncodingStrategy = BasicKeyEncodingStrategy.Default;
            this.loggerFactory       = new ExtendedLoggerFactory();
            this.loggerFactory.AddConsoleWithFilters();
            this.gasLimit = (Gas)10000;
            this.gasMeter = new GasMeter(this.gasLimit);

            this.state = new ContractStateRepositoryRoot(new NoDeleteSource <byte[], byte[]>(new MemoryDictionarySource()));
            var persistenceStrategy = new MeteredPersistenceStrategy(this.state, this.gasMeter, this.keyEncodingStrategy);

            this.persistentState = new PersistentState(persistenceStrategy, TestAddress.ToUint160(this.network), this.network);
        }
 public InternalTransactionExecutor(
     IContractStateRepository contractStateRepository,
     List <TransferInfo> internalTransferList,
     IKeyEncodingStrategy keyEncodingStrategy,
     ILoggerFactory loggerFactory,
     Network network)
 {
     this.contractStateRepository = contractStateRepository;
     this.internalTransferList    = internalTransferList;
     this.keyEncodingStrategy     = keyEncodingStrategy;
     this.loggerFactory           = loggerFactory;
     this.logger  = loggerFactory.CreateLogger(this.GetType());
     this.network = network;
 }
示例#7
0
 public InternalTransactionExecutor(ITransactionContext transactionContext, ISmartContractVirtualMachine vm,
                                    IContractStateRepository contractStateRepository,
                                    List <TransferInfo> internalTransferList,
                                    IKeyEncodingStrategy keyEncodingStrategy,
                                    ILoggerFactory loggerFactory,
                                    Network network)
 {
     this.transactionContext      = transactionContext;
     this.contractStateRepository = contractStateRepository;
     this.internalTransferList    = internalTransferList;
     this.keyEncodingStrategy     = keyEncodingStrategy;
     this.loggerFactory           = loggerFactory;
     this.logger  = loggerFactory.CreateLogger(this.GetType());
     this.network = network;
     this.vm      = vm;
 }
 public CallSmartContract(IKeyEncodingStrategy keyEncodingStrategy,
                          ILoggerFactory loggerFactory,
                          Network network,
                          IContractStateRepository stateSnapshot,
                          ISmartContractResultRefundProcessor refundProcessor,
                          ISmartContractResultTransferProcessor transferProcessor,
                          ISmartContractVirtualMachine vm)
 {
     this.logger              = loggerFactory.CreateLogger(this.GetType());
     this.loggerFactory       = loggerFactory;
     this.stateSnapshot       = stateSnapshot;
     this.network             = network;
     this.keyEncodingStrategy = keyEncodingStrategy;
     this.refundProcessor     = refundProcessor;
     this.transferProcessor   = transferProcessor;
     this.vm = vm;
 }
示例#9
0
 public ReflectionSmartContractExecutorFactory(
     IKeyEncodingStrategy keyEncodingStrategy,
     ILoggerFactory loggerFactory,
     Network network,
     ISmartContractResultRefundProcessor refundProcessor,
     ISmartContractResultTransferProcessor transferProcessor,
     SmartContractValidator validator,
     ISmartContractVirtualMachine vm)
 {
     this.keyEncodingStrategy = keyEncodingStrategy;
     this.loggerFactory       = loggerFactory;
     this.network             = network;
     this.refundProcessor     = refundProcessor;
     this.transferProcessor   = transferProcessor;
     this.validator           = validator;
     this.vm = vm;
 }