Add StableSwapHooks hook on base - #1629
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Review: hooks/base/0x37ca10c307fa8caa772f3583b3fd1e923dee2aa8.json
Address Flags
Address suffix 0x2aa8 = 0010 1010 1010 1000 (16-bit), lowest 14 bits:
| Bit | Flag | Expected | File |
|---|---|---|---|
| 13 | beforeInitialize | true | true ✓ |
| 12 | afterInitialize | false | false ✓ |
| 11 | beforeAddLiquidity | true | true ✓ |
| 10 | afterAddLiquidity | false | false ✓ |
| 9 | beforeRemoveLiquidity | true | true ✓ |
| 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 ✓ |
Also independently confirmed by getHookPermissions() in Base.sol.
Properties
-
dynamicFee: false ✓ —
_beforeSwapreturns0as the fee override (return (this.beforeSwap.selector, delta, 0)). LP fee is set as an immutable at construction. NoupdateDynamicLPFee()call anywhere. -
upgradeable: false ✓ — No proxy pattern, no
SELFDESTRUCT, nodelegatecallto mutable addresses.factoryandpoolManagerareimmutable. The_getRateoracle calls useAddress.functionStaticCall(read-only), which is a rate feed, not an upgrade mechanism. -
requiresCustomSwapData: false ✓ —
_beforeSwapacceptsbytes calldataas its fourth parameter but does not reference it at all. Swaps work correctly with empty hookData. -
vanillaSwap: false ✓ —
beforeSwapReturnsDeltais true and the hook executes the entire StableSwap (Curve-style) AMM computation in_beforeSwap, returning aBeforeSwapDeltathat fully replaces the standard v4 AMM swap. This definitively makes it non-vanilla. -
swapAccess: "none" ✓ —
_beforeSwapcalls only_validatePoolId(_poolKey), which checks that the pool is one managed by this hook instance (not a per-user access control). Any caller can swap without restriction.
Metadata
- verifiedSource: true ✓ — confirmed by
source_meta.json("verified": true). - chainId: 8453 ✓ — matches
"base"inchains.json. - name: "StableSwapHooks" ✓ — matches
contractNameinsource_meta.json. - description ✓ — All claims are substantiated by the source:
- "Curve-style StableSwap AMM" —
StableSwapMathuses the StableSwap invariant. - "full custom accounting" — swap is fully handled in
beforeSwapviaBeforeSwapDelta. - "Supports 2–4 currencies" —
MIN_CURRENCIES = 2,MAX_CURRENCIES = 4inBase.sol. - "optional rate oracles" —
RateOracleConfigwithaddress(0)for static rate inBase.sol. - "dynamic amplification coefficient (ramp)" —
startAmpRamp/stopAmpRampinAmp.sol. - "collecting LP, hook, and protocol fees" — fee logic in
Fees.sol. - "Issues its own ERC20 LP token (SSLP)" —
ERC20("StableSwap LP Token", "SSLP")constructor inLiquidity.sol.
- "Curve-style StableSwap AMM" —
No promotional, audit, safety, or endorsement language in the name or description. All metadata is accurate and substantiated.
Summary
A Uniswap v4 hook implementing a Curve-style StableSwap AMM with full custom accounting. Supports 2–4 currencies with optional rate oracles and dynamic amplification coefficient (ramp). Executes swaps entirely in beforeSwap via BeforeSwapDelta, collecting LP, hook, and protocol fees. Issues its own ERC20 LP token (SSLP).
Flags
Properties
Warnings
Closes #1625