-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
20 lines (19 loc) · 1.41 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Represents a user (wallet address) interacting with the token
type User @entity {
id: ID! # Ethereum address of the user
address: Bytes! # Ethereum address in bytes format
balance: BigInt! # Current token balance of the user (for address(0), this represents total supply)
observationCount: BigInt! # Number of hourly observations for this user
lastHourTimestamp: BigInt! # Timestamp of the last rounded hour an observation was created/updated
observations: [HourObservation!]! @derivedFrom(field: "user") # Reverse lookup for user's hourly observations
}
# Represents an hourly observation of a user's token holding (or token-wide stats for address(0))
type HourObservation @entity {
id: ID! # Composite id: user address + hour timestamp
user: User! # Reference to the user this observation belongs to (address(0) for token-wide observations)
lastTimestamp: BigInt! # Exact timestamp of the observation (can be any time within the hour)
lastBalance: BigInt! # Last Balance for the user when this observation was created or updated
cumulativeHODL: BigInt! # Cumulative HODL value at this observation
previousHourTimestamp: BigInt! # the hour timestamp for the observation that precedes this observation
nextHourTimestamp: BigInt! # the hour timestamp for the observation that succeeds this observation
}