Add EulerSwap hook on ethereum - #7155
Conversation
There was a problem hiding this comment.
Review: hooks/ethereum/0xfc171fd20e6fdca8e6b53e7286a1a21dc73928a8.json
Address Flags
Address 0xfc171fd20e6fdca8e6b53e7286a1a21dc73928a8 — last 14 bits are 0x28a8 & 0x3FFF = 0x28a8 (decimal 10408):
| Bit | Flag | Expected | File |
|---|---|---|---|
| 13 | beforeInitialize | true | true ✓ |
| 12 | afterInitialize | false | false ✓ |
| 11 | beforeAddLiquidity | true | true ✓ |
| 10 | afterAddLiquidity | false | false ✓ |
| 9 | beforeRemoveLiquidity | false | false ✓ |
| 8 | afterRemoveLiquidity | false | false ✓ |
| 7 | beforeSwap | true | true ✓ |
| 6 | afterSwap | false | false ✓ |
| 5 | beforeDonate | true | true ✓ |
| 4 | afterDonate | false | false ✓ |
| 3 | beforeSwapReturnsDelta | true | true ✓ |
| 2 | afterSwapReturnsDelta | false | false ✓ |
| 1 | afterAddLiquidityReturnsDelta | false | false ✓ |
| 0 | afterRemoveLiquidityReturnsDelta | false | false ✓ |
All flags match the address bitmask and are confirmed by getHookPermissions() in src_UniswapHook.sol.
Properties
dynamicFee: false ✓ — _beforeSwap returns fee override as 0 (literal zero, not OVERRIDE_FEE_FLAG). No calls to poolManager.updateDynamicLPFee() anywhere in the hook.
upgradeable: false ✓ — source_meta.json reports "proxy": false. The hook instances use delegatecall into this fixed implementation contract (a code-size pattern), but the implementation itself has no admin-controlled upgrade mechanism, no mutable implementation slot, and no SELFDESTRUCT. The EVC address and pool manager address are both immutable.
requiresCustomSwapData: false ✓ — _beforeSwap declares bytes calldata but never reads or decodes it; all swap logic derives from CtxLib.getParams() and params (the SwapParams struct). Swaps work with empty hookData.
vanillaSwap: false ✓ — beforeSwapReturnsDelta is true and _beforeSwap computes its own custom AMM curve (CurveLib), deposits input tokens into Euler vaults (FundsLib.depositAssets), withdraws output tokens from Euler vaults (FundsLib.withdrawAssets), and returns a non-zero BeforeSwapDelta. The swap does not execute via standard pool math at all.
swapAccess: "none" ✓ — _beforeSwap has no caller access control. The only revert conditions are the reentrancy lock and the curve invariant check (CurveLib.verify); neither gates by caller identity, time, or admin flag.
Metadata
- verifiedSource: true ✓ — confirmed by
source_meta.json("verified": true). - chainId: 1 ✓ — matches
chains.jsonforethereum. - name: "EulerSwap" ✓ — matches
contractNameinsource_meta.json. - description ✓ — accurately describes the on-chain behavior: custom bonding curve via CurveLib, Euler vault deposits/withdrawals via FundsLib, BeforeSwapDelta accounting, and intentional reverts on beforeInitialize (non-factory callers), beforeAddLiquidity (CLAMM positions), and beforeDonate (irrecoverable funds). No promotional, audit, or safety language.
All fields are correct.
Ponx
left a comment
There was a problem hiding this comment.
Bot review verified; bitmask/flags/properties check out. LGTM.
Summary
A Uniswap v4 hook implementing a custom AMM backed by Euler Finance vault positions. In beforeSwap, it computes swap amounts using a custom bonding curve (CurveLib), deposits input tokens into and withdraws output tokens from Euler vaults (FundsLib), and returns a BeforeSwapDelta to handle all swap accounting outside of standard pool math. Native concentrated liquidity, initialization by non-factory callers, and donations are intentionally blocked.
Flags
Properties
Warnings
Closes #7128