coinbase / coinbase/agentkit

feat: Add Uniswap V4 pool discovery and analytics actions

Open
#957 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
815
Avg merge
13h 31m
Merged PRs (30d)
2

Description

## Summary

Add a `get_v4_pool_analytics` action that queries Uniswap V4 pool data including liquidity depth, volume, fee revenue, and active hooks, potentially via The Graph or direct on-chain reads.

## Motivation

Before swapping or providing liquidity, agents need to understand pool conditions. Currently, the V4 provider can get quotes but cannot answer questions like:
- "What pools exist for ETH/USDC on V4?"
- "What is the TVL in this pool?"
- "Are there any hooks attached to this pool?"
- "What is the 24h volume?"

This is also related to issue #319 (The Graph integration for Uniswap) which has been open for 11+ months.

## Proposed Actions

| Action | Description |
|--------|-------------|
| `get_v4_pool_info` | Get pool details (liquidity, current price, tick, fee, hook address) |
| `list_v4_pools` | Discover available V4 pools for a token pair |
| `get_v4_pool_analytics` | Get pool analytics (volume, TVL, fee revenue) via subgraph |

## Implementation Options

### Option A: Direct On-Chain Reads
- Read pool state from PoolManager's `getSlot0` and `getLiquidity` functions
- No external dependencies, but limited to current state (no historical data)

### Option B: The Graph / Subgraph
- Query Uniswap's V4 subgraph for historical data, volume, TVL
- Richer data but requires subgraph endpoint
- Addresses issue #319

### Option C: Hybrid
- Use on-chain reads for current state (price, liquidity, hook)
- Use subgraph for historical analytics (volume, fees)

## References

- [Uniswap V4 PoolManager](https://github.com/Uniswap/v4-core/blob/main/src/PoolManager.sol)
- Issue #319 (The Graph Integration for Uniswap)
- Issue #299 (Action Provider umbrella request)
- Related to PR #951 (Uniswap V4 action provider)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.