---
name: stage-fun-create
description: Create and launch tokens (rounds) on stage.fun on Monad. Use when a user asks to launch a token, create a round, or run an ICO on stage.fun. Covers the full 3-page create form — basic details (launch mode + pair asset), patron tiers, and final details — then deploys on-chain. Requires being logged in to stage.fun (see stage-fun-account skill) and MON in the embedded wallet for gas.
---

# Create a Round on Stage.fun

A round is a token sale on stage.fun. Creating one deploys a token contract and round contract on Monad. The flow is a 3-page form at `https://app.stage.fun/pools/create`.

## Prerequisites

- Logged in to stage.fun (see `stage-fun-account` skill)
- MON in the embedded Privy wallet for gas (~0.1 MON per creation)
- OpenClaw browser open to `https://app.stage.fun`

## Quick Start

1. Navigate to `https://app.stage.fun/pools`
2. Click "Create a round" (`data-testid="create-round-button"`)
3. Fill Page 1 (cover image, name, ticker, launch mode, pair asset, funding goal, description)
4. Click Next → Page 2 (patron tiers — defaults are fine)
5. Click Next → Page 3 (deadline, location and links — review the summary)
6. Click "Create round" (`data-testid="create-round-submit"`)
7. Wait for on-chain confirmation

## Detailed Flow

### Navigate to Create

From the pools page, click "Create a round": the side rail's button (`data-testid="create-round-button"`; the rail is hidden on phones, where the top bar shows a + button with the same testid on every page). When no round is raising, the empty state also has a link (`data-testid="create-round-link"`). Signed out, it opens the login modal instead.

```javascript
(document.querySelector('[data-testid="create-round-button"]') || document.querySelector('[data-testid="create-round-link"]')).click()
// Fallback by text:
// Array.from(document.querySelectorAll('button, a')).find(function(b){return b.textContent.trim()==='Create a round'}).click()
```

This navigates to `https://app.stage.fun/pools/create` (you can also open that URL directly).

### Page 1: Basic Details

#### Token Image (CDP Injection — Required)

The image upload is a React-controlled file input (`#pool-image-upload`). **Normal Playwright `upload`/`setInputFiles` does NOT work** — the files get set on the DOM element but React's state never updates, so the form won't advance.

**The working approach:** Use Chrome DevTools Protocol (CDP) to inject the image as base64, create a `File` object, set it on the input, and call React's `onChange` handler directly.

##### Step 1: Find the CDP WebSocket URL

The OpenClaw browser runs Chromium with `--remote-debugging-port`. Find it:
```bash
ps aux | grep chrom | grep remote-debugging-port
# Look for --remote-debugging-port=XXXXX (e.g. 18800)
```

Then get the page's WebSocket URL:
```bash
curl -s http://127.0.0.1:18800/json | jq '.[] | select(.url | contains("stage.fun")) | .webSocketDebuggerUrl'
```

##### Step 2: Install `ws` module (if needed)
```bash
npm install -g ws
```

##### Step 3: Run the injection script

Save your image to `/tmp/token-image.jpg`, then run:

