grimoire-uniswap
franalgaba/grimoire
Query Uniswap router metadata, tokens, and pools via Grimoire CLI for V3/V4 integration.
What is grimoire-uniswap?
Retrieves Uniswap router addresses, token lists, and pool data using the Grimoire venue CLI. Use this skill when you need to look up Uniswap adapter metadata, find pools for token pairs, or generate spell parameter blocks for swap actions.
- Fetch router addresses and adapter metadata for Uniswap V3 and V4
- Look up token lists by symbol or address across supported chains
- Query pools for token pairs with configurable fee tiers and limits
- Generate spell `params:` blocks for tokens and pools (agent-only)
- Support both The Graph subgraph and on-chain RPC pool lookups
- Emit metric surfaces for protocol comparison via `quote_out`
How to install grimoire-uniswap
npx skills add https://github.com/franalgaba/grimoire --skill grimoire-uniswap- Grimoire CLI installed (`npx skills add https://github.com/franalgaba/grimoire --skill grimoire-uniswap`)
- Optional: The Graph API key (`GRAPH_API_KEY`) for subgraph queries, or RPC URL (`RPC_URL`) for on-chain lookups
- Chain ID and token symbols or addresses for pool/token queries
How to use grimoire-uniswap
- 1.Run `grimoire venue doctor --adapter uniswap --chain 1 --rpc-url <rpc> --json` to validate adapter setup
- 2.Use `grimoire venue uniswap routers --chain <id>` to retrieve router addresses for your target chain
- 3.Query tokens with `grimoire venue uniswap tokens --chain 1 --symbol USDC --format spell` to list available tokens
- 4.Find pools using `grimoire venue uniswap pools --token0 USDC --token1 WETH --chain 1 --fee 3000` to discover liquidity
- 5.Generate spell params blocks with `tokens-snapshot` or `pools-snapshot` for agent-only automation
- 6.Reference the fee tier and constraints in your spell's `with()` clause when calling swap actions
Use cases
- Find the correct Uniswap V3 router address and fee tier before writing a swap spell
- Query available pools between USDC and WETH to determine optimal fee tier
- Generate a token snapshot to populate spell parameters for multiple assets
- Compare V3 and V4 swap quotes using the metric surface for protocol selection
- Validate adapter configuration with preflight health checks before deployment
- Spell developers writing Uniswap swap actions
- Agents automating token and pool discovery
- DeFi engineers comparing Uniswap V3 vs V4 routing
- Teams using Grimoire for multi-chain liquidity queries
grimoire-uniswap FAQ
`pools` outputs human-readable JSON or table format; `pools-snapshot` generates a `params:` block for direct use in spell files (agent-only, suppressed in interactive mode).
No. If `GRAPH_API_KEY` is not set, the skill falls back to on-chain RPC lookups using factory contracts. Set it to query The Graph subgraph for faster, more comprehensive pool data.
Common fee tiers are 500 (0.05%), 3000 (0.3%), and 10000 (1%). The `--fee` parameter accepts any integer in basis points; use `pools` to discover available tiers for a pair.
Yes. The Uniswap adapter throws an error if `fee_tier` is not specified in the `with()` clause. Always set it based on your pool's fee tier.
CLI metadata commands work for both V3 and V4. V4 adapter is available programmatically via `createUniswapV4Adapter()`. Always use `grimoire venue uniswap ...` for metadata lookups regardless of your spell's venue.
Full instructions (SKILL.md)
Source of truth, from franalgaba/grimoire.
name: grimoire-uniswap description: Retrieves Uniswap router metadata using the Grimoire venue CLI. Use when you need router addresses, adapter information, or Uniswap V3/V4 details.
Grimoire Uniswap Skill
Use this skill to inspect Uniswap metadata and produce token/pool snapshots for spells.
Preferred invocations:
grimoire venue uniswap ...npx -y @grimoirelabs/cli venue uniswap ...(no-install)bun run packages/cli/src/index.ts venue uniswap ...(repo-local)grimoire-uniswap ...(direct binary from@grimoirelabs/venues)
Recommended preflight:
grimoire venue doctor --adapter uniswap --chain 1 --rpc-url <rpc> --json
Commands
grimoire venue uniswap info— adapter metadatagrimoire venue uniswap routers [--chain <id>]— router addresses per chaingrimoire venue uniswap tokens [--chain <id>] [--symbol <sym>] [--address <addr>] [--source <url>]— token list lookupgrimoire venue uniswap tokens-snapshot [--chain <id>] [--symbol <sym>] [--address <addr>] [--source <url>]— generate spellparams:block for tokens (agent-only)grimoire venue uniswap pools --token0 <address|symbol> --token1 <address|symbol> [--chain <id>] [--fee <bps>] [--limit <n>] [--source <url>] [--endpoint <url>] [--graph-key <key>] [--subgraph-id <id>] [--rpc-url <url>] [--factory <address>]— find pools for a token pairgrimoire venue uniswap pools-snapshot --token0 <address|symbol> --token1 <address|symbol> [--chain <id>] [--fee <bps>] [--limit <n>] [--source <url>] [--endpoint <url>] [--graph-key <key>] [--subgraph-id <id>] [--rpc-url <url>] [--factory <address>]— generate spellparams:block for pools (agent-only)
Pool Data Sources
Pools can be fetched from The Graph (subgraph) or directly from on-chain factory contracts:
- Subgraph (default when
GRAPH_API_KEYis set): queries The Graph decentralized network. Built-in subgraph IDs for Ethereum, Optimism, Polygon, Base, Arbitrum. - RPC (fallback): if no usable graph config is present, pools uses on-chain factory lookups (with
--rpc-url/RPC_URLwhen provided, otherwise chain default RPC where available). - To force RPC mode: provide
--rpc-urland omit--graph-key.
Environment Variables
| Variable | Description |
|---|---|
GRAPH_API_KEY | The Graph API key for subgraph queries (get one at https://thegraph.com/studio/apikeys/) |
RPC_URL | Fallback RPC URL for on-chain pool lookups |
Examples
grimoire venue uniswap info --format table
grimoire venue uniswap routers
grimoire venue uniswap routers --chain 1
grimoire venue uniswap tokens --chain 1 --symbol USDC --format spell
grimoire venue uniswap pools --chain 1 --token0 USDC --token1 WETH --fee 3000 --format spell
grimoire venue uniswap pools --chain 8453 --token0 USDC --token1 WETH --fee 500 --rpc-url $RPC_URL --format table
grimoire venue uniswap pools --chain 8453 --token0 USDC --token1 WETH --fee 500 --graph-key $GRAPH_API_KEY --subgraph-id <id>
grimoire venue uniswap tokens-snapshot --chain 1 --symbol USDC
grimoire venue uniswap pools-snapshot --chain 1 --token0 USDC --token1 WETH --rpc-url $RPC_URL
Use tokens-snapshot or pools-snapshot to emit a params: block for spell inputs. These are agent-only commands (output suppressed in interactive mode).
Metric Surface (Spell Comparisons)
Uniswap V3 and V4 expose quote_out for protocol comparison:
v3_out = metric("quote_out", uni_v3, USDC, "asset_out=WETH,amount=1000000,fee_tier=3000")
v4_out = metric("quote_out", uni_v4, USDC, "asset_out=WETH,amount=1000000,fee_tier=3000,tick_spacing=60")
Selector fields:
- required:
asset_out - optional:
amount(defaults to 1 unit of input asset),fee_tier - V4 optional:
tick_spacing
Spell Constraints
When writing swap actions in .spell files targeting Uniswap, use with clauses to set constraints:
uniswap_v3.swap(USDC, WETH, params.amount) with (
fee_tier=3000,
max_slippage=50,
min_output=900000000000000,
deadline=300,
)
fee_tier is required. The adapter throws if fee_tier is not specified. It is an action parameter (not a constraint) and is extracted from the with() clause.
Common fee tiers: 500 (0.05%), 3000 (0.3%), 10000 (1%).
| Parameter | Type | Description |
|---|---|---|
fee_tier | integer (bps) | Required. Uniswap pool fee tier (e.g. 500, 3000, 10000) |
| Constraint | Type | Description |
|---|---|---|
max_slippage | integer (bps) | Maximum slippage in basis points (e.g. 50 = 0.5%) |
min_output | integer (wei) | Minimum output amount floor |
max_input | integer (wei) | Maximum input amount cap |
deadline | integer (seconds) | Transaction deadline from now |
require_quote | boolean | Fail if on-chain quote fetch fails |
require_simulation | boolean | Fail if simulation unavailable |
max_gas | integer (wei) | Gas estimate cap |
Always set both max_slippage and min_output for swaps to prevent unexpected losses.
Supported Adapters
| Adapter | Router | Approval Flow |
|---|---|---|
@uniswap_v3 | SwapRouter02 | Standard ERC20 approve |
@uniswap_v4 | Universal Router | Permit2 |
Notes
- CLI currently exposes V3 metadata. V4 adapter is available programmatically via
createUniswapV4Adapter(). - For metadata lookups (
tokens,pools), usegrimoire venue uniswap ...even when your spell venue isuniswap_v4. - Outputs JSON/table;
tokensandpoolsalso support--format spell. - Prefer
--format jsonfor automation and reproducible snapshots. - Only metadata is exposed (no on-chain quote endpoints).
Related skills
More from franalgaba/grimoire and the wider catalog.

grimoire
Install, author, and execute Grimoire .spell files with full DSL syntax coverage and advisory decision logic.

grimoire-aave
Query Aave V3 market data, health metrics, and reserve snapshots via Grimoire CLI.

grimoire-hyperliquid
Query Hyperliquid market data and execute withdrawals via Grimoire CLI.

grimoire-morpho-blue
Query Morpho Blue deployment metadata, vault snapshots, and liquidity data via Grimoire CLI.

freee-api-skill
Access freee accounting, HR, invoicing, and business management APIs through AI agents.

gpt-image-2-style-library
Generate production-ready GPT-Image2 prompts using curated style templates and visual guidelines.