-
Notifications
You must be signed in to change notification settings - Fork 20
/
schema.graphql
217 lines (207 loc) · 6.33 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
type Vault @entity {
id: ID!
"Amount of underlying token per 1 share"
pricePerFullShare: BigDecimal!
"Total shares supply"
totalSupply: BigDecimal!
"Full vault underlying token balance (vault + strategy)"
vaultBalance: BigDecimal!
"Strategy underlying token balance"
strategyBalance: BigDecimal!
# TODO:
"How much the vault allows to be borrowed"
available: BigDecimal!
"Deposit token"
underlyingToken: Token!
shareToken: Token!
currentController: Controller!
currentStrategy: Strategy!
"Transaction metadata for the last update"
transaction: Transaction!
# TODO:
"balance: totalDeposited - totalWithdrawn: all deposits of underlying made by external accounts"
netDeposits: BigDecimal!
totalDeposited: BigDecimal!
totalWithdrawn: BigDecimal!
"totalActiveShares: totalSharesMinted - totalSharesBurned"
totalActiveShares: BigDecimal!
totalSharesMinted: BigDecimal!
totalSharesBurned: BigDecimal!
totalEarnings: BigDecimal!
# raw
pricePerFullShareRaw: BigInt!
totalSupplyRaw: BigInt!
# TODO:
"Balance of the Vault contract of underlying Token + balance of the Strategy contract of underlying Token"
vaultBalanceRaw: BigInt!
# TODO:
"Balance of underlying Token specifically held in the strategy"
strategyBalanceRaw: BigInt!
# TODO:
"How much the vault allows to be borrowed"
availableRaw: BigInt!
netDepositsRaw: BigInt!
totalDepositedRaw: BigInt!
totalWithdrawnRaw: BigInt!
totalActiveSharesRaw: BigInt!
totalSharesMintedRaw: BigInt!
totalSharesBurnedRaw: BigInt!
totalEarningsRaw: BigInt!
totalHarvestCalls: BigInt!
# derived fields
transfers: [Transfer!]! @derivedFrom(field: "vault")
deposits: [Deposit!]! @derivedFrom(field: "vault")
withdrawals: [Withdrawal!]! @derivedFrom(field: "vault")
harvests: [Harvest!]! @derivedFrom(field: "vault")
balances: [AccountVaultBalance!]! @derivedFrom(field: "vault")
strategies: [Strategy!]! @derivedFrom(field: "vault")
controllers: [Controller!]! @derivedFrom(field: "vault")
}
type Account @entity {
"User ethereum address"
id: ID!
vaultBalances: [AccountVaultBalance!]! @derivedFrom(field: "account")
"Account deposits"
deposits: [Deposit!]! @derivedFrom(field: "account")
"Account withdrawals"
withdrawals: [Withdrawal!]! @derivedFrom(field: "account")
"Incoming transfers"
receivedTransfers: [Transfer!]! @derivedFrom(field: "to")
"Outgoing transfers"
sentTransfers: [Transfer!]! @derivedFrom(field: "from")
}
type AccountVaultBalance @entity {
id: ID!
vault: Vault!
account: Account!
"Deposit/withdrawal token"
underlyingToken: Token!
shareToken: Token!
"Net deposits of a given Account within a given Vault. Transfers between accounts are taken into consideration for this metric"
netDeposits: BigDecimal!
"Total tokens deposited by this Account in Vault"
totalDeposited: BigDecimal!
"Total tokens withdrawn by this Account in Vault"
totalWithdrawn: BigDecimal!
"Total tokens sent to another account by this Account in Vault"
totalSent: BigDecimal!
"Total tokens received from another account by this Account in Vault"
totalReceived: BigDecimal!
"Shares are the token minted by the Vault"
shareBalance: BigDecimal!
totalSharesMinted: BigDecimal!
totalSharesBurned: BigDecimal!
totalSharesSent: BigDecimal!
totalSharesReceived: BigDecimal!
"Net deposits of a given Account within a given Vault. Transfers between accounts are taken into consideration for this metric"
netDepositsRaw: BigInt!
"Total tokens deposited by this Account in Vault"
totalDepositedRaw: BigInt!
"Total tokens withdrawn by this Account in Vault"
totalWithdrawnRaw: BigInt!
"Total tokens sent to another account by this Account in Vault"
totalSentRaw: BigInt!
"Total tokens received from another account by this Account in Vault"
totalReceivedRaw: BigInt!
"Shares are the token minted by the Vault"
shareBalanceRaw: BigInt!
totalSharesMintedRaw: BigInt!
totalSharesBurnedRaw: BigInt!
totalSharesSentRaw: BigInt!
totalSharesReceivedRaw: BigInt!
}
type Token @entity {
id: ID!
address: Bytes!
decimals: Int!
name: String!
symbol: String!
}
type Transfer @entity {
id: ID!
from: Account!
to: Account!
value: BigInt!
amount: BigInt!
vault: Vault!
pricePerFullShare: BigInt!
vaultBalance: BigInt!
totalSupply: BigInt!
available: BigInt!
transaction: Transaction!
}
type Deposit @entity {
id: ID!
vault: Vault!
account: Account!
amount: BigInt!
shares: BigInt!
pricePerFullShare: BigInt!
vaultBalance: BigInt!
totalSupply: BigInt!
available: BigInt!
transaction: Transaction!
}
type Withdrawal @entity {
id: ID!
vault: Vault!
account: Account!
amount: BigInt!
shares: BigInt!
pricePerFullShare: BigInt!
vaultBalance: BigInt!
totalSupply: BigInt!
available: BigInt!
transaction: Transaction!
}
type Harvest @entity {
id: ID!
vault: Vault!
strategy: Strategy!
caller: Bytes!
pricePerFullShareBefore: BigDecimal!
pricePerFullShareAfter: BigDecimal!
vaultBalanceBefore: BigDecimal!
vaultBalanceAfter: BigDecimal!
strategyBalanceBefore: BigDecimal!
strategyBalanceAfter: BigDecimal!
earnings: BigDecimal!
pricePerFullShareBeforeRaw: BigInt!
pricePerFullShareAfterRaw: BigInt!
vaultBalanceBeforeRaw: BigInt!
vaultBalanceAfterRaw: BigInt!
strategyBalanceBeforeRaw: BigInt!
strategyBalanceAfterRaw: BigInt!
earningsRaw: BigInt!
transaction: Transaction!
}
type Strategy @entity {
"Ethereum address"
id: ID!
vault: Vault!
totalEarnings: BigDecimal!
totalEarningsRaw: BigInt!
harvests: [Harvest!]! @derivedFrom(field: "strategy")
activeOnVaults: [Vault!] @derivedFrom(field: "currentStrategy")
}
type Controller @entity {
"Ethereum address"
id: ID!
vault: Vault!
activeOnVaults: [Vault!] @derivedFrom(field: "currentController")
}
type Transaction @entity {
"ID = Transaction Hash"
id: ID!
timestamp: BigInt!
blockNumber: BigInt!
# duplicated field to allow for byte search with transactionHash_contains
transactionHash: Bytes!
deposits: [Deposit!]! @derivedFrom(field: "transaction")
withdrawals: [Withdrawal!]! @derivedFrom(field: "transaction")
transfers: [Transfer!]! @derivedFrom(field: "transaction")
harvests: [Harvest!]! @derivedFrom(field: "transaction")
# TODO: rename
"List of Vaults that last updated on this transaction"
vaultsUpdated: [Vault!]! @derivedFrom(field: "transaction")
}