-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
196 lines (184 loc) · 4.22 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
### Common ###
type Tx @entity {
# txn hash
id: ID!
# block txn was included in
blockNumber: Int!
# timestamp txn was confirmed
timestamp: DateTime!
# the itinerary
from: String!
to: String
# gas used during txn execution
gasUsed: BigInt!
gasPrice: BigInt!
# derived values
mints: [Mint]! @derivedFrom(field: "transaction")
burns: [Burn]! @derivedFrom(field: "transaction")
swaps: [Swap]! @derivedFrom(field: "transaction")
collects: [Collect]! @derivedFrom(field: "transaction")
}
### From factory events ###
type Pool @entity {
# pool address
id: ID!
# creation
createdAtTimestamp: DateTime
createdAtBlockNumber: Int
# token0
token0Id: String
# token1
token1Id: String
# initial state
initialTick: Int
initialSqrtPriceX96: BigInt
# derived fields
mints: [Mint!]! @derivedFrom(field: "pool")
burns: [Burn!]! @derivedFrom(field: "pool")
swaps: [Swap!]! @derivedFrom(field: "pool")
}
### From pool events ###
type Mint @entity {
id: ID!
# txn the mint was included in
transactionHash: String! @index
transaction: Tx!
# time of txn
timestamp: DateTime!
# pool position is within
poolAddress: String! @index
pool: Pool!
# owner of position where liquidity minted to
owner: String!
# the address that minted the liquidity
sender: String
# amount of liquidity minted
amount: BigInt!
# amount of token 0 minted
amount0: BigInt!
# amount of token 1 minted
amount1: BigInt!
# lower tick of the position
tickLower: Int!
# upper tick of the position
tickUpper: Int!
# txn origin
origin: String! # the EOA that initiated the txn
# order within the txn
logIndex: Int
}
type Burn @entity {
id: ID!
# txn burn was included in
transactionHash: String! @index
transaction: Tx!
# pool position is within
poolAddress: String! @index
pool: Pool!
# need this to pull recent txns for specific token or pool
timestamp: DateTime!
# owner of position where liquidity was burned
owner: String
# amouny of liquidity burned
amount: BigInt!
# amount of token 0 burned
amount0: BigInt!
# amount of token 1 burned
amount1: BigInt!
# lower tick of position
tickLower: Int!
# upper tick of position
tickUpper: Int!
# txn origin
origin: String! # the EOA that initiated the txn
# position within the transactions
logIndex: Int
}
type Swap @entity {
id: ID!
# txn swap was included in
transactionHash: String! @index
transaction: Tx!
# timestamp of transaction
timestamp: DateTime!
# pool swap occured within
poolAddress: String! @index
pool: Pool!
# sender of the swap
sender: String!
# recipient of the swap
recipient: String!
# delta of token0 swapped
amount0: BigInt!
# delta of token1 swapped
amount1: BigInt!
# The sqrt(price) of the pool after the swap, as a Q64.96
sqrtPriceX96: BigInt!
# liquidity after the swap
liquidity: BigInt!
# the tick after the swap
tick: Int!
# txn origin
origin: String! # the EOA that initiated the txn
# index within the txn
logIndex: Int
}
### From positions manager events ###
type IncreaseLiquidity @entity {
id: ID!
# pointer to the tx
transactionHash: String! @index
transaction: Tx!
# timestamp of the event
timestamp: DateTime!
# id of the position nft
tokenId: BigInt!
# liquidity amt
liquidity: BigInt!
# individual token amts
amount0: BigInt!
amount1: BigInt!
}
type DecreaseLiquidity @entity {
id: ID!
# pointer to the tx
transactionHash: String! @index
transaction: Tx!
# timestamp of the event
timestamp: DateTime!
# id of the position nft
tokenId: BigInt!
# liquidity amt
liquidity: BigInt!
# individual token amts
amount0: BigInt!
amount1: BigInt!
}
type Collect @entity {
id: ID!
# pointer to the tx
transactionHash: String! @index
transaction: Tx!
# timestamp of the event
timestamp: DateTime!
# id of the position nft
tokenId: BigInt!
# recipient
recipient: String!
# individual token amts
amount0: BigInt!
amount1: BigInt!
}
type Transfer @entity {
id: ID!
# pointer to the tx
transactionHash: String! @index
transaction: Tx!
# timestamp of the event
timestamp: DateTime!
# id of the position nft
tokenId: BigInt!
# the itinerary
from: String!
to: String!
}