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

# DEVELOPERS

## peeps.wtf docs

A fair-launch token platform on Robinhood Chain. Launch an ERC-20 onto a PEEPS bonding curve (\~$5 creation fee), trade with live charts on peeps.wtf, earn creator fees, and **graduate** into a **locked Uniswap V3** LP at \~$35k FDV.

### Introduction <a href="#introduction" id="introduction"></a>

* **Non-custodial**— every action is signed by the user's wallet.
* **Fair launches** — no presale, no team allocation; full supply minted to the bonding curve.
* **LP locked** — after graduation the V3 position NFT sits in PeepsLPFeeVault (principal locked).
* **Creator earnings** — 0.40% of curve volume + 40% of post-grad LP fees.

### Network <a href="#network" id="network"></a>

| Field     | Value                                     |
| --------- | ----------------------------------------- |
| Chain     | `Robinhood Chain`                         |
| Chain ID  | `4663 (0x1237)`                           |
| RPC       | `https://rpc.mainnet.chain.robinhood.com` |
| Explorer  | `https://robinhoodchain.blockscout.com`   |
| Gas token | `ETH`                                     |

### Deployed contracts <a href="#contracts" id="contracts"></a>

Mainnet (chain 4663). Source of truth: packages/contracts/deployments/4663.json.

| Contract          | Address                                      | Role                                |
| ----------------- | -------------------------------------------- | ----------------------------------- |
| PeepsCurveFactory | `0x138C1C551bAd0F1c43084ddbC79F5E78225Eb9dD` | Deploys token + curve; creation fee |
| PeepsLPFeeVault   | `0xCdD3dBb6e7e2613443d27Ffc3FB041202BBD5259` | Locks LP NFTs; splits fees          |
| PeepsRouter       | `0x4946DF0C6685266CA4b0bDfc9ecfdabFe5d1afc6` | Create / buy / sell entrypoint      |
| WETH              | `0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73` | Quote asset                         |
| SwapRouter02      | `0xCaf681a66D020601342297493863E78C959E5cb2` | Uniswap V3 router                   |
| PositionManager   | `0x73991a25C818Bf1f1128dEAaB1492D45638DE0D3` | V3 positions                        |
| UniswapV3Factory  | `0x1f7d7550B1b028f7571E69A784071F0205FD2EfA` | V3 pools                            |

Each launch gets its own **token** and **bonding curve**. Look them up from factory events / `curveOf(token)`.

### How it works <a href="#how-it-works" id="how-it-works"></a>

**Launch:** call `PeepsRouter.createToken` with \~$5 creation fee (plus optional initial buy). Factory deploys the ERC-20 + bonding curve, mints supply to the curve, initializes an empty V3 pool via the migrator, and emits `TokenCreated`.

**Trade:** buys/sells go through the router → curve (1.25% fee: 0.40% creator / 0.85% protocol). Optional anti-snipe window caps early non-creator buys.

**Graduate:** when the \~$35k FDV ETH threshold is met, `graduate()` migrates inventory into a full-range Uniswap V3 position locked in PeepsLPFeeVault.

### Setup <a href="#setup" id="setup"></a>

Examples use ethers v6 (`npm i ethers`).

```
import { ethers } from "ethers";

const RPC = "https://rpc.mainnet.chain.robinhood.com";
const provider = new ethers.JsonRpcProvider(RPC, 4663);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);

const A = {
  factory: "0x138C1C551bAd0F1c43084ddbC79F5E78225Eb9dD",
  vault:   "0xCdD3dBb6e7e2613443d27Ffc3FB041202BBD5259",
  router:  "0x4946DF0C6685266CA4b0bDfc9ecfdabFe5d1afc6",
  weth:    "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",
};
```

#### Launch a token <a href="#launch" id="launch"></a>

Prefer `PeepsRouter.createToken` (handles creation fee + optional initial buy). `LaunchConfig.graduationCap` should be `Cap35k` (enum value `2`) and `postGradCreatorShareBps` must be `4000` (40%).

```
const ROUTER_ABI = [
  "function createToken(string name,string symbol,bytes32 metadataHash,string metadataUri,(uint8 graduationCap,uint16 postGradCreatorShareBps,bool antiSnipe) launch,uint256 minTokensOut,uint256 deadline) payable returns (address token,address curve,uint256 tokensOut)",
];
const FACTORY_ABI = [
  "function creationFee() view returns (uint256)",
  "event TokenCreated(address indexed token,address indexed curve,address indexed creator,string name,string symbol,bytes32 metadataHash,string metadataUri,address pool,uint8 graduationCap,uint16 postGradCreatorShareBps)",
];

const router = new ethers.Contract(A.router, ROUTER_ABI, wallet);
const factory = new ethers.Contract(A.factory, FACTORY_ABI, provider);

const fee = await factory.creationFee(); // ~0.002822 ETH ≈ $5
const launch = {
  graduationCap: 2,              // Cap35k
  postGradCreatorShareBps: 4000, // 40%
  antiSnipe: true,
};
const metadataHash = ethers.id("ipfs://your-meta"); // commit to off-chain JSON
const deadline = Math.floor(Date.now() / 1000) + 600;

const tx = await router.createToken(
  "My Token",
  "MTK",
  metadataHash,
  "ipfs://your-meta",
  launch,
  0n,            // minTokensOut for optional initial buy
  deadline,
  { value: fee } // add ETH above fee for an initial buy
);
const rc = await tx.wait();

const ev = rc.logs
  .map((l) => { try { return factory.interface.parseLog(l); } catch { return null; } })
  .find((e) => e && e.name === "TokenCreated");
console.log("token:", ev.args.token, "curve:", ev.args.curve);
```

