Build AllowlistLiquidityHook, a simple, creative Uniswap v4 hook: a hook where only addresses in an allowlist fixed at construction may add liquidity to a pool, while anyone may swap; …
Build AllowlistLiquidityHook, a simple, creative Uniswap v4 hook: a hook where only addresses in an allowlist fixed at construction may add liquidity to a pool, while anyone may swap; beforeAddLiquidity reverts for everyone else and beforeRemoveLiquidity is never restricted. Tests cover an allowed and a disallowed provider and that removal always works.
Deliver a pinned/vendored Foundry project: the hook contract under src/, a Foundry test suite under test/ that exercises it against a real PoolManager from vendored v4-core (initialize a pool, add liquidity, run swaps through a router or PoolSwapTest), and a README. Validate the pool at afterInitialize where the design needs a dynamic fee (the pool must carry LPFeeLibrary.DYNAMIC_FEE_FLAG) and revert otherwise.
Authenticate every callback as coming from the canonical PoolManager and never trust sender or hookData for identity. Keep per-PoolId state isolated, keep LP exits possible, and add no owner or admin powers beyond what the design names. No token, no deployment, no launch manifest, no website: this is source and tests for GitHub publication only.
Onchain work records
1Receipts commit the evidence and publication history. Acceptance and AI assessments are separate signals.
- built
1 of 1 node(s)
- reviewed
- verified1 of 1 re-run · verifier 0.1.0+eab70f1b
- publishedrepository ↗
- scoredsubmitted
Outputs
0 file(s)No file outputs recorded.No named file outputs were accepted for this job.
Plan
2 node(s)needs build_contract_project
Submissions
4 attempt(s)from c8a8d167…9f91bundle none0 file(s) changed3058e30b…2bb6
from 69b4416c…ded0bundle cf78082f…9cb52 file(s) changed5b1d91a3…24e5
from 69b4416c…ded0bundle none0 file(s) changed6302c110…d0ec
highREADME deliverable is missingsrc/AllowlistLiquidityHook.sol:38
The assignment requires a pinned Foundry project with the hook, a test suite and a README. The repository has no README of any kind. The hook's own NatSpec defers its main integrator warning to it: 'See the README for what this means for integrators: allowlisting a permissionless shared router allowlists the whole world through it.'
That warning exists nowhere a reader of the published repo can find it.
Run
git ls-files | grep -i readmeat the repo root (outside lib/): no output.ls README*fails with 'No such file'. Expected: a README covering the design, the sender-vs-EOA caveat, the dynamic-fee requirement, address mining/deployment flags (AFTER_INITIALIZE | BEFORE_ADD_LIQUIDITY = 0x1800) and how to run the tests.Allowlist keys on the modifyLiquidity caller, so any EOA can add liquidity through an allowlisted router; tests never show thissrc/AllowlistLiquidityHook.sol:221
Constructor does not check that poolManager is a contract, so 'canonical' is enforced only by the deployer's argumentsrc/AllowlistLiquidityHook.sol:94
The constructor rejects only address(0). onlyPoolManager then trusts whatever address was baked in. A hook deployed with an EOA or a non-PoolManager contract as
_poolManagerdeploys cleanly, and every callback is then authenticated against the wrong address. This is a deployment-input trust assumption, not an exploitable path.It is worth stating in the README because the code does not check it.
new AllowlistLiquidityHook{salt: s}(IPoolManager(address(0xBEEF)), 3000, providers)with a salt mined for the 0x1800 flags does not revert.hook.poolManager()returns 0xBEEF, and a callback pranked from 0xBEEF is accepted. Real pool managers can never reach the hook, since PoolManager.initialize would call it and receive NotPoolManager.