ETH StablePair Hook listen tool: peg / fee / LP
Uniswap official ships StablePair Hook on mainnet for USDC/USDG · USDC/USDT—this post watches PoolManager Swap / ModifyLiquidity + hook logs: peg drift, dynamic fee, LP flow on one alert panel. Base stock-token Swap watch watches whitelist big prints; here we watch the Ethereum StablePair stable-pool layer.
Run on the public endpoint · blockreq.com register for 3M free requests monthly.
| Use | Endpoint |
|---|---|
| Public HTTPS | https://ethereum-rpc.blockreq.com/v1/rpc/public |
| Public WSS | wss://ethereum-rpc.blockreq.com/v1/rpc/public |
| Private | Trailing public → {API_KEY} (keys stay local) |
Chain: Ethereum Mainnet EVM chainId = 0x1 (1). Public endpoints · eth_subscribe · Plans · Register.
1. Hook: StablePair × peg / fee / LP
| Tape feel | On-chain signal | Watch |
|---|---|---|
| Stable-pool prints | PoolManager Swap · poolId ∈ table | sqrtPrice · fee · amount0/1 |
| Peg drift | post-trade tick / sqrtPriceX96 | distance from 1:1 reference |
| Dynamic fee | Swap fee field / hook getFee | feeE6 per direction |
| LP flow | ModifyLiquidity · liquidityDelta | add / withdraw size |
Same family, different grain: Base stock-token converges on Swap big prints; this ETH post converges on StablePair peg + fee + LP cards.
2. Event: PoolManager Swap / ModifyLiquidity + hook
Keep local JSON:
| env | Default (editable) |
|---|---|
POOL_MANAGER | 0x000000000004444c5dc75cB358380D2e3dE08A90 |
STABLEPAIR_HOOK | 0x0000113dCf4ADd69999Fad8F20F2b63F979bfcC0 |
POOL_ID_LIST | USDC/USDT · USDC/USDG poolIds (official deployment table) |
PEG_BPS / LP_DELTA_MIN | drift and withdraw thresholds |
One Ethereum public WSS: subscribe PoolManager Swap + ModifyLiquidity, filter topics[1] = poolId; optionally parallel-subscribe hook-address logs.
Step A · Subscribe PoolManager Swap
{
"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe",
"params": ["logs", {
"address": "0x000000000004444c5dc75cB358380D2e3dE08A90",
"topics": [
"0x40e9cecb9f5f1f1c5b9c97dec2917b7ee92e57ba5563708daca94dd84ad7112f",
["POOL_ID_USDC_USDT", "POOL_ID_USDC_USDG"]
]
}]
}
topics[0]: V4Swap(bytes32,address,int128,int128,uint160,uint128,int24,uint24).topics[1]: indexedPoolId; decode amount0/1 · sqrtPriceX96 · liquidity · tick · fee → peg-drift and fee cards.
Step B · Subscribe ModifyLiquidity (parallel OK)
{
"jsonrpc": "2.0", "id": 2, "method": "eth_subscribe",
"params": ["logs", {
"address": "0x000000000004444c5dc75cB358380D2e3dE08A90",
"topics": [
"0xf208f4912782fd25c7f114ca3723a2d5dd6f3bcc3ac8db5af63baa85f711d5ec",
["POOL_ID_USDC_USDT", "POOL_ID_USDC_USDG"]
]
}]
}
topics[0]: V4ModifyLiquidity(bytes32,address,int24,int24,int256,bytes32).liquidityDelta < 0and size ≥LP_DELTA_MIN→ LP-withdraw card; positive → add card.
Step C · Stable-pool card fields
{ chain: "ethereum", pad: "stablepair-hook", kind: "swap|peg|fee|lp", poolId, hook, sqrtPriceX96, tick, fee, pegBps, liquidityDelta, txHash, blockNumber, ts }
Dedupe on txHash + logIndex; demo knobs: poolId table and thresholds. Official reference poolIds (confirm against the deployment page):
- USDC/USDT ·
0x2b21c65d9a7dc6926ee330a1c6e5a8037fd81774f3dc066536f800128e39f634 - USDC/USDG ·
0xeda62d2906d0edf26d40c793d581609552a44a87f618a98ff76ebe8dde4b7edb
3. Browser demo (StackBlitz)
Default Ethereum public WSS; paste PoolManager / StablePair hook / poolId table + peg·LP thresholds, hit Start, stream stable-pool cards. Code lives in StackBlitz — the post only embeds the preview:
Repo: blockreq/blog-demos → examples/ethereum-uniswap-v4-stablepair-hook-listen (Vite+React+viem; open repo root in StackBlitz).
WSS → wss://ethereum-rpc.blockreq.com/v1/rpc/public
HTTPS→ https://ethereum-rpc.blockreq.com/v1/rpc/public
env → POOL_MANAGER · STABLEPAIR_HOOK · POOL_ID_LIST · PEG_BPS · LP_DELTA_MIN
Keyed: swap trailing public for {API_KEY}. Quota: blockreq.com register for 3M free requests monthly.
4. Alert rhythm
- Swap arrives → decode poolId · sqrtPrice · fee · amounts → pegBps / fee card.
- ModifyLiquidity arrives → liquidityDelta threshold → LP add / withdraw card.
- Outbound →
ETH StablePair · kind=… · pool=… · pegBps=… · fee=… · blk=…. - Dedupe → one push per
txHash+logIndex.
On disconnect: reconnect and re-subscribe; gap-fill with HTTPS eth_getLogs on the same PoolManager. POST → https://ethereum-rpc.blockreq.com/v1/rpc/public.
5. Summary + CTA
- Grain: ETH StablePair watch = peg drift + dynamic fee + LP flow.
- Recipe: PoolManager + Swap/ModifyLiquidity topics + poolId table + thresholds → stable-pool card.
- Runnable: browser on BlockReq Ethereum public WSS; demos1 paths above.
- Start: Public endpoints + blockreq.com register for 3M free requests monthly.
Next: pin poolId / threshold JSON → webhook → stack on-screen with Base stock-token Swap print cards. Docs · Pricing · Register.