-
Notifications
You must be signed in to change notification settings - Fork 9
/
schema.graphql
364 lines (254 loc) · 8.38 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
type BondFactory @entity {
" factory address "
id: ID!
" number of bonds created by the factory "
bondCount: BigInt!
" list of bonds created by the factory "
bonds: [BondController!] @derivedFrom(field: "factory")
}
type BondController @entity {
" bond address "
id: ID!
" factory used to create the bond "
factory: BondFactory
" bond issuer used to create the bond "
issuer: BondIssuer
" reference to the collateral token "
collateral: Token!
" date of bond creation as a unix timestamp "
creationDate: BigInt!
" date of maturity as a unix timestamp "
maturityDate: BigInt!
" date bond was matured as a unix timestamp "
maturedDate: BigInt
" true if this bond is mature, else false "
isMature: Boolean!
" total amount of debt distributed. Equal to the sum of tranche total supplies "
totalDebt: BigDecimal!
" Total amount of debt distributed at time bond matured. Equal to the sum of tranche total supplies "
totalDebtAtMaturity: BigDecimal
" amount of collateral locked in this bond "
totalCollateral: BigDecimal!
" The amount of collateral locked in this bond at time bond matured "
totalCollateralAtMaturity: BigDecimal
" tranches and ratios in a list "
tranches: [Tranche!]!
}
type Tranche @entity {
" tranche token address "
id: ID!
" reference to the bond in which this tranche belongs "
bond: BondController!
" reference to the tranche token contract "
token: Token!
" ratio of this tranche, all tranche ratios sum to 1000 "
ratio: BigInt!
" index of this tranche, i.e. A-tranche is 0, B is 1 and so on "
index: BigInt!
" The amount of collateral in this tranche for redemption "
totalCollateral: BigDecimal!
" The amount of collateral in this tranche for redemption at time bond matured "
totalCollateralAtMaturity: BigDecimal
" token total supply at time bond matured "
totalSupplyAtMaturity: BigDecimal
}
type AccountTrancheValue @entity {
" Equals to: <accountAddress>-<trancheAddress>"
id: ID!
" if the tranche's parent bond has matured "
isBondMature: Boolean!
" if the tranche has the most senior payout "
isSeniorTranche: Boolean!
" total supply of tranche tokens "
trancheSupply: BigDecimal!
" parent bond's collateral balance "
bondCollateralBalance: BigDecimal!
" parent bond's total debt "
bondTotalDebt: BigDecimal!
" collateral claimable by tranche "
trancheClaim: BigDecimal!
" the tranche cdr "
trancheCDR: BigDecimal!
" parent bond's cdr "
bondCDR: BigDecimal!
" price of each tranche token "
tranchePrice: BigDecimal!
" total value of account's tranche tokens"
trancheValue: BigDecimal!
}
type Token @entity {
" token address "
id: ID!
" token symbol "
symbol: String!
" token name "
name: String!
" token decimals "
decimals: BigInt!
" token total supply as floating point "
totalSupply: BigDecimal!
" Token balances of all accounts "
balances: [AccountBalance!]! @derivedFrom(field: "token")
}
type AccountBalance @entity {
" Equals to: <tokenAddress>-<accountAddress>"
id: ID!
" token reference "
token: Token!
" account address "
account: Account!
" current account balance as floating point"
amount: BigDecimal!
" Block number in which the balance was last modified "
block: BigInt
" Last modified timestamp in seconds "
modified: BigInt
" Hash of the last transaction that modified the balance "
transaction: Bytes
}
type Account @entity {
" Account address "
id: ID!
" Token balances that this account holds "
balances: [AccountBalance!]! @derivedFrom(field: "account")
}
type BondIssuer @entity {
" issuer address "
id: ID!
" timestamp of last issue "
lastIssueTimestamp: BigInt
" list of bonds issued by the issuer "
issuedBonds: [BondController!] @derivedFrom(field: "issuer")
}
type PerpetualTranche @entity {
" perp token store reference "
id: ID!
" reference to the ERC20 token attributes "
token: Token!
" reference to the collateral "
underlying: Token!
" reference to the current deposit bond "
depositBond: BondController
" reference to assets held in the reserve "
reserves: [PerpetualTrancheReserveAsset!]! @derivedFrom(field: "perp")
" addresses of assets currently in the reserve "
activeReserves: [PerpetualTrancheReserveAsset!]!
" the current tvl based on the active reserves "
tvl: BigDecimal!
" the price of each perp token "
price: BigDecimal!
" reference to the daily stats "
dailyStats: [PerpetualTrancheDailyStat!]! @derivedFrom(field: "perp")
}
type PerpetualTrancheReserveAsset @entity {
" Equals to: <perpTokenAddress>-<reserveTokenAddress>"
id: ID!
" reference to the perpetual tranche token "
perp: PerpetualTranche!
" reference to the token "
token: Token!
" reference to the reserve tranche "
tranche: Tranche
" Value of the reserve tranche "
value: AccountTrancheValue
" balance held by the reserve "
balance: BigDecimal!
}
type PerpetualTrancheDailyStat @entity {
" Equals to: <perpTokenAddress>-<timestamp>"
id: ID!
" reference to the perpetual tranche token "
perp: PerpetualTranche!
" the timestamp of the given day "
timestamp: BigInt!
" the total perp tokens minted on the given day "
totalMints: BigDecimal!
" the total perp tokens redeemed on the given day "
totalRedemptions: BigDecimal!
" the total value of perp tokens minted on the given day "
totalMintValue: BigDecimal!
" the total value of perp tokens redeemed on the given day "
totalRedemptionValue: BigDecimal!
" the tvl on the given day "
tvl: BigDecimal!
" the price on the given day "
price: BigDecimal!
" the perp token supply on the given day "
totalSupply: BigDecimal!
}
type RolloverVault @entity {
" vault token address "
id: ID!
" reference to the ERC20 token attributes "
token: Token!
" reference to the underlying collateral token"
underlying: Token!
" reference to the perp on which rollovers are performed"
perp: PerpetualTranche!
" reference to assets held in by the vault "
assets: [RolloverVaultAsset!]! @derivedFrom(field: "vault")
" addresses of assets currently in the reserve "
activeReserves: [RolloverVaultAsset!]!
" the total fixed mc share of underlying tokens deposited into the system "
totalScaledUnderlyingDeposited: BigDecimal!
" the total fixed mc share of underlying tokens deposited by each user "
scaledUnderlyingBalances: [ScaledUnderlyingVaultDepositorBalance!]! @derivedFrom(field: "vault")
" the current tvl based on the active reserves "
tvl: BigDecimal!
" the current rebase multiplier "
rebaseMultiplier: BigDecimal!
" the price of each token "
price: BigDecimal!
" reference to the daily stats "
dailyStats: [RolloverVaultDailyStat!]! @derivedFrom(field: "vault")
}
type ScaledUnderlyingVaultDepositorBalance @entity {
id: ID!
vault: RolloverVault!
account: Bytes!
value: BigDecimal!
}
type RolloverVaultAsset @entity {
" Equals to: <vaultTokenAddress>-<assetTokenAddress>"
id: ID!
" reference to the vault "
vault: RolloverVault!
" reference to the asset token "
token: Token!
" reference to the underlying tranche "
tranche: Tranche
" balance held by the vault "
balance: BigDecimal!
" Value of the reserve tranche "
value: AccountTrancheValue
}
type RolloverVaultDailyStat @entity {
" Equals to: <vaultAddress>-<timestamp>"
id: ID!
" reference to the rollover vault "
vault: RolloverVault!
" the timestamp of the given day "
timestamp: BigInt!
" the total vault notes minted on the given day "
totalMints: BigDecimal!
" the total vault notes redeemed on the given day "
totalRedemptions: BigDecimal!
" the total value of vault notes minted on the given day "
totalMintValue: BigDecimal!
" the total value of vault notes redeemed on the given day "
totalRedemptionValue: BigDecimal!
" the tvl on the given day "
tvl: BigDecimal!
" the rebase multiplier on the given day "
rebaseMultiplier: BigDecimal!
" the price on the given day "
price: BigDecimal!
" the vault note supply on the given day "
totalSupply: BigDecimal!
" the total value of swaps on the given day "
totalSwapValue: BigDecimal!
" the total value of underlying to perp swaps on the given day "
totalUnderlyingToPerpSwapValue: BigDecimal!
" the total value of perp to underlying swaps on the given day "
totalPerpToUnderlyingSwapValue: BigDecimal!
}