Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Uniswap v3 LP monitor

Template: uniswap-v3-lp-monitor ยท category: monitoring ยท risk: monitor_only

Tells you the moment a Uniswap v3 pool's price tick leaves the range your LP position earns in. Two workflows on one pool: lp-swap-out-of-range watches Swap events (each carries the post-swap tick) for an instant page, and lp-slot0-out-of-range polls slot0() and fires once on the crossing โ€” a safety net that catches a range exit even if the event stream was down.

When to use it

  • know the second your concentrated liquidity stops earning fees
  • catch a range exit that happened while your indexer was catching up
  • a base for a rebalancing keeper (add a send once you trust the signal)

Generate it

rflow new --template uniswap-v3-lp-monitor
 
# or add the workflow to an existing project
rflow add workflow uniswap-v3-lp-monitor

Non-interactive (CI/agents):

rflow new --template uniswap-v3-lp-monitor --yes --output ./lp \
  --answer tick_lower=-60000 --answer tick_upper=60000

Inputs

keytypedefault
project_namestringuniswap-v3-lp-monitor
network / chain_id / rpc_env / rpc_urlnetwork / chain_id / env_var / stringethereum / 1 / ETH_RPC / a public RPC
pool_name / pool_addresscontract / addressPool / zero placeholder (replace!)
tick_lower / tick_upperint-60000 / 60000
poll_everyduration1m
channelstringops

Ticks are signed โ€” negative ticks are normal for low prices. Read tick_lower / tick_upper off your LP NFT, or use a wide band to watch the whole pool.

Required env vars

DATABASE_URL, the RPC env var (default ETH_RPC), TG_BOT_TOKEN, TG_CHAT_ID โ€” all listed in the generated .env.example.

Safety notes

Monitor-only: no signer: and no relayers:, so the relayer engine never boots. The poll workflow is edge-triggered (fires once on the crossing out of range), and both workflows end in on_failure: dead_letter.

Run it locally

docker compose up -d     # postgres on localhost:5448
# fill .env, set pool_address + the tick range
rflow validate
rflow start

Common modifications

  • widen the band to a whole-pool price-move alarm
  • add a second pool by copying the two workflows
  • extend into a rebalancer: add an approval-gated send_transaction