📦 Uniswap Pool Analysis — 技能工具

v0.1.0

[自动翻译] Analyze Uniswap pool data including liquidity distribution, fee tiers, tick ranges, and TVL. Use when the user asks about pool metrics, liquidity anal...

0· 747·2 当前·2 累计
by @wpank·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/1
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
medium confidence
The skill's stated purpose (on-chain Uniswap pool analysis) matches its instructions, but the SKILL.md references environment variables, repo-local config, and external install instructions that are not declared — this inconsistency could lead to unexpected network access or require secrets the skill does not explicitly request.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.1.02026/2/10

- Initial release: analyze Uniswap v3/v4 pool data including liquidity, tick ranges, fee tiers, and TVL. - Supports querying on-chain pool state using viem, including `slot0` and `liquidity`. - Includes utilities for price and tick conversion. - Offers liquidity distribution analysis across ticks. - Accepts `chainId` for multi-chain support with configurable endpoints.

无害

安装命令

点击复制
官方npx clawhub@latest install uniswap-pool-analysis
🇨🇳 镜像加速npx clawhub@latest install uniswap-pool-analysis --registry https://cn.longxiaskill.com

技能文档

Overview

This skill covers querying and analyzing Uniswap v3/v4 pool state on-chain using viem.

Key Concepts

  • sqrtPriceX96: Encoded price format used by Uniswap v3/v4. Convert with price = (sqrtPriceX96 / 2^96)^2
  • Ticks: Discrete price points defining liquidity ranges. Tick spacing depends on fee tier.
  • Liquidity: The L value representing active liquidity at the current tick.

Fee Tiers (v3)

Fee (bps)Tick SpacingTypical Use
1 (0.01%)1Stablecoin pairs
5 (0.05%)10Correlated pairs
30 (0.30%)60Standard pairs
100 (1.00%)200Exotic pairs

Querying Pool State

Use the Uniswap v3 Pool ABI to read on-chain state:

import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";

const client = createPublicClient({ chain: mainnet, transport: http(process.env.ETHEREUM_RPC_URL), });

// Read slot0 for current price and tick const [ sqrtPriceX96, tick, observationIndex, observationCardinality, observationCardinalityNext, feeProtocol, unlocked, ] = await client.readContract({ address: poolAddress, abi: poolAbi, functionName: "slot0", });

// Read liquidity const liquidity = await client.readContract({ address: poolAddress, abi: poolAbi, functionName: "liquidity", });

Price Conversion

function sqrtPriceX96ToPrice(
  sqrtPriceX96: bigint,
  decimals0: number,
  decimals1: number,
): number {
  const price = Number(sqrtPriceX96) / 2 * 96;
  return (price  price  10  decimals0) / 10  decimals1;
}

function tickToPrice( tick: number, decimals0: number, decimals1: number, ): number { return (1.0001 tick 10 decimals0) / 10 decimals1; }

Liquidity Distribution

To analyze liquidity distribution across ticks:

  • Query tickBitmap to find initialized ticks
  • For each initialized tick, read ticks(tickIndex) to get liquidityNet
  • Walk from MIN_TICK to MAX_TICK, accumulating net liquidity changes
  • Plot cumulative liquidity vs price for the distribution

Multi-chain Support

Always accept a chainId parameter. Use the shared chain config from packages/common/ to resolve:

  • RPC URL
  • Pool factory address
  • Quoter address
  • Subgraph endpoint (if available)
数据来源:ClawHub ↗ · 中文优化:龙虾技能库