# Create Pools

## 🏗 Creating a Pool with the GoFundMeme SDK

The GoFundMeme SDK provides two main methods for creating pools:

• Bonding Curve Pools – Pools that use an automated market maker (AMM) for price discovery.

• Fair Launch Pools – A community-driven fundraising mechanism.<br>

### Each method follows a two-step process:

1\. Request Pool Creation – Generates a transaction that the creator must sign.

2\. Process Pool Creation – After signing, the transaction is submitted and finalized.

### 🔥 Key Features

✔️ Automated Market Making (for Bonding Curve Pools).

✔️ Community-Driven Fundraising (for Fair Launch Pools).

✔️ Built-in Tokenomics Validation – Prevents incorrect pool setups.

✔️ Decentralized Pool Ownership – Ensures fair and trustless execution.

✔️ Easy Integration – Only two simple API calls are needed.

🚀 Bonding Curve Pool Creation

<br>

### 📌 How Bonding Curve Pools Work

Bonding Curve Pools allow dynamic price discovery and automated liquidity provisioning without traditional order books. The token price increases as more SOL is contributed.

## 📜 Create a Bonding Curve Pool

To create a Bonding Curve Pool, follow these steps:

1️⃣ Request Pool Creation

```typescript
import { gfmSDK, NETWORK } from "@gofundmeme/sdk";
import { Keypair } from "@solana/web3.js";

const creator = Keypair.generate(); // Replace with the actual creator Keypair

const payload = {
    token: {
        base64: "BASE64 (Image/Gif)",  // Base64 image of token logo
        name: "MyToken",
        symbol: "MTK",
        description: "A community-driven token",
        website: "https://mytoken.io",
        twitter: "https://twitter.com/mytoken",
        discord: "https://discord.gg/mytoken",
        telegram: "https://t.me/mytoken"
    },
    amountIn: 5, // Initial SOL to seed the pool
    network: NETWORK.MAINNET,
    creatorWalletAddress: creator.publicKey.toString(),
    supply: 1_000_000_000 // Total supply
};

(async () => {
    const createRequest = await gfmSDK.api.bondingCurve.createPool.request(payload);
    console.log("✍️ Sign the transaction:", createRequest.transaction);
})();
```

## 2️⃣ Sign & Process the Transaction

Once the transaction is created, it must be signed and submitted.

```typescript
const response = await createRequest.signAndConfirm({ creator });
console.log("✅ Pool Created!", response);
```

✅ Successful Response

```json
{
  "mintAddress": "5tsHhs3GpmYjSWXbczVj...",
  "txid": "4hgh8a87sdg76agsd67as8...",
  "pool": {
    ...
  }
}
```

### 📌 Bonding Curve Pool API Methods

| Method                                                         | Description                          |
| -------------------------------------------------------------- | ------------------------------------ |
| gfmSDK.api.bondingCurve.createPool.request(payload)            | Initiates the pool creation request. |
| createRequest.signAndConfirm({ creator })                      | Signs and submits the transaction.   |
| gfmSDK.api.pools.bondingCurve.fetchBondingCurvePool({ mintB }) | Fetches the pool details.            |

## 🚀 Fair Launch Pool Creation

### 📌 How Fair Launch Pools Work

Fair Launch Pools enable decentralized fundraising where contributors purchase allocations at a fixed price over a specified duration.

<br>

## 📜 Create a Fair Launch Pool

To create a Fair Launch Pool, follow these steps:

1️⃣ Request Pool Creation

