Skip to main content
Glama

generate_orbit_deployment

Generate deployment code for Orbit chains to configure rollups, token bridges, or full deployments with validators and batch posters.

Instructions

Generate deployment code for Orbit chains. Supports rollup deployment, token bridge deployment, and full deployment with validators and batch posters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of the deployment requirements
deployment_typeNoType of deployment to generaterollup
validatorsNoValidator addresses for the rollup
batch_postersNoBatch poster addresses
native_tokenNoCustom gas token address
parent_chainNoParent chain for deploymentarbitrum-sepolia
rollup_versionNoRollup version to deployv3.1
chain_idNoChain ID for the new Orbit chain
is_anytrustNoWhether to deploy as AnyTrust chain
rollup_addressNoExisting rollup address (for token_bridge deployment)

Implementation Reference

  • The GenerateOrbitDeploymentTool class handles the logic for generating Orbit chain deployment scripts using templates.
    class GenerateOrbitDeploymentTool(BaseTool):
        """Generate Orbit chain deployment scripts."""
    
        name = "generate_orbit_deployment"
        description = """Generate deployment code for Orbit chains.
    
    Supports:
    - Rollup deployment with createRollup()
    - Token bridge deployment with createTokenBridge()
    - Full deployment (rollup + token bridge in sequence)
    
    Configures validators, batch posters, native tokens, and rollup versions.
    Generates TypeScript scripts using @arbitrum/orbit-sdk."""
    
        input_schema = {
            "type": "object",
            "properties": {
                "prompt": {
                    "type": "string",
                    "description": "Description of the deployment requirements",
                },
                "deployment_type": {
                    "type": "string",
                    "enum": ["rollup", "token_bridge", "full"],
                    "description": "Type of deployment to generate",
                    "default": "rollup",
                },
                "validators": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Validator addresses for the rollup",
                },
                "batch_posters": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Batch poster addresses",
                },
                "native_token": {
                    "type": "string",
                    "description": "Custom gas token address (for custom gas token chains)",
                },
                "parent_chain": {
                    "type": "string",
                    "enum": [
                        "arbitrum-one",
                        "arbitrum-sepolia",
                        "ethereum-mainnet",
                        "ethereum-sepolia",
                    ],
                    "description": "Parent chain for deployment",
                    "default": "arbitrum-sepolia",
                },
                "rollup_version": {
                    "type": "string",
                    "enum": ["v2.1", "v3.1"],
                    "description": "Rollup version to deploy",
                    "default": "v3.1",
                },
                "chain_id": {
                    "type": "integer",
                    "description": "Chain ID for the new Orbit chain",
                    "default": 412346,
                },
                "is_anytrust": {
                    "type": "boolean",
                    "description": "Whether to deploy as AnyTrust chain",
                    "default": False,
                },
                "rollup_address": {
                    "type": "string",
                    "description": "Existing rollup address (for token_bridge deployment)",
                },
            },
            "required": ["prompt"],
        }
    
        def __init__(self, vectordb=None):
            """Initialize with optional vector database."""
            self.vectordb = vectordb
    
        def execute(self, **kwargs) -> dict[str, Any]:
            """Generate Orbit chain deployment code."""
            prompt = kwargs.get("prompt", "")
            deployment_type = kwargs.get("deployment_type", "rollup")
            validators = kwargs.get("validators", [])
            batch_posters = kwargs.get("batch_posters", [])
            native_token = kwargs.get("native_token")
            parent_chain = kwargs.get("parent_chain", "arbitrum-sepolia")
            rollup_version = kwargs.get("rollup_version", "v3.1")
            chain_id = kwargs.get("chain_id", 412346)
            is_anytrust = kwargs.get("is_anytrust", False)
            rollup_address = kwargs.get("rollup_address", "0x0000000000000000000000000000000000000000")
    
            if not prompt:
                return {"error": "prompt is required"}
    
            # Get parent chain info
            parent_rpc = PARENT_CHAIN_RPCS.get(parent_chain, PARENT_CHAIN_RPCS["arbitrum-sepolia"])
            parent_chain_id = self._get_parent_chain_id(parent_chain)
            parent_chain_name = parent_chain.replace("-", " ").title()
    
            # Format validator/batch poster arrays
            validators_str = self._format_address_array(validators)
            batch_posters_str = self._format_address_array(batch_posters)
    
            files = {}
    
            # Generate rollup deployment
            if deployment_type in ("rollup", "full"):
                rollup_template = get_orbit_template("deploy_rollup")
                if rollup_template:
                    code = rollup_template.code
                    code = self._substitute_params(
                        code,
                        chain_id=chain_id,
                        parent_chain_id=parent_chain_id,
                        parent_chain_name=parent_chain_name,
                        is_anytrust=is_anytrust,
                        validators_str=validators_str,
                        batch_posters_str=batch_posters_str,
                        native_token=native_token,
                    )
                    # Look up the known RollupCreator address for this version + parent chain
                    version_addresses = ROLLUP_CREATOR_ADDRESSES.get(
                        rollup_version, ROLLUP_CREATOR_ADDRESSES["v3.1"]
                    )
                    rollup_creator_address = version_addresses.get(
                        parent_chain_id, "0x0000000000000000000000000000000000000000"
                    )
    
                    # Apply version-specific modifications
                    version_label = "v2.1 / classic" if rollup_version == "v2.1" else "v3.1 / BoLD"
                    code = code.replace(
                        "console.log('Deploying Orbit chain...');",
                        f"console.log('Deploying Orbit chain ({version_label})...');\n"
                        f"  console.log('  RollupCreator: {rollup_creator_address}');",
                    )
                    if rollup_version == "v2.1":
                        code = code.replace(
                            "  // Deploy rollup\n",
                            f"  // Deploy rollup — v2.1 uses classic challenge protocol\n"
                            f"  // RollupCreator: {rollup_creator_address}\n"
                            "  // baseStake = 0.1 ETH, stakeToken = ETH (default)\n",
                        )
                        code = code.replace(
                            "    walletClient,\n  }});",
                            "    parentChainPublicClient: publicClient,\n"
                            "    // v2.1: classic challenge protocol (stable, non-BoLD)\n"
                            "    rollupCreatorVersion: 'v2.1',\n"
                            "  }});",
                        )
                        code = code.replace(
                            "console.log('\\nRollup deployed successfully!');",
                            "console.log('\\nRollup deployed successfully! (v2.1 classic)');\n"
                            "  console.log('\\nv2.1 validator config:');\n"
                            "  console.log('  Base stake: 0.1 ETH (default)');\n"
                            "  console.log('  Stake token: ETH');",
                        )
                    else:
                        code = code.replace(
                            "  // Deploy rollup\n",
                            f"  // Deploy rollup — v3.1 uses BoLD challenge protocol\n"
                            f"  // RollupCreator: {rollup_creator_address}\n",
                        )
                        code = code.replace(
                            "    walletClient,\n  }});",
                            "    parentChainPublicClient: publicClient,\n"
                            "    // v3.1: BoLD challenge protocol (default)\n"
                            "    rollupCreatorVersion: 'v3.1',\n"
                            "  }});",
                        )
                        code = code.replace(
                            "console.log('\\nRollup deployed successfully!');",
                            "console.log('\\nRollup deployed successfully! (v3.1 BoLD)');",
                        )
                    files["scripts/deploy-rollup.ts"] = validate_template_output(
                        code, "deploy-rollup"
                    )
    
                # Generate standalone approve-token.ts when using custom gas token
                if native_token:
                    approve_code = APPROVE_TOKEN_TEMPLATE
                    approve_code = approve_code.replace(
                        "{parent_chain_id}", str(parent_chain_id)
                    )
                    approve_code = approve_code.replace(
                        "{parent_chain_name}", parent_chain_name
                    )
                    approve_code = approve_code.replace(
                        "{native_token}", native_token
                    )
                    files["scripts/approve-token.ts"] = validate_template_output(
                        approve_code, "approve-token"
                    )
    
            # Generate token bridge deployment
            if deployment_type in ("token_bridge", "full"):
                bridge_template = get_orbit_template("deploy_token_bridge")
                if bridge_template:
                    code = bridge_template.code
                    code = code.replace("{chain_id}", str(chain_id))
                    code = code.replace("{chain_name}", f"orbit-chain-{chain_id}")
                    code = code.replace("{parent_chain_id}", str(parent_chain_id))
                    code = code.replace("{parent_chain_name}", parent_chain_name)
                    code = code.replace("{rollup_address}", rollup_address)
    
                    # Inject token approval for TokenBridgeCreator when using custom gas token
                    if native_token:
                        tbc_address = TOKEN_BRIDGE_CREATOR_ADDRESSES.get(
                            parent_chain_id, "0x0000000000000000000000000000000000000000"
                        )
    
                        # Add maxUint256 to the viem import
                        code = code.replace(
                            "  createWalletClient,\n  http,\n  Chain,\n} from 'viem';",
                            "  createWalletClient,\n  http,\n  maxUint256,\n  Chain,\n} from 'viem';",
                        )
    
                        # Add ERC20 ABI after the chain-sdk import
                        erc20_abi_block = (
                            "\n// ERC20 ABI for token approval\n"
                            "const erc20Abi = [\n"
                            "  {\n"
                            "    name: 'approve',\n"
                            "    type: 'function',\n"
                            "    stateMutability: 'nonpayable',\n"
                            "    inputs: [\n"
                            "      { name: 'spender', type: 'address' },\n"
                            "      { name: 'amount', type: 'uint256' },\n"
                            "    ],\n"
                            "    outputs: [{ name: '', type: 'bool' }],\n"
                            "  },\n"
                            "  {\n"
                            "    name: 'allowance',\n"
                            "    type: 'function',\n"
                            "    stateMutability: 'view',\n"
                            "    inputs: [\n"
                            "      { name: 'owner', type: 'address' },\n"
                            "      { name: 'spender', type: 'address' },\n"
                            "    ],\n"
                            "    outputs: [{ name: '', type: 'uint256' }],\n"
                            "  },\n"
                            "] as const;\n"
                        )
                        code = code.replace(
                            "import { createTokenBridge } from '@arbitrum/chain-sdk';",
                            "import { createTokenBridge } from '@arbitrum/chain-sdk';\n"
                            + erc20_abi_block,
                        )
    
                        # Inject approval block right before "console.log('Deploying token bridge...')"
                        approval_block = (
                            "  // --- Approve native token for TokenBridgeCreator ---\n"
                            "  // Custom gas token chains require the TokenBridgeCreator to spend the native token\n"
                            "  if (nativeToken) {\n"
                            f"    const tokenBridgeCreator = '{tbc_address}' as `0x${{string}}`;\n"
                            "    console.log('Approving native token for TokenBridgeCreator...');\n"
                            "    console.log('  Token:', nativeToken);\n"
                            "    console.log('  TokenBridgeCreator:', tokenBridgeCreator);\n"
                            "\n"
                            "    const currentAllowance = await parentPublicClient.readContract({\n"
                            "      address: nativeToken,\n"
                            "      abi: erc20Abi,\n"
                            "      functionName: 'allowance',\n"
                            "      args: [account.address, tokenBridgeCreator],\n"
                            "    });\n"
                            "\n"
                            "    if (currentAllowance === 0n) {\n"
                            "      const approveTx = await parentWalletClient.writeContract({\n"
                            "        address: nativeToken,\n"
                            "        abi: erc20Abi,\n"
                            "        functionName: 'approve',\n"
                            "        args: [tokenBridgeCreator, maxUint256],\n"
                            "      });\n"
                            "      await parentPublicClient.waitForTransactionReceipt({ hash: approveTx });\n"
                            "      console.log('  Token approved for TokenBridgeCreator');\n"
                            "    } else {\n"
                            "      console.log('  Token already approved for TokenBridgeCreator');\n"
                            "    }\n"
                            "  }\n"
                            "\n"
                        )
    
                        # Also read nativeToken from deployment.json — add after the existing deployment.json read
                        code = code.replace(
                            "    console.log('Loaded deployment.json — rollup:', rollupAddress);",
                            "    nativeToken = deployment.nativeToken as `0x${string}` | undefined;\n"
                            "    console.log('Loaded deployment.json — rollup:', rollupAddress);\n"
                            "    if (nativeToken) console.log('  Native token:', nativeToken);",
                        )
                        # Add nativeToken variable declaration after orbitChainId
                        # Note: {chain_id} was already replaced above, so match the actual value
                        code = code.replace(
                            f"  let orbitChainId = {chain_id};",
                            f"  let orbitChainId = {chain_id};\n"
                            "  let nativeToken: `0x${string}` | undefined;",
                        )
    
                        code = code.replace(
                            "  console.log('Deploying token bridge...');",
                            approval_block + "  console.log('Deploying token bridge...');",
                        )
    
                    files["scripts/deploy-token-bridge.ts"] = validate_template_output(
                        code, "deploy-token-bridge"
                    )
    
            # Add .env.example
            env_vars = [
                "DEPLOYER_PRIVATE_KEY=0x...",
                f"PARENT_CHAIN_RPC={parent_rpc}",
            ]
            if rollup_version == "v2.1":
                env_vars.append("# Using v2.1 RollupCreator (classic challenge protocol)")
            if deployment_type in ("token_bridge", "full"):
                env_vars.append("ORBIT_CHAIN_RPC=http://localhost:8449")
            files[".env.example"] = "\n".join(env_vars) + "\n"
    
            # Build response
            result = {
                "template_used": f"deploy_{deployment_type}",
                "deployment_type": deployment_type,
                "rollup_version": rollup_version,
                "files": files,
                "dependencies": ORBIT_DEPENDENCIES,
                "parent_chain": {
                    "name": parent_chain,
                    "chain_id": parent_chain_id,
                    "rpc": parent_rpc,
                },
                "chain_config": {
                    "chain_id": chain_id,
                    "is_anytrust": is_anytrust,
                    "native_token": native_token,
                    "validators": validators,
                    "batch_posters": batch_posters,
                },
                "setup_instructions": self._get_setup_instructions(deployment_type, native_token),
                "notes": self._get_notes(deployment_type, native_token, is_anytrust, rollup_version),
                "disclaimer": TEMPLATE_DISCLAIMER,
            }
    
            return result
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions what the tool generates, it doesn't describe what 'generate' entails (e.g., returns code snippets, configuration files, or full deployment scripts), whether it requires authentication, rate limits, or what happens with existing deployments. For a complex 10-parameter tool with no annotations, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose upfront. It could be slightly more structured by separating the three deployment types with commas or bullets, but it's appropriately sized with zero wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 10 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what 'generate' produces (code format, language, structure), doesn't mention error conditions or validation requirements, and provides minimal guidance on parameter usage. The description should do more to compensate for the lack of structured metadata.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description mentions the three deployment types which correspond to the 'deployment_type' enum values, adding minimal context about what each type includes. However, it doesn't explain relationships between parameters (e.g., that 'rollup_address' is only relevant for 'token_bridge' type). Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates deployment code for Orbit chains and specifies three supported deployment types (rollup, token bridge, full). It uses specific verbs like 'generate' and identifies the resource as 'deployment code for Orbit chains', but doesn't explicitly differentiate from sibling tools like 'generate_orbit_config' or 'orchestrate_orbit'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lists the three deployment types supported but provides no guidance on when to choose one type over another, what prerequisites exist, or when to use this tool versus alternatives like 'generate_orbit_config' or 'orchestrate_orbit'. There's no explicit when/when-not guidance or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Quantum3-Labs/ARBuilder'

If you have feedback or need assistance with the MCP directory API, please join our Discord server