@@ -13,6 +13,11 @@ type PoolFactory @entity {
13
13
pools : [Pool ! ] @derivedFrom (field : " factoryID" )
14
14
}
15
15
16
+ type DatatokenFactory @entity {
17
+ id : ID !
18
+ tokenCount : Int ! # Number of datatokens
19
+ datatokens : [Tokens ! ] @derivedFrom (field : " factory" )
20
+ }
16
21
17
22
type Global @entity {
18
23
id : ID !
@@ -29,15 +34,13 @@ type Global @entity {
29
34
finalizedPoolCount : Int ! # Number of finalized pools for all factories
30
35
}
31
36
32
-
33
- type TokenValue @entity {
37
+ type TokenValue {
34
38
35
39
token : Token!
36
40
value : BigDecimal!
37
41
38
42
}
39
43
40
-
41
44
type Token @entity {
42
45
id : ID ! #
43
46
symbol : String #
@@ -104,8 +107,6 @@ type Pool @entity {
104
107
transactions : [PoolTransaction ! ] @derivedFrom (field : " pool" )
105
108
}
106
109
107
- //PoolToken - all good as it is
108
-
109
110
type PoolToken @entity {
110
111
id : ID ! # poolId + token address
111
112
pool : Pool ! #
@@ -119,15 +120,12 @@ type PoolToken @entity {
119
120
}
120
121
121
122
type PoolShare @entity {
122
- id : ID ! # poolId + userAddress
123
+ id : ID ! # poolId + userAddress
123
124
user : User !
124
125
pool : Pool !
125
126
balance : BigDecimal !
126
127
}
127
128
128
- // Will be replaced with a generic PoolTokenValue WIP
129
-
130
-
131
129
type PoolTransaction @entity {
132
130
id : ID ! # pool tx
133
131
pool : Pool # Pool related to this tx
@@ -147,50 +145,9 @@ type PoolTransaction @entity {
147
145
tokens : [TokenValue ! ] # tokens transfered
148
146
}
149
147
150
-
151
- type DatatokenFactory @entity {
152
- id : ID !
153
- tokenCount : Int ! # Number of datatokens
154
- datatokens : [Tokens ! ] @derivedFrom (field : " factory" )
155
- }
156
-
157
-
158
- type MetadataUpdate @entity {
159
- id : ID ! # update tx + datatokenAddress
160
- datatokenId : Datatoken !
161
-
162
- datatokenAddress : String !
163
- userAddress : String !
164
-
165
- //all fields from the market edit
166
- name
167
- description
168
- author
169
- links
170
- timeout
171
-
172
-
173
- block : Int !
174
- timestamp : Int !
175
- tx : Bytes !
176
- }
177
-
178
- type Asset {
179
-
180
- did
181
- name
182
- description
183
- author
184
- services ? [ access, compute ] ?
185
-
186
- datatoken : Datatoken
187
- }
188
-
189
-
190
-
191
- type TokenOrder @entity {
192
- id : ID ! # datatokenId + userAddress + tx
193
- datatokenId : Datatoken !
148
+ type Order @entity { # renamed from TokenOrder to Order
149
+ id : ID ! # datatokenId + userAddress + tx
150
+ token : Token !
194
151
195
152
consumer : User !
196
153
payer : User !
@@ -204,18 +161,11 @@ type TokenOrder @entity {
204
161
block : Int !
205
162
}
206
163
207
- type TokenBalance @entity {
208
- id : ID ! # datatokenId + userAddress
209
- userAddress : User !
210
- datatokenId : Datatoken !
211
- balance : BigDecimal !
212
- }
213
-
214
164
type TokenTransaction @entity {
215
165
id : ID ! # Log ID
216
166
event : String
217
- datatokenAddress : Datatoken
218
- userAddress : User
167
+ token : Token
168
+ user : User
219
169
220
170
block : Int !
221
171
gasUsed : BigDecimal !
@@ -226,26 +176,20 @@ type TokenTransaction @entity {
226
176
227
177
type User @entity {
228
178
id : ID !
229
-
230
- sharesOwned : [PoolShare ! ] @derivedFrom (field : " userAddress" )
231
- tokenBalancesOwned : [TokenBalance ! ] @derivedFrom (field : " userAddress" )
232
- tokensOwned : [Datatoken ! ] @derivedFrom (field : " minter" )
233
- poolTransactions : [PoolTransaction ! ] @derivedFrom (field : " userAddress" )
234
- poolTransactionsTokenValues : [PoolTransactionTokenValues ! ]
235
- @derivedFrom (field : " userAddress" )
236
- tokenTransactions : [TokenTransaction ! ] @derivedFrom (field : " userAddress" )
237
- orders : [TokenOrder ! ] @derivedFrom (field : " payer" )
179
+ sharesOwned : [PoolShare ! ] @derivedFrom (field : " user" )
180
+ tokenBalancesOwned : [TokenValue ! ]
181
+ tokensOwned : [Token ! ] @derivedFrom (field : " minter" )
182
+ poolTransactions : [PoolTransaction ! ] @derivedFrom (field : " user" )
183
+ tokenTransactions : [TokenTransaction ! ] @derivedFrom (field : " user" )
184
+ orders : [Order ! ] @derivedFrom (field : " payer" )
238
185
freSwaps : [FixedRateExchangeSwap ! ] @derivedFrom (field : " by" )
239
186
}
240
187
241
188
type FixedRateExchange @entity {
242
- id : ID ! # fixed rate exchange id
189
+ id : ID ! # fixed rate exchange id
243
190
exchangeOwner : User !
244
- datatoken : Datatoken !
245
- // will be a token not just an address
246
- baseToken : String !
247
- // no need for this , since it will be on token
248
- baseTokenSymbol : String !
191
+ datatoken : Token !
192
+ baseToken : Token !
249
193
rate : BigDecimal !
250
194
active : Boolean !
251
195
updates : [FixedRateExchangeUpdate ! ] @derivedFrom (field : " exchangeId" )
@@ -322,3 +266,35 @@ type PoolSnapshot @entity {
322
266
tokens : [PoolSnapshotTokenValue ! ] @derivedFrom (field : " poolSnapshot" )
323
267
}
324
268
269
+
270
+ type MetadataUpdate @entity {
271
+ id : ID ! # update tx + datatokenAddress
272
+ datatokenId : Datatoken !
273
+
274
+ datatokenAddress : String !
275
+ userAddress : String !
276
+
277
+ //all fields from the market edit
278
+ name
279
+ description
280
+ author
281
+ links
282
+ timeout
283
+
284
+
285
+ block : Int !
286
+ timestamp : Int !
287
+ tx : Bytes !
288
+ }
289
+
290
+ type Asset {
291
+
292
+ did
293
+ name
294
+ description
295
+ author
296
+ services ? [ access, compute ] ?
297
+
298
+ datatoken : Datatoken
299
+ }
300
+
0 commit comments