Polyfun is an internal bonding curve launcher and twin-sided AMM (YES/NO prediction market) natively deployed on Base (Chain ID: 8453). Upon successful migration gating, the protocol provisions liquidity to Uniswap V3 and permanently burns the Liquidity Provider (LP) position via the Nonfungible Position Manager (NFPM).
1. Core State & Lifecycle
Every token deployment instantiates a paired architectural coupling: PolyfunToken (ERC20) and PolyfunMarket (Escrow/AMM). Asset velocity and price discovery remain encapsulated within the market contract until a terminal lifecycle event triggers:
┌─────────────── [ Deploy ] ───────────────┐
│ │
▼ ▼
┌────────────────────────┐ ┌────────────────────────┐
│ internal (Bonding) │ │ settle (Expiry) │
│ - Dual-sided AMM │ │ - Threshold NOT met │
│ - 1% protocol fee │ │ - YES = 0 | NO = Claim│
└────────────────────────┘ └────────────────────────┘
│
▼ (Threshold + Floor Met)
┌────────────────────────┐
│ migrate (Terminal) │
│ - Atomic UniV3 LP │
│ - NFPM NFT -> Burn │
└────────────────────────┘- internal
- Active trading phase (48-hour countdown from deploy). Executes YES/NO asset minting, global pool accounting, and chronological epoch countdown.
- migrate
- Terminal optimistic execution path. Triggered atomically when YES side satisfies both the saturation threshold and the ETH floor.
- settle
- Terminal pessimistic execution path. Triggered post-expiry if the migration gate criteria are not met. NO positions claim pro-rata collateral; YES positions are hard-coded to zero value.
Migration Gate Predicate
Migration conditions are evaluated on-chain via the following logic:
Reference state at exact gate saturation: ≈ 4.44 ETH cumulative gross TVL (4 ETH assigned to YES / remainder residual NO skew).
2. Deployment Topology & Vanity Suffix Gating
Initiated via Base mainnet. Target gas budget requires native ETH coverage alongside a flat execution premium.
- Route: /launch — POST payload contains metadata, initializes a decentralized vanity worker to compute a CREATE2 salt.
- Address Verification: The protocol enforces an on-chain suffix constraint. The low 4 bytes of the deployed token address must resolve to
0xba5e(ba5e). - Access Control: The generated salt is strictly cryptographically bound to the
msg.senderwallet. The deployment factory rejects foreign or front-run salt injection. - Data Availability: UI states synchronize via polling
/api/marketstriggered by custom indexer subgraphs tracking factory deploy blocks.
// On-chain validation snippet require( address(deployedToken) & 0xFFFFFFFF == 0x0000ba5e, "Err: Invalid Suffix" );
3. Internal Market Mechanics
Direct capital routing utilizes buyYes / buyNo entry points using raw msg.value (ETH). A hard-coded 1% protocol fee is sliced directly to the FEE_RECEIVER prior to calculating pool invariant adjustments and crediting user position weights.
Execution Paths
- YES (Long Migration)
- The transaction that fulfills the bonding curve criteria executes
migrate()atomically inline. Post-migration, YES holders pull their proportional share of the 800M token allocation pool relative to their internal deposit weight. - NO (Short Settlement)
- If expiration is reached, NO holders claim a pro-rata share of the contract's aggregate ETH balance based on relative pool weight. YES positions forfeit all deposited capital.
4. Terminal State Resolution
Path A: migrate (YES Victory)
- State Lock: Mutates internal AMM functions to disabled states.
- Fee Extraction: Deducts a fixed 0.1000 ETH protocol migration fee (immutable wei constant in production bytecode).
- Liquidity Provisioning: Automatically routes 200M tokens paired with all residual pool ETH to a fresh Uniswap V3 pool. Tick ranges are hard-coded into the factory adapter architecture (zero user-side slippage or range configuration).
- Distribution: Unlocks the 800M token tranche for internal YES claims; sets
transfersEnabled = true. - Anti-Rug Enforcement: Transposes the Uniswap V3 NFPM ownership directly to
address(0)(Burn). Liquidity pull vectors viadecreaseLiquidityare permanently neutralized.
Path B: settle (NO Victory)
- Trigger: Permissionless execution vector available to any EOA once block timestamp surpasses expiration and migration predicates evaluate to false. Caller pays gas; no MEV bounties.
- Fee Capture: Deducts a flat 2% platform fee (
settleNoWinpath). - Liquidation: Disburses the remaining 98% of total contract ETH to NO depositors. No external AMM pool is initialized.
5. Tokenomics & Fee Structure
Token Allocation
- Total Supply Max Cap: 1 × 10⁹ × 10¹⁸ (1B tokens, 18 decimals)
- Internal Distribution (Bonding / Claims): 80% (800M)
- External Liquidity (Uniswap V3 LP): 20% (200M)
Protocol Matrix
| Operation | Type | Rate / Cost | Hook / Target |
|---|---|---|---|
| Deploy | Flat Fee | 0.0005 ETH | createLaunch() |
| Trade | Percentage | 1% | buyYes() / buyNo() |
| Migration | Fixed Slice | 0.1000 ETH | migrate() (YES Win) |
| Settlement | Percentage | 2% | settleNoWin() (NO Win) |
6. Security Guards & System Constraints
- Deterministic LP Lock: The NFPM token destination is strictly assigned to the burn address inside the migration transaction payload.
- Launch Anti-Whale / Anti-Bot Window: The first 60 blocks post-deployment enforce strict
tx.origin == msg.sender(EOA-only validation). Individual swap volume is hard-capped at 0.5% of total supply per transaction. - Factory Isolation: Only tokens carrying the validated
ba5esuffix minted via the verified factory can initialize markets. Direct manual injections are rejected at the edge.