forked from l0c4t0r/visor-subgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
265 lines (246 loc) · 6.32 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
type VisrToken @entity {
id: ID!
name: String!
decimals: Int!
totalSupply: BigInt!
totalStaked: BigInt!
totalDistributed: BigInt!
totalDistributedUSD: BigDecimal!
}
type VisrDistribution @entity {
id: ID!
timestamp: BigInt!
visor: Visor!
amount: BigInt!
amountUSD: BigDecimal!
}
type VisrTokenDayData @entity {
id: ID!
date: BigInt!
timezone: String!
# Total VISR staked at the end of the day
totalStaked: BigInt!
# VISR distributed for the day
distributed: BigInt!
distributedUSD: BigDecimal!
}
type Factory @entity {
id: ID!
owner: Bytes!
}
type Hypervisor @entity {
id: ID!
owner: Bytes!
stakingToken: Token
totalStakedAmount: BigInt
rewardToken: Token
rewardPool: Bytes
rewardPoolAmount: BigInt
powerSwitch: Bytes
bonusTokens: [Bytes!]
vaultFactory: Factory
}
type Visor @entity {
id: ID!
owner: User!
operator: User
tokenId: BigInt
visrStaked: BigInt!
staked: [StakedToken!] @derivedFrom(field: "visor")
rewardClaimed: [RewardedToken!] @derivedFrom(field: "visor")
hypervisorShares: [UniswapV3HypervisorShares!]! @derivedFrom(field: "visor")
visrDistributions: [UniswapV3HypervisorShares!]! @derivedFrom(field: "visor")
}
type VisorTemplate @entity {
id: ID!
address: Bytes!
active: Boolean!
}
type User @entity {
id: ID!
visorsOwned: [Visor!] @derivedFrom(field: "owner") # Visors owned by this user
visorsApproved: [Visor!] @derivedFrom(field: "operator") # Visors where this user is approved as an operator
operators: [OwnerOperator!] @derivedFrom(field: "operator") # Operators this users delegates to
operatorFor: [OwnerOperator!] @derivedFrom(field: "owner") # Other users that this user is an operator for
}
type OwnerOperator @entity {
id: ID!
owner: User!
operator: User!
approved: Boolean!
}
type StakedToken @entity {
id: ID! # Vault address-Token address
token: Token!
visor: Visor!
amount: BigInt!
}
type RewardedToken @entity {
id: ID! # Vault address-Token address
token: Token!
visor: Visor!
amount: BigInt!
}
type Token @entity {
# token address
id: ID!
# token symbol
symbol: String!
# token name
name: String!
# token decimals
decimals: Int!
}
type UniswapV3Pool @entity {
# Pool address
id: ID!
token0: Token!
token1: Token!
# Fee tier: 50, 3000, 10000
fee: Int!
}
type UniswapV3HypervisorFactory @entity {
# Hypervisor address
id: ID!
# Timestamp factory was created
created: BigInt!
# Number of hypervisors created by factory
hypervisorCount: BigInt!
# Cumulative fees claimed by hypervisors from Uniswap
grossFeesClaimedUSD: BigDecimal!
# Cumulative fees collected by protocol from hypervisors
protocolFeesCollectedUSD: BigDecimal!
# Cumulative fees reinvested into pools by hypervisors
feesReinvestedUSD: BigDecimal!
# Adjusted version is reduced by withdraws
adjustedFeesReinvestedUSD: BigDecimal!
# TVL of all hypervisors under one factory
tvlUSD: BigDecimal!
hypervisors: [UniswapV3Hypervisor!]! @derivedFrom(field: "factory")
}
type UniswapV3Hypervisor @entity {
# Hypervisor address
id: ID!
factory: UniswapV3HypervisorFactory!
owner: Bytes!
created: Int!
symbol: String!
pool: UniswapV3Pool!
tick: Int!
# Lower tick of base position
baseLower: Int!
# Upper tick of base position
baseUpper: Int!
# Lower tick of limit position
limitLower: Int!
# Upper tick of limit position
limitUpper: Int!
# All time Gross Fees claimed
deposit0Max: BigInt!
deposit1Max: BigInt!
totalSupply: BigInt!
maxTotalSupply: BigInt!
grossFeesClaimed0: BigInt!
grossFeesClaimed1: BigInt!
grossFeesClaimedUSD: BigDecimal!
# All time Protocol fees for VISR buyback
protocolFeesCollected0: BigInt!
protocolFeesCollected1: BigInt!
protocolFeesCollectedUSD: BigDecimal!
# All time Gross fees minus protocol fees
feesReinvested0: BigInt!
feesReinvested1: BigInt!
feesReinvestedUSD: BigDecimal!
# Adjusted version is reduced by withdraws
adjustedFeesReinvestedUSD: BigDecimal!
# TVL updated every deposit/rebalance/withdraw
tvl0: BigInt!
tvl1: BigInt!
tvlUSD: BigDecimal!
deposits: [UniswapV3Deposit!]! @derivedFrom(field: "hypervisor")
rebalances: [UniswapV3Rebalance!]! @derivedFrom(field: "hypervisor")
withdraws: [UniswapV3Withdraw!]! @derivedFrom(field: "hypervisor")
uniswapV3HypervisorDayData: [UniswapV3HypervisorDayData!]! @derivedFrom(field: "hypervisor")
}
type UniswapV3Deposit @entity {
id: ID!
hypervisor: UniswapV3Hypervisor!
timestamp: BigInt!
sender: Bytes!
to: Bytes!
shares: BigInt!
amount0: BigInt!
amount1: BigInt!
amountUSD: BigDecimal!
}
type UniswapV3Rebalance @entity {
id: ID!
hypervisor: UniswapV3Hypervisor!
timestamp: BigInt!
tick: Int!
baseLower: Int!
baseUpper: Int!
limitLower: Int!
limitUpper: Int!
totalAmount0: BigInt!
totalAmount1: BigInt!
totalAmountUSD: BigDecimal!
grossFees0: BigInt!
grossFees1: BigInt!
grossFeesUSD: BigDecimal!
protocolFees0: BigInt!
protocolFees1: BigInt!
protocolFeesUSD: BigDecimal!
netFees0: BigInt!
netFees1: BigInt!
netFeesUSD: BigDecimal!
totalSupply: BigInt!
}
type UniswapV3Withdraw @entity {
id: ID!
hypervisor: UniswapV3Hypervisor!
timestamp: BigInt!
sender: Bytes!
to: Bytes!
shares: BigInt!
amount0: BigInt!
amount1: BigInt!
amountUSD: BigDecimal!
}
type UniswapV3HypervisorDayData @entity {
id: ID!
date: BigInt!
hypervisor: UniswapV3Hypervisor!
# Deposits for the day
deposited0: BigInt!
deposited1: BigInt!
depositedUSD: BigDecimal!
# withdraws for the day
withdrawn0: BigInt!
withdrawn1: BigInt!
withdrawnUSD: BigDecimal!
# Gross Fees claimed for the day
grossFeesClaimed0: BigInt!
grossFeesClaimed1: BigInt!
grossFeesClaimedUSD: BigDecimal!
# Protocol fees for VISR buyback for the day
protocolFeesCollected0: BigInt!
protocolFeesCollected1: BigInt!
protocolFeesCollectedUSD: BigDecimal!
# Gross fees minus protocol fees for the day
feesReinvested0: BigInt!
feesReinvested1: BigInt!
feesReinvestedUSD: BigDecimal!
# Cumulative fees reinvested at the end of day
adjustedFeesReinvestedUSD: BigDecimal!
# Last TVL for the day
tvl0: BigInt!
tvl1: BigInt!
tvlUSD: BigDecimal!
}
type UniswapV3HypervisorShares @entity {
id: ID! # HypervisorAddress-VisorAddress
visor: Visor!
hypervisor: UniswapV3Hypervisor!
shares: BigInt!
}