#### Buy (bonding curve) <a href="#buy" id="buy"></a>

Native ETH → tokens via the router while the token is still on the curve.

```
const ROUTER_ABI = [
  "function buy(address token,address recipient,uint256 minTokensOut,uint256 deadline) payable returns (uint256)",
];
const router = new ethers.Contract(A.router, ROUTER_ABI, wallet);

const ethIn = ethers.parseEther("0.05");
const deadline = Math.floor(Date.now() / 1000) + 600;
const tx = await router.buy(token, wallet.address, 0n, deadline, { value: ethIn });
await tx.wait();
```

During anti-snipe, non-creator wallets have an early buy cap. Creators are exempt. Oversized buys revert.

#### Sell (bonding curve) <a href="#sell" id="sell"></a>

Approve the router (or use permit), then sell tokens back to the curve for ETH.

```
const ERC20_ABI = [
  "function approve(address,uint256) returns (bool)",
  "function allowance(address,address) view returns (uint256)",
];
const ROUTER_ABI = [
  "function sell(address token,uint256 tokenAmount,address recipient,uint256 minEthOut,uint256 deadline) returns (uint256)",
];
const tokenC = new ethers.Contract(token, ERC20_ABI, wallet);
const router = new ethers.Contract(A.router, ROUTER_ABI, wallet);

const amountIn = ethers.parseEther("1000000");
if ((await tokenC.allowance(wallet.address, A.router)) < amountIn) {
  await (await tokenC.approve(A.router, ethers.MaxUint256)).wait();
}
const deadline = Math.floor(Date.now() / 1000) + 600;
await (await router.sell(token, amountIn, wallet.address, 0n, deadline)).wait();
```

After graduation, trade on Uniswap V3 (PeepsV3SwapRouter or SwapRouter02) — the curve no longer accepts swaps.

#### Fees & claims <a href="#fees" id="fees"></a>

* **Creation:** \~$5 (`creationFee()`) → treasury.
* **Curve trades:** 1.25% total — 0.40% creator (claimable) / 0.85% protocol.
* **Post-grad LP:** 1% Uniswap pool fee — 40% creator / 60% protocol via the vault.

```
// Creator curve fees
const CURVE_ABI = ["function claimCreatorFees() returns (uint256)"];
const curve = new ethers.Contract(curveAddress, CURVE_ABI, wallet);
await (await curve.claimCreatorFees()).wait();

// Collect V3 LP fees into the vault, then claim creator share
const VAULT_ABI = [
  "function collectForToken(address launchToken) returns (uint256,uint256)",
  "function claimCreatorLpFees(address launchToken) returns (uint256,uint256)",
];
const vault = new ethers.Contract(A.vault, VAULT_ABI, wallet);
await (await vault.collectForToken(token)).wait(); // permissionless
await (await vault.claimCreatorLpFees(token)).wait(); // creator only
```

#### Graduation <a href="#graduate" id="graduate"></a>

When reserves hit the design cap, anyone can call `graduate()` on the curve (router buys may also auto-trigger). Migrator seeds the V3 pool and locks the LP NFT in the vault.

```
const CURVE_ABI = ["function graduate()"];
const curve = new ethers.Contract(curveAddress, CURVE_ABI, wallet);
await (await curve.graduate()).wait();
// Listen for Graduated(token, pool, tokenId, ...) from the migrator / curve flow
```

#### Read state <a href="#read-state" id="read-state"></a>

```
const FACTORY_ABI = [
  "function curveOf(address token) view returns (address)",
  "function tokenOf(address curve) view returns (address)",
  "function isCurve(address) view returns (bool)",
  "function creationFee() view returns (uint256)",
];
const CURVE_ABI = [
  "function token() view returns (address)",
  "function creator() view returns (address)",
  "function phase() view returns (uint8)", // 0 trading, 1 ready, 2 graduated
  "function GRADUATION_ETH() view returns (uint256)",
];
const factory = new ethers.Contract(A.factory, FACTORY_ABI, provider);
const curveAddr = await factory.curveOf(token);
const curve = new ethers.Contract(curveAddr, CURVE_ABI, provider);
console.log("phase:", await curve.phase());

// Stream new launches
const TOPIC = ethers.id(
  "TokenCreated(address,address,address,string,string,bytes32,string,address,uint8,uint16)"
);
// wsProvider.on({ address: A.factory, topics: [TOPIC] }, log => { ... })
```

### Gotchas <a href="#gotchas" id="gotchas"></a>

* Always create through `PeepsRouter` and send at least `creationFee()` wei.
* `postGradCreatorShareBps` must be `4000`; graduation cap for UI launches is `Cap35k`.
* Curve fee split (0.40% / 0.85%) is frozen per token at create — not changeable later on that curve.
* After graduation, use Uniswap / PeepsV3SwapRouter — curve buys/sells revert.
* Graduated LP is full-range and locked in the vault; collect then claim for creator LP fees.
* Metadata URI should match `metadataHash` commitment (IPFS JSON).


---

# 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://peeps-2.gitbook.io/peeps-docs/peeps-whitepaper/developers.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.
