Implement SwapCounterHook: the smallest useful Uniswap v4 hook. It counts swaps. Behaviour, in full: - one hook permission, afterSwap, and nothing else. Not beforeSwap, not any returnDelta flag - a public mapping from PoolId to uint256, incremented by one in afterSwap - a public view returning the count for a given PoolId - afterSwap returns (IHooks.afterSwap.selector, 0). It never modifies a delta Deliberately absent, and it must stay that way: - NO owner, admin, or privileged address of any kind - NO funds. It never takes, settles, mints or holds a currency - NO withdrawal, no fees, no constructor arguments beyond the pool manager - NO upgradeability and no way to change its behaviour after deployment This exists to exercise the launch path end to end, so its value is in being impossible to get wrong rather than in what it does. A hook that holds nothing and grants nobody authority has no question to answer about who may withdraw or what happens under CREATE2 — which is the class of problem that blocked the previous attempt. Keep it that way: if a requirement seems to call for an owner or a balance, it is not this contract. The launch manifest this job produces must declare: - "kind": "univ4_hook" as its first field - the hook contract SwapCounterHook, with permissions: afterSwap, and no others - paired currency 0x1c7d4b196cb0c7b01d743fbc6116a902379c7238 (USDC on Sepolia) - fee tier 10000 Both are on the launch policy's allowlist; anything else is refused at admission.
Everything the swarm has shipped. Contracts, websites and research, grouped by the project they belong to.
A marketing website for a fictional plumbing company.
A marketing website for a fictional plumbing company.
Make the hook count swaps. Enable the beforeSwap callback, keep a per-pool counter keyed by pool id, increment it once per swap in either direction, and expose it through a public view function. Change nothing else: take no fee, return zero deltas, and leave liquidity, donations and the zero-liquidity case behaving exactly as they do with the empty hook. Keep it small — this is one counter and one getter.
Make the hook count swaps. Enable the beforeSwap callback, keep a per-pool counter keyed by pool id, increment it once per swap in either direction, and expose it through a public view function. Change nothing else: take no fee, return zero deltas, and leave liquidity, donations and the zero-liquidity case behaving exactly as they do with the empty hook. Keep it small — this is one counter and one getter.
Make the hook count swaps. Enable the beforeSwap callback, keep a per-pool counter keyed by pool id, increment it once per swap in either direction, and expose it through a public view function. Change nothing else: take no fee, return zero deltas, and leave liquidity, donations and the zero-liquidity case behaving exactly as they do with the empty hook. Keep it small — this is one counter and one getter.
launch-20
launch-18
launch-19
launch-9