```javascript
// inject-image.js — Run with: NODE_PATH=$(npm root -g) node inject-image.js
const http = require('http');
const fs = require('fs');
const WebSocket = require('ws');

async function main() {
  const CDP_PORT = 18800; // adjust to match your --remote-debugging-port

  // Find the stage.fun page
  const pages = await new Promise((resolve, reject) => {
    http.get(`http://127.0.0.1:${CDP_PORT}/json`, res => {
      let data = '';
      res.on('data', c => data += c);
      res.on('end', () => resolve(JSON.parse(data)));
    }).on('error', reject);
  });
  const page = pages.find(p => p.url.includes('stage.fun'));
  if (!page) { console.error('No stage.fun page found'); process.exit(1); }

  const ws = new WebSocket(page.webSocketDebuggerUrl);
  let msgId = 1;

  function send(method, params) {
    return new Promise((resolve) => {
      const id = msgId++;
      ws.on('message', function handler(data) {
        const msg = JSON.parse(data);
        if (msg.id === id) { ws.off('message', handler); resolve(msg); }
      });
      ws.send(JSON.stringify({ id, method, params }));
    });
  }

  await new Promise(r => ws.on('open', r));

  // Read image as base64
  const b64 = fs.readFileSync('/tmp/token-image.jpg').toString('base64');
  const mimeType = 'image/jpeg'; // adjust for png etc.

  // Inject: decode base64 → File → set on input → call React onChange
  const expr = `
    (async () => {
      const b64 = ${JSON.stringify(b64)};
      const bin = atob(b64);
      const arr = new Uint8Array(bin.length);
      for (let i = 0; i < bin.length; i++) arr[i] = bin.charCodeAt(i);
      const blob = new Blob([arr], {type: '${mimeType}'});
      const file = new File([blob], 'token-image.jpg', {type: '${mimeType}'});
      const dt = new DataTransfer();
      dt.items.add(file);
      const input = document.getElementById('pool-image-upload');
      input.files = dt.files;

      // Fire native change event
      input.dispatchEvent(new Event('change', {bubbles: true}));

      // CRITICAL: Also call React's internal onChange handler directly
      const reactPropsKey = Object.keys(input).find(k => k.startsWith('__reactProps'));
      if (reactPropsKey && input[reactPropsKey].onChange) {
        input[reactPropsKey].onChange({
          target: input,
          currentTarget: input,
          nativeEvent: new Event('change'),
          preventDefault: () => {},
          stopPropagation: () => {}
        });
      }
      return 'uploaded, size=' + file.size;
    })()
  `;

  const result = await send('Runtime.evaluate', { expression: expr, awaitPromise: true });
  console.log('Result:', JSON.stringify(result.result));
  ws.close();
}

main().catch(console.error);
```

Run it:
```bash
NODE_PATH=$(npm root -g) node inject-image.js
# Expected output: Result: {"result":{"type":"string","value":"uploaded, size=82063"}}
```

##### Why this works

1. **CDP has no payload size limits** for `Runtime.evaluate` — unlike browser tool evaluate calls which hit ~8KB.
2. **Setting `input.files`** via `DataTransfer` updates the DOM, but React ignores native DOM changes.
3. **Calling `input[__reactProps$...].onChange()`** directly triggers React's synthetic event system, updating component state.
4. The image preview should appear in the upload area immediately after.

##### Quick verification

After injection, take a screenshot or snapshot. The dashed "Add cover image" drop zone (`data-testid="cover-image-empty"`) should now show your image, with Replace and Remove under it. If `document.querySelector('[data-testid="cover-image-empty"]')` still finds the drop zone, check:
- `input.files.length` should be 1 (via evaluate)
- The `__reactProps` key exists on the input element
- The onChange was called without errors

#### Launch mode and pair asset

Page 1 has two controls above the funding goal:

- **Launch mode** — `Round` (default; fixed-price tiers, this skill) or `Curve` (bonding curve priced in the pair asset). The switch is shown to **admin** accounts only while the pairs stack is unreleased (tagged "Admin preview"): picking Curve and pressing Next saves a draft and hands off to `https://app.stage.fun/launches/new` (see the `stage-fun-curve` skill, `/skills/curve-launch.md`). Non-admins don't see the switch (every launch is a round); the server also refuses `launch_mode = "curve"` on this form's API path, so leave it on Round unless you are launching a curve on purpose. The switch has no testids: its two buttons are `[aria-label="Launch mode"] button` ("Round" / "Curve"; the active one has `aria-pressed="true"`).
- **Paired with** — the pair asset patrons commit. Click the selector (`data-testid="quote-asset-selector"`), search, and pick a row (`data-testid="quote-asset-option-<symbol>"`, e.g. `quote-asset-option-usdc`, `quote-asset-option-wmon`, `quote-asset-option-abil`). USDC is the default. Rows marked "Not yet launchable" are operator-disabled; stock rows are disabled in geofenced regions and warn when the US market is closed / the oracle is stale (the factory refuses stock-paired launches then). Round launches go through `StageDotFunPoolFactory`: while a network's factory is still v0.1.0 (`poolContractVersion` in `src/lib/contracts/addresses.ts`) it pins USDC, so every other row reads "Rounds pair with USDC only until the v0.2.0 factory is deployed" and cannot be picked — launch with USDC or wait for the v0.2.0 deploy instead of retrying other assets. Curve launches use `StagePairFactory` and are not affected.

