MEV Tax Distribution
Angstrom L2 captures priority-fee MEV inside the Uniswap v4 hook and pays it out immediately. This note explains how the hook splits the tax between fee recipients and how liquidity providers receive their share. The first section summarizes the on-chain flow; the remainder reproduces the full compensation-price derivation used by the contracts.
How the Tax Flows to LPs
- Snapshot state:
beforeSwapstores the pre-swap tick and liquidity so the hook knows exactly which ranges were crossed. - Compute base deltas:
TickIteratorLibwalks the crossed ticks to derive each range's token deltas. - Solve for a uniform price:
CompensationPriceFinderchooses a compensation pricep*so makers are paid as if the entire swap cleared at that level, using the formulas derived below. - Accrue rewards:
PoolRewardsLibupdates growth accumulators (rewardGrowthOutsideX128,globalGrowthX128) that mirror Uniswap v3/v4 fee accounting. - Pay on exit: When LPs remove liquidity,
afterRemoveLiquiditysettles their accumulated native-token rewards. Integrators can also querygetPendingPositionRewardsmid-position.
The hook shares the tax between the pool creator, protocol treasury, and LPs according to the fee configuration stored in the factory. LP payouts always stay in the rollup's native asset, matching the currency that sequencers prioritize.
Detailed Compensation Price Derivation
This section ports the formal derivation from the contracts repository. It defines the compensation price that equalizes maker payoffs when a swap crosses multiple ticks.

Variables & Definitions
- : virtual liquidity for range ( where are the virtual reserves for range )
- is the price of the lower boundary of range
- : post-trade effective compensation price
- is the bid/liquidity compensation amount.
- Given some liquidity and a price we can determine the virtual reserves in & at that price point with:
- To compute the net amount deltas required to cross a range :
- : aggregated swap amount of whole ranges where the final is known to lie outside of (where , implicitly ):
Compensation Price definition
Assuming unsigned total deltas the final compensation price is defined as:
Zero-for-One Swap: such that each range trades
One-for-Zero Swap: such that each range trades
Base Considered Swap Amount
Notice from the above definition that there will be a consecutive sub-set of ranges which will trade at ( for zero-for-one, for one-for-zero).
This range can be determined by walking from and keeping track of the total sum so far . At each step checking depending on the swap direction. If is outside of the current range the current range will be part of the consecutive set.
If all ranges are depleted and lies beyond then we can take .
Otherwise when a range is found such that we need to calculate the actual that satisfies our original formula.
Zero-for-One (price decreasing)
Setup
For a given tick that is being swapped through, we have:
Quadratic in
Clearing denominators and simplifying yields:
Solutions:
(The two radicands are equal because .)
Existence & Uniqueness on (where )
The quadratic gives us two solutions, we now want to prove the theorem that:
There exists one unique solution that lies in the range and that solution is given by:
Let's take the above quadratic as a function s.t.