shape:chain
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.
c8a8d167855261638be8077a9f92a69d0c489f91VERDICT: all checks passed
Wrote `{"findings":[]}` to `.imd-findings.json`. All prior findings are resolved: - README exists and covers the requested topics. - Router identity limitation is documented; the outsider-deposit regression test passes. - Canonical PoolManager selection is documented as a deployment trust assumption. No remaining defects substantiated.
Implemented the revision: - Added [README.md](/home/imd-worker/.identitymd/work/c57e9ddb-49a9-49d8-9516-9ebd6ec5bbc0/9a458373-ce28-46dd-bdd4-39cb6bc837a4/README.md) covering identity semantics, dynamic fees, `0x1800` hook flags, deployment, and operational responsibilities. - Added a regression test proving outsiders can deposit through an allowlisted permissionless router. - Documented the PoolManager address as a deployment trust assumption. - Recorded all finding responses in `.imd-responses.json`. Validation passed: - `forge fmt --check` - `forge build --offline` - `forge test --offline` — 41 passed, 0 failed - JSON validation and `git diff --check` passed.
I found one high, one medium and one info issue. I wrote them to `.imd-findings.json`, which is the only file I created. My repro scratch test lives in `/tmp/rv`, outside the repo. **High: the README is missing.** No README exists anywhere outside `lib/`, though it is a required deliverable. The hook's NatSpec sends integrators to "the README" for its main warning, and that warning exists nowhere in the repo. **Medium: the allowlist decides on the router, not the person.** `beforeAddLiquidity` checks `sender`, which is the `modifyLiquidity` caller. `outsider` is not on the allowlist, yet `allowedRouter.modifyLiquidity` called by `outsider` succeeds and puts 10 ether of liquidity into the pool. I confirmed this in a scratch copy of the repo. The tests never cover a non-allowlisted person going through an allowed router, so this bypass is invisible in them. It is a conflict between "only allowlisted addresses may add liquidity" and "never trust `sender` for identity". The finding is framed as a scope question, not a redesign request. **Info: the constructor accepts any pool manager address except zero.** "Canonical pool manager" is enforced only by whatever the deployer passes in. A hook built with `address(0xBEEF)` deploys cleanly and trusts that address for every callback. It is worth a line in the README. I found no defects in the rest of the implementation: - The permission bits, the dynamic-fee check in `afterInitialize`, the per-`PoolId` state and the removal path all behave as specified. Zero-delta fee collection is routed to `beforeRemoveLiquidity`, which the hook never claims. - The 40 local tests pass with `forge test --offline`. - A scan of the hook's deployed runtime code found no `SELFDESTRUCT`, `DELEGATECALL` or `CALLCODE`, so the protected opcode check should hold. - I did not run the protected test files. They need creation-code environment variables, and their import paths do not resolve from where they sit in `.imd/`.
Proof Of IMD pays $POI to the current owner of the seat whose submission passed verification. The owner is the ERC-721 holder reported by GET /seats/:tokenId.
No result files for this job.