Track a DEX Pool's Liquidity Over Time
Follow a single DEX pool's liquidity with decoded events: find the pool, chart deposits and withdrawals, read reserves, and spot liquidity leaving early.
A decentralised exchange is only as useful as the liquidity sitting in its pools. Deep pools let large trades execute with little price impact; thin pools punish anyone who trades size. Liquidity also moves — providers add it when fees look attractive and pull it when risk rises — and those movements often say more about a token's health than its price does.
In this tutorial you will follow a single pool's liquidity over time using decoded events: finding the pool, measuring deposits and withdrawals, and charting how liquidity evolves. The examples use a Uniswap v2-style pool because its events are the simplest to read; the same approach applies to other designs with different event names.
Find the pool address
Every pool is its own contract, created by a factory contract when someone first pairs two tokens. To track a pool you need its address.
The easiest route is the factory's creation events. Our first SQL lesson used the PairCreated events table to count new pools per day; the same table tells you which pool belongs to which token pair. Filter it by the two token addresses you care about and read the pair column from the result. If you already know the pool address — from a DEX interface or a link someone shared — you can skip this step.
Confirm the exact table and column names in the tables catalog on Wevr.ai before you query; naming follows the platform's decoded-events convention.
Learn the pool's events
A v2-style pool emits a small set of events, and three matter for liquidity:
Mint— liquidity was added. It records how much of each token was deposited.Burn— liquidity was removed. It records how much of each token was withdrawn.Sync— emitted after every change, recording the pool's new reserves of both tokens.
Sync is the most convenient for tracking total liquidity, because it gives you the full reserve snapshot directly. Mint and Burn tell you about the flows — who is adding and removing, and when.
Chart reserves over time
Start with reserves. Take the last Sync event of each day as that day's closing reserve:
SELECT toDate(block_timestamp) AS day,
argMax(reserve0, block_timestamp) AS reserve0,
argMax(reserve1, block_timestamp) AS reserve1
FROM uniswap_v2_evt_sync
WHERE contract_address = lower('<pool address>')
AND block_timestamp >= now() - INTERVAL 90 DAY
GROUP BY day
ORDER BY day;
argMax(column, block_timestamp) is a ClickHouse function that returns the column value from the row with the latest timestamp — exactly what "closing value of the day" means. Remember to divide each reserve by its token's decimals before reading the numbers.
Chart both reserves against day. If both fall together, liquidity is leaving. If one rises while the other falls, traders are moving price — buying one token with the other — rather than liquidity changing.
Measure deposits and withdrawals
Reserves blend two things: trading and liquidity changes. To isolate liquidity decisions, look at Mint and Burn directly:
SELECT toDate(block_timestamp) AS day,
countIf(event = 'Mint') AS adds,
countIf(event = 'Burn') AS removes
FROM (
SELECT block_timestamp, 'Mint' AS event FROM uniswap_v2_evt_mint
WHERE contract_address = lower('<pool address>')
UNION ALL
SELECT block_timestamp, 'Burn' AS event FROM uniswap_v2_evt_burn
WHERE contract_address = lower('<pool address>')
)
WHERE block_timestamp >= now() - INTERVAL 90 DAY
GROUP BY day
ORDER BY day;
Counting events shows activity; summing the token amounts in each event shows size. Try both. A day with one huge Burn is very different from a day with a hundred small ones.
Read the story
With reserves and flows on the same screen, a pool's history becomes readable:
- Steady reserves, balanced adds and removes: a healthy, mature pool.
- Falling reserves driven by a few large burns: concentrated providers leaving. Worth checking who they are.
- A single burn that removes most of the liquidity: the signature of a rug pull in a small token's pool. Check whether the remover is the address that created the pool.
- Rising reserves with many small mints: organic growth, often after a listing or incentive programme.
When one address dominates the flows, paste it into Wevr Footprint to see its other activity across chains.
Turn it into a monitor
Save the reserves query and pin its chart to a dashboard next to the token's price. Liquidity leaving ahead of price weakness is one of the more reliable early warnings in small-cap tokens, and having the two side by side makes the pattern hard to miss.
Troubleshooting
Reserves jump in a way that makes no sense. Check whether you divided each reserve by the correct decimals — the two tokens in a pair often have different decimals, and mixing them up produces wildly wrong ratios.
Your pool has no Mint or Burn events. It may not be a v2-style pool. Concentrated-liquidity and other designs use different event names; check the pool's decoded events in the catalog to see what it actually emits.
The chart has gaps. A day without a Sync event simply had no activity in the pool. Carry the previous day's reserves forward when charting so quiet days do not look like liquidity vanishing.
Going further
Concentrated-liquidity designs, such as Uniswap v3, track liquidity per price range rather than as a single reserve pair, and their events are richer as a result. The method is the same — find the pool, identify the liquidity events, aggregate by day — but expect more fields and a steeper learning curve. Master the v2 version first; everything you learned here carries over.