Uniswap V3: When collect() Is More Than “Collect Fees”
Source: Dev.to
Overview
Uniswap V3 introduced concentrated liquidity, NFTs for positions, and a much more expressive — but also more subtle — event model. One consequence of this design is that on‑chain events can be perfectly correct, yet still semantically confusing for end‑users.
The “Collect” Action
Common Assumption
For many users (and even some dashboards):
collect() = collect earned fees
What a Uniswap V3 Position Represents
- Liquidity
- Fee growth inside the tick range
- Last fee checkpoints
Typical Exit Flow
decreaseLiquidity()collect()
Key Nuance
collect() can bundle two different things:
- Accrued fees (actual yield)
- Leftover liquidity (principal being returned)
This occurs especially when:
- Liquidity is fully removed
- The position is closed
- Amounts remain owed to the position
From the protocol’s point of view, this is perfectly valid:
- Everything owed to the position is paid out
- All values are emitted correctly in event logs
However, fees and principal are very different concepts semantically.
Protocol vs. User Perspective
Most explorers (Etherscan included) handle the log level correctly:
- Decode
Collectevents faithfully - Display the amounts emitted by the contract
- Label the action according to the function/event name
The problem is not decoding accuracy; it is the gap between log‑level correctness and user‑level semantic clarity.
User‑Facing Ambiguity
- “Collect: 12,000 USDC”
- vs. “Fees earned: 1,200 USDC” & “Liquidity returned: 10,800 USDC”
Without protocol context, these meanings are indistinguishable.
Decoding Challenges
You cannot reliably separate fees from liquidity by decoding a single event. To do this correctly you must:
- Decode all event logs in the transaction.
- Detect the
removeLiquidityevent and thecollectevent. - Extract the “Liquidity return” and the “Fee earned” amounts from the
collectevent.
Events remain low‑level and composable; meaning emerges only when state is reconstructed. This creates UX gaps between “what happened” and “what users think happened”.
Implications for Data Builders
- Accurate decoding is the baseline.
- Building higher‑level semantics requires aggregating multiple events and reconstructing state.
Resources
- Transaction decoding API – standardizing blockchain data into one unified, readable schema on Ethereum, Base, BSC, Solana
- Website:
- X (Twitter):
- Telegram:
- Announcements:
- Medium: