Step-by-Step Tutorial
What This Does
Takes an existing Uniswap V3 trading bot and adds V4 support via Universal Router with Permit2 approvals. The bot listens for new Clanker token launches and automatically buys, then manages exits. V4 becomes the primary path, V3 stays as fallback.
The Prompt
Add Uniswap V4 support to this Clanker sniper bot. Use the Universal Router
with Permit2 for approvals. Keep V3 as fallback. The bot should detect which
pool version a token launched on and route swaps accordingly.
What Claude Does
- Reads all 7 files in the codebase to understand architecture
- Spins up a research agent to investigate Clanker V4 factory contract on BaseScan
- Agent reports back: pools use WETH (not native ETH), fee tier 500, tick spacing 10
- Modifies config.js with 5 V4 contract addresses
- Adds buyTokenV4() and sellTokenV4() to trader.js with correct encoding
- Updates portfolio tracking to store pool version and pool keys per position
- Adds V4 listener in signal.js that correlates PoolManager Initialize events
- Updates slippage checks in safety.js to handle V4 Quoter
- Routes buys and sells by pool version in index.js and exits.js
- Syntax checks all 7 files with node –check
- Commits to git with descriptive message
- Creates handoff doc with complete source code