Overview
402.cat uses a constant product bonding curve (similar to Uniswap and Pump.fun) to provide instant liquidity for newly created tokens. Tokens trade on the curve until graduation, when they automatically move to Uniswap V4.The Formula
The bonding curve follows the constant product formula:k is a constant that never changes (the invariant).
Buy Formula
When you buy tokens, you add USDC to the curve and remove tokens:Sell Formula
When you sell tokens, you add tokens to the curve and remove USDC:Virtual vs Real Reserves
402.cat implements a dual reserve system (Pump.fun model):Virtual Reserves (For Pricing)
Used to calculate prices via the constant product formula:- virtual_usdc: Virtual USDC reserve
- Initial:
7,403,872($7.40) - Increases on buys, decreases on sells
- Initial:
- virtual_tokens: Virtual token reserve
- Initial:
1,073,025tokens (1,073,025,000,000,000,000,000,000 with 18 decimals) - Decreases on buys, increases on sells
- Initial:
Real Reserves (Actual Holdings)
Tracks actual tradeable assets:- real_usdc: Actual USDC deposited
- Initial:
0 - Accumulates from net buys (after fees)
- Used for LP creation at graduation
- Initial:
- real_tokens: Tokens available for purchase
- Initial:
793,100tokens (79.31% of total supply) - Decreases on buys, increases on sells
- Graduation triggers when this reaches 0
- Initial:
Key Insight: Virtual reserves determine price via the formula, while real reserves track whatβs actually available for trading.
Initial Conditions
For a 1,000,000 token supply on testnet:| Parameter | Value | Notes |
|---|---|---|
| Total Supply | 1,000,000 tokens | Fixed at creation |
| Real Tokens | 793,100 tokens | 79.31% available for trading |
| LP Reserve | 206,900 tokens | 20.69% reserved for liquidity |
| Virtual USDC | 7,403,872 ($7.40) | Initial virtual reserve |
| Virtual Tokens | 1,073,025 tokens | Initial virtual reserve |
| Real USDC | $0 | Accumulates from trades |
| Initial Market Cap | $6.90 | Starting valuation |
| Initial Price | ~$0.0000069 | Starting token price |
k is calculated as:
Virtual Token Derivation
Virtual tokens are derived mathematically to ensure the graduation price matches the LP price:T_v= virtual_tokensT_r= real_tokens (793,100)total_supply= 1,000,000
Price Calculation
Current Price (Spot Price)
The current price per token is:Market Cap
Market cap is the current price multiplied by total supply:Graduation Progress
Track how close a token is to graduation:Buy and Sell Mechanics
Buy Operation
- Calculate fee:
fee = usdc_in Γ 1% = usdc_in Γ 100 / 10000 - Net USDC:
net_usdc = usdc_in - fee - Calculate tokens using virtual reserves:
- Check availability: Ensure
tokens_out β€ real_tokens - Update reserves:
virtual_usdc += net_usdcvirtual_tokens -= tokens_outreal_usdc += net_usdcreal_tokens -= tokens_out
Sell Operation
- Calculate gross USDC using virtual reserves:
- Check availability: Ensure
gross_usdc β€ real_usdc - Calculate fee:
fee = gross_usdc Γ 1% = gross_usdc Γ 100 / 10000 - Net USDC to user:
net_usdc = gross_usdc - fee - Update reserves:
virtual_usdc -= gross_usdcvirtual_tokens += tokens_inreal_usdc -= gross_usdcreal_tokens += tokens_in
Atomic Execution
All buy/sell operations use PostgreSQL row-level locking (FOR UPDATE) to prevent race conditions during concurrent trades. This ensures the bonding curve state remains consistent even under high-frequency trading.
Fee Structure
Bonding Curve Phase
- Buy Fee: 1% (100 basis points)
- Added to the payment amount
- Example: Buy 0.101 total
- Sell Fee: 1% (100 basis points)
- Deducted from proceeds
- Example: Sell for 0.099
- Platform operations
- LP token distribution at graduation
- Referral rewards (10% of fees)
Post-Graduation (Uniswap V4)
After graduation, trades happen on Uniswap V4 with a custom hook:- Hook Fee: ~0.3% (30 basis points)
- Fee Distribution:
- 33% to token creator
- 33% to platform
- 33% to LP holders
Graduation Mechanism
Trigger
Graduation occurs when all real tokens are sold:- All 793,100 tradeable tokens have been purchased
- Market cap has reached the graduation threshold
- The bonding curve is βcompleteβ
Testnet vs Mainnet
| Network | Initial Mcap | Graduation Threshold | Total Supply |
|---|---|---|---|
| Base Sepolia | $6.90 | ~$69 | 1,000,000 |
| Base | $6,900 | ~$69,000 | 1,000,000 |
What Happens at Graduation
- Airdrop: Remaining LP reserve tokens (206,900) are airdropped to existing holders proportionally
-
π₯ CAT Buy Pressure: ALL accumulated
real_usdcis used to buy the platform token (CAT) from the market- This creates automatic buy pressure on CAT with every graduation!
- Example: 69,000 CAT market buy π
- More successful tokens = more CAT demand
-
LP Creation: Uniswap V4 Token/CAT pool is created with:
- Purchased CAT tokens (from step 2)
- LP reserve tokens (206,900)
- LP Locking: 80% of LP tokens are locked forever
- Creator Reward: 20% of LP tokens go to the token creator
- Hook Deployment: Cat402Hook is attached for fee distribution
Price Impact
The constant product formula creates automatic price slippage - larger trades have higher price impact:Example: Buy Impact
Buying $1 USDC worth whenvirtual_usdc = 7,403,872:
- Small buy ($0.10): ~0.00135% price impact
- Medium buy ($1.00): ~0.0135% price impact
- Large buy ($10.00): ~0.135% price impact
No Additional Slippage Parameters
Unlike DEXes, the bonding curve has no slippage tolerance settings. The constant product formula automatically determines the execution price based on the trade size and current reserves.Comparison to Pump.fun
402.catβs bonding curve is modeled after Pump.fun with key similarities:| Feature | 402.cat | Pump.fun |
|---|---|---|
| Formula | Constant product (xΓy=k) | Constant product (xΓy=k) |
| Reserves | Virtual + Real separation | Virtual + Real separation |
| Graduation | To Uniswap V4 | To Raydium |
| LP Distribution | 80% locked, 20% creator | Similar distribution |
| Fee Model | 1% buy/sell | 1% buy/sell |
- Network: Base (Ethereum L2) vs Solana
- Graduation DEX: Uniswap V4 vs Raydium
- Hook System: Custom V4 hooks for fees vs Raydium standard
- Payment Protocol: x402 micropayments vs SOL gas fees
Advanced Topics
Invariant Preservation
The constantk must remain unchanged throughout trading:
Price Continuity
The virtual reserve design ensures price continuity at graduation:Edge Cases
Last Tokens Available:- If a buy would exceed
real_tokens, the buy is capped at available tokens - User receives whatever is left at the calculated price
- Transaction succeeds, token graduates immediately
- If
gross_usdc > real_usdc, the sell fails - This can happen if many people sell after a large buy
- Rare in practice due to balanced in/out flows
Monitoring the Curve
Key Metrics to Watch
-
Graduation Progress: How close to selling out
-
Price Trend: Is the price increasing or decreasing
-
Volume: Total USDC traded
-
Holder Distribution: Who owns the tokens
- Check via positions endpoint
- High concentration = risky
- Distributed = healthier
API Endpoints
Check bonding curve state via:Next Steps
Graduation
Learn about the graduation process
Fee Structure
Understand all fees in the system
Token Lifecycle
Complete journey from creation to graduation
API Reference
Build applications on the bonding curve