Skip to content

Commit d8c0d1c

Browse files
committed
schema updates
Signed-off-by: mihaisc <[email protected]>
1 parent 028e83c commit d8c0d1c

File tree

1 file changed

+53
-77
lines changed

1 file changed

+53
-77
lines changed

schema.graphql

+53-77
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ type PoolFactory @entity {
1313
pools: [Pool!] @derivedFrom(field: "factoryID")
1414
}
1515

16+
type DatatokenFactory @entity {
17+
id: ID!
18+
tokenCount: Int! # Number of datatokens
19+
datatokens: [Tokens!] @derivedFrom(field: "factory")
20+
}
1621

1722
type Global @entity {
1823
id: ID!
@@ -29,15 +34,13 @@ type Global @entity {
2934
finalizedPoolCount: Int! # Number of finalized pools for all factories
3035
}
3136

32-
33-
type TokenValue @entity {
37+
type TokenValue {
3438

3539
token : Token!
3640
value : BigDecimal!
3741

3842
}
3943

40-
4144
type Token @entity {
4245
id: ID! #
4346
symbol: String #
@@ -104,8 +107,6 @@ type Pool @entity {
104107
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
105108
}
106109

107-
//PoolToken - all good as it is
108-
109110
type PoolToken @entity {
110111
id: ID! # poolId + token address
111112
pool: Pool! #
@@ -119,15 +120,12 @@ type PoolToken @entity {
119120
}
120121

121122
type PoolShare @entity {
122-
id: ID! # poolId + userAddress
123+
id: ID! # poolId + userAddress
123124
user: User!
124125
pool: Pool!
125126
balance: BigDecimal!
126127
}
127128

128-
// Will be replaced with a generic PoolTokenValue WIP
129-
130-
131129
type PoolTransaction @entity {
132130
id: ID! # pool tx
133131
pool: Pool # Pool related to this tx
@@ -147,50 +145,9 @@ type PoolTransaction @entity {
147145
tokens: [TokenValue!] # tokens transfered
148146
}
149147

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!
194151

195152
consumer: User!
196153
payer: User!
@@ -204,18 +161,11 @@ type TokenOrder @entity {
204161
block: Int!
205162
}
206163

207-
type TokenBalance @entity {
208-
id: ID! # datatokenId + userAddress
209-
userAddress: User!
210-
datatokenId: Datatoken!
211-
balance: BigDecimal!
212-
}
213-
214164
type TokenTransaction @entity {
215165
id: ID! # Log ID
216166
event: String
217-
datatokenAddress: Datatoken
218-
userAddress: User
167+
token: Token
168+
user: User
219169

220170
block: Int!
221171
gasUsed: BigDecimal!
@@ -226,26 +176,20 @@ type TokenTransaction @entity {
226176

227177
type User @entity {
228178
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")
238185
freSwaps: [FixedRateExchangeSwap!] @derivedFrom(field: "by")
239186
}
240187

241188
type FixedRateExchange @entity {
242-
id: ID! # fixed rate exchange id
189+
id: ID! # fixed rate exchange id
243190
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!
249193
rate: BigDecimal!
250194
active: Boolean!
251195
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
@@ -322,3 +266,35 @@ type PoolSnapshot @entity {
322266
tokens: [PoolSnapshotTokenValue!] @derivedFrom(field: "poolSnapshot")
323267
}
324268

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

Comments
 (0)