-
Notifications
You must be signed in to change notification settings - Fork 2
/
schema.graphql
278 lines (247 loc) · 9.58 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
enum ContractCategory {
LockupDynamic
LockupLinear
LockupTranched
}
enum StreamCategory {
LockupDynamic
LockupLinear
LockupTranched
}
enum ActionCategory {
Approval
ApprovalForAll
Cancel
Create
Renounce
Transfer
Withdraw
}
type Action @entity {
"unique identifier resolving to transaction hash concatenated with the log index (there may be multiple actions per tx)"
id: ID!
"transaction details: block number"
block: BigInt!
"category of action e.g. Deposit or Withdraw"
category: ActionCategory!
"hardcoded chain id"
chainId: BigInt!
"contract through which the stream actions has been triggered"
contract: Contract!
"transaction details: hash"
hash: Bytes!
"address that triggered the transaction"
from: Bytes!
"stream linked to this action (or null if this is a contract level action)"
stream: Stream
"unique global id tracked by the subgraph watcher"
subgraphId: BigInt!
"transaction details: timestamp"
timestamp: BigInt!
"address of an actor, differs based on action type e.g. for Create it resolves to the sender"
addressA: Bytes
"address of an actor, differs based on action type e.g. for Transfer it resolves to the new recipient"
addressB: Bytes
"amount, differs based on action type e.g. for Deposit it resolves to the depositAmount"
amountA: BigInt
"amount, differs based on action type e.g. for Withdraw it resolves to the refundedAmount"
amountB: BigInt
}
type Asset @entity(immutable: true) {
"unique identifier resolving to the ERC20 asset/token address"
id: ID!
"address of the ERC20 asset/token"
address: Bytes!
"hardcoded chain id"
chainId: BigInt!
"decimals of the ERC20 asset/token"
decimals: BigInt!
"name of the ERC20 asset/token"
name: String!
"symbol of the ERC20 asset/token"
symbol: String!
"streams that rely on this asset/token"
streams: [Stream!]! @derivedFrom(field: "asset")
}
type Batch @entity {
"unique identifier of the batch, resolving to the hash of the parent transaction"
id: String!
"number of streams that are part of this batch"
size: BigInt!
"index of the batch resolving to a conditional counter of 2+ stream batches, filtered by sender (label is null for batches containing a single stream, for filtering)"
label: String
"batcher (sender) that started this batch"
batcher: Batcher
"streams that are part of this batch"
streams: [Stream!]! @derivedFrom(field: "batch")
"hash of the transaction that created this batch"
hash: Bytes!
"timestamp of the transaction that created this batch"
timestamp: BigInt!
}
type Batcher @entity {
"unique identifier of the batcher (sender), resolving to their address"
id: String!
"address of the sender"
address: Bytes!
"numeric index, will be used to construct the batch label"
batchIndex: BigInt!
"batches started by this batcher (sender)"
batches: [Batch!]! @derivedFrom(field: "batcher")
}
type Contract @entity {
"unique identifier resolving to contract address"
id: String!
"full version based on the v2-core contract versioning system (e.g. '2.0' / '2.1')"
version: String!
"hardcoded alias, resolved by replacing the contract address from the id with the contract alias"
alias: String!
"address of the contract"
address: Bytes!
"address of the contract admin"
admin: Bytes
"category of contract e.g. LockupLinear or LockupDynamic"
category: ContractCategory!
"streams created through this contract"
streams: [Stream!]! @derivedFrom(field: "contract")
"actions on streams, triggered through this contract"
actions: [Action!]! @derivedFrom(field: "contract")
}
type Segment @entity {
"unique id resolving to stream id concatenated with the position of the segment"
id: String!
"position of the segment inside the array"
position: BigInt!
"stream upon which the segment is used"
stream: Stream!
"amount resolving to the value streamed during this segment"
amount: BigInt!
"exponent for the time passed percentage of the main amount compute function"
exponent: BigInt!
"timestamp resolving to the end moment of the segment"
milestone: BigInt!
"timestamp resolving to the *milestone* parameter"
endTime: BigInt!
"timestamp resolving to the start moment of the segment (the end time of previous segment or the startTime of the stream)"
startTime: BigInt!
"derived amount resoling to the total amount streamed until the start of the segment"
startAmount: BigInt!
"derived amount resoling to the total amount streamed until the end of the segment"
endAmount: BigInt!
}
type Stream @entity {
"unique identifier for the stream, resolving to the origin contract address concatenated with the chainId and the tokenId"
id: String!
"hardcoded alias, resolved by replacing the contract address from the id with the contract alias"
alias: String!
"unique global id tracked by the subgraph watcher - 🚨 these may change if new contracts are added and the chronological order of streams changes"
subgraphId: BigInt!
"unique identifier for the stream released by the origin contract - same as the tokenId or streamId values given by the contract"
tokenId: BigInt!
"full version based on the v2-core contract versioning system (e.g. '2.0' / '2.1')"
version: String!
"type of stream (for sorting reasons)"
category: StreamCategory!
"hardcoded chain id"
chainId: BigInt!
"contract through which this stream has been created"
contract: Contract!
"transaction hash for the stream creation"
hash: Bytes!
"timestamp of the stream creation (for sorting reasons)"
timestamp: BigInt!
"source of funds for the stream (anyone can create and fund a stream on any sender's behalf)"
funder: Bytes!
"manager of the stream, defined at creation by the funder (usually the same as the funder)"
sender: Bytes!
"current recipient of the stream, can withdraw the funds (the recipient can change on stream/nft transfer)"
recipient: Bytes!
"list of relevant stream parties (for filtering) - sender, recipient, possibly sender's"
parties: [Bytes!]!
"owner of the proxy when the stream is created through a PRBProxy (sender = proxy, proxender = owner(proxy))"
proxender: Bytes
"flag for streams created through a proxy"
proxied: Boolean!
"flag for linear streams with a cliff"
cliff: Boolean!
"asset (ERC20 token) supported by this stream"
asset: Asset!
"flag showing the cancelability of the stream (making it false is a one-way trip)"
cancelable: Boolean!
"action in which the stream has been made non-cancelable (can be the deposit transaction or a different one)"
renounceAction: Action
"timestamp for the when the stream was made non-cancelable"
renounceTime: BigInt
"flag showing if the stream was (making it true is a one-way trip)"
canceled: Boolean!
"action in which the stream was"
canceledAction: Action
"timestamp for the when the stream was canceled"
canceledTime: BigInt
"timestamp for the start of the cliff, only available on linear streams"
cliffTime: BigInt
"derived amount of the cliff, only available on linear streams"
cliffAmount: BigInt
"timestamp for the end of the stream"
endTime: BigInt!
"timestamp for the start of the stream"
startTime: BigInt!
"snapshot of the duration (difference between end and start time)"
duration: BigInt!
"flag showing the transferability of the stream (decided when the stream is created)"
transferable: Boolean!
"amount deposit in the stream (without fees)"
depositAmount: BigInt!
"amount resolving to the sum still inside the stream (regardless of it being locked or not) (difference between deposit and withdrawn pre-cancel)"
intactAmount: BigInt!
"amount resolving to the sum of all withdrawals"
withdrawnAmount: BigInt!
"actions triggered in the context of this stream"
actions: [Action!]! @derivedFrom(field: "stream")
"batch the stream is part of, only available when created within a batch create transaction"
batch: Batch!
"position in the batch, only available when created within a batch create transaction"
position: BigInt!
"segments of the stream curve, only available on dynamic streams"
segments: [Segment!]! @derivedFrom(field: "stream")
"segments of the stream curve, only available on dynamic streams"
tranches: [Tranche!]! @derivedFrom(field: "stream")
"amount of fees paid to the broker"
brokerFeeAmount: BigInt!
"amount of fees paid to the protocol"
protocolFeeAmount: BigInt!
}
type Tranche @entity {
"unique id resolving to stream id concatenated with the position of the tranche"
id: String!
"position of the tranche inside the array"
position: BigInt!
"stream upon which the tranche is used"
stream: Stream!
"amount resolving to the value streamed during this tranche"
amount: BigInt!
"timestamp resolving to the end moment of the tranche"
timestamp: BigInt!
"timestamp resolving to the *timestamp* parameter"
endTime: BigInt!
"timestamp resolving to the start moment of the timestamp (the end time of previous timestamp or the startTime of the stream)"
startTime: BigInt!
"derived amount resoling to the total amount streamed until the start of the timestamp"
startAmount: BigInt!
"derived amount resoling to the total amount streamed until the end of the timestamp"
endAmount: BigInt!
}
type Watcher @entity {
"unique identifier for the watcher, resolving to the chainId - there is one watcher for entire subgraph"
id: String!
"hardcoded chain id"
chainId: BigInt!
"global index for streams"
streamIndex: BigInt!
"global index for streams"
actionIndex: BigInt!
"flag that defines the initialization status of the subgraph"
initialized: Boolean!
"list of logs, for debugging purposes"
logs: [String!]!
}