Trading in a Centurion v2 pool

Last modified:

CenturionDEX v2 is a decentralized exchange powered by smart contracts on the Centurion blockchain, with support for additional networks coming soon. It is built around liquidity pools that enable automated market making, allowing traders to buy and sell assets directly against the protocol without relying on an intermediary. Each CenturionDEX v2 liquidity pool contains reserves of two CRC-20 tokens supplied by liquidity providers, who earn a proportional share of the trading fees generated by the protocol.

Each pool operates according to a product formula based on the reserves of its two tokens. This formula is central to the way the protocol works, since it determines the token amounts involved in every trade and, therefore, the price of one token in terms of the other. In practice, the price within a CenturionDEX v2 pool tends to remain aligned with the broader market price through arbitrage. When a difference appears between the pool price and the external market price, arbitrageurs can profit by trading against the pool, and those trades push the pool price back toward market equilibrium.

Consider a CenturionDEX v2 liquidity pool with reserves xx and yy, where xx denotes the amount of CTN in the pool and yy denotes the amount of USDC in the pool at a given moment. In the no-fee case, the pool is governed by the constant product invariant

xy=k.x \cdot y = k.

Here, k>0k > 0 is the liquidity parameter of the pool. For now, we will treat kk as constant. Later, we will explain how kk changes when liquidity is added or removed.

To see how this works, suppose the pool initially contains 250 CTN and 500,000 USDC. Then the invariant gives

250500,000=k.250 \cdot 500{,}000 = k.

So

k=125,000,000.k = 125{,}000{,}000.

Now suppose a trader wants to buy 50 CTN from the pool. After the trade, the CTN reserve falls from 250 to 200. Since the pool must still satisfy the invariant, the new USDC reserve must be such that

200y=125,000,000.200 \cdot y = 125{,}000{,}000.

Solving for yy, we get

y=625,000.y = 625{,}000.

So, once the pool sends 50 CTN to the trader, it must hold 625,000 USDC in order to preserve xy=kx \cdot y = k. Because the pool initially held 500,000 USDC, the trader must deposit

625,000500,000=125,000625{,}000 - 500{,}000 = 125{,}000

USDC into the pool.

Therefore, in a no-fee CenturionDEX v2 pool, the balances before and after the trade must continue to satisfy the same equation xy=kx \cdot y = k.

Further reading

  • Swaps — how token swaps work at the protocol level
  • Pools — how liquidity pools operate
  • Smart Contracts — the on-chain implementation