Skip to content

Uniswap v4 staking indexing#21

Open
elmeddinkamalli wants to merge 4 commits intodevelopfrom
uniswap-v4-staking-indexing
Open

Uniswap v4 staking indexing#21
elmeddinkamalli wants to merge 4 commits intodevelopfrom
uniswap-v4-staking-indexing

Conversation

@elmeddinkamalli
Copy link

@elmeddinkamalli elmeddinkamalli commented Mar 2, 2026

Overview

This PR introduces a complete indexing solution for the Uniswap V4 Staking contract. It defines a comprehensive GraphQL schema, implements event handlers for all relevant on-chain events, and adds a scheduled onBlock handler to calculate daily rewards and build Merkle trees.

Key Features

Full Schema Coverage – Entities for staking pools, positions, Uniswap V4 pools/positions, user cumulative rewards, and time‑aggregated records.

Daily Reward Calculation – An onBlock handler runs once per day (based on chain block time) to compute each user’s share of daily rewards based on active (in‑range) liquidity. It builds a Merkle tree of (tokenId, cumulativeReward) leaves and stores the root.

Event Handlers

  • Processes LPStakingInit, Deposit, Withdraw, EarlyWithdraw, Reward, RewardsClaimed, and RewardsBurned events from the Staking V4 contract to:

    • Update pool state
    • Track position changes
    • Maintain historical reward and distribution records
  • Processes Initialize, ModifyLiquidity, and Swap events from the Uniswap V4 Pool Manager contract to:

    • Track pool state changes
    • Update liquidity positions
  • Processes the Transfer event from the Uniswap V4 Position Manager contract to:

    • Track ownership changes of LP positions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants