CPMM Model

The Constant Product Market Maker (CPMM) model is the core mechanism behind XenDEX’s liquidity pools. It ensures continuous liquidity for all token swaps, facilitates decentralized trading, and offers fair rewards to liquidity providers.


What is the CPMM Model?

The CPMM model uses a simple mathematical formula to manage liquidity in pools:

xy=kx * y = k

x: The reserve of Token A in the pool.

y: The reserve of Token B in the pool.

k: Constant and remains unchanged during swaps.

Whenever a trade occurs, the reserves adjust to maintain this constant. This dynamic adjustment determines token prices based on supply and demand.


How Does CPMM Work?

💱 Token Swaps

  • When a user swaps Token A for Token B, the pool adjusts reserves to keep k constant.

  • For example, adding Token A increases its supply and decreases its price, while Token B’s price increases proportionally.

💲 Price Determination

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

  • Larger swaps may cause slippage, where the actual trade price deviates from the expected price due to the proportional impact on reserves.

💧 Liquidity Provision

  • Liquidity providers (LPs) add equal value amounts of both tokens to the pool.

  • In return, they receive LP tokens, representing their share of the pool and entitling them to a portion of trading fees.


Key Benefits of CPMM

✔️️ Continuous Liquidity: Ensures trades can always be executed, regardless of market conditions.

✔️ Decentralized Price Discovery: Token prices adjust automatically based on pool reserves, eliminating the need for a centralized order book.

✔️ Simplicity: The model’s straightforward mechanics make it easy for both traders and liquidity providers to participate.

✔️ Fair Rewards: Trading fees are distributed proportionally to LPs, encouraging active liquidity provision.


Why XenDEX Uses CPMM

✔️ Transparency: Simple and predictable, the CPMM model allows users to see exactly how prices and rewards are determined.

✔️ Fairness: Uniform liquidity distribution ensures equal access for all users, regardless of trade size.

✔️ Accessibility: The straightforward design of CPMM lowers barriers to entry for new users and projects in DeFi.


How CPMM Impacts You

As a Trader:

  • Execute trades seamlessly with dynamic, decentralized pricing.

  • Benefit from continuous liquidity, ensuring your trades are always fulfilled.

As a Liquidity Provider:

  • Earn a share of trading fees proportional to your liquidity contribution.

  • Enjoy a transparent and fair rewards system with no need for active management.

Last updated