A liquidity pool smart contract holds and accounts for assets deposited into a pool, then applies programmed rules when swaps or liquidity actions are requested. In an automated market maker (AMM), traders exchange assets against pool inventory rather than matching directly with a specific counterparty. The contract’s exact pricing, accounting, and position rules are design-specific, so a general description cannot establish how a particular deployment behaves.
What a liquidity pool smart contract does
A smart contract is code and data at an on-chain address that carries out the behavior defined by its program. For a liquidity pool, that behavior can include recording pool state and applying rules to asset interactions. The contract is not the same thing as the entire application: a user-facing interface may help someone inspect a pool and prepare an interaction, while the contract applies the pool’s rules when the requested operation executes.
One example is a Uniswap liquidity pool, described as a pairing of tokens held in a smart contract and used for swaps. In Uniswap v2, deposited reserves of a token pair serve as swap inventory, and liquidity-provider shares represent contributions. These are examples of a particular design, not universal requirements: other AMMs can use different curves, assets, fees, and accounting. source source
The distinction between contract and application helps explain what a user can and cannot infer from a screen. An interface can present information and request an action, but that presentation is not itself the pool’s authoritative state or a promise that a transaction will execute. The actual behavior depends on the deployed contract and its rules. The pool contract also does not, by itself, describe every governance decision or off-chain service that may be part of a wider application.
How an automated market maker uses pool reserves
Reserves are the pool’s deposited assets treated as available inventory for swaps. An AMM applies a pricing rule or curve to its pool state to determine the result of a trade. In the Uniswap v2 constant-product example, the reserves are for a token pair; other pool designs can use different assets and rules. source
This means the amount received in a swap is connected to the pool’s current state and chosen design. A quote is not independent of the inventory and rules used to produce it. Pool depth and transaction execution conditions can also matter in public-blockchain AMM trading: transaction visibility, ordering, pool depth, and price impact can affect a swap before block inclusion. That statement describes factors that can affect execution, not a universal formula for every AMM.
A reserve figure should be read as part of a particular contract’s accounting model. It does not, by itself, specify how the pool represents a provider’s position, how fees are handled, or how a withdrawal is calculated. Those details need to be checked against documentation for the actual pool design.
What happens during a swap
A simplified swap lifecycle has several stages. A user or connected application prepares a request to exchange one asset for another. The request is submitted to the relevant pool through a blockchain transaction. The contract evaluates the request under its programmed rules and, if execution succeeds, processes the asset movement and updates the pool’s accounting. This is a conceptual outline: the exact call path and conditions differ across implementations.
For an AMM-based decentralized exchange, trading is implemented through smart contracts and liquidity pools, with transactions settled when included in a blockchain block. Other exchange designs—including order-book, auction, intent-based, cross-chain, or hybrid designs—can use different execution paths, so their flow should not be assumed to match this pool model.
The distinction between a requested swap and a completed swap matters. A user interface can help construct or submit a request, but the contract’s rules determine whether it can be carried out. A general explanation cannot establish the transaction costs, failure conditions, or status rules for a particular chain or application. Those are deployment- and transaction-specific details that require the relevant documentation.
How liquidity providers contribute and withdraw assets
A liquidity provider contributes assets to a pool. In the Uniswap v2 example, provider shares represent contributions to the pool’s token reserves. Across AMMs, a provider can receive a share of trading fees, but also bears inventory and adverse-selection risk. The pool formula, fee tiers, price ranges, and allocation of losses vary by protocol and position. source source
A provider’s exposure can change as pool prices move. An AMM liquidity provider can experience an inventory-value loss relative to simply holding the assets contributed; trading fees may or may not offset that difference. The result depends on the pool design, price path, range, fees, timing, and withdrawal state. This describes a possible risk, not a forecast or an estimate for an individual position. source
Some designs represent a contribution through shares; others can account for positions differently. A provider needs to understand what the pool’s position representation means, which assets it covers, and how the contract treats changes to the position and withdrawal requests. A representation of a contribution does not establish a particular withdrawal value or guarantee that a specific amount of fees will be earned.
Fee mechanics also vary. In one documented Uniswap example, swap fees are taken from swap input and allocated proportionally to liquidity providers with active positions; out-of-range concentrated positions do not earn those fees. This example illustrates why a position’s eligibility and accounting rules matter. It should not be generalized to all pools or treated as a statement about a particular provider’s outcome. source
Contract risks and what to verify
The contract’s behavior depends on its code and the assumptions built into its design. An explanation of reserves and swaps does not establish that a particular implementation is correct or secure. Nor does one pool’s behavior establish that another pool uses the same asset rules, pricing method, accounting, or withdrawal process.
For a specific deployment, start with materials that identify the pool contract and the network where it operates. Then check how that pool defines its assets and reserves, prices swaps, represents provider positions, handles fees, and processes withdrawals. Confirm that the documentation being read refers to the deployment in question; a familiar pool name alone does not explain its exact contract behavior.
A security review should be interpreted in light of what it actually covers. The evidence summarized here does not identify an audited deployment, audit scope, review date, or unresolved findings, and it does not establish the existence or terms of upgrade, pause, or recovery mechanisms for any particular pool. Those points require current authoritative documentation for that deployment and cannot be inferred from general AMM mechanics.
The core model is that a pool contract accounts for deposited assets and applies programmed rules to swaps and liquidity positions. Reserves provide the inventory for a pool’s swaps, while the design determines how trade outcomes and provider accounting work. Because pool mechanics differ, understanding a general model is only a starting point for reading the documentation of a specific contract.
Sources and references
- What is a liquidity pool? — Uniswap Labs Support; retrieved 2026-10-19.
- Pools — Uniswap Developers; retrieved 2026-10-18.
- Trading in the DeFi era: automated market-makers — Bank for International Settlements; retrieved 2026-10-18.
- The Anatomy of Decentralised Exchanges — Bank for International Settlements; retrieved 2026-10-18.
- What is a liquidity provider (LP) fee? — Uniswap Labs Support; retrieved 2026-10-19.