Protocol

How It Works

peg.fun is a two-phase protocol. Tokens are born on a bonding curve, which already pays holders a fee share from the first trade. When the curve fills, liquidity migrates atomically to Uniswap v4 and locks permanently, and the fee split changes to reflect the new pool. peg.fun keeps exactly one narrow, one-way power after that point — see "The one narrow post-graduation exception" below.

Phase 1 · The bonding curve

When a collection launches, every buy and sell goes through peg.fun's bonding curve, which lives inside a Uniswap v4 hook. The price increases as more PEG is bought, so early buyers get a lower price and later buyers pay more.

All ETH paid into the curve stays in the contract. There is no external market maker, no order book, and no AMM pool yet. The curve is the only price source until graduation.

NoteThe graduation threshold is 4.16 ETH locked in the curve. Until then, the curve and the hook are the only place this token exists.

Every buy on the curve does three things in one transaction:

  1. ETH is sent to the PegHook contract.
  2. The hook routes the swap through Uniswap v4's PoolManager.
  3. PEG tokens are minted directly to the buyer's wallet, and one on-chain glyph is minted per whole 1.0 PEG received. Fractional PEG becomes dust.

Phase 2 · Graduation

When a buy would push the curve past 4.16 ETH, the hook triggers migration atomically in the same transaction. The buyer pays the migration gas as part of their buy. No separate trigger, no admin call, no countdown.

At graduation:

  1. A new Uniswap v4 pool is created for PEG/ETH with the protocol's fixed fee tier and the same hook.
  2. All ETH and remaining PEG in the curve are deposited as initial liquidity into that pool.
  3. The LP position representing that liquidity is permanently locked inside the hook contract itself — not sent anywhere, just never removable by any code path that exists. See LP burn.
  4. The bonding curve permanently disables. All future swaps route through the Uniswap v4 pool.

Graduation is one-shot and irreversible. Nothing, including peg.fun, can cancel it, delay it, or reverse it.

Phase 3 · Post-graduation swaps via DirectSwap

After graduation, PEG mints on arrival from the Uniswap v4 pool — it no longer matters which router carried the swap. DirectSwap, peg.fun's own router, remains available and is what the native swap UI uses; it clamps an oversized order to the per-transaction limit and refunds the rest instead of reverting.

NoteEvery buy — through any router — is capped at 700 tokens per transaction. Above that, the swap fails outright rather than silently shorting you. peg.fun's own swap UI clamps and refunds automatically, so you never meet this as a revert. See How buying works, whichever app you use.

Holder fee distribution

Every swap after graduation pays a fee, split between the creator, the platform treasury, and PEG holders via a balance-weighted accumulator inside the hook. There is a separate pool fee too, but it does not reach this accumulator — it compounds back into the locked graduation liquidity instead. See LP burn for where that share goes.

Holders claim accumulated fees by clicking "Claim ETH" on the token detail page. The longer you hold and the more PEG you hold, the more you accumulate — automatically, up to 100 glyphs. Above that, you must settle once via claimRange before you start earning anything at all; until you do, your share goes to the treasury instead. See How to claim holder fees for the mechanics.

The glyph-mint invariant

1 token = 1 peg at all times. This is enforced at the contract level:

  1. Buying a whole token through DirectSwap mints one fresh glyph to your wallet.
  2. Selling a whole token through DirectSwap burns the oldest glyph you hold.
  3. Transferring PEG to another wallet transfers the matching glyphs atomically. There is no "orphan" ERC-20 balance.
  4. Fractional PEG that didn't complete a whole glyph becomes dust , which has ETH value but does not mint a glyph on its own. If you keep buying more through peg.fun, that dust accumulates and mints a glyph once your cumulative peg.fun-bought total crosses the next whole PEG — dust received any other way (a transfer, a gift, a purchase elsewhere) never counts toward that crossing.

The one narrow post-graduation exception

After graduation, no upgrade path, no pause function, no fee-rate change, and no way to touch liquidity or a holder's balance exists anywhere in the contract. peg.fun keeps exactly one power: it can permanently redirect a graduated token's creator feeto that token's holders, once, one-way, only on an approved community takeover — and that lever cannot pay peg.fun, cannot touch liquidity, and cannot touch fees a holder has already earned. That is the deliberate trade-off for the "permanent, rug-safe" liquidity narrative, stated in full rather than rounded up to "renounced."

See Risks for the long-form trade-offs and Security for the disclosure channel.