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
This example begins with count zero and a request to call increment(). No real contract is deployed.
This example begins with count zero and a request to call increment(). No real contract is deployed.Execution follows the code’s input and permission rules. A website button is not the access-control mechanism.The function reads zero, calculates zero plus one, and writes one to persistent storage.The accepted state contains count one. Later reads can inspect it. Events are emitted only if the code implements them.
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?
Different pool designs have different curves, fees and liquidity representations.