AMM Pricing Formula
Core Concept: Constant Product Formula
x × y = kHow Pricing Works
Initial Pool Setup
Price = y / x = Reserve_USDC / Reserve_YRTInitial Liquidity:
- 1000 YRT
- 1000 USDC
Initial Price:
- 1000 / 1000 = 1 USDC per YRT
Constant k:
- k = 1000 × 1000 = 1,000,000Trading Mechanics
Buy Example: User Swaps USDC for YRT
Sell Example: User Swaps YRT for USDC
Key Formulas
Price Calculation
Swap Output (Exact Input)
Swap Input (Exact Output)
Liquidity Provision
Price Impact
Formula
Example Calculations
Trade Size (USDC)
Output (YRT)
Price Impact
Effective Price
Slippage Protection
Implementation
Fee Mechanism
Fee Structure
Fee Distribution
Fee Calculation Example
Liquidity Provider Economics
LP Token Value
Example: Adding Liquidity
Removing Liquidity
Advanced Concepts
Impermanent Loss
Minimum Liquidity Lock
Price Oracle
Gas Optimization
Batching Swaps
Liquidity Management
Related Documentation
Last updated
