Skip to main content

Integrating with Angstrom L2

Angstrom L2 uses a hub-and-spoke architecture model, with new AngstromL2 hooks deployed via the AngstromL2Factory. See here for more on hook deployment.

On interactions, the Angstrom L2 hook charges a MEV tax according to its current tax configuration. If jitTaxEnabled is 'true', then taxes are charged on both liquidity modifications and swaps; otherwise taxes are only charged on swaps. If the priority fee of a transaction is below the configured priorityFeeTaxFloor then no tax is charged. Otherwise, the tax is proportional to the transaction’s priority fee. The arbitrage auction page provides more details on these taxes. Arbitrageurs, routers, and liquidity frontends all interact with the pool through the standard Uniswap v4 manager; the only additional requirement is accounting for the tax before final settlement.

Swapping

  • Set a tax bid: Each swap with priorityFee above the current priorityFeeTaxFloor must fund a tax equal to (priorityFee - priorityFeeTaxFloor) * TAXED_GAS * swapMEVTaxFactor. Choose your max priority fee so that this amount matches the value you are willing to rebate to the pool.
  • Quote-aware routing: Use AngstromL2.getSwapTaxAmount(priorityFee) or replicate the formula off-chain when deciding whether an arbitrage is profitable.
  • Optional max tax parameter If desired, encode a maxSwapTax parameter in the hookData input to the swap call. This will cause the swap to revert if the calculated tax amount exceeds this optional input.
  • Swap flow: Submit swaps exactly as you would against another v4 pool. The hook escrows the tax in currency0 during beforeSwap and settles it alongside the normal swap deltas in afterSwap.

Liquidity Modification

  • If jitTaxEnabled == true, then each liquidity modification with priorityFee above the current priorityFeeTaxFloor must fund a tax equal to (priorityFee - priorityFeeTaxFloor) * TAXED_GAS * jitMEVTaxFactor in native tokens, where jitMEVTaxFactor = swapMEVTaxFactor * 3 / 2. Use AngstromL2.getJitTaxAmount(priorityFee) to query this amount beforehand or replicate the formula off-chain.
  • This tax is intended to recapture MEV from Just-In-Time liquidity provision and is ~1.5x larger than the swap tax. Normal LPs should have a zero or near-zero priority fee, resulting in a zero or near-negligible liquidity modification tax.

Pool Deployment

  • Pools must specify the native currency as their currency0 so that the hook can appropriately charge priority-fee-based taxes.

Indexing of On-Chain Events

Overviews of hook events and factory events are provided in the Contracts section of the documentation.

For guidance on how to achieve specific goals by indexing these events, see the indexing page.