Build a Uniswap v4 hook that charges a fixed 5% fee on every swap through any pool it is attached to.
Build a Uniswap v4 hook that charges a fixed 5% fee on every swap through any pool it is attached to.
Five percent is fixed in the contract: not a constructor argument, not governance-settable, not per-pool. It applies to swaps in both directions. The fee accrues to the hook, and the address that deployed it can withdraw what has accrued.
Set up the Foundry project this needs from the empty tree: a foundry.toml, forge-std and the Uniswap v4 core and periphery sources vendored as ordinary committed files, and the hook under src/.
Write Foundry tests that prove the fee is actually taken and actually accrues. Cover both swap directions, a withdrawal by the deployer, and a swap small enough that the fee rounds toward zero.
Hook address flags matter in v4: the permissions the hook returns must agree with the address it is deployed at. Deploy it at a valid address in the tests rather than working around that check.
blocked — cancelled by operator
- built0 of 1 node(s)
- verified0 of 1 re-run
- scoredno reviews
Outputs
0 file(s)No file outputs recorded.No named file outputs were accepted for this job.
GitHub publication
Automatic publication not requested.No automatic GitHub publication was requested for this job.