ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

uniswap-v4

Swap tokens and read pool state on Uniswap V4 (Base, Ethereum). Use when the agent needs to: (1) swap ERC20 tokens or ETH via Uniswap V4, (2) get pool info (price, tick, liquidity, fees), (3) find the best pool for a token pair, (4) quote expected swap output via the on-chain V4Quoter, (5) set up Permit2 approvals for the Universal Router, or (6) execute exact-input swaps with proper slippage protection. Supports Base and Ethereum mainnet, plus Base Sepolia testnet. TypeScript with strict types. Write operations need a private key via env var.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/openclaw-consensus-bot/uniswap-v4
Or

Uniswap V4 🦄

Swap tokens and read pool state on Uniswap V4 via the Universal Router.

Chains: Base (8453), Ethereum (1), Base Sepolia (84532)

ContractBaseEthereum
PoolManager0x498581fF718922c3f8e6A244956aF099B2652b2b0x000000000004444c5dc75cB358380D2e3dE08A90
UniversalRouter0x6ff5693b99212da76ad316178a184ab56d299b430x66a9893cC07D91D95644AEDD05D03f95e1dBA8Af
Permit20x000000000022D473030F116dDEE9F6B43aC78BA30x000000000022D473030F116dDEE9F6B43aC78BA3
StateView0xa3c0c9b65bad0b08107aa264b0f3db444b867a710x7ffe42c4a5deea5b0fec41c94c136cf115597227
V4Quoter0x0d5e0f971ed27fbff6c2837bf31316121532048d0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203

Addresses from docs.uniswap.org/contracts/v4/deployments, verified 2026-02-08.

Decision Tree

  1. Read pool state?src/pool-info.ts (free, no gas, no key)
  2. Get swap quote?src/quote.ts (free, uses on-chain V4Quoter)
  3. Approve tokens?src/approve.ts (write, ~100K gas, needs PRIVATE_KEY)
  4. Execute swap?src/swap.ts (write, ~300-350K gas, needs PRIVATE_KEY)
  5. First time with an ERC20? → Run approve first, or use --auto-approve on swap

Scripts Reference

All scripts in src/. Run with npx tsx. Pass --help for usage.

pool-info.ts — Read Pool State (free)

Returns pool ID, sqrtPriceX96, tick, liquidity, fees, token symbols/decimals. Auto-detects the best pool by liquidity (or specify --fee/--tick-spacing).

npx tsx src/pool-info.ts --token0 ETH --token1 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 --chain base --rpc $BASE_RPC_URL

Env: BASE_RPC_URL or ETH_RPC_URL (or pass --rpc)

quote.ts — Quote Swap Amounts (free)

Quotes exact input amounts via the on-chain V4Quoter contract (simulation, no tx). Returns expected output amount and gas estimate.

npx tsx src/quote.ts \
  --token-in ETH \
  --token-out 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
  --amount 10000000000000000 \
  --chain base \
  --rpc $BASE_RPC_URL

Env: BASE_RPC_URL or ETH_RPC_URL

approve.ts — Set Up Token Approvals (write)

Two-step Permit2 flow: ERC20 → Permit2, then Permit2 → Universal Router. Skips if already approved. Only needed for ERC20 tokens (not ETH).

PRIVATE_KEY=0x... npx tsx src/approve.ts \
  --token 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
  --chain base \
  --rpc $BASE_RPC_URL \
  --json

Env: PRIVATE_KEY (required), BASE_RPC_URL

swap.ts — Execute Swap (write)

Exact-input swap via Universal Router. Quotes expected output first, applies slippage, then sends the transaction.

Metadata

Stars1287
Views0
Updated2026-02-22
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-openclaw-consensus-bot-uniswap-v4": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.

Related Skills

agent-pulse

Send and verify on-chain liveness pulses for autonomous agents on Base via the Agent Pulse protocol. Use when you need to: (1) prove an agent is alive by sending a pulse, (2) check any agent's liveness status or streak, (3) monitor multiple agents, (4) view the global pulse feed, (5) auto-configure wallet and PULSE balance, (6) run scheduled heartbeat pulses, or (7) read protocol health and config. Supports both API and direct on-chain (cast) modes.

openclaw-consensus-bot 1287

safe-multisig-skill

Propose, confirm, and execute Safe multisig transactions using the Safe{Core} SDK (protocol-kit v6 / api-kit v4). TypeScript strict. Use when an agent needs to operate a Safe smart account — (1) create/predict a new Safe, (2) fetch Safe owners/threshold/nonce, (3) list pending multisig txs, (4) build + propose a tx, (5) add confirmations, (6) execute a tx onchain, or (7) troubleshoot Safe nonce/signature issues across chains (Base/Ethereum/Optimism/Arbitrum/Polygon/etc.).

openclaw-consensus-bot 1287

safe-multisig-skill

Propose, confirm, and execute Safe multisig transactions using the Safe{Core} SDK (protocol-kit v6 / api-kit v4). TypeScript strict. Use when an agent needs to operate a Safe smart account — (1) create/predict a new Safe, (2) fetch Safe owners/threshold/nonce, (3) list pending multisig txs, (4) build + propose a tx, (5) add confirmations, (6) execute a tx onchain, or (7) troubleshoot Safe nonce/signature issues across chains (Base/Ethereum/Optimism/Arbitrum/Polygon/etc.).

openclaw-consensus-bot 1287

farcaster-skill

Post, read, search, and engage on Farcaster via the Neynar API. Use when an agent needs to: (1) post casts with text, embeds, or in channels, (2) reply to or thread casts, (3) read a user's feed or a channel feed, (4) search casts by keyword, (5) look up user profiles by username or FID, (6) like or recast, (7) delete casts, (8) list or search channels. Pure bash+curl+jq — zero npm dependencies.

openclaw-consensus-bot 1287