This repository contains a subgraph implementation for tracking and analyzing HODLer behavior in ERC20 tokens. The subgraph calculates HODLer ratios for users over specific time periods, providing insights into token retention and user loyalty.
- Tracks user balances and cumulative HODL values at regular (hourly) intervals
- Exposes data that enables clients to calculate HODLer ratios between any two discrete hourly timestamps (e.g., 1:00 PM, 2:00 PM, but not 1:30 PM)
- Implements comprehensive tests to verify correct entity updates and HODLer ratio calculations over arbitrary time ranges
- Analyze user retention and loyalty metrics
- Identify long-term token holders
- Support token economics research and decision-making
- Provide data for community rewards or governance systems based on HODLing behavior
This subgraph offers a powerful tool for token projects, analysts, and researchers to gain deep insights into HODLing patterns and user behavior within ERC20 token ecosystems.
A given user's HODLer ratio over a period [A,B] can be calculated as follows:
(cumulativeHODL(user, B) - cumulativeHODL(user, A)) / (cumulativeHODL(token, B) - cumulativeHODL(token, A))
Where:
cumulativeHODL(user, X)
is the cumulative HODL value for a user at time XcumulativeHODL(token, X)
is the cumulative HODL value for the entire token supply at time X (represented by address(0))
- If cumulativeHODL for a user (or the token) at time N does not exist but has an immediately preceding observation at time M where M < N:
cumulativeHODL(user, N) = cumulativeHODL(user, M) + latest user balance * (N - M)
This extrapolation assumes the user's balance has remained unchanged from M to N.
- If cumulativeHODL for a user at time N does not exist and has no earlier observation:
cumulativeHODL(user, N) = 0
This approach ensures accurate HODLer ratio calculations by using only known data points and extrapolating when necessary.
Synced at:
Pending Changes at same URL
- Install Docker if you don't have it already
- Install postgres:
brew install postgresql
yarn run build:docker
yarn run test
TODO: