Usually, one user’s counterparty is another trader. However, liquidity pool acts as users’ counterparty when trading.
We introduce the constant product (x * y = k) market maker model to design the on-chain liquidity pool. The liquidity pool has short position and collateral tokens. Anyone can trade with the pool at any time. The trading price is determined by the pool’s price formula. As the pool acts like a market maker, it is also call an AMM (automatic market maker).