AMM Design (CPMM)
고지 사항: 이 백서는 영어 버전이 공식 문서입니다. 다른 언어 버전은 참고용입니다。
Overview
섹션 제목: “Overview”PIPO uses a Constant Product Market Maker (CPMM) for warrant price discovery and liquidity provision. This is the same proven model used by Uniswap, adapted for structured product characteristics.
Core Mechanism
섹션 제목: “Core Mechanism”The Constant Product Formula
섹션 제목: “The Constant Product Formula”x × y = k
Where:x = Warrant token reserve in pooly = USDC reserve in poolk = Constant product (invariant)Price Derivation
섹션 제목: “Price Derivation”Spot Price = y / x (USDC per Warrant)
Example:x = 100,000 warrant tokensy = 35,000 USDCk = 3,500,000,000
Spot Price = 35,000 / 100,000 = $0.35 per warrantTrading Mechanics
섹션 제목: “Trading Mechanics”Buy (Swap USDC for Warrants)
섹션 제목: “Buy (Swap USDC for Warrants)”User wants to buy warrants with Δy USDC:
New y' = y + ΔyNew x' = k / y' = k / (y + Δy)Warrants received = x - x' = x - k/(y + Δy)
Example:Buy with $1,000 USDC:├── Initial: x=100,000, y=35,000, k=3.5B├── New y' = 35,000 + 1,000 = 36,000├── New x' = 3,500,000,000 / 36,000 = 97,222├── Warrants received = 100,000 - 97,222 = 2,778├── Effective price = $1,000 / 2,778 = $0.36└── Price impact = ($0.36 - $0.35) / $0.35 = 2.9%Sell (Swap Warrants for USDC)
섹션 제목: “Sell (Swap Warrants for USDC)”User wants to sell Δx warrants:
New x' = x + ΔxNew y' = k / x' = k / (x + Δx)USDC received = y - y' = y - k/(x + Δx)
Example:Sell 2,000 warrants:├── Initial: x=100,000, y=35,000, k=3.5B├── New x' = 100,000 + 2,000 = 102,000├── New y' = 3,500,000,000 / 102,000 = 34,314├── USDC received = 35,000 - 34,314 = $686├── Effective price = $686 / 2,000 = $0.343└── Price impact = ($0.35 - $0.343) / $0.35 = 2.0%Pool Architecture
섹션 제목: “Pool Architecture”Per-Warrant Pools
섹션 제목: “Per-Warrant Pools”Each warrant series has its own pool:
┌─────────────────────────────────────────────────────────────────┐│ PIPO AMM POOLS │├─────────────────────────────────────────────────────────────────┤│ ││ SPACEX-CALL-200B-Q42025 ││ ┌──────────────────────────────────────────────┐ ││ │ Warrants: 500,000 | USDC: 175,000 | k: 87.5B │ ││ │ Price: $0.35 | TVL: $350,000 │ ││ └──────────────────────────────────────────────┘ ││ ││ SPACEX-CALL-180B-Q42025 ││ ┌──────────────────────────────────────────────┐ ││ │ Warrants: 300,000 | USDC: 150,000 | k: 45B │ ││ │ Price: $0.50 | TVL: $300,000 │ ││ └──────────────────────────────────────────────┘ ││ ││ SPACEX-PUT-150B-Q42025 ││ ┌──────────────────────────────────────────────┐ ││ │ Warrants: 200,000 | USDC: 30,000 | k: 6B │ ││ │ Price: $0.15 | TVL: $60,000 │ ││ └──────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────┘Pool Factory
섹션 제목: “Pool Factory”// Simplified pool creationcontract PIPOPoolFactory { function createPool( address warrant, // Warrant token address uint256 initialWarrants, // Initial warrant supply uint256 initialUSDC // Initial USDC liquidity ) external returns (address pool);}Liquidity Provision
섹션 제목: “Liquidity Provision”LP Mechanics
섹션 제목: “LP Mechanics”Liquidity providers deposit both warrant tokens and USDC in the current pool ratio:
LP Deposit Process:├── 1. LP has USDC to deposit├── 2. Platform mints warrants at current ratio├── 3. Both assets deposited to pool├── 4. LP receives LP tokens representing share└── 5. LP earns fees proportional to shareLP Token
섹션 제목: “LP Token”LP Token Value = (Pool TVL × LP Share)
Example:├── Pool TVL: $350,000├── Total LP tokens: 1,000,000├── User LP tokens: 50,000├── User share: 5%└── User value: $17,500Impermanent Loss
섹션 제목: “Impermanent Loss”LP positions are subject to impermanent loss:
IL = 2 × √(price_ratio) / (1 + price_ratio) - 1
Example (price doubles):├── Price ratio = 2├── IL = 2 × √2 / (1 + 2) - 1 = -5.7%└── LP loses 5.7% compared to just holdingFee Structure
섹션 제목: “Fee Structure”Trading Fees
섹션 제목: “Trading Fees”| Fee Type | Rate | Recipient |
|---|---|---|
| Base trading fee | 0.30% | LP + Protocol |
| LP share | 0.25% | Liquidity providers |
| Protocol share | 0.05% | Platform treasury |
Fee Accrual
섹션 제목: “Fee Accrual”Fee Calculation:├── Trade: $1,000 USDC for warrants├── Fee: $1,000 × 0.30% = $3.00├── LP receives: $2.50├── Protocol receives: $0.50└── User receives warrants worth $997Slippage Protection
섹션 제목: “Slippage Protection”User Settings
섹션 제목: “User Settings”┌─────────────────────────────────────────────────────────────────┐│ TRADE SETTINGS │├─────────────────────────────────────────────────────────────────┤│ ││ Slippage Tolerance: [0.5%] [1%] [2%] [Custom: ___%] ││ ││ Transaction Deadline: [10 min] [30 min] [1 hour] ││ ││ Note: Transaction will revert if: ││ • Price moves more than slippage tolerance ││ • Deadline passes before execution ││ │└─────────────────────────────────────────────────────────────────┘Implementation
섹션 제목: “Implementation”function swap( uint256 amountIn, uint256 amountOutMin, // Slippage protection uint256 deadline // Time protection) external { require(block.timestamp <= deadline, "Expired");
uint256 amountOut = getAmountOut(amountIn); require(amountOut >= amountOutMin, "Slippage exceeded");
// Execute swap}Price Impact Visualization
섹션 제목: “Price Impact Visualization”Trade Size vs Impact
섹션 제목: “Trade Size vs Impact”┌─────────────────────────────────────────────────────────────────┐│ PRICE IMPACT CURVE │├─────────────────────────────────────────────────────────────────┤│ ││ Price Impact ││ │ ││ 10% │ ● ││ │ ● ││ 8% │ ● ││ │ ● ││ 6% │ ● ││ │ ● ││ 4% │ ● ││ │ ● ││ 2% │ ● ││ │ ● ││ 1% │ ● ││ │ ● ││ 0.5% │ ● ││ └──────────────────────────────────────────────────────── ││ $100 $500 $1K $5K $10K $25K $50K $100K ││ Trade Size ││ ││ Pool TVL: $350,000 ││ │└─────────────────────────────────────────────────────────────────┘Advanced Features
섹션 제목: “Advanced Features”1. Concentrated Liquidity (Future)
섹션 제목: “1. Concentrated Liquidity (Future)”Reserve CPMM can be enhanced with concentrated liquidity:
Concentrated Liquidity Benefits:├── Higher capital efficiency├── Lower slippage for same TVL├── Custom price ranges for LPs└── Better suited for bounded products (warrants)2. Oracle Integration
섹션 제목: “2. Oracle Integration”AMM prices anchored to oracle:
Oracle-AMM Deviation Check:├── Calculate: deviation = |AMM_price - Oracle_price| / Oracle_price├── If deviation > 10%: Display warning├── If deviation > 20%: Increase fees├── If deviation > 30%: Pause trading└── If deviation < 5%: Green status3. Dynamic Fees
섹션 제목: “3. Dynamic Fees”Fees can adjust based on market conditions:
Dynamic Fee Factors:├── Volatility: Higher vol → Higher fees (protect LPs)├── Volume: Higher volume → Potentially lower fees (reward activity)├── Deviation: High deviation → Higher fees (arbitrage protection)└── Time to expiry: Closer to expiry → Slightly higher feesPool Initialization
섹션 제목: “Pool Initialization”Launch Sequence
섹션 제목: “Launch Sequence”New Warrant Series Launch:├── 1. Oracle Committee approves series├── 2. Platform determines initial price (fair value estimate)├── 3. Platform seeds pool:│ ├── Mints initial warrant supply│ ├── Deposits USDC to set price│ └── k = initial_warrants × initial_usdc├── 4. Pool opens for trading├── 5. External LPs can add liquidity└── 6. Price discovery beginsExample Initialization
섹션 제목: “Example Initialization”SPACEX-CALL-220B-Q22026 Launch:├── Initial warrant supply: 1,000,000 tokens├── Target price: $0.20 (20% probability)├── Initial USDC: 200,000├── k = 1,000,000 × 200,000 = 200,000,000,000├── Opening price: $0.20└── Initial TVL: $400,000Pool Monitoring
섹션 제목: “Pool Monitoring”Health Metrics
섹션 제목: “Health Metrics”| Metric | Target | Alert Threshold |
|---|---|---|
| TVL | > $100K | < $50K |
| Daily Volume | > $10K | < $1K |
| Price Impact (10K) | < 3% | > 10% |
| LP Token Price | Stable | > 5% drop/day |
Dashboard
섹션 제목: “Dashboard”┌─────────────────────────────────────────────────────────────────┐│ POOL HEALTH DASHBOARD │├─────────────────────────────────────────────────────────────────┤│ ││ Pool: SPACEX-CALL-200B-Q42025 ││ ││ Status: 🟢 Healthy ││ ││ Metrics: ││ ├── TVL: $347,500 (🟢 above target) ││ ├── 24h Volume: $45,200 (🟢 healthy) ││ ├── Price Impact (10K): 2.8% (🟢 acceptable) ││ ├── Oracle Deviation: 3.2% (🟢 aligned) ││ └── LP Returns (30d): +4.2% (🟢 positive) ││ ││ Liquidity Providers: 47 ││ Largest LP: 12.5% of pool ││ ││ [View Trades] [Add Liquidity] [Pool Analytics] ││ │└─────────────────────────────────────────────────────────────────┘API Reference
섹션 제목: “API Reference”Get Pool State
섹션 제목: “Get Pool State”const pool = await pipo.getPoolState('SPACEX-CALL-200B-Q42025');
// Response{ poolAddress: '0x...', warrantReserve: 500000, usdcReserve: 175000, k: 87500000000, spotPrice: 0.35, tvl: 350000, volume24h: 45200, fees24h: 135.6, lpTokenSupply: 1000000, lpTokenPrice: 0.35}Add Liquidity
섹션 제목: “Add Liquidity”const tx = await pipo.addLiquidity({ pool: 'SPACEX-CALL-200B-Q42025', usdcAmount: 10000, minLpTokens: 28000, // Slippage protection deadline: Math.floor(Date.now() / 1000) + 600});
// Response{ txHash: '0x...', lpTokensReceived: 28571, warrantsDeposited: 14285, usdcDeposited: 10000, shareOfPool: 2.86}