Skip to content

Commit 2bc4f2b

Browse files
committed
fix: updated pool maping and schema
1 parent 3006487 commit 2bc4f2b

3 files changed

Lines changed: 104 additions & 66 deletions

File tree

schemas/v3.schema.graphql

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ type Pool @entity {
2828

2929
reserves: [Reserve!]! @derivedFrom(field: "pool")
3030
supplyHistory: [Supply!]! @derivedFrom(field: "pool")
31+
mintUnbackedHistory: [MintUnbacked!]! @derivedFrom(field: "pool")
32+
backUnbackedHistory: [BackUnbacked!]! @derivedFrom(field: "pool")
33+
mintedToTreasuryHistory: [MintedToTreasury!]! @derivedFrom(field: "pool")
34+
isolationModeTotalDebtUpdatedHistory: [IsolationModeTotalDebtUpdated!]!
35+
@derivedFrom(field: "pool")
3136
redeemUnderlyingHistory: [RedeemUnderlying!]! @derivedFrom(field: "pool")
3237
borrowHistory: [Borrow!]! @derivedFrom(field: "pool")
33-
swapHistory: [Swap!]! @derivedFrom(field: "pool")
38+
swapHistory: [SwapBorrowRate!]! @derivedFrom(field: "pool")
3439
usageAsCollateralHistory: [UsageAsCollateral!]! @derivedFrom(field: "pool")
3540
rebalanceStableBorrowRateHistory: [RebalanceStableBorrowRate!]! @derivedFrom(field: "pool")
3641
repayHistory: [Repay!]! @derivedFrom(field: "pool")
@@ -141,27 +146,26 @@ interface UserTransaction {
141146
type Supply implements UserTransaction @entity {
142147
"""
143148
tx hash
144-
""" # TODO: replace with blockNumber/timestamp + blockPosition
149+
"""
145150
id: ID!
146151
pool: Pool!
147152
user: User!
148-
onBehalfOf: User!
153+
caller: User!
149154
reserve: Reserve!
150155
referrer: Referrer
151156
userReserve: UserReserve!
152157
amount: BigInt!
153158
timestamp: Int!
154159
}
155160

156-
# TODO: check nomenclature for new v2
157161
type RedeemUnderlying implements UserTransaction @entity {
158162
"""
159163
tx hash
160-
""" # TODO: replace with blockNumber/timestamp + blockPosition
164+
"""
161165
id: ID!
162166
pool: Pool!
163167
user: User!
164-
onBehalfOf: User!
168+
to: User!
165169
reserve: Reserve!
166170
userReserve: UserReserve!
167171
amount: BigInt!
@@ -171,11 +175,11 @@ type RedeemUnderlying implements UserTransaction @entity {
171175
type Borrow implements UserTransaction @entity {
172176
"""
173177
tx hash
174-
""" # TODO: replace with blockNumber/timestamp + blockPosition
178+
"""
175179
id: ID!
176180
pool: Pool!
177181
user: User!
178-
onBehalfOf: User!
182+
caller: User!
179183
reserve: Reserve!
180184
userReserve: UserReserve!
181185
amount: BigInt!
@@ -187,10 +191,10 @@ type Borrow implements UserTransaction @entity {
187191
variableTokenDebt: BigInt!
188192
}
189193

190-
type Swap implements UserTransaction @entity {
194+
type SwapBorrowRate implements UserTransaction @entity {
191195
"""
192196
tx hash
193-
""" # TODO: replace with blockNumber/timestamp + blockPosition
197+
"""
194198
id: ID!
195199
pool: Pool!
196200
user: User!
@@ -206,7 +210,7 @@ type Swap implements UserTransaction @entity {
206210
type UsageAsCollateral implements UserTransaction @entity {
207211
"""
208212
tx hash
209-
""" # TODO: replace with blockNumber/timestamp + blockPosition
213+
""" #
210214
id: ID!
211215
pool: Pool!
212216
user: User!
@@ -220,7 +224,7 @@ type UsageAsCollateral implements UserTransaction @entity {
220224
type RebalanceStableBorrowRate implements UserTransaction @entity {
221225
"""
222226
tx hash
223-
""" # TODO: replace with blockNumber/timestamp + blockPosition
227+
""" #
224228
id: ID!
225229
pool: Pool!
226230
user: User!
@@ -235,22 +239,33 @@ type RebalanceStableBorrowRate implements UserTransaction @entity {
235239
type Repay implements UserTransaction @entity {
236240
"""
237241
tx hash
238-
""" # TODO: replace with blockNumber/timestamp + blockPosition
242+
"""
239243
id: ID!
240244
pool: Pool!
241245
user: User!
242-
onBehalfOf: User!
246+
repayer: User!
243247
reserve: Reserve!
244248
userReserve: UserReserve!
245249
amount: BigInt!
246250
timestamp: Int!
247251
useATokens: Boolean!
248252
}
249253

254+
type IsolationModeTotalDebtUpdated implements UserTransaction @entity {
255+
"""
256+
tx hash
257+
"""
258+
id: ID!
259+
pool: Pool!
260+
reserve: Reserve!
261+
isolatedDebt: BigInt!
262+
timestamp: Int!
263+
}
264+
250265
type FlashLoan @entity {
251266
"""
252267
tx hash
253-
""" # TODO: replace with blockNumber/timestamp + blockPosition
268+
""" #
254269
id: ID!
255270
pool: Pool!
256271
reserve: Reserve!
@@ -265,7 +280,7 @@ type FlashLoan @entity {
265280
type LiquidationCall implements UserTransaction @entity {
266281
"""
267282
tx hash
268-
""" # TODO: replace with blockNumber/timestamp + blockPosition
283+
""" #
269284
id: ID!
270285
pool: Pool!
271286
user: User!
@@ -282,7 +297,7 @@ type LiquidationCall implements UserTransaction @entity {
282297
type OriginationFeeLiquidation implements UserTransaction @entity {
283298
"""
284299
tx hash
285-
""" # TODO: replace with blockNumber/timestamp + blockPosition
300+
""" #
286301
id: ID!
287302
pool: Pool!
288303
user: User!
@@ -299,8 +314,9 @@ type MintUnbacked @entity {
299314
id: ID!
300315
pool: Pool!
301316
user: User!
302-
onBehalfOf: User!
317+
caller: User!
303318
reserve: Reserve!
319+
userReserve: UserReserve!
304320
amount: BigInt!
305321
referral: Int!
306322
timestamp: Int!
@@ -310,6 +326,7 @@ type BackUnbacked @entity {
310326
id: ID!
311327
pool: Pool!
312328
reserve: Reserve!
329+
userReserve: UserReserve!
313330
backer: User!
314331
amount: BigInt!
315332
fee: BigInt!
@@ -567,10 +584,15 @@ type Reserve @entity {
567584
# lifetimeVariableDebtFeeCollected: BigInt!
568585
userReserves: [UserReserve!]! @derivedFrom(field: "reserve")
569586
supplyHistory: [Supply!]! @derivedFrom(field: "reserve")
587+
mintUnbackedHistory: [MintUnbacked!]! @derivedFrom(field: "reserve")
588+
backUnbackedHistory: [BackUnbacked!]! @derivedFrom(field: "reserve")
589+
mintedToTreasuryHistory: [MintedToTreasury!]! @derivedFrom(field: "reserve")
590+
isolationModeTotalDebtUpdatedHistory: [IsolationModeTotalDebtUpdated!]!
591+
@derivedFrom(field: "reserve")
570592
redeemUnderlyingHistory: [RedeemUnderlying!]! @derivedFrom(field: "reserve")
571593
borrowHistory: [Borrow!]! @derivedFrom(field: "reserve")
572594
usageAsCollateralHistory: [UsageAsCollateral!]! @derivedFrom(field: "reserve")
573-
swapHistory: [Swap!]! @derivedFrom(field: "reserve")
595+
swapHistory: [SwapBorrowRate!]! @derivedFrom(field: "reserve")
574596
rebalanceStableBorrowRateHistory: [RebalanceStableBorrowRate!]! @derivedFrom(field: "reserve")
575597
repayHistory: [Repay!]! @derivedFrom(field: "reserve")
576598
flashLoanHistory: [FlashLoan!]! @derivedFrom(field: "reserve")
@@ -690,9 +712,11 @@ type UserReserve @entity {
690712

691713
usageAsCollateralHistory: [UsageAsCollateral!]! @derivedFrom(field: "userReserve")
692714
supplyHistory: [Supply!]! @derivedFrom(field: "userReserve")
715+
mintUnbackedHistory: [MintUnbacked!]! @derivedFrom(field: "userReserve")
716+
backUnbackedHistory: [BackUnbacked!]! @derivedFrom(field: "userReserve")
693717
redeemUnderlyingHistory: [RedeemUnderlying!]! @derivedFrom(field: "userReserve")
694718
borrowHistory: [Borrow!]! @derivedFrom(field: "userReserve")
695-
swapHistory: [Swap!]! @derivedFrom(field: "userReserve")
719+
swapHistory: [SwapBorrowRate!]! @derivedFrom(field: "userReserve")
696720
rebalanceStableBorrowRateHistory: [RebalanceStableBorrowRate!]! @derivedFrom(field: "userReserve")
697721
repayHistory: [Repay!]! @derivedFrom(field: "userReserve")
698722
liquidationCallHistory: [LiquidationCall!]! @derivedFrom(field: "collateralUserReserve")
@@ -718,10 +742,13 @@ type User @entity {
718742

719743
reserves: [UserReserve!]! @derivedFrom(field: "user")
720744
supplyHistory: [Supply!]! @derivedFrom(field: "user")
745+
mintUnbackedHistory: [MintUnbacked!]! @derivedFrom(field: "user")
746+
backUnbackedHistory: [BackUnbacked!]! @derivedFrom(field: "backer")
747+
userEmodeSetHistory: [UserEModeSet!]! @derivedFrom(field: "user")
721748
redeemUnderlyingHistory: [RedeemUnderlying!]! @derivedFrom(field: "user")
722749
usageAsCollateralHistory: [UsageAsCollateral!]! @derivedFrom(field: "user")
723750
borrowHistory: [Borrow!]! @derivedFrom(field: "user")
724-
swapHistory: [Swap!]! @derivedFrom(field: "user")
751+
swapHistory: [SwapBorrowRate!]! @derivedFrom(field: "user")
725752
rebalanceStableBorrowRateHistory: [RebalanceStableBorrowRate!]! @derivedFrom(field: "user")
726753
repayHistory: [Repay!]! @derivedFrom(field: "user")
727754
liquidationCallHistory: [LiquidationCall!]! @derivedFrom(field: "user")

0 commit comments

Comments
 (0)