> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ponzu.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Ponzu Factory

> Deploy a complete token ecosystem in a single transaction. Web UI, SDK, MCP server, or raw contract call.

PonzuV4Recipe is the factory contract. One `craftPonzu` call clones the per-project stack and registers the token with the chain-wide Ponzuki hook. The DEX pool is not created until graduation.

The app factory defaults to a **Ponzu Auction**. The SDK encodes a **Ponzu Curve**. Both bind to the same Presale.

| Path                                           | Best For                                 |
| ---------------------------------------------- | ---------------------------------------- |
| [ponzu.app](https://ponzu.app)                 | Founders who want a web UI               |
| [MCP Server](#mcp-server-ai-agent-integration) | AI agents (Claude, Cursor, etc.)         |
| [SDK](#using-the-sdk)                          | Developers building integrations         |
| [Raw viem](#using-raw-viem-no-sdk)             | Protocol engineers who want full control |

***

## Deploy via ponzu.app

No code required.

<Steps>
  <Step title="Prepare your assets">
    Token image (PNG or SVG) and a short description. The app handles IPFS upload.
  </Step>

  <Step title="Connect your wallet">
    MetaMask, WalletConnect, or any EVM wallet. Sepolia for dry runs (min \~0.1 sETH gross).
  </Step>

  <Step title="Configure your token">
    Name, symbol, vesting duration (10 days or 10 weeks). Pick Curve, Auction (1–10 Hours), or Auction (1–10 Days). Set Target ETH, Multiple, Start now or Start later. On a curve, set sniper tax. Add socials.
  </Step>

  <Step title="Deploy">
    One transaction. Creation fee from `getCreationFee` plus optional dev buy. The stack deploys atomically. Presale is live.
  </Step>
</Steps>

Canonical factory crafts set 69% presale / 31% LP, with treasury, team, and payment-vault bps at 0.

***

## MCP Server (AI Agent Integration)

Add to your MCP config (Claude Desktop: `claude_desktop_config.json`, Cursor: `.cursor/mcp.json`):

```json theme={null}
{
  "mcpServers": {
    "ponzu": {
      "command": "npx",
      "args": ["-y", "@ponzu_app/mcp"],
      "env": {
        "PONZU_PRIVATE_KEY": "0x...",
        "PONZU_NETWORK": "mainnet"
      }
    }
  }
}
```

Deploy tokens, buy presales, swap, farm, claim rewards from conversation.

* `PONZU_NETWORK`: `mainnet` | `sepolia` | `robinhood`
* Omit `PONZU_PRIVATE_KEY` for read-only access
* NPM: [@ponzu\_app/mcp](https://www.npmjs.com/package/@ponzu_app/mcp)

***

## Using the SDK

```bash theme={null}
npm install @ponzu_app/sdk viem
```

```typescript theme={null}
import { deploy } from '@ponzu_app/sdk'
import { parseEther, createWalletClient, createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0xYOUR_PRIVATE_KEY')
const wallet  = createWalletClient({ account, chain: mainnet, transport: http() })
const client  = createPublicClient({ chain: mainnet, transport: http() })

const result = await deploy(
  {
    owner:          account.address,
    tokenName:      'My Token',
    tokenSymbol:    'MYTKN',
    metadata:       'ipfs://Qm...',   // JSON: { image, description, socials }
    targetEthRaise: parseEther('5'),  // clamped to the network's grossed minRaise
  },
  wallet,
  client,
  'mainnet', // 'sepolia' | 'robinhood'
)

const tokenAddress    = result.addresses.token
const presaleAddress  = result.addresses.presale   // also the bottle NFT collection
const farmAddress     = result.addresses.farm      // zero if farmEnabled was false; SDK leaves farm on
const hookAddress     = result.addresses.hook      // chain-wide Ponzuki
const launcherAddress = result.addresses.launcher
```

The SDK encodes a Ponzu Curve, reads `getCreationFee`, and decodes `PonzuCrafted`. Image lives in the metadata JSON, not as a separate `craftPonzu` field.

***

## Using Raw viem (No SDK)

```typescript theme={null}
import { decodeEventLog, encodeAbiParameters, keccak256, parseAbi, toBytes, zeroAddress } from 'viem'

const PONZU_RECIPE = '0xCF3c37C0aD2Fd94368921ff570d100119072E826' // mainnet PonzuV4Recipe

const RECIPE_ABI = parseAbi([
  'function craftPonzu((address owner, address keyContract, address transferKey, uint256 initialBuyAmount, uint256 vestingDuration, bytes32 pricingStrategyTemplate, bytes pricingStrategyData, bytes feeStrategyData, string tokenName, string tokenSymbol, string metadata, address teamAddress, uint16 paymentVaultBps, uint16 teamTokenBps, uint16 presaleBps, uint16 treasuryBps, address platformReferrer, address orderReferrer, uint128 activationRate, bool farmEnabled, bool futarchyEnabled, uint256 minRaise) params) payable',
  'function getCreationFee(bytes feeStrategyData) view returns (address feeToken, uint256 feeAmount)',
])

const PONZU_CRAFTED_ABI = parseAbi([
  'event PonzuCrafted(address indexed owner, string tokenName, string tokenSymbol, (address governor, address project, address operator, address lpVault, address memberCard, address membersVault, address token, address presale, address launcher, address distributor, address farm, address hook, address paymentVault, address teamVault, address workLock) addresses, (uint256 poolId, address pricingStrategy, address protocolFeeRecipient, address ethRewarder, bytes32 pricingStrategyTemplate, uint256 vestingDuration, uint256 presaleAllocation, uint256 midRaise, uint256 minRaise, uint256 maxBonusMultiplier, bytes pricingStrategyData) terms)',
])
```

### Pricing Configuration

Total supply: 1,000,000. Canonical crafts sell 690,000 (69%) in presale and seed 310,000 (31%) into DEX liquidity at launch.

<Tabs>
  <Tab title="Ponzu Auction">
    Factory default for timed sales. Caller encodes `(duration, startTime, requestedBonus)`. The recipe fills in the rest.

    ```typescript theme={null}
    const auctionDuration  = 36000n   // 3600 (1h) / 36000 (10h) / 864000 (10d)
    const presaleStartTime = 0n       // 0 = start now, or a future unix second
    const requestedBonus   = 5n * 10n ** 18n  // 5×; recipe binds to bonusMultiplierCap

    const pricingStrategyTemplate = keccak256(toBytes('HyperbolicPricingStrategy')) // Ponzu Auction
    const pricingStrategyData = encodeAbiParameters(
      [{ type: 'uint256' }, { type: 'uint256' }, { type: 'uint256' }],
      [auctionDuration, presaleStartTime, requestedBonus],
    )
    ```

    The target raise falls toward the floor over the duration. The sale launches when raised ETH catches that target, not when a token count sells out.
  </Tab>

  <Tab title="Ponzu Curve">
    SDK default. Caller encodes `(startPrice, finishPrice, startTime, snipeTaxBps)`. The recipe injects allocation.

    ```typescript theme={null}
    const PRESALE_SUPPLY = 690_000n // when presaleBps = 6900
    const targetRaise   = parseEther('5')
    const endPriceWei   = (targetRaise * 20n) / (11n * PRESALE_SUPPLY)
    const startPriceWei = endPriceWei / 10n

    const pricingStrategyTemplate = keccak256(toBytes('LinearPricingStrategy')) // Ponzu Curve
    const pricingStrategyData = encodeAbiParameters(
      [{ type: 'uint256' }, { type: 'uint256' }, { type: 'uint256' }, { type: 'uint256' }],
      [startPriceWei, endPriceWei, 0n, 0n], // startTime 0 = now; snipeTaxBps 0 = no opening premium
    )
    ```

    Launch on full sellout.
  </Tab>
</Tabs>

### Deploy Transaction

```typescript theme={null}
const feeStrategyData = '0x' as `0x${string}`
const [, feeAmount] = await publicClient.readContract({
  address: PONZU_RECIPE,
  abi: RECIPE_ABI,
  functionName: 'getCreationFee',
  args: [feeStrategyData],
})

const params = {
  owner: account.address,
  keyContract: zeroAddress,
  transferKey: zeroAddress,
  initialBuyAmount: 0n,
  vestingDuration: 864000n, // 10 days — must be on the recipe allowlist
  pricingStrategyTemplate,
  pricingStrategyData,
  feeStrategyData,
  tokenName: 'My Token',
  tokenSymbol: 'MYTKN',
  metadata: 'ipfs://Qm...',
  teamAddress: zeroAddress,
  paymentVaultBps: 0,
  teamTokenBps: 0,
  presaleBps: 6900,
  treasuryBps: 0,
  platformReferrer: zeroAddress,
  orderReferrer: zeroAddress,
  activationRate: 0n,
  farmEnabled: true,
  futarchyEnabled: false,
  minRaise: 3_990_000_000_000_000_000n, // net floor; recipe rejects below minEthRaise
}

const hash = await wallet.writeContract({
  address: PONZU_RECIPE,
  abi: RECIPE_ABI,
  functionName: 'craftPonzu',
  args: [params],
  value: feeAmount,
})
```

### Parse Deployed Addresses

```typescript theme={null}
const receipt = await publicClient.waitForTransactionReceipt({ hash })
for (const log of receipt.logs) {
  try {
    const decoded = decodeEventLog({ abi: PONZU_CRAFTED_ABI, data: log.data, topics: log.topics })
    if (decoded.eventName === 'PonzuCrafted') {
      const { token, presale, farm, hook, launcher } = decoded.args.addresses
    }
  } catch { /* not PonzuCrafted */ }
}
```

`hook` in that tuple is the chain-wide Ponzuki. The Presale **is** the bottle NFT collection. Liquidity cards are embedded in the Farm.

***

## Metadata

The contract accepts any URI string — IPFS, Arweave, or `https://`. Image lives **in the metadata JSON**, not as a separate `craftPonzu` field. ponzu.app handles uploads automatically. For SDK or raw deploys, host these yourself.

```typescript theme={null}
// { image: 'ipfs://…', description: string, socials: { twitter?, discord?, website? } }
const metadata = 'ipfs://Qm...'
```

***

<Card title="ABI Reference" icon="code" href="/protocol/abi-reference">
  Contract ABIs for presale, swap, farming, and factory deployment.
</Card>
