In this track: How people use Ethereum
intermediate · 3 MIN READ

Liquidity pools explained

A pool’s reserves and pricing rule shape what a swap can receive.

LET’S PICTURE IT

Two buckets of different tokens can be linked by a rule that changes the exchange rate as their quantities change.

SEE IT FOR YOURSELF
A valid counter call, step by stepStep 1 / 4
A valid counter call, step by stepFunction requestincrement()No argumentsBefore executionstored count0A local teaching example with a defined starting stateIncoming callCheck function dispatchCheck coded conditionsRules passConditions passContinue executionA failed check can revert insteadCalculation0 + 1Result: 1Storage writecount = 1Persists if call succeedsCalculating a local value and storing it are separate stepsPersistent statecount1Later readGetter reports 1No new incrementState, logs and browser display have different roles

This example begins with count zero and a request to call increment(). No real contract is deployed.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Reserves supply the exchange

Liquidity providers can deposit assets under a pool’s rules. Traders interact with the resulting reserves. The contract determines pricing, fees and how provider claims are represented.

A simple teaching rule

In a fee-free constant-product model, x times y remains constant. With reserves 100 and 100, adding 10 of the first asset leaves about 90.9091 of the second, so the output is about 9.0909 before any real-world rounding policy.

The model has limits

Real pools may charge fees, concentrate liquidity or use another curve. Their integer arithmetic and reserve updates need exact implementation analysis. The example is a model, not a live quote or universal exchange formula.

Providing liquidity has risk

A provider’s final holdings depend on trades, prices and the mechanism. A fee stream is not a guaranteed profit. Study the rules and dependencies before treating a reserve number as a promise.

QUICK CHECK · NO PRESSURE

Does every exchange pool use the exact same constant-product implementation?

Your progress stays in this browser.
Keep exploring the original referenceethereum.org ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.