Install
openclaw skills install uniswap-pool-analysisAnalyze Uniswap pool data including liquidity distribution, fee tiers, tick ranges, and TVL. Use when the user asks about pool metrics, liquidity analysis, or wants to query on-chain pool state.
openclaw skills install uniswap-pool-analysisThis skill covers querying and analyzing Uniswap v3/v4 pool state on-chain using viem.
price = (sqrtPriceX96 / 2^96)^2L value representing active liquidity at the current tick.| Fee (bps) | Tick Spacing | Typical Use |
|---|---|---|
| 1 (0.01%) | 1 | Stablecoin pairs |
| 5 (0.05%) | 10 | Correlated pairs |
| 30 (0.30%) | 60 | Standard pairs |
| 100 (1.00%) | 200 | Exotic pairs |
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",
});
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;
}
To analyze liquidity distribution across ticks:
tickBitmap to find initialized ticksticks(tickIndex) to get liquidityNetMIN_TICK to MAX_TICK, accumulating net liquidity changesAlways accept a chainId parameter. Use the shared chain config from packages/common/ to resolve: