-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.graphql
237 lines (202 loc) · 5.49 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
type factory_admin_changed @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
new_admin: Bytes!
previous_admin: Bytes!
}
type factory_beacon_upgraded @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
beacon: Bytes!
}
type factory_deployed_lender_group_contract @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_contract: Bytes!
}
type factory_upgraded @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
implementation: Bytes!
}
type group_borrower_accepted_funds @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
evt_address: String!
group_pool_address: Bytes!
bid_id: BigDecimal!
borrower: Bytes!
collateral_amount: BigDecimal!
interest_rate: BigInt!
loan_duration: BigInt!
principal_amount: BigDecimal!
}
type group_lender_added_principal @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
amount: BigDecimal!
lender: Bytes!
shares_amount: BigDecimal!
shares_recipient: Bytes!
}
type group_earnings_withdrawn @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
amount_pool_shares_tokens: BigDecimal!
lender: Bytes!
principal_tokens_withdrawn: BigDecimal!
recipient: Bytes!
}
type group_defaulted_loan_liquidated @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
evt_address: String!
group_pool_address: Bytes!
amount_due: BigDecimal!
bid_id: BigDecimal!
liquidator: Bytes!
token_amount_difference: BigDecimal!
}
type group_initialized @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
version: BigInt!
}
type group_loan_repaid @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
bid_id: BigDecimal!
interest_amount: BigDecimal!
principal_amount: BigDecimal!
repayer: Bytes!
total_interest_collected: BigDecimal!
total_principal_repaid: BigDecimal!
}
type group_ownership_transferred @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
new_owner: Bytes!
previous_owner: Bytes!
}
type group_paused @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
account: Bytes!
}
# use group pool metrics instead
type group_pool_initialized @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
collateral_token_address: Bytes!
interest_rate_lower_bound: BigInt!
interest_rate_upper_bound: BigInt!
liquidity_threshold_percent: BigInt!
loan_to_value_percent: BigInt!
market_id: BigDecimal!
max_loan_duration: BigInt!
pool_shares_token: Bytes!
principal_token_address: Bytes!
twap_interval: BigInt!
uniswap_pool_fee: BigInt!
}
type group_unpaused @entity {
id: ID!
evt_tx_hash: Bytes!
evt_index: BigInt!
evt_block_time: String!
evt_block_number: BigInt!
group_pool_address: Bytes!
account: Bytes!
}
type group_pool_metrics @entity {
id: ID! #will be based on group pool address
group_pool_address: Bytes!
principal_token_address: Bytes!
collateral_token_address: Bytes!
shares_token_address: Bytes!
# get these from RPC calls
uniswap_v3_pool_address: Bytes!
teller_v2_address: Bytes!
smart_commitment_forwarder_address: Bytes!
# ---
market_id: BigInt!
uniswap_pool_fee: Int!
max_loan_duration : Int!
twap_interval : Int!
interest_rate_upper_bound: Int!
interest_rate_lower_bound: Int!
liquidity_threshold_percent: Int!
collateral_ratio: Int! #loan to value
total_principal_tokens_committed: BigInt!
total_principal_tokens_withdrawn: BigInt!
total_principal_tokens_lended: BigInt!
total_principal_tokens_repaid: BigInt!
total_interest_collected: BigInt!
token_difference_from_liquidations: BigInt!
}
type group_lender_metrics @entity {
id: ID! #will be based on group pool address and user lender address
user_lender_address: Bytes!
group_pool_address: Bytes!
total_principal_tokens_committed: Int!
total_principal_tokens_withdrawn: Int!
shares_tokens_net: Int!
}
# also add borrower metrics ?
type group_pool_metrics_data_point @entity {
id: ID! #will be based on group pool address
group_pool_address: Bytes!
block_number: BigInt!
block_time: BigInt
total_principal_tokens_committed: BigInt!
total_principal_tokens_withdrawn: BigInt!
total_principal_tokens_lended: BigInt!
total_principal_tokens_repaid: BigInt!
total_interest_collected: BigInt!
}