decrease_liquidity removes some or all liquidity from a position. It does not transfer token value to the holder. The contract converts withdrawn principal and pending fees into public tokens_owed balances, which the holder later withdraws through collect.
Decrease and collect are separate operations:
Outcome
The decrease is complete when the transaction is accepted, the public position shows the remaining liquidity, withdrawn principal and fees are reflected intokens_owed, and the replacement PositionNFT is stored. No payout record is created until a later collect.
Before you start
Read the current position, slot, fee growth, and freeze state. Reserve the currentPositionNFT, choose the exact liquidity amount to remove, and calculate raw token minimums using the current price and the position’s fixed range.
Inputs and outputs
The transition accepts:- Current
PositionNFTrecord - Public liquidity to remove
- Public token0 minimum
- Public token1 minimum
PositionNFT record.
The pool, token programs, and range come from the PositionNFT. The public Position mapping must match those values.
Exit controls
The position must not be frozen, and the requested amount cannot exceed its public liquidity. The decrease finalize path does not check pool entry controls. An LP can reduce exposure while pool, global, token, or pair controls stop new entry and trading. A position-specific freeze still blocks the decrease. A frozen live position is handled separately by the administrator’s freeze path. Freeze removes all active liquidity and settles value intotokens_owed, then blocks decrease and collect until unfreeze.
Principal calculation
The contract calculates principal at the current square-root price using the position’s fixed lower and upper ticks. Depending on price:- Below range, withdrawn principal is token0.
- In range, withdrawn principal can include both tokens.
- Above range, withdrawn principal is token1.
Fee settlement order
The position’s pending fee entitlement is settled using its full liquidity before the requested reduction:- Reduced liquidity
- Current inside-growth checkpoints
- Updated owed balances
Tick updates
At the lower boundary:liquidity_gross reaches zero, the contract:
- Reconnects the boundary’s previous and next neighbors.
- Updates cached nearest-tick pointers if necessary.
- Removes the boundary from the
ticksmapping.
Active-liquidity update
The slot’s active liquidity decreases only if the current tick is inside the range:Partial and full decrease
Partial decrease
- Position remains in the mapping.
- Replacement
PositionNFTremains necessary. - Remaining liquidity may continue earning fees if active.
- Settled principal and fees stay in
tokens_owed.
Full decrease
- Position liquidity becomes zero.
- Boundary ticks may be removed if no other position uses them.
- All principal and settled fees stay in
tokens_owed. - The position cannot be burned until both owed balances are collected.
tokens_owed. The LP must collect those amounts before burning the position.
Rounding and settlement cadence
Principal is rounded down under the amount-for-liquidity formulas. Fee entitlement is also rounded down to an integer native base unit when the checkpoint advances. Each partial decrease can discard a sub-unit fee fraction. A strategy that repeatedly removes small amounts can settle more often than a single large decrease and may leave more dust in the contract. There is no per-position residual field, pool-level residual carry, or generic surplus sweep. Discarding the sub-Q128 remainder prevents fee fractions from moving across liquidity epochs.Operational sequence
For a managed exit:- Read the latest slot, position, and boundary state.
- Compute principal in native base units using the current Q128.128 price.
- Set raw minimum amounts for the intended slippage tolerance.
- Submit decrease with the latest ownership record.
- Save the replacement record.
- Verify new public liquidity and owed balances.
- Collect the desired native base-unit amounts.
- Burn only after liquidity and both owed balances are zero.