Skip to content

Add Loyalty Volatility Dynamic Fee Hook hook on base#626

Merged
Ponx merged 2 commits into
mainfrom
hooks/base/0xaa226363fb5b8718d125357ddc6539a82489e0c4
Jun 10, 2026
Merged

Add Loyalty Volatility Dynamic Fee Hook hook on base#626
Ponx merged 2 commits into
mainfrom
hooks/base/0xaa226363fb5b8718d125357ddc6539a82489e0c4

Conversation

@hooklist-generator

Copy link
Copy Markdown

Summary

Dynamic LP fee hook that adjusts the swap fee based on recent tick volatility (using configurable gamma and tick-delta threshold) and grants a discount to swappers holding a configured ERC-20 or ERC-721 loyalty token above a threshold. A fixed 0.01% developer fee is extracted from the output currency on every swap via afterSwapReturnsDelta. Fee bounds and loyalty parameters are configurable per pool by the pool owner.

Flags

Flag Value
beforeInitialize true
afterInitialize false
beforeAddLiquidity false
afterAddLiquidity false
beforeRemoveLiquidity false
afterRemoveLiquidity false
beforeSwap true
afterSwap true
beforeDonate false
afterDonate false
beforeSwapReturnsDelta false
afterSwapReturnsDelta true
afterAddLiquidityReturnsDelta false
afterRemoveLiquidityReturnsDelta false

Properties

Property Value
dynamicFee true
upgradeable false
requiresCustomSwapData false
vanillaSwap false
swapAccess none

Warnings

  • Submitter-proposed description rejected: exceeds 500-character length limit and includes non-functional claims (permissions list, external verification status). Using AI-generated description.

Closes #625

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hooklist Ready Ready Preview, Comment Jun 10, 2026 8:55pm

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: hooks/base/0xaa226363fb5b8718d125357ddc6539a82489e0c4.json

Contract: LoyaltyVolatilityHook — verified source on Base (chainId 8453). Source analysis performed against .sources/src_LoyaltyVolatilityHook.sol and supporting libraries.


Flags — PASS

Address 0xe0c4 → binary 1110 0000 1100 0100. Lowest 14 bits:

Bit Flag Expected File
13 beforeInitialize true true ✓
12 afterInitialize false false ✓
11 beforeAddLiquidity false false ✓
10 afterAddLiquidity false false ✓
9 beforeRemoveLiquidity false false ✓
8 afterRemoveLiquidity false false ✓
7 beforeSwap true true ✓
6 afterSwap true true ✓
5 beforeDonate false false ✓
4 afterDonate false false ✓
3 beforeSwapReturnsDelta false false ✓
2 afterSwapReturnsDelta true true ✓
1 afterAddLiquidityReturnsDelta false false ✓
0 afterRemoveLiquidityReturnsDelta false false ✓

Confirmed by getHookPermissions() in source.


Properties — PASS

  • dynamicFee: true ✓ — beforeSwap calls _computeSwapFee() which returns a fee with LPFeeLibrary.OVERRIDE_FEE_FLAG set via FeeMath.withOverrideFlag(). The fee varies per swap based on tick volatility and loyalty holdings.
  • upgradeable: false ✓ — No proxy patterns, no delegatecall, no mutable implementation storage, no SELFDESTRUCT.
  • requiresCustomSwapData: false ✓ — hookData parameter in beforeSwap is declared but completely ignored; swaps work normally without any hookData.
  • vanillaSwap: false ✓ — Correct; dynamicFee is true and afterSwapReturnsDelta is true.
  • swapAccess: "none" ✓ — beforeSwap has no per-caller access control (only a pool-enabled check that applies universally).

Metadata — ISSUES FOUND

chainId: 8453 ✓ — matches chains.json for Base.

verifiedSource: true ✓ — confirmed by source_meta.json.

name:"Loyalty Volatility Dynamic Fee Hook" contains a double space between "Loyalty" and "Volatility". This is a typo and should read "Loyalty Volatility Dynamic Fee Hook".