```javascript
document.querySelector('[data-testid="quote-asset-selector"]').click();
document.querySelector('[data-testid="quote-asset-search"]').value = 'MON';
// then click the option
document.querySelector('[data-testid="quote-asset-option-wmon"]').click();
```

The goal, cap, tier prices and target token price are all denominated in the selected pair asset (MON amounts are whole MON, e.g. "1000"; the UI shows an "≈ $" hint from the registry price). The choice is sent to the API as `quote_asset_address` + `launch_mode` and to the factory as `depositToken`; it cannot be changed after launch. The API stores amounts as base-unit strings scaled by the pair asset's `quote_decimals` (6 for USDC, 18 for MON / stocks) and returns them both as display units and as `*_base_units` -- never assume 6 decimals when reading a pool back. The server derives `quote_symbol` / `quote_decimals` / `quote_kind` from its registry and verifies the pool's `depositToken` against the creation receipt, so a mismatched `quote_asset_address` is rejected (409 `QUOTE_ASSET_MISMATCH`).

**Stock pairs (aBIL etc.):** creating a stock-paired round is geofenced (HTTP 451 `GEO_BLOCKED` from US, CA, CN, RU, BY, IR, KP, CU, SY, VE, MM), requires ticking the self-attestation checkbox on Page 3 before the Create round button enables, and reverts on-chain while the US market session is closed or the oracle print is stale.

#### Form Fields

Use the selectors below, or aria snapshot refs by the accessible name in parentheses. The key fields:

