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

# Haystack Launch

## Overview

Haystack Launch (HayLaunch) is a token launch system built on an Algorand smart contract. It lets anyone create a new ASA token that immediately trades on a bonding curve. When the bonding target is reached, liquidity automatically migrates to a Pact DEX pool and the LP tokens are burned, creating a permanently liquid, fully decentralized market.

The entire lifecycle — from token creation through bonding to liquidity migration — is handled on-chain by the HayLaunch contract. No external custodians, no manual pool creation, no unlock schedules.

The [Launch page](https://hay.app/launch) walks you through four steps — **Image**, **Name and about**, **Curve** and **Launch** — and asks for two signatures: one to store the image, one to launch.

## How It Works

1. **Start with the image** — Upload, paste or drop a picture, generate one with AI, or link your own. Storing an uploaded image on IPFS is its own signature: you pay a small USDC fee, then Haystack checks the image and pins it. Your own `https://` or `ipfs://` link skips this step.
2. **Name it** — Pick a ticker (up to 8 characters) and a name, then add a description and links if you like.
3. **Set the curve** — Choose what buyers pay with (USDC, ALGO, HAY or another supported asset), how much has to be raised before the token graduates, and how far the price climbs on the way. Optionally add a first buy to get in before anyone else.
4. **Launch** — The token's text is checked, then one signature creates the token (and makes your first buy, if you set one). Only sexual content involving minors blocks a launch; text flagged for anything else still launches, and the token is shown blurred on Haystack. Anyone can trade it straight away.

When the curve sells out, which happens once the bonding target has been raised, all collected liquidity automatically migrates to a Pact pool. The LP tokens are burned, making the liquidity permanent and irrevocable.

## Bonding Curve Economics

Launched tokens trade on a **constant-product** bonding curve. The contract maintains virtual reserves that determine the price at any point during the bonding phase:

> `k = virtualTokenReserves x virtualBondingReserves`
>
> The invariant k is constant — every buy reduces token reserves and increases bonding reserves, pushing the price up. Sells do the opposite.

The price starts low and increases as more people buy. The shape of this curve is determined by two parameters, both set in the Curve step:

**Bonding Target (USD)**

How much has to be raised before the token graduates. You set it in USD, and when you launch the contract turns it into a fixed amount of the bonding currency at its oracle price. The minimum is set by the contract, and is also the default: currently $2,500. The Launch page caps it at $500,000. A higher target means more liquidity accumulates before migration.

**Price Multiplier (5x–250x)**

The ratio of the token's final price (at graduation) to its initial price (at launch). A 20x multiplier (the default) means early buyers can see up to 20x appreciation if the token reaches its bonding target.

> **Warning — Precision Guard:** The contract uses 9-decimal fixed-point arithmetic (SCALE = 1,000,000,000). If your chosen parameters would cause the initial price to truncate to 0, the launch is blocked. The Curve step warns you and won't let you continue until you raise the target or lower the multiplier.

## Bonding Currencies

When launching a token, you choose which currency the bonding curve trades against. This determines what buyers pay with, what the Pact pool is paired with at graduation, and what currency you earn your fee share in.

The Curve step offers USDC, ALGO and HAY first:

| Currency | Description                                                                                             |
| -------- | ------------------------------------------------------------------------------------------------------- |
| **USDC** | Prices in dollars. Fees and liquidity are in a stable asset, for predictable, USD-denominated earnings. |
| **ALGO** | Algorand's own coin. Buyers need no opt-in, and fees are paid in ALGO.                                  |
| **HAY**  | Haystack's token. Fees accumulate in HAY, aligning creator incentives with the Haystack ecosystem.      |

Other assets can be used too. Any asset the Haystack oracle prices and HayLaunch has enabled appears in the list, with its price. An asset that can't be picked right now says why: "Price is out of date" (prices must be under 24 hours old), "Not enabled for launches", or "Couldn't check it just now" when Haystack couldn't reach the contract to ask.

The contract turns the USD bonding target into an amount of the bonding currency at its oracle price when you launch. Every bonding amount is in that currency's own units and decimals.

Because the target is fixed in the bonding currency, the USD value at graduation moves with that currency's price (except for USDC). The bonding currency is set at launch and cannot be changed afterward. If your wallet can't hold the currency yet, the launch adds it so you can receive your fee share.

## Creator Fees

Every trade on the curve pays a 1.5% fee. As the creator you earn 0.5% of every trade — a third of the fee — while the token is on the bonding curve. It's paid in the bonding currency and sent to your wallet automatically on each trade; there's nothing to claim.

If your wallet can't receive it (it no longer holds the bonding currency, or the account is closed), the contract waives your share and trades pay 1% instead: a buyer gets more tokens, a seller keeps more of the payout. A waived fee isn't saved for later, so keep the bonding currency in your wallet. While it's waived, the token's fee details say "Waived — creator inactive".

> **Creator Share:** Creators earn **33%** of all trading fees during the bonding phase, and keep earning their creator rate (0.5% today) on every trade on the token's Pact pool after graduation.

The remaining 67% (the platform share) is distributed through Haystack's fee distribution system, the same mechanism that powers [HAY staking](/haystack-docs/platform/staking.md) rewards:

### Platform Fee Distribution (67% of total)

Platform fees paid in HAY go entirely to HAY stakers. Fees in any other currency are first swapped to USDC, then split:

| Recipient        | Share |
| ---------------- | ----- |
| HAY Stakers      | 70%   |
| Treasury         | 25%   |
| Buy & Burn (HAY) | 5%    |

The 5% burn portion is swapped to HAY and permanently burned. The Haystack team may adjust how fees are split.

> **Full Fee Breakdown Example:** On a trade with 100 units in fees, in any currency other than HAY: **33** go to the creator, **46.9** to HAY stakers (67% x 70%), **16.75** to treasury (67% x 25%), and **3.35** are used to buy and burn HAY (67% x 5%). On a HAY-bonded token, all **67** go to stakers. See [Staking — Fee Distribution](/haystack-docs/platform/staking.md#fee-distribution) for more detail.

After graduation (liquidity migrates to Pact), the bonding curve is closed and the token trades on its Pact pool. A trade there pays about 1.5% in all, the same as on the curve: Pact's 1% swap fee on what goes in, and your creator rate, 0.5% today, of what comes out to you. Pact's own share of the pool's fees can squeeze that rate (see the FAQ below). Your share builds up in the pool, in both the token and the bonding currency, until you claim it from **Creator fees** under **To claim** in [Portfolio](https://hay.app/holdings), or from the token's Manage Token dialog. The claim adds the token and the bonding currency to your wallet if they aren't there yet (0.1 ALGO each).

## Graduation and Liquidity Migration

When the curve's tokens sell out, the token *graduates*. That happens once the bonding target, fixed in the bonding currency at launch, has been raised. Graduation is fully automated and triggered by the contract:

1. The bonding curve is closed — no more buys or sells through the contract.
2. All accumulated bonding reserves and a portion of the token supply are deposited into a new Pact V2 liquidity pool, with the creator's fee share set on it.
3. The LP tokens from that pool are burned, making the liquidity permanent and irremovable.
4. The token's `poolAppId` and `lpTokenId` are recorded on the contract for indexing.

The buy that completes graduation also pays for creating the pool, about 0.03 ALGO more in network fees, and has to be paid in the bonding currency directly rather than routed from another token.

Buyers, the creator included, then claim their tokens in [Portfolio](https://hay.app/holdings) (under **To claim**, as launched tokens; with several, **Review** opens the Launches tab to claim each one) or on the token's page. Claiming adds the token to your wallet and returns the 0.0225 ALGO deposit your first buy made. After graduation, the token trades freely on Pact (and is discoverable via the Haystack Router for best-execution routing across all DEXes).

## Token Supply and Allocation

All launched tokens have 6 decimals and a fixed total supply set by the contract (the `createSupply` global parameter). The supply is split into two pools:

| Allocation  | Share | Description                                                                                                                                                            |
| ----------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bonding** | 80%   | Available for purchase on the bonding curve. The contract records each buyer's balance, and buyers claim their tokens once the token graduates.                        |
| **LP**      | 20%   | Reserved for the liquidity pool at graduation. These tokens are never sold on the curve — they are paired with the accumulated bonding reserves to seed the Pact pool. |

There is no team allocation, vesting schedule, or pre-mine. The creator can optionally make a first buy at launch, which is subject to the same curve mechanics as any other purchase.

## Initial Buy (Optional)

Creators can optionally buy tokens at launch, in the same signature that creates the token. This atomic "launch + buy" is executed in a single transaction group, guaranteeing the creator buys at the very bottom of the curve.

**How it works:** Enter the first buy in the Curve step, in the bonding currency, or pick one of the quick amounts. The contract executes the launch and the buy atomically — both succeed or both fail. There is no partial state.

**Estimating tokens:** The Curve step shows how many tokens you'll receive, what share of the supply that is, and the fee on the buy (a third of which comes back to you); the chart marks your share of the curve. The estimate uses the contract's own curve math.

> **Transaction Structure:**
>
> **ALGO bonding:** two `gas()` calls + MBR payment + ALGO buy payment + `launchTokenThenBuyWithAlgo()`
>
> **Any other bonding currency (USDC, HAY, …):** two `gas()` calls + MBR payment + asset transfer + `launchTokenThenBuy()`
>
> Either group starts with an opt-in to the bonding currency if your wallet doesn't hold it yet. A launch without a first buy is MBR payment + `launchToken()`, after the same opt-in if needed.
>
> A first buy can't take the whole curve: that would graduate the token inside the launch itself, which the launch transaction has no room for.

## Image Handling

The image comes first, and it's stored before the rest of the launch. Token images can be provided in four ways:

### Upload from Computer

Select or drop an image file (PNG, JPEG, GIF or WebP, max 5 MB). Nothing is uploaded until you store it: storing pays the pin fee in one USDC transfer, then uploads the file to Haystack, which runs a content check and pins it on IPFS. The resulting `ipfs://` CID becomes the token's asset URL. SVG files can't be uploaded; link to one instead.

### Paste from Clipboard

Press Ctrl+V (or Cmd+V) anywhere on the page, or click the Paste button. The image is stored the same way as an upload.

### AI Generation

Describe your token's picture and the AI generator creates an image, and can fill in a name, ticker and description too. Each image costs 0.20 USDC, paid when you generate. The image you pick is then stored on IPFS like an upload, for the pin fee on top.

### Your Own Link

Paste an `https://` or `ipfs://` link to an image you already host. There's nothing to store or pay, and SVG works this way. The linked image is checked before you continue (an `ipfs://` link through a gateway): a blocked image is removed, and a flagged one is shown blurred.

> **IPFS Pinning:** Pinning costs a small USDC fee, shown before you sign, plus a 0.001 ALGO network fee. One payment pins one image and covers up to 5 tries: if an upload fails, or the content check blocks the image, you can try again or pick another image without paying again. A blocked or unreadable image uses up a try; a failure on Haystack's side doesn't. If you don't pay within 15 minutes of starting, the request lapses and nothing is charged. Replacing an image you've already stored is a new payment. Images flagged as sensitive (other than the one blocked category, sexual content involving minors) are still pinned and shown blurred.

## Draft Persistence

Your launch is saved in this browser as you go, per wallet. If you close the page or switch wallets, each wallet's draft comes back when you return within 24 hours of your last change.

* **Storage key:** `haystack-launch-draft:{address}`
* **TTL:** 24 hours from the last change — expired drafts are automatically discarded.
* **Includes:** Every field, the bonding currency and curve, and the stored image. A picked image that wasn't stored yet has to be picked again; a pin fee you already paid carries over.

Drafts are cleared after a successful launch. You can also click "Start over" to clear your draft at any time.

## Costs

Launching a token involves a few small costs, and the Launch page shows each one before you sign. Amounts below are mainnet values at the time of writing.

| Cost                           | Amount                                     |
| ------------------------------ | ------------------------------------------ |
| Creating the token             | \~2.35 ALGO (\~2.38 ALGO with a first buy) |
| Network fees                   | Up to 0.006 ALGO (0.054 with a first buy)  |
| Adding the bonding currency    | 0.101 ALGO, only if it isn't there yet     |
| Storing the image on IPFS      | Small USDC fee + 0.001 ALGO                |
| AI image generation (optional) | 0.20 USDC per image                        |
| First buy (optional)           | Your chosen amount                         |

> **Creating the token:** This covers the minimum balance (MBR) the contract must hold for the new asset and its box storage, and sets aside what graduation costs: creating the Pact pool, adding the token to Pact's vault, and the opt-ins for the pool's fees and the LP burn. Adding a currency to your wallet locks 0.1 ALGO of your own minimum balance, plus the opt-in's fee.

## Form Fields and Limits

Token metadata is stored on-chain in the HayLaunch contract's box storage. Each field has a byte limit enforced by the contract; the format rules in the notes are applied by the Launch page. Note that byte length may differ from character length for non-ASCII characters (e.g., emoji, CJK).

| Field       | Max Bytes | Notes                                                                  |
| ----------- | --------- | ---------------------------------------------------------------------- |
| Ticker      | 8         | Required. Auto-uppercased, spaces removed.                             |
| Name        | 32        | Required.                                                              |
| Asset URL   | 96        | Must start with `ipfs://` or `https://`                                |
| Description | 1,024     | Optional.                                                              |
| Website     | 256       | Enter the domain (e.g. `yoursite.com`); `https://` is added for you.   |
| X / Twitter | 64        | Handle or full URL. Stored as a full `https://x.com/…` link.           |
| Telegram    | 64        | Handle or full URL. Stored as a full `https://t.me/…` link.            |
| Discord     | 64        | Invite code or full URL. Stored as a full `https://discord.gg/…` link. |

The social links' 64-byte limit includes the `https://…/` part, which leaves about 50 characters for an X handle, 51 for Telegram and 45 for a Discord invite.

## Curve Settings

The Curve step sets the bonding currency, target and multiplier. If you don't change them, the contract's defaults are used.

**Bonding Target**

Pick one of three cards or enter your own amount under "Other", up to $500,000. The first card is the contract's minimum and default, currently $2,500; the others are the presets above it ($5K, $25K and $100K), so today the cards read $2.5K, $5K and $25K. Controls how much total capital flows into the curve before graduation. Higher targets create deeper liquidity pools.

**Price Multiplier**

Pick 10x, 20x or 50x, or enter your own between 5x and 250x (default 20x). Determines the steepness of the price curve. A higher multiplier means a steeper curve — early buyers get a lower price relative to the graduation price, but it needs a higher target to keep the initial price above zero.

> **Curve Preview:** As you adjust the settings, the Curve step shows the price the token starts at and graduates at, its value (FDV) from launch to graduation, and a chart of the curve, calculated with the same math the contract uses at launch time.

## Trading on the Bonding Curve

Once a token is launched, anyone can buy and sell immediately through the bonding curve. Trades are executed by the HayLaunch contract using the constant-product formula.

### Direct Trades

If you hold the token's bonding currency, you trade with the curve directly:

**Buying:** Pay the bonding currency (whichever was chosen at launch) and the contract adds the tokens to your balance on the curve. You don't need to add the token to your wallet first. Your first buy of each token pays a 0.0225 ALGO deposit for your balance record, which comes back when you claim. Only a claim returns it: if you sell your whole balance before the token graduates, the record stays and so does the deposit. Each purchase moves the price up along the curve.

**Selling:** Sell from your balance on the curve and receive the bonding currency. Each sale moves the price down along the curve.

**Holding:** Tokens bought on the curve stay in the contract until the token graduates. Then you claim them into your wallet (see [Graduation](#graduation-and-liquidity-migration)).

### Router-Assisted Trades

On a token's page you can buy or sell with any token, not just the bonding currency (e.g. ALGO for a USDC-bonded token). Haystack combines two steps in one atomic transaction group:

* **Buy:** the [Haystack Router](/haystack-docs/developers/router-api.md) swaps your token into the bonding currency across Algorand's DEXes, and the bonding currency buys from the curve.
* **Sell:** the curve sells your tokens for the bonding currency, and the router swaps it into the token you want.

Near the end of the curve, a routed buy that would take 90% or more of what's left is refused, and the page offers to switch you to paying in the bonding currency. The buy that completes bonding also deploys the Pact pool, so it has to be paid in the bonding currency directly.

Only the router's guaranteed minimum goes into the curve on a routed buy, and on a routed sell anything the curve pays above the router's input stays with you, so a routed trade can leave a little of the bonding currency in your wallet.

### Atomic Transactions

Every trade, direct or router-assisted, is an **atomic transaction group** on Algorand: either every transaction in it succeeds, or none of them do. For example, if a router-assisted sell's curve leg succeeds but the router swap can't fill at an acceptable price, the whole group reverts and your tokens stay on the curve.

### Slippage Protection

All trades include a minimum output. If the actual output would be below it (because other trades executed first), the trade reverts. In a router-assisted trade, the curve leg and the router leg each have their own minimum, both set from your one slippage setting. See [Trading & Fees — Slippage Protection](/haystack-docs/platform/trading-fees.md#slippage-protection) for recommended settings.

### Trading Fees

| Trade Type                             | Bonding Curve Fee | Router Swap Fee | Network Fee |
| -------------------------------------- | ----------------- | --------------- | ----------- |
| Direct buy/sell (bonding currency)     | Yes               | No              | Yes         |
| Router-assisted buy/sell (other token) | Yes               | Yes             | Yes         |

* **Bonding curve fee:** 1.5%, split between the creator and the platform (see [Creator Fees](#creator-fees)). On buys it's taken from the bonding currency before it enters the curve; on sells, from what the curve pays out.
* **Router swap fee:** the tiered router fee on the routed leg. [HAY discounts](/haystack-docs/platform/hay-token.md#fee-discounts) apply to it, but not to the bonding curve fee. See [Trading & Fees](/haystack-docs/platform/trading-fees.md).
* **Network fees:** standard Algorand transaction fees for each transaction in the group.

## Bonding Progress

Each token's bonding progress is tracked as the percentage of bonding supply that has been purchased. This is displayed on the asset detail page and in the screener.

> `progress = (initialRealTokenReserves - realTokenReserves) / initialRealTokenReserves x 100`

At 100% progress (all bonding tokens sold), the token graduates and liquidity migrates to Pact. The contract's `bondingOn` flag transitions from 0 to 3 (Pact V2; tokens that graduated before the move to V2 show 2, Pact V1), and `poolAppId` / `lpTokenId` are set.

## FAQs

<details>

<summary>How much does it cost to launch a token?</summary>

About 2.35 ALGO to create the token, plus network fees, plus a small USDC fee if Haystack stores your image on IPFS, plus 0.101 ALGO if your wallet doesn't hold the bonding currency yet. AI image generation costs 0.20 USDC per image. The Launch page shows every cost before you sign.

</details>

<details>

<summary>Can I change my token metadata after launching?</summary>

The description and links can be changed later for 30 USDC: open the token's row in [Portfolio](https://hay.app/holdings) and use the pencil icon to open Manage Token. The ticker, name, image and curve are fixed at launch, so make sure they're right before you sign.

</details>

<details>

<summary>What happens if my token never reaches the bonding target?</summary>

The token remains on the bonding curve indefinitely. Users can continue to buy and sell through the contract. There is no expiration or deadline — the token graduates when (and if) the bonding target is reached.

</details>

<details>

<summary>What is the first buy?</summary>

An optional buy made in the same signature that creates the token. It's atomic — the launch and buy either both succeed or both fail. You buy at the very bottom of the curve, the same as any first buyer would.

</details>

<details>

<summary>Why do I need to choose a bonding currency?</summary>

The bonding currency determines what buyers pay with, what the liquidity pool is paired with at graduation, and what you earn trading fees in. Choose USDC for stable USD-denominated earnings, ALGO for the broadest buyer accessibility, or HAY to align with the Haystack ecosystem. Other assets the Haystack oracle prices can be used too; pick one with enough supply for your target, since a cheap asset with a small supply makes it hard for buyers to reach it.

</details>

<details>

<summary>Where is my token image stored?</summary>

If you upload, paste or generate an image, Haystack pins it on IPFS once you pay the pin fee, and the token's asset URL is its `ipfs://` CID. You can also use your own `https://` or `ipfs://` link.

</details>

<details>

<summary>I paid to store my image, but it didn't finish. Do I pay again?</summary>

No. One payment covers one stored image, with up to 5 tries. If the upload fails, the page reloads, or the image is blocked by the content check, try again or pick another image and it's stored on the same payment. A blocked image uses up one of the tries.

</details>

<details>

<summary>Do creators earn fees after graduation?</summary>

Yes. The token's Pact pool pays you 0.5% of every trade, on top of Pact's 1% swap fee. It builds up in the pool until you claim it from **Creator fees** in [Portfolio](https://hay.app/holdings). Pact can change its own share of a pool's fees, which can shrink yours, so the rate isn't guaranteed. Tokens that graduated before the move to Pact V2 are on V1 pools, which pay no creator fee.

</details>
