CPMM Model

⚙️ CPMM Model Explained

The Constant Product Market Maker (CPMM) is the pricing engine behind XDEX’s liquidity pools. It powers decentralized swaps, maintains continuous liquidity, and ensures fair rewards for liquidity providers.


🧮 What Is the CPMM Formula?

At its core, CPMM uses a simple yet powerful formula:

x * y = k

x: Reserve of Token A

y: Reserve of Token B

k: A constant that remains unchanged during swaps

Every trade adjusts the reserves (x and y) to maintain the constant k. This dynamic ensures the pool stays balanced and determines token prices based on real-time supply and demand.


🔁 How CPMM Works

🔄 Token Swaps

When a user swaps Token A for Token B, the pool rebalances to maintain the constant product:

🔹Adding Token A increases its supply → lowers its price 🔹Removing Token B decreases its supply → raises its price

📊 Price Discovery

Token prices are based on the ratio of the reserves in the pool.

🔹More of Token A vs Token B = Token A is cheaper

⚠️ Large swaps may cause slippage, where the actual execution price differs from the expected rate due to reserve shifts.

💧 Providing Liquidity

Liquidity providers (LPs) deposit equal value of both tokens into the pool. In return, they receive LP tokens, representing ownership and entitling them to a share of trading fees.


❓ Why XDEX Uses CPMM

☑️ Continuous Liquidity Swaps can be executed 24/7, without relying on active buyers or sellers.

☑️ Decentralized Price Discovery Token prices adjust automatically based on liquidity and demand — no centralized control or order books.

☑️ Simplicity CPMM is transparent and easy to understand, making DeFi accessible to both traders and LPs.

☑️ Fair Rewards Fees are distributed proportionally to LPs based on their share of the pool — no favoritism, no front-running.


🔍 How CPMM Impacts You

👤 As a Trader

🔹Seamless swaps with automated pricing 🔹Always-available liquidity 🔹Transparent slippage and price impact

🪙 As a Liquidity Provider

🔹Earn a share of trading fees 🔹No active rebalancing required 🔹Transparent and predictable reward structure


✅ Final Thoughts

The CPMM model offers the ideal balance of efficiency, fairness, and decentralization — making it the perfect foundation for XDEX. It aligns with our mission to build the fastest, most accessible DEX on the X1 blockchain.

Last updated