Skip to content

[study] (2h) V4 return-delta hooks — BEFORE_SWAP_RETURN_DELTA, AFTER_SWAP_RETURN_DELTA #87

@ozpool

Description

@ozpool

Goal

Understand the advanced V4 feature PRISM avoids in v1.0 but may use in v1.1.

Time estimate

2h (single focused session)

Prerequisites

Study plan (in order)

  1. [25 min] uniswap/v4-core: src/libraries/Hooks.sol — return-delta flags (bits 0–3)
  2. [25 min] uniswap/v4-core: src/PoolManager.sol — how return-delta modifies pool accounting
  3. [25 min] Use cases: custom fees, JIT-liquidity hooks, dynamic fee + delta combos
  4. [20 min] Why PRISM v1.0 doesn't use return-delta (simpler security surface)
  5. [25 min] Write outcomes from memory

Total: 120 min

After studying, you can

  • Explain BEFORE_SWAP_RETURN_DELTA semantics (hook returns custom delta that adjusts swap)
  • Explain AFTER_SWAP_RETURN_DELTA use cases
  • Describe when returnDelta enables custom accounting
  • Articulate why PRISM v1.0 avoids these flags

Tradeoff prompt for the architectural review

What would PRISM need return-delta hooks for in v1.1 MEV execution?

References

  • uniswap/v4-core Hooks.sol
  • uniswap/v4-core PoolManager.sol

Metadata

Metadata

Assignees

Labels

priority:p2-polishNice-to-have / polishstatus:readyScoped and ready to pick uptype:studyArchitecture study / research issue

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions