-
Notifications
You must be signed in to change notification settings - Fork 7
/
schema.graphql
396 lines (357 loc) · 10.2 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
type HoneyswapFactory @entity {
"Factory address"
id: ID!
"Number of pairs created by the factory"
pairCount: Int!
"Total trading volume in USD"
totalVolumeUSD: BigDecimal!
"Total trading volume in the native currency"
totalVolumeNativeCurrency: BigDecimal!
"Trading volume in USD that could not be tracked"
untrackedVolumeUSD: BigDecimal!
"Total liquidity in USD"
totalLiquidityUSD: BigDecimal!
"Total liquidity in the native currency"
totalLiquidityNativeCurrency: BigDecimal!
"Total number of transactions"
txCount: BigInt!
}
type Token @entity {
"Token address"
id: ID!
"Token symbol"
symbol: String!
"Token name"
name: String!
"Number of decimal places for the token"
decimals: BigInt!
"Total token supply"
totalSupply: BigInt!
"Total trading volume"
tradeVolume: BigDecimal!
"Total trading volume in USD"
tradeVolumeUSD: BigDecimal!
"Untracked trading volume in USD"
untrackedVolumeUSD: BigDecimal!
"Total number of transactions"
txCount: BigInt!
"Total liquidity across all pairs"
totalLiquidity: BigDecimal!
"Derived price of the token in the native currency"
derivedNativeCurrency: BigDecimal
"Array of daily data for the token"
tokenDayData: [TokenDayData!]! @derivedFrom(field: "token")
"Array of daily data for pairs where this token is the base"
pairDayDataBase: [PairDayData!]! @derivedFrom(field: "token0")
"Array of daily data for pairs where this token is the quote"
pairDayDataQuote: [PairDayData!]! @derivedFrom(field: "token1")
"Array of pairs where this token is the base"
pairBase: [Pair!]! @derivedFrom(field: "token0")
"Array of pairs where this token is the quote"
pairQuote: [Pair!]! @derivedFrom(field: "token1")
}
type Pair @entity {
"Pair address"
id: ID!
"Token 0 of the pair"
token0: Token!
"Token 1 of the pair"
token1: Token!
"Reserve of token 0"
reserve0: BigDecimal!
"Reserve of token 1"
reserve1: BigDecimal!
"Total supply of the liquidity token"
totalSupply: BigDecimal!
"Derived liquidity in the native currency"
reserveNativeCurrency: BigDecimal!
"Derived liquidity in USD"
reserveUSD: BigDecimal!
"Tracked liquidity in the native currency"
trackedReserveNativeCurrency: BigDecimal!
"Price of token 0 in terms of token 1"
token0Price: BigDecimal!
"Price of token 1 in terms of token 0"
token1Price: BigDecimal!
"Trading volume of token 0"
volumeToken0: BigDecimal!
"Trading volume of token 1"
volumeToken1: BigDecimal!
"Total trading volume in USD"
volumeUSD: BigDecimal!
"Untracked trading volume in USD"
untrackedVolumeUSD: BigDecimal!
"Total number of transactions"
txCount: BigInt!
# creation stats
"Creation timestamp of the pair"
createdAtTimestamp: BigInt!
"Block number at which the pair was created"
createdAtBlockNumber: BigInt!
"used to detect new exchanges"
liquidityProviderCount: BigInt!
"derived fields"
pairHourData: [PairHourData!]! @derivedFrom(field: "pair")
"Pair liquididty posistions"
liquidityPositions: [LiquidityPosition!]! @derivedFrom(field: "pair")
"Snapshot of liquididty position"
liquidityPositionSnapshots: [LiquidityPositionSnapshot!]! @derivedFrom(field: "pair")
"Token pairs minted"
mints: [Mint!]! @derivedFrom(field: "pair")
"Token pairs burned"
burns: [Burn!]! @derivedFrom(field: "pair")
"Token pair swaps"
swaps: [Swap!]! @derivedFrom(field: "pair")
}
type User @entity {
"User ID"
id: ID!
"Users liquididty position"
liquidityPositions: [LiquidityPosition!] @derivedFrom(field: "user")
"USD value of swapped"
usdSwapped: BigDecimal!
}
type LiquidityPosition @entity {
"Liquidity position id"
id: ID!
"User liquidity position"
user: User!
"Pair liquidity position"
pair: Pair!
"Token balance of LP"
liquidityTokenBalance: BigDecimal!
}
# saved over time for return calculations, gets created and never updated
type LiquidityPositionSnapshot @entity {
"liquidity position snapshot id"
id: ID!
"Snapshot of LP position"
liquidityPosition: LiquidityPosition!
"saved for fast historical lookups"
timestamp: Int!
"saved for fast historical lookups"
block: Int!
"reference to user"
user: User!
"reference to pair"
pair: Pair! # "reference to pair"
"snapshot of token0 price"
token0PriceUSD: BigDecimal!
"snapshot of token1 price"
token1PriceUSD: BigDecimal!
"snapshot of pair token0 reserves"
reserve0: BigDecimal!
"snapshot of pair token1 reserves"
reserve1: BigDecimal!
"snapshot of pair reserves in USD"
reserveUSD: BigDecimal!
"snapshot of pool token supply"
liquidityTokenTotalSupply: BigDecimal!
"snapshot of users pool token balance"
liquidityTokenBalance: BigDecimal!
}
type Transaction @entity {
"txn hash"
id: ID!
"Blocknumber of transaction"
blockNumber: BigInt!
"Timestamp of transaction"
timestamp: BigInt!
# This is not the reverse of Mint.transaction; it is only used to
# track incomplete mints (similar for burns and swaps)
mints: [Mint!]!
burns: [Burn!]!
swaps: [Swap!]!
}
type Mint @entity {
"transaction hash + "-" + index in mints Transaction array"
id: ID!
"Transaction hash of mint"
transaction: Transaction!
"Timestamp of the mint"
timestamp: BigInt!
"Address of pair"
pair: Pair!
"Populated from the primary Transfer event"
to: Bytes!
"Populated from the primary Transfer event"
liquidity: BigDecimal!
"Populated from the Mint event"
sender: Bytes
"Populated from the Mint event"
amount0: BigDecimal
"Populated from the Mint event"
amount1: BigDecimal
"Populated from the Mint event"
logIndex: BigInt
"Derived amount based on available prices of tokens"
amountUSD: BigDecimal
"Optional fee fields, if a Transfer event is fired in _mintFee"
feeTo: Bytes
"Optional fee fields, if a Transfer event is fired in _mintFee"
feeLiquidity: BigDecimal
}
type Burn @entity {
"transaction hash + '-' + index in mints Transaction array"
id: ID!
"Transaction hash of burn"
transaction: Transaction!
"need this to pull recent txns for specific token or pair"
timestamp: BigInt!
"Address of pair"
pair: Pair!
"populated from the primary Transfer event"
liquidity: BigDecimal!
"populated from the Burn event"
sender: Bytes
"populated from the Burn event"
amount0: BigDecimal
"populated from the Burn event"
amount1: BigDecimal
"populated from the Burn event"
to: Bytes
"populated from the Burn event"
logIndex: BigInt
"derived amount based on available prices of tokens"
amountUSD: BigDecimal
"mark uncomplete in ETH case"
needsComplete: Boolean!
"optional fee fields, if a Transfer event is fired in _mintFee"
feeTo: Bytes
"optional fee fields, if a Transfer event is fired in _mintFee"
feeLiquidity: BigDecimal
}
type Swap @entity {
"transaction hash + "-" + index in swaps Transaction array"
id: ID!
"Pointer to transaction"
transaction: Transaction!
"Need this to pull recent txns for specific token or pair"
timestamp: BigInt!
"Address of pair"
pair: Pair!
"Populated from the Swap event"
sender: Bytes!
"The EOA that initiated the txn"
from: Bytes!
"Amount of token0 swapped in"
amount0In: BigDecimal!
"Amount of token1 swapped in"
amount1In: BigDecimal!
"Amount of token0 swapped out"
amount0Out: BigDecimal!
"Amount of token1 swapped out"
amount1Out: BigDecimal!
"Address swapped to"
to: Bytes!
"Order within the txn"
logIndex: BigInt
# Derived info
"Derived amount based on available prices of tokens"
amountUSD: BigDecimal!
}
# stores for USD calculations
type Bundle @entity {
"Bundle address"
id: ID!
"price of native currency usd"
nativeCurrencyPrice: BigDecimal!
}
# Data accumulated and condensed into day stats for all of Honeyswap
type HoneyswapDayData @entity {
"timestamp rounded to current day by dividing by 86400"
id: ID!
"Date of information"
date: Int!
"Daily volume in native currency"
dailyVolumeNativeCurrency: BigDecimal!
"Daily volume in USD"
dailyVolumeUSD: BigDecimal!
"Daily volume"
dailyVolumeUntracked: BigDecimal!
"Total volume in native currency"
totalVolumeNativeCurrency: BigDecimal!
"Total liquidity in native token"
totalLiquidityNativeCurrency: BigDecimal!
"Accumulate at each trade, not just calculated off whatever totalVolume is. making it more accurate as it is a live conversion"
totalVolumeUSD: BigDecimal!
"Total liquidity in USD"
totalLiquidityUSD: BigDecimal!
"Transactions across all pairs"
txCount: BigInt!
}
type PairHourData @entity {
"Pair hour data id"
id: ID!
"unix timestamp for start of hour"
hourStartUnix: Int!
"Address of pair"
pair: Pair!
"reserves"
reserve0: BigDecimal!
"reserves"
reserve1: BigDecimal!
"derived liquidity"
reserveUSD: BigDecimal!
"Hourly volume token0"
hourlyVolumeToken0: BigDecimal!
"Hourly volume token1"
hourlyVolumeToken1: BigDecimal!
"Hourly volume in usd"
hourlyVolumeUSD: BigDecimal!
"Number of hourly trasactions"
hourlyTxns: BigInt!
}
# Data accumulated and condensed into day stats for each exchange
type PairDayData @entity {
"Pair day data id"
id: ID!
"Date of information"
date: Int!
"Address of pair"
pairAddress: Bytes!
"Token0 address"
token0: Token!
"Token1 address"
token1: Token!
"Reserves"
reserve0: BigDecimal!
"Reserves"
reserve1: BigDecimal!
"total supply for LP historical returns"
totalSupply: BigDecimal!
"derived liquidity"
reserveUSD: BigDecimal!
"Daily volume token0"
dailyVolumeToken0: BigDecimal!
"Daily volume token1"
dailyVolumeToken1: BigDecimal!
"Daily volume in usd"
dailyVolumeUSD: BigDecimal!
"Number of daily transactions"
dailyTxns: BigInt!
}
type TokenDayData @entity {
"Token day data id"
id: ID!
"Date of information"
date: Int!
"Token symbol"
token: Token!
"Token daily volume"
dailyVolumeToken: BigDecimal!
"Daily volume native currency"
dailyVolumeNativeCurrency: BigDecimal!
"Daily volume in usd"
dailyVolumeUSD: BigDecimal!
"Number of daily transactions"
dailyTxns: BigInt!
"Total amount for liquidity token"
totalLiquidityToken: BigDecimal!
"Total liquidity native currency"
totalLiquidityNativeCurrency: BigDecimal!
"Total liquidity usd"
totalLiquidityUSD: BigDecimal!
"Price usd"
priceUSD: BigDecimal!
}