Deployment Guide
This guide covers deploying the full LaunchRobin protocol stack: smart contracts to Robinhood Chain, the off-chain indexer, and the Next.js frontend to Vercel. Follow the sections in order — contracts must be deployed before the indexer, and the indexer should be running before the frontend goes live.
Contracts
Prerequisites
- Node.js 22+
- pnpm (or npm) for root dependencies
- A funded wallet on the target network (testnet ETH from the faucet, or real ETH for mainnet)
Quick Deploy
# 1. Install root dependencies pnpm install # 2. Set your private key export PRIVATE_KEY=0xyour_private_key_here # 3. Deploy to the target network npx hardhat run script/deploy.cjs --network robinhoodTestnet # testnet (chain 46630) npx hardhat run script/deploy.cjs --network robinhood # mainnet (chain 4663) npx hardhat run script/deploy.cjs --network localhost # local Hardhat node
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
PRIVATE_KEY | Yes | — | Deployer wallet private key (0x-prefixed hex). The deployer becomes the protocol owner. |
RESERVE_TARGET | No | 10 | Default graduation target in ETH for new bonding curves. |
CURVE_SUPPLY | No | 800000000 | Default total token supply for new bonding curves (800M tokens). |
LP_FEE | No | 5000 | Uniswap v4 pool fee in pips (5000 = 0.5%). |
TRADING_FEE_BPS | No | 125 | Total platform trading fee in basis points (125 = 1.25%. 0.25% protocol + 1.0% platform). |
POOL_MANAGER_ADDRESS | No | 0x000000000004444c5dc75cB358380D2e3dE08A90 | Uniswap v4 PoolManager address. On localhost, a MockPoolManager is deployed automatically. |
PLATFORM_CONFIG_ADDRESS | No | — | Reuse an existing PlatformConfig proxy (skips deployment). |
LIQUIDITY_MANAGER_ADDRESS | No | — | Reuse an existing LiquidityManager proxy (skips deployment). |
UNISWAP_V4_ADAPTER_ADDRESS | No | — | Reuse an existing UniswapV4Adapter proxy (skips deployment). |
What the Deploy Script Does
The script at script/deploy.cjs performs the following steps in order. All contracts use UUPS upgradeable proxies (OpenZeppelin Upgrades plugin).
Resolve PoolManager — Uses POOL_MANAGER_ADDRESS if set, deploys a MockPoolManager on localhost, or defaults to the canonical Uniswap v4 PoolManager.
Deploy PlatformConfig — UUPS proxy. The deployer address is set as the protocol treasury.
Deploy LiquidityManager — UUPS proxy (no constructor args). Coordinates liquidity provisioning via registered adapters.
Deploy Factory — UUPS proxy with PlatformConfig, reserveTarget, and curveSupply. Deploys Launch + MemeToken contracts.
Deploy Registry — UUPS proxy with Factory address. Central on-chain registry tracking all launches.
Deploy UniswapV4Adapter — UUPS proxy with PoolManager, Registry, and PlatformConfig. Adds full-range liquidity on graduation.
Register Adapter — Registers UniswapV4Adapter in LiquidityManager as the active adapter.
Wire Factory — Links Registry and LiquidityManager into Factory via setRegistry() and setLiquidityManager().
Wire PlatformConfig — Links Factory and Registry into PlatformConfig via setCoreAddresses().
Grant Roles — Grants DEFAULT_ADMIN_ROLE on PlatformConfig to Factory.
Register Default Platform — Registers "Bullion Launchpad" as the default platform. Costs 0.0005 ETH.
Output Files
| File | Description |
|---|---|
deployment.json | JSON record: network name, chain ID, deployer address, pool manager address, all contract addresses, default platform ID, and timestamp. |
sdk/constants.ts | Auto-generated TypeScript constants file. Contains CONTRACT_ADDRESSES keyed by chain ID. Do not edit manually. |
Register Additional Platforms
After the initial deploy, register more branded launchpads using the platform registration script.
# Edit script/register-platform.cjs with your platform details first npx hardhat run script/register-platform.cjs --network robinhoodTestnet
Verify Deployment
# Read deployment.json to confirm addresses cat deployment.json | python3 -m json.tool # Check that sdk/constants.ts was updated grep "FACTORY" sdk/constants.ts
Indexer
Prerequisites
- Node.js 22+
- Docker and Docker Compose (for PostgreSQL)
- Alchemy API key (for WebSocket-based real-time indexing in production)
- Smart contracts deployed (see Contracts section above)
Docker Setup (PostgreSQL)
The indexer uses PostgreSQL 16. Start it with Docker Compose.
# Start PostgreSQL only (for local dev) cd indexer docker compose up -d postgres # Start everything (PostgreSQL + testnet indexer + mainnet indexer) docker compose up -d # Check health curl http://localhost:3002/health # testnet curl http://localhost:3001/health # mainnet # View logs docker compose logs -f indexer-testnet # Stop docker compose down
Local Development Setup
cd indexer # 1. Install dependencies npm install # 2. Configure environment (.env.local already exists with local default values) # 3. Start PostgreSQL docker compose up -d postgres # 4. Run database migrations npm run migration:run # 5. Start the indexer npm run start:local # chain 31337 (Hardhat) npm run start:testnet # chain 46630 (Testnet) npm run start:mainnet # chain 4663 (Mainnet)
Environment Variables
Environment files per environment: .env.local (chain 31337), .env.testnet (chain 46630), .env.mainnet (chain 4663).
| Variable | Required | Example | Description |
|---|---|---|---|
CHAIN_ID | Yes | 46630 | Chain ID: 4663 (mainnet), 46630 (testnet), 31337 (local). |
PORT | Yes | 3002 | HTTP API port. Convention: 3000 local, 3001 mainnet, 3002 testnet. |
DB_HOST | Yes | localhost | PostgreSQL host. Use postgres in Docker Compose. |
DB_PORT | Yes | 5432 | PostgreSQL port. |
DB_USER | Yes | indexer | PostgreSQL user. |
DB_PASSWORD | Yes | indexer | PostgreSQL password. Use a strong password in production. |
DB_NAME | Yes | indexer_testnet | PostgreSQL database name. |
RPC_URL | Yes | https://rpc.testnet.chain.robinhood.com | HTTP JSON-RPC endpoint for batch catch-up. |
WSS_URL | No | wss://robinhood-testnet.g.alchemy.com/v2/YOUR_KEY | WebSocket endpoint for real-time block subscription. |
PLATFORM_CONFIG_ADDRESS | Yes | 0x5fC1C7e... | PlatformConfig proxy address. |
FACTORY_ADDRESS | Yes | 0x1fa7dAEe... | Factory proxy address. |
REGISTRY_ADDRESS | Yes | 0x5b3eAb68... | Registry proxy address. |
LIQUIDITY_MANAGER_ADDRESS | Yes | 0x7003bE42... | LiquidityManager proxy address. |
POOL_MANAGER_ADDRESS | Yes | 0x000000000004444c5dc75cB358380D2e3dE08A90 | Uniswap v4 PoolManager. |
CONFIRMATION_DEPTH | No | 6 | Blocks to wait before processing. |
CATCH_UP_BATCH_SIZE | No | 2000 | Blocks per eth_getLogs batch during catch-up. |
Database Migrations
# Run pending migrations npm run migration:run # Generate a new migration from entity changes npm run migration:generate
Docker Compose (Full Production Stack)
# Build and start everything export ALCHEMY_API_KEY=your_key_here docker compose up -d # Check both indexers are healthy curl http://localhost:3002/health curl http://localhost:3001/health # Monitor logs docker compose logs -f # Stop everything (preserves data volume) docker compose down
Frontend
Prerequisites
- Node.js 22+
- pnpm
- Smart contracts deployed
- Indexer running (recommended)
Local Development
# Install dependencies pnpm install # Start dev server (defaults to http://localhost:3000) pnpm dev
Production Build
# Build for production pnpm build # Start production server pnpm start
Next.js 16 Configuration
Key configuration in next.config.ts:
- React Strict Mode — Enabled for development safety.
- API Rewrites — Proxies
/api/v1/*to the indexer atINDEXER_URL. - Image Optimization — Remote patterns allow loading images from any host.
- Content Security Policy — Configured for RPC connections and CDN assets.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
INDEXER_URL | No | http://127.0.0.1:3000 | Base URL of the indexer REST API. |
Vercel Deploy
The frontend is a standard Next.js 16 app and can be deployed to Vercel with no additional configuration.
Build Settings
| Setting | Value |
|---|---|
| Framework | Next.js |
| Build Command | pnpm build |
| Output Directory | .next |
| Install Command | pnpm install |
| Node.js Version | 22.x |
| Root Directory | ./ |
Via Vercel CLI
# Install Vercel CLI pnpm add -g vercel # Link project vercel link # Set environment variables vercel env add INDEXER_URL production # Deploy preview vercel # Deploy production vercel --prod
Production Checklist
Review every item on this checklist before deploying to Robinhood Chain mainnet (chain 4663).
Smart Contracts
- Testnet verification — Deploy and fully exercise all contract functionality on testnet first. Run
examples/flow.tsagainst testnet. - Private key security — Use a dedicated deployer wallet. Transfer ownership to a multisig (Safe) after deployment.
- Protocol treasury — Update to a secure multisig address before significant fee accumulation.
- Fee parameters audit — Confirm TRADING_FEE_BPS, LP_FEE, and creatorShareBps are set to intended values.
- Configuration versioning — Changing platform fees later only affects new launches, not existing ones.
- UUPS upgrade safety — Never leave the implementation contract uninitialized.
- Liquidity lock verification — Confirm the UniswapV4Adapter has no LP withdrawal function.
- Source code verification — Verify all contracts on Blockscout.
Indexer
- Database credentials — Use a strong DB_PASSWORD. Never commit .env files.
- RPC provider — Use a dedicated provider (Alchemy, QuickNode) for production.
- Confirmation depth — Use CONFIRMATION_DEPTH=6 for mainnet.
- Separate databases — Run testnet and mainnet indexers with separate databases.
- Backup strategy — Set up regular PostgreSQL backups for mainnet.
Frontend
- RPC endpoints in CSP — Update CSP if using a different RPC provider.
- CORS and rewrites — Ensure INDEXER_URL is set correctly in Vercel.
- Error boundaries — Verify error pages render correctly.
General Security
- Audit — Get smart contracts audited by a reputable firm before mainnet.
- Multisig everywhere — Protocol owner, treasuries should all be multisig.
- Pause capability test — Verify protocol-wide pause works on testnet.
- Graduation stress test — Test graduation on testnet with multiple tokens.
- Fee calculation accuracy — Verify fee calculations on testnet trades.
- Monitoring and alerting — Set up healthcheck monitoring for the indexer.