orchestrate_dapp
Scaffold a template-based dApp monorepo with starter components including smart contracts, backend, frontend, indexer, and oracle for the Arbitrum ecosystem.
Instructions
Scaffold a template-based dApp monorepo with starter components (contract, backend, frontend, indexer, oracle).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the dApp to generate | |
| components | No | Components to generate (default: contract, backend, frontend) | |
| network | No | Target network | arbitrumSepolia |
| backend_framework | No | Backend framework to use | nestjs |
| contract_type | No | Type of smart contract | custom |
| include_tests | No | Include test files for all components |
Implementation Reference
- src/mcp/tools/orchestrate_dapp.py:99-187 (handler)The execute method of OrchestrateDappTool implements the logic for orchestrating the generation of a dApp, including generating contracts, backend, frontend, indexer, and oracle components, and injecting the ABI.
def execute(self, **kwargs) -> dict[str, Any]: """Generate a complete dApp with the specified components.""" prompt = kwargs.get("prompt", "") components = kwargs.get("components", ["contract", "backend", "frontend"]) network = kwargs.get("network", "arbitrumSepolia") backend_framework = kwargs.get("backend_framework", "nestjs") include_tests = kwargs.get("include_tests", False) contract_type = kwargs.get("contract_type", "custom") # Validate inputs if not prompt: return {"error": "prompt is required"} # Context retrieval (template-based generation doesn't require RAG) context = [] # Generate project structure project = { "name": self._generate_project_name(prompt), "description": prompt, "network": network, "components": {}, "shared_config": self._generate_shared_config(network), "monorepo_structure": self._generate_monorepo_structure(components), "setup_instructions": [], } # Extract ABI from contract for injection into backend/frontend abi_json = [] abi_human_readable = [] # Generate each component if "contract" in components: project["components"]["contract"] = self._generate_contract( prompt, contract_type, include_tests ) project["setup_instructions"].append("1. Run ./setup.sh to install dependencies") # Extract ABI from contract lib.rs lib_rs = project["components"]["contract"]["files"].get("src/lib.rs", "") if lib_rs: abi_json = extract_abi_from_code(lib_rs) abi_human_readable = abi_to_viem_human_readable(abi_json) project["components"]["contract"]["abi"] = abi_json project["components"]["contract"]["abi_human_readable"] = abi_human_readable if "backend" in components: project["components"]["backend"] = self._generate_backend( prompt, backend_framework, include_tests, abi_json, abi_human_readable ) project["setup_instructions"].append("2. Run ./deploy.sh to build and deploy the contract") if "frontend" in components: project["components"]["frontend"] = self._generate_frontend( prompt, include_tests, abi_human_readable ) project["setup_instructions"].append("3. Run ./start.sh to launch backend + frontend") if "indexer" in components: project["components"]["indexer"] = self._generate_indexer( prompt, network, abi_json=abi_json, abi_human_readable=abi_human_readable ) project["setup_instructions"].append("4. Deploy the subgraph to index contract events") if "oracle" in components: project["components"]["oracle"] = self._generate_oracle( prompt, network, abi_json=abi_json ) project["setup_instructions"].append("5. Set up Chainlink oracle integration") # Generate root configuration files (includes scripts) project["root_files"] = self._generate_root_files( project, components, network, backend_framework ) # Add development workflow project["development_workflow"] = self._generate_dev_workflow(components) if context: project["references"] = [ { "source": c.get("metadata", {}).get("source", "Unknown"), "relevance": c.get("distance", 0), } for c in context[:5] ] project["disclaimer"] = TEMPLATE_DISCLAIMER return project