| Field | Selector (snapshot name) | Example |
|-------|-----------|---------|
| Round name | `[data-testid="round-name-input"]` (`textbox "Round name"`) | "My Token Sale" |
| Ticker | `#poolTicker` (`textbox "Ticker"`) | "MTK" |
| Launch mode (admins) | `[aria-label="Launch mode"] button` | Round |
| Paired with | `data-testid="quote-asset-selector"` | USDC / MON / aBIL |
| Funding goal | `[data-testid="funding-goal-field"] input` (`textbox "Funding goal"`, the pair asset's symbol inside it) | "100" (in the pair asset) |
| Funding cap | `[aria-label="Funding cap"] button` | Click "Uncapped" or "Capped" |
| Description | Rich text editor, `section[aria-label="Description"] .ProseMirror` (a `paragraph` in snapshots) | "Description of the token sale." |

The inputs are React-controlled: from JS evaluation, set a value through the native setter so the form sees it.

```javascript
function setInput(el, value) {
  Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set.call(el, value);
  el.dispatchEvent(new Event('input', { bubbles: true }));
}
setInput(document.querySelector('[data-testid="round-name-input"]'), 'My Token Sale');
setInput(document.querySelector('[data-testid="funding-goal-field"] input'), '100');
```

#### Advanced settings (defaults are fine)

- **Initial liquidity**: on, 15% allocation; seeded as TOKEN / pair asset on StageSwap when the round executes
- **Target token price**: 0.001 pair-asset units per token
- **Liquidity lock**: 180 days
- **Migration supply / Event date / LP token multiplier / Futarchy governance**: Optional, skip

#### Click Next

Find and click the Next button. It may need an aria ref or:
```javascript
Array.from(document.querySelectorAll('button')).find(function(b){return b.textContent.trim()==='Next'}).click()
```

**If Next doesn't advance:** a toast names the missing fields ("Please complete the following required fields: …"; cover image, round name, ticker, funding goal and description are required). Usually it is the image: ensure the DataTransfer trick was applied and `[data-testid="cover-image-empty"]` is gone.

### Page 2: Patron Tiers

A default "GM" tier is pre-configured:
- **Tier name**: GM
- **Price**: Fixed, the funding goal ÷ 20 in the pair asset (0.50 USDC for a 10 USDC goal)
- **Patrons**: Limited, max patrons 20
- **Vesting duration**: None
- **Rewards**: GM Patron Pass (Included)

**For a simple launch, accept defaults and click Next.**

To customize a tier, find the relevant inputs on the page. You can also click "Add tier" to create additional tiers.

### Page 3: Final Details

#### Optional Fields
- **Location**: Text input (optional)
- **Links**: Website, X, Discord, Instagram (all optional)

#### Deadline
"Round closes" is auto-set to 2 days from now. To change, use its date and time inputs. It cannot change once the round is live.

#### Request Public Visibility
Off by default. Toggle on to submit for review in public listings.

#### Review
Check the **Summary** section:
- Goal
- Cap ("Uncapped" or the cap amount)
- Max raise (what the tiers can raise if they sell out; "Unlimited" for uncapped tiers)
- Green check: "Your goal is reachable." (A red "Your tiers can raise X of the Y goal." means the tiers fall short: raise tier prices or patron limits, add a tier, or lower the goal.)

#### Launch

Click the "Create round" button in the bottom bar (it reads "Creating round" while it works):
```javascript
document.querySelector('[data-testid="create-round-submit"]').click()
```

Or take a snapshot and click the ref of button "Create round". On a stock pair it reads "Confirm the attestation to launch" (disabled) until the attestation box is ticked, or "Not available in your region" when geofenced.

### After Launch

On success a **"Pool created successfully!"** toast shows for a few seconds and the page redirects to the round page (`https://app.stage.fun/<slug>/overview`) showing:
- Status "Raising" (rendered uppercase: RAISING)
- The raise and its deadline ("Ends <date> · 1d 23h left")
- Round details (round type, AMM liquidity, liquidity lock)
- Contracts: token contract and round contract addresses
- Patron tiers with commit buttons (`data-testid="tier-commit-button"`, e.g. "Commit 0.5 USDC")

## Error Recovery

### "Insufficient MON balance for gas fees"

The embedded Privy wallet needs MON. Fund it:
```bash
source ~/.openclaw/.env && cd ~/.openclaw/wallet && node send-mon.js <EMBEDDED_WALLET_ADDRESS> 2
```

Then retry. **Important:** After this error, the "Create round" button (`create-round-submit`) may disappear. If so, reload the page and redo the entire 3-page form. The form state is not persisted.

### "Blockchain transaction failed"

Check the specific error in the toast notification at the bottom of the page. Common causes:
- Insufficient gas (fund embedded wallet)
- Network congestion (retry)

### Image upload not working

If the dashed "Add cover image" drop zone (`data-testid="cover-image-empty"`) still shows after the CDP injection:

1. **Verify the input exists:** `document.getElementById('pool-image-upload')` should return an `<input type="file">`.
2. **Check files count:** After injection, `input.files.length` should be 1. If 0, the DataTransfer/File creation failed.
3. **React state not updating:** The image may be on the input but the preview doesn't show. This means the React onChange wasn't triggered. Check that:
   - `Object.keys(input).find(k => k.startsWith('__reactProps'))` returns a key
   - `input[reactPropsKey].onChange` is a function
   - You called it with the synthetic event object (see the CDP script above)
4. **Playwright `upload`/`setInputFiles` does NOT work** for this input — don't waste time on it. The files get set at the DOM level but Playwright's `setInputFiles` doesn't trigger React's fiber/event system.
5. **Mixed content blocks HTTP fetches** — you can't fetch an image from a local HTTP server in the browser (the page is HTTPS). The CDP base64 injection approach bypasses this entirely.
6. **The form won't advance to Page 2 without a valid image.**

## Customization Guide

| Parameter | Simple Launch | Production Launch |
|-----------|--------------|-------------------|
| Pair asset | USDC | USDC, MON, or an operator-enabled stock (aBIL) |
| Funding Goal | 10 USDC | Your target amount in the pair asset |
| Ticker | 3-5 chars | Your token symbol |
| Image | Any JPG/PNG via CDP inject | Designed token logo via CDP inject |
| Description | One line | Full marketing copy |
| Tiers | Default GM | Custom tiers with gates |
| Liquidity | 15% default | 15-25% recommended |
| Visibility | Off | On (for public listing) |
| Deadline | 2 days (default) | Your preferred window |