description: ❌ Minor inaccuracy — the description states the developer fee is "extracted from the output currency", but the source code takes the fee from the unspecified currency (specifiedTokenIs0 ? key.currency1 : key.currency0). For exact-output swaps, the unspecified currency is actually the input token, not the output. The description should say "unspecified currency" instead of "output currency".


Required Changes

  1. Fix the double space in name: "Loyalty Volatility Dynamic Fee Hook"
  2. Fix description: replace "output currency" with "unspecified currency" (or "the unspecified token in each swap")

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: hooks/base/0xaa226363fb5b8718d125357ddc6539a82489e0c4.json

Address Flags

Address suffix 0xe0c4 = 0b1110_0000_1100_0100. Masking to 14 bits:

Bit Flag Expected JSON
13 beforeInitialize true true ✓
12 afterInitialize false false ✓
11 beforeAddLiquidity false false ✓
10 afterAddLiquidity false false ✓
9 beforeRemoveLiquidity false false ✓
8 afterRemoveLiquidity false false ✓
7 beforeSwap true true ✓
6 afterSwap true true ✓
5 beforeDonate false false ✓
4 afterDonate false false ✓
3 beforeSwapReturnsDelta false false ✓
2 afterSwapReturnsDelta true true ✓
1 afterAddLiquidityReturnsDelta false false ✓
0 afterRemoveLiquidityReturnsDelta false false ✓

All 14 flags match. Confirmed by getHookPermissions() in source.

Properties

  • dynamicFee: true ✓ — beforeSwap computes a fee and returns it with FeeMath.withOverrideFlag(finalFee), which ORs in LPFeeLibrary.OVERRIDE_FEE_FLAG to activate the dynamic LP fee override path.
  • upgradeable: false ✓ — Contract uses only immutable storage (poolManager, developerFeeRecipient), no proxy pattern, no delegatecall, no SELFDESTRUCT.
  • requiresCustomSwapData: false ✓ — The hookData parameter in beforeSwap is unnamed and never read. Swaps function correctly with empty hookData.
  • vanillaSwap: false ✓ — Correctly false: afterSwapReturnsDelta=true (developer fee skim via poolManager.take) and dynamicFee=true both disqualify vanilla classification.
  • swapAccess: "none" ✓ — beforeSwap performs no access control (no caller check, no timestamp gate, no governance flag). Any address may swap freely.

Metadata

  • chainId 8453 ✓ — Matches base in chains.json.
  • verifiedSource: true ✓ — Confirmed by source_meta.json ("verified": true).
  • name ✓ — "Loyalty Volatility Dynamic Fee Hook" is a readable expansion of the on-chain contract name LoyaltyVolatilityHook, supported by the NatSpec @notice: "Dynamic LP fees based on tick volatility and ERC-20/ERC-721 loyalty holdings". No promotional or endorsement language.
  • description ✓ — Every claim is substantiated by the source:
    • "adjusts the swap fee based on recent tick volatility" → FeeMath.computeVolatilityDelta tracking tick differences across blocks.
    • "configurable gamma and tick-delta threshold" → PoolConfig.gamma and thetaThreshold.
    • "grants a discount to swappers holding... ERC-20 or ERC-721 loyalty token above a threshold" → LoyaltyVerifier.computeLoyaltyDelta.
    • "fixed 0.01% developer fee" → DEVELOPER_FEE_BIPS = 1 (1 bip = 0.01%).
    • "extracted from the unspecified currency on every swap via afterSwapReturnsDelta" → afterSwap calling poolManager.take and returning the delta.
    • "Fee bounds and loyalty parameters are configurable per pool by the pool owner" → updatePoolConfig gated by msg.sender != config.owner.

No audit claims, safety guarantees, or marketing language present. All verified.

@Ponx Ponx merged commit eb2e0b7 into main Jun 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hook: Loyalty & Volatility Dynamic Fee Hook (Base)

1 participant