示例#1
0
        public HostSmartContractBridgeContext(ISmartContractBridgeService smartContractBridgeService,
                                              ITransactionReadOnlyExecutionService transactionReadOnlyExecutionService, IAccountService accountService,
                                              IOptionsSnapshot <HostSmartContractBridgeContextOptions> options,
                                              IOptionsSnapshot <ContractOptions> contractOptions)
        {
            _smartContractBridgeService          = smartContractBridgeService;
            _transactionReadOnlyExecutionService = transactionReadOnlyExecutionService;
            _accountService  = accountService;
            _contractOptions = contractOptions.Value;

            Variables = new ContextVariableDictionary(options.Value.ContextVariables);

            var self = this;

            Address GetAddress() => self.Transaction.To;

            _lazyStateProvider = new Lazy <ICachedStateProvider>(
                () => new CachedStateProvider(
                    new ScopedStateProvider()
            {
                ContractAddress = GetAddress(),
                HostSmartContractBridgeContext = this
            }),
                LazyThreadSafetyMode.PublicationOnly);
        }
 public SmartContractBridgeServiceTests()
 {
     _blockchainService          = GetRequiredService <IBlockchainService>();
     _smartContractBridgeService = GetRequiredService <ISmartContractBridgeService>();
     _kernelTestHelper           = GetRequiredService <KernelTestHelper>();
     _chainOptions        = GetRequiredService <IOptionsSnapshot <ChainOptions> >().Value;
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _smartContractHelper = GetRequiredService <SmartContractHelper>();
 }