/// <inheritdoc/>
        public Task DeployContractAsync(ContractDto contractDto)
        {
            // get runner
            var runner = _smartContractRunnerContainer.GetRunner(contractDto.SmartContractRegistration.Category);

            if (contractDto.ContractName != null)
            {
                _smartContractAddressService.SetAddress(contractDto.ContractName, contractDto.ContractAddress);
            }
            return(Task.CompletedTask);
        }
示例#2
0
        /// <inheritdoc/>
        public Task DeployContractAsync(ContractDto contractDto)
        {
            // get runner
            var runner = _smartContractRunnerContainer.GetRunner(contractDto.SmartContractRegistration.Category);

            if (contractDto.ContractName != null)
            {
                _smartContractAddressService.SetAddress(contractDto.ContractName, contractDto.ContractAddress);
            }
            //Todo New version metadata handle it
//            var contractType = runner.GetContractType(registration);
//            var contractTemplate = runner.ExtractMetadata(contractType);
//            await _functionMetadataService.DeployContract(contractAddress, contractTemplate);
            return(Task.CompletedTask);
        }
示例#3
0
        /// <inheritdoc/>
        public async Task DeployContractAsync(Address contractAddress,
                                              SmartContractRegistration registration, bool isPrivileged, Hash name)
        {
            // get runner
            var runner = _smartContractRunnerContainer.GetRunner(registration.Category);
            await Task.Run(() => runner.CodeCheck(registration.Code.ToByteArray(), isPrivileged));

            if (name != null)
            {
                _smartContractAddressService.SetAddress(name, contractAddress);
            }

            //Todo New version metadata handle it
//            var contractType = runner.GetContractType(registration);
//            var contractTemplate = runner.ExtractMetadata(contractType);
//            await _functionMetadataService.DeployContract(contractAddress, contractTemplate);
        }
        /// <inheritdoc/>
        public async Task DeployContractAsync(ContractDto contractDto)
        {
            // get runner
            var runner = _smartContractRunnerContainer.GetRunner(contractDto.SmartContractRegistration.Category);
            await Task.Run(() => runner.CodeCheck(contractDto.SmartContractRegistration.Code.ToByteArray(), contractDto.IsPrivileged));

            if (contractDto.ContractName != null)
            {
                _smartContractAddressService.SetAddress(contractDto.ContractName, contractDto.ContractAddress);
            }
            await _smartContractExecutiveService.SetContractInfoAsync(contractDto.ContractAddress,
                                                                      contractDto.BlockHeight);

            //Todo New version metadata handle it
//            var contractType = runner.GetContractType(registration);
//            var contractTemplate = runner.ExtractMetadata(contractType);
//            await _functionMetadataService.DeployContract(contractAddress, contractTemplate);
        }
示例#5
0
        private async Task <IExecutive> GetExecutiveAsync(Address address, SmartContractRegistration reg)
        {
            // get runner
            var runner = _smartContractRunnerContainer.GetRunner(reg.Category);

            // run smartcontract executive info and return executive
            var executive = await runner.RunAsync(reg);

            var context =
                _hostSmartContractBridgeContextService.Create();

            executive.SetHostSmartContractBridgeContext(context);
            return(executive);
        }
示例#6
0
 private void CheckRunner(int category)
 {
     _smartContractRunnerContainer.GetRunner(category);
 }