```typescript
import { gfmSDK, NETWORK } from "@gofundmeme/sdk";
import { Keypair } from "@solana/web3.js";

const creator = Keypair.generate(); // Replace with the actual creator Keypair

const payload = {
    token: {
        base64: "BASE64 (Image/Gif)",  // Base64 image of token logo
        name: "FairToken",
        symbol: "FAIR",
        description: "A fair and transparent launch",
        website: "https://fairtoken.io",
        twitter: "https://twitter.com/fairtoken",
        discord: "https://discord.gg/fairtoken",
        telegram: "https://t.me/fairtoken"
    },
    tokenomics: {
        supply: 1_000_000_000, // Total supply
        lpPercent: 40, // % for LP
        fundersPercent: 40, // % for funders
        allocations: [
            { name: "Marketing", percent: 10, destination: "3KgPZdBvh..." },
            { name: "Team", percent: 10, destination: "6KgQZzCvh..." }
        ]
    },
    campaignDurationHours: 3, // The campaign duration
    targetRaise: 30, // Target amount to raise in SOL
    amountIn: 10, // Initial SOL contribution
    network: NETWORK.MAINNET,
    creatorWalletAddress: creator.publicKey.toString()
};

(async () => {
    const createRequest = await gfmSDK.api.fairLaunch.createPool.request(payload);
    console.log("✍️ Sign the transaction:", createRequest.transaction);
})();
```

2️⃣ Sign & Process the Transaction

```typescript
const response = await createRequest.signAndConfirm({ creator });
console.log("✅ Fair Launch Pool Created!", response);
```

✅ Successful Response

```json
{
  "mintAddress": "9sHjdJkP6Yo...",
  "txid": "9jasdg67dsga7...",
  "pool": {
    ...
  }
}
```

### 📌 Fair Launch Pool API Methods

| Method                                                     | Description                          |
| ---------------------------------------------------------- | ------------------------------------ |
| gfmSDK.api.fairLaunch.createPool.request(payload)          | Initiates the pool creation request. |
| createRequest.signAndConfirm({ creator })                  | Signs and submits the transaction.   |
| gfmSDK.api.pools.fairLaunch.fetchFairLaunchPool({ mintB }) | Fetches the pool details.            |

### 🔍 Comparison of Bonding Curve vs Fair Launch Pools

| Feature           | Bonding Curve Pool            | Fair Launch Pool        |
| ----------------- | ----------------------------- | ----------------------- |
| Price Mechanism   | Dynamic price discovery       | Fixed pricing           |
| Fundraising Model | Continuous token issuance     | Fixed sale period       |
| Use Cases         | AMM-style trading             | Community-driven raises |
| Target Audience   | Traders & Liquidity Providers | Investors & Communities |
| Timeframe         | No expiration                 | Set campaign duration   |

### 🔌 Error Handling & Debugging

Here are some common errors and how to fix them:

| Error                                                       | Solution                               |
| ----------------------------------------------------------- | -------------------------------------- |
| Token name too long (Up to 30 characters)                   | Shorten the token name.                |
| Token symbol too long (Up to 8 characters)                  | Use a shorter symbol.                  |
| Supply must be between 10,000,000 and 1,000,000,000,000,000 | Adjust token supply.                   |
| Amount in must be between 0 SOL - 70 SOL                    | Ensure SOL contribution is valid.      |
| Total token allocation percent must equal 100%              | Adjust allocations to sum to 100%.     |
| Duration hours missing                                      | Specify campaignDurationHours.         |
| Incorrect signer                                            | Ensure the correct Keypair is signing. |

### 🎯 Final Summary

| Pool Type       | Method                                    | Description                     |
| --------------- | ----------------------------------------- | ------------------------------- |
| Bonding Curve   | createPool.request(payload)               | Starts pool creation            |
| Bonding Curve   | createRequest.signAndConfirm({ creator }) | Signs & submits                 |
| Fair Launch     | createPool.request(payload)               | Starts pool creation            |
| Fair Launch     | createRequest.signAndConfirm({ creator }) | Signs & submits                 |
| Fetching a Pool | fetchBondingCurvePool({ mintB })          | Retrieves Bonding Curve details |
| Fetching a Pool | fetchFairLaunchPool({ mintB })            | Retrieves Fair Launch details   |


---

# Agent Instructions: 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:

```
GET https://docs.gofundmeme.io/developers/apis/create-pools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
