/// <inheritdoc /> public async Task <OneOf <MaterialManufacturingResponseModel, EntityNotFound> > CreateMaterialManufacturingAsync( CreateMaterialManufacturingCommand command, CancellationToken cancellationToken) { var smartContract = await _blockchainRepository.GetSmartContractByTypeAsync(ContractType, cancellationToken); if (smartContract == null) { return(new EntityNotFound { Message = $"Smart-contract with type: {ContractType} not found" }); } var deployedContractAddress = await _ethereumService.DeployAsync(command, smartContract); var deployedSmartContractModel = new DeployedSmartContract( deployedContractAddress, ContractType, smartContract.Abi); var deployedSmartContract = await _blockchainRepository.AddDeployedSmartContractAsync(deployedSmartContractModel, cancellationToken); return(new MaterialManufacturingResponseModel(deployedSmartContract.Id, command.Name)); }