Handling MEV on L2
The L2 product runs Angstrom’s auction entirely inside a Uniswap v4 hook. Rather than coordinating an external validator set, every swap pays a deterministic tax based on the priority fee it attached. This section outlines how that tax is computed, how the proceeds are shared, and the guardrails that keep the mechanism honest.
Angstrom L2 applies the “priority is all you need” playbook directly inside a Uniswap v4 hook. There is no custom validator network; the hook reads the sequencer tip, charges a deterministic tax, and distributes the proceeds synchronously within the swap call.
Priority-Fee Tax
Rollup sequencers typically order transactions by effective priority fee (tx.gasprice - block.basefee). AngstromL2.beforeSwap reads that tip and records a deterministic tax so every searcher pays the same marginal cost:
SWAP_TAXED_GAS = 100_000;
SWAP_MEV_TAX_FACTOR = 49; // captures 98% of the marginal priority fee
tax = SWAP_TAXED_GAS * SWAP_MEV_TAX_FACTOR * (tx.gasprice - block.basefee);
Routers can pre-compute the tax off-chain using AngstromL2.getSwapTaxAmount(priorityFee). Because the multiplier is fixed, competing searchers face the same economics regardless of the actual gas consumed by the swap.
Distribution & LP Compensation
During afterSwap, the hook:
- Splits the swap fee between the pool creator and the protocol treasury (
creatorSwapFeeE6/protocolSwapFeeE6). - Splits the MEV tax into creator, protocol, and LP shares based on
creatorTaxFeeE6/protocolTaxFeeE6. - Mints the LP share in the rollup-native currency and distributes it across every crossed tick using the Compensation Price Finder. The distribution ensures LPs effectively traded at a uniform compensation price
p*, offsetting adverse selection.
The hook’s PoolRewards accumulator tracks these credits so LPs can withdraw them when removing liquidity or via getPendingPositionRewards.
JIT Liquidity Tax
Just-in-time liquidity adjustments are taxed separately to deter sniping:
JIT_TAXED_GAS = 100_000;
JIT_MEV_TAX_FACTOR = 73; // 1.5x the swap factor
tax = JIT_TAXED_GAS * JIT_MEV_TAX_FACTOR * (tx.gasprice - block.basefee);
afterAddLiquidity and afterRemoveLiquidity charge the tax whenever a position changes within the same transaction. 100% of the proceeds flow to the protocol treasury, while the rewards accumulator is updated so LPs earn the MEV refund that built up before the change.
Safety Considerations
- The rollup sequencer cannot alter how the tax is applied. Inclusion or exclusion is the only lever, and the tax depends only on the priority fee the caller willingly attached.
- Only hooks deployed via
AngstromL2Factoryare marked as verified. Unauthorized contracts cannot call back into the factory to change protocol fees. - Governance can enter
withdrawOnlymode from the factory if needed, pausing swaps while leaving LP withdrawals unaffected.
These guardrails keep the MEV tax deterministic and guarantee that the captured value flows to LPs and configured fee recipients.