What is liquidity pool?
A pot of two or more tokens locked in a smart contract that lets people trade against it, instead of against another trader.
Liquidity pool diagram example
A liquidity pool is a shared pot of tokens, usually two kinds, held in a smart contract so that others can swap one for the other at any time. People who supply the tokens, called liquidity providers, earn a share of trading fees. It matters because it lets markets work without a traditional order book.
How it works
A common design is the constant-product pool, where the amounts of the two tokens, x and y, are kept so that x × y stays constant. When a trader buys token X, they add token Y and remove X, which raises the price of X. The price is set by the ratio of the two amounts, and larger trades move it more. Fees on each trade are added to the pool.
The trade-off for providers is that fees are earned, but if the price of one token changes a lot relative to the other, they end up holding more of the token that fell. This is called impermanent loss. Deep pools have less price movement per trade, which attracts more trading and more fees.
Example
Say a pool holds 1,000 token X and 1,000 token Y, so x × y = 1,000,000 and the price is 1 Y per X. A trader buys 100 X. The pool must keep the product, so Y becomes 1,000,000 ÷ 900 = 1,111.1. The trader paid 111.1 Y for 100 X, an average of 1.11 each, and the pool price is now 1.23 Y per X (1,111.1 ÷ 900). These are illustrative numbers and ignore fees.
How to model it in Machinations
Use two Pools for the two tokens and a Trader between them. A Register computes the price as the ratio of the two Pools, and the amount received per trade from the constant-product formula. A small Drain-to-Pool flow adds the fee. Set trade size and fee as Levers. Play a series of trades and chart the price to see how much one large trade moves it compared with many small ones.
See liquidity pool in a system you can Play
Build the rules in a Machinations diagram, change a value and Play it to watch how the system responds.