> For the complete documentation index, see [llms.txt](https://stonkmarket.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stonkmarket.gitbook.io/docs/guides/deploying-a-token.md).

# Deploying a Token

This guide walks through launching a new token via the Factory. Most people launch through [the website](/docs/guides/launchpad-ui.md) in about a minute; this page covers the direct contract path.

## What a Launch Produces

A single `deployToken` transaction does everything atomically:

* Clones a `StonkTokenV2` and mints the fixed 1,000,000,000 supply.
* Creates the token's **Uniswap v4 pool** (hook = [StonkHook](/docs/smart-contracts/stonk-hook.md), LP fee = 0) and seeds it once with the concentrated-liquidity position that reproduces the bonding curve.
* Mints the 0.5% dev allocation and runs the deployer's optional launch buy.
* Computes `launchTime` (the next NYSE open) and locks trading until then.

There is **no graduation** — the pool is a live, real market from the first bell, and its liquidity is permanent (see [No Graduation](/docs/concepts/graduation.md)).

## Prerequisites

* Choose a chain: **Base** or **Robinhood Chain**. Both run the same factory; the addresses, backing assets and launch fees differ (see [Deployments](/docs/reference/deployments.md)).
* Choose a backing asset: **WETH** (native ETH) or the chain's dollar asset — **USDC** on Base, **USDG** on Robinhood Chain.
* ETH on that chain for gas and, for WETH-backed tokens on Base, the launch fee.
* The backing-asset ERC-20 if making a launch buy or paying the fee as ERC-20.
* The Factory address for your chain and the backing-asset address.

## Fees and Limits

The launch fee and the launch-buy cap are **per backing asset**; the trade fee and wallet cap are global. These are baked into your token at launch and cannot be changed later.

On **Base**:

|                | WETH-backed | USDC-backed |
| -------------- | ----------- | ----------- |
| Launch fee     | 0.1 WETH    | 150 USDC    |
| Max launch buy | 0.1 WETH    | 160 USDC    |
| Trade fee      | 1%          | 1%          |
| Max wallet     | 5%          | 5%          |

On **Robinhood Chain**, where launching is free:

|                | WETH-backed | USDG-backed |
| -------------- | ----------- | ----------- |
| Launch fee     | **0**       | **0**       |
| Max launch buy | 0.1 WETH    | 160 USDG    |
| Trade fee      | 1%          | 1%          |
| Max wallet     | 5%          | 5%          |

The launch fee is payable in **ETH or WETH** for a WETH launch, and in the dollar asset for a dollar-asset launch. With a zero fee you still pay gas, and you still pay for any launch buy.

The examples below use Base's fees. On Robinhood Chain set `feePrice` to `0n`, and read `factory.deploymentFee(assetAddress)` rather than hardcoding either — it is an owner-settable value and can change for future launches.

## Deploy

`deployToken(name, symbol, initialBuyAmount, assetToken, creator, platformReferrer)` is payable. `assetToken` selects the backing asset — WETH or USDC on Base, WETH or USDG on Robinhood Chain. `creator` receives the 10% creator share of every trade fee; `platformReferrer` receives the 10% platform share — pass the zero address for an unreferred launch and that 10% folds into the treasury (a 10 / 90 split).

### Option A: No launch buy (WETH-backed, pay fee in ETH)

```typescript
const factory = await ethers.getContractAt("StonkFactoryV2", FACTORY_ADDRESS);
const feePrice = ethers.parseEther("0.1"); // WETH launch fee
const creator = await signer.getAddress();

const tx = await factory.deployToken(
  "My Token",         // name
  "MTK",              // symbol
  0,                  // no launch buy
  WETH_ADDRESS,       // backing asset
  creator,            // creator — receives the 10% creator fee share
  ethers.ZeroAddress, // platform referrer — none (its 10% folds into treasury)
  { value: feePrice } // launch fee in native ETH
);
```

### Option B: Launch buy with native ETH (WETH-backed)

```typescript
const buyAmount = ethers.parseEther("0.1"); // <= max launch buy

const tx = await factory.deployToken(
  "My Token",
  "MTK",
  buyAmount,
  WETH_ADDRESS,
  creator,
  ethers.ZeroAddress,
  { value: feePrice + buyAmount } // fee + buy together; excess is refunded
);
```

### Option C: WETH-backed, paying with WETH ERC-20

```typescript
const buyAmount = ethers.parseEther("0.1");

// Approve factory to spend fee + buy amount in WETH, send no ETH
await weth.approve(await factory.getAddress(), feePrice + buyAmount);

const tx = await factory.deployToken("My Token", "MTK", buyAmount, WETH_ADDRESS, creator, ethers.ZeroAddress);
```

### Option D: dollar-asset-backed (USDC on Base, USDG on Robinhood Chain)

```typescript
const feePrice = 150_000000n;   // 150 USDC (6 decimals)
const buyAmount = 160_000000n;  // 160 USDC — the max launch buy on the USDC path

// Approve factory to spend fee + buy amount in USDC, send no ETH
await usdc.approve(await factory.getAddress(), feePrice + buyAmount);

const tx = await factory.deployToken("My Token", "MTK", buyAmount, USDC_ADDRESS, creator, ethers.ZeroAddress);
```

## Get the Token Address

Raw logs from `receipt.logs` are unparsed — decode them through the factory's interface:

```typescript
const receipt = await tx.wait();

const deployed = receipt!.logs
  .map((log) => {
    try {
      return factory.interface.parseLog(log);
    } catch {
      return null; // log from another contract (PoolManager, WETH, ...)
    }
  })
  .find((parsed) => parsed?.name === "TokenDeployed");

const tokenAddress = deployed!.args.tokenAddress;
console.log("Token deployed at:", tokenAddress);
```

## What Happens Next

1. Trading is **locked** until `launchTime` (the next NYSE market open).
2. When the market opens, anyone can swap the token in its Uniswap v4 pool — see [Trading](/docs/guides/trading.md).
3. Liquidity is **permanent** from launch; there is no graduation and no way to remove it.

## Common Mistakes

| Mistake                                                | Why It Fails                                            |
| ------------------------------------------------------ | ------------------------------------------------------- |
| Trading immediately after launch                       | Trading is locked until `launchTime`                    |
| Expecting a grace period                               | There is none — trading locks immediately               |
| Deploying a duplicate name/symbol                      | The factory registry rejects duplicates                 |
| Sending less than `fee + launchBuy` for the launch     | Insufficient payment                                    |
| Launch buy above the asset's max launch buy            | Exceeds the per-asset cap                               |
| Sending ETH for a USDC- or USDG-backed launch          | The dollar-asset path is ERC-20 only (`EthOnlyForWeth`) |
| Using a Base address on Robinhood Chain, or vice versa | The two deployments share no addresses                  |
| Passing an asset with no config, or a disabled one     | Unsupported asset path                                  |
| Deploying while the factory is paused                  | Launches are paused                                     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://stonkmarket.gitbook.io/docs/guides/deploying-a-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
