impermax-sdk 2.1.394 → 2.1.395
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/subgraphs.js +45 -42
- package/lib/offchain/offchainTypes.d.ts +2 -0
- package/lib/offchain/queries/apis/ponder/index.js +2 -1
- package/lib/offchain/queries/apis/thegraph/index.js +3 -2
- package/lib/offchain/vault/offchainLendingVault.d.ts +4 -2
- package/lib/offchain/vault/offchainLendingVault.js +21 -11
- package/package.json +1 -1
package/lib/config/subgraphs.js
CHANGED
|
@@ -6,37 +6,39 @@ const types_1 = require("./types");
|
|
|
6
6
|
// - FactoryV2: Sonic/Base/Optimism
|
|
7
7
|
// - FactoryV3: Arbitrum/Base
|
|
8
8
|
// - LendingVaults: Polygon/Arbitrum/Blast/Sonic/Base/Scroll
|
|
9
|
+
//"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmfMs5GpdHtaDjUy4YceRhJJdQa4Po2YypLYfxw1z5JEK7",
|
|
10
|
+
//
|
|
9
11
|
// @ts-ignore
|
|
10
12
|
exports.IMPERMAX_SUBGRAPH_URL = {
|
|
11
13
|
[types_1.Networks.Ropsten]: {},
|
|
12
14
|
[types_1.Networks.Mainnet]: {
|
|
13
15
|
[types_1.Factory.V2V1]: [
|
|
14
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
16
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmfMs5GpdHtaDjUy4YceRhJJdQa4Po2YypLYfxw1z5JEK7",
|
|
15
17
|
],
|
|
16
18
|
},
|
|
17
19
|
[types_1.Networks.Polygon]: {
|
|
18
20
|
[types_1.Factory.V2V1_1]: [
|
|
19
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
21
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmQ332E3zFhsKtLERvdmov2uCts6H6MXi4di3q9G3c3kAN",
|
|
20
22
|
],
|
|
21
23
|
[types_1.Factory.V2V2]: [
|
|
22
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
24
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmWh8sg6FrjGhMX3uUZgkdaBS6ZgDcb4jLH9bEUMS1BrwG",
|
|
23
25
|
],
|
|
24
26
|
[types_1.Factory.SOLV2]: [
|
|
25
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
27
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmSMJbLnxgTAREbyXaeLeHKiQXwjNckew2sZxpqZmHxkDm",
|
|
26
28
|
],
|
|
27
29
|
[types_1.Factory.SOL_STABLE]: [
|
|
28
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
30
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmNNLJfpuP8qUMKmKqxtXHbmeCFYwSQWocT2V6zFErRXB4",
|
|
29
31
|
],
|
|
30
32
|
},
|
|
31
33
|
[types_1.Networks.Arbitrum]: {
|
|
32
34
|
[types_1.Factory.V2V1_1]: [
|
|
33
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
35
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmcmApTRcWAA4zvJQB9snDZyavzz9PUb6cBNyNX3ntzaB6",
|
|
34
36
|
],
|
|
35
37
|
[types_1.Factory.V2V2]: [
|
|
36
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
38
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmSNxf97fskBf3yD3ye1DWfYzTruvuzSYLhHtFuoyUoNSf",
|
|
37
39
|
],
|
|
38
40
|
[types_1.Factory.SOLV2]: [
|
|
39
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
41
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmXXP4NqyDAf2jDQ7m3W1Y6oKaMo4scjNxCV6nGVNZByx1",
|
|
40
42
|
],
|
|
41
43
|
[types_1.Factory.V3]: [
|
|
42
44
|
"https://arbitrum-factory-v3-production.up.railway.app/",
|
|
@@ -44,13 +46,13 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
44
46
|
},
|
|
45
47
|
[types_1.Networks.Avalanche]: {
|
|
46
48
|
[types_1.Factory.V2V1_2]: [
|
|
47
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
49
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmYfj4AAPHyW9rDGbAx85ZgfmePPq6GU5WwH9VBqs1VMng",
|
|
48
50
|
],
|
|
49
51
|
[types_1.Factory.V2V2]: [
|
|
50
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
52
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmUqfiWb36YFkULiiVFsLWXWtWP5cFggJ5YrcioAqK7cmB",
|
|
51
53
|
],
|
|
52
54
|
[types_1.Factory.SOLV2]: [
|
|
53
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
55
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmaotGvcAQvrzmNCTa59iqDkYqMUnWXSXDqFj4zkhfMiSS",
|
|
54
56
|
],
|
|
55
57
|
},
|
|
56
58
|
[types_1.Networks.Mantle]: {
|
|
@@ -67,13 +69,13 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
67
69
|
[types_1.Networks.Cronos]: {},
|
|
68
70
|
[types_1.Networks.Fantom]: {
|
|
69
71
|
[types_1.Factory.SOLV1_2]: [
|
|
70
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
72
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmbyA55MdKVtXdtfB3RPPiyMQ7iUj53DEmcVwN6ur2bpH7",
|
|
71
73
|
],
|
|
72
74
|
[types_1.Factory.SOLV2]: [
|
|
73
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
75
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmarkbhadA5k9pL8jKDuQqSXruef2ZcyGzzSnjMDAfS35q",
|
|
74
76
|
],
|
|
75
77
|
[types_1.Factory.V2V2]: [
|
|
76
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
78
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmeRttRaDA3esfkdhhu5Y6SpkdSHMXVGTZh6QC2VZZnGta",
|
|
77
79
|
],
|
|
78
80
|
},
|
|
79
81
|
[types_1.Networks.Canto]: {
|
|
@@ -83,7 +85,7 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
83
85
|
},
|
|
84
86
|
[types_1.Networks.ZksyncEra]: {
|
|
85
87
|
[types_1.Factory.SOLV2]: [
|
|
86
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
88
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmRoDyaepa51SCmq5EVWSRvz6rFac6SaAewSsr82a4QJ4K",
|
|
87
89
|
],
|
|
88
90
|
},
|
|
89
91
|
[types_1.Networks.Harmony]: {},
|
|
@@ -91,10 +93,10 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
91
93
|
[types_1.Networks.Sxnetwork]: {},
|
|
92
94
|
[types_1.Networks.Blast]: {
|
|
93
95
|
[types_1.Factory.SOLV2]: [
|
|
94
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
96
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmbDkneZko6LW65hi9B65Qpmm2QMkwSX4D9CvHvPYFiW8Q",
|
|
95
97
|
],
|
|
96
98
|
[types_1.Factory.V2V2]: [
|
|
97
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
99
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmbHiuFrMmSSjnquZ7LupZB6UneVgtaMSUg4BQ25qfLqNp",
|
|
98
100
|
],
|
|
99
101
|
},
|
|
100
102
|
[types_1.Networks.Base]: {
|
|
@@ -103,8 +105,8 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
103
105
|
"https://base-factory-production.up.railway.app/",
|
|
104
106
|
],
|
|
105
107
|
[types_1.Factory.SOL_STABLE]: [
|
|
106
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
107
|
-
"https://base-factory-production.up.railway.app/"
|
|
108
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmV5LPzSGdv91V9CkLnmNMirbhAQRKEyuXn1cFNSCXqCGj",
|
|
109
|
+
"https://base-factory-production.up.railway.app/"
|
|
108
110
|
],
|
|
109
111
|
[types_1.Factory.V2V2]: [
|
|
110
112
|
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmQsSqSSm2gvj9LxYxmHapJV5eMjuV1JdKuWirgyJe8zn5",
|
|
@@ -116,15 +118,15 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
116
118
|
},
|
|
117
119
|
[types_1.Networks.Scroll]: {
|
|
118
120
|
[types_1.Factory.SOLV2]: [
|
|
119
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
121
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmSLn3tnYxTpZsdbSNXhgScsx3AnvsNamvo2B2DTTqT7UH",
|
|
120
122
|
],
|
|
121
123
|
[types_1.Factory.SOL_STABLE]: [
|
|
122
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
124
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmfSAMG3c9Gy5Eezndq7H4KcgrorKLY9koUnNYZS1kT2FX",
|
|
123
125
|
],
|
|
124
126
|
},
|
|
125
127
|
[types_1.Networks.Optimism]: {
|
|
126
128
|
[types_1.Factory.SOLV2]: [
|
|
127
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
129
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmPpnoyZ2TkCxmHanjaoiLg4zbaKDvFSuvPvCDdyFjoeuu",
|
|
128
130
|
"https://optimism-factory-production.up.railway.app/",
|
|
129
131
|
],
|
|
130
132
|
[types_1.Factory.SOL_STABLE]: [
|
|
@@ -142,19 +144,19 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
142
144
|
[types_1.Networks.Sonic]: {
|
|
143
145
|
[types_1.Factory.SOLV2]: [
|
|
144
146
|
'https://sonic-factory-production.up.railway.app/',
|
|
145
|
-
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
147
|
+
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/Qme1gMBrdwQb6gbyT5aUmDRCoYMX4yXJGCBKfZZoMMD9yC'
|
|
146
148
|
],
|
|
147
149
|
[types_1.Factory.SOL_STABLE]: [
|
|
148
150
|
'https://sonic-factory-production.up.railway.app/',
|
|
149
|
-
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
151
|
+
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmaeheAp9hBVfUFs9JtzaYtKmEVfz2btv2UfWbQDvxecj8'
|
|
150
152
|
]
|
|
151
153
|
},
|
|
152
154
|
[types_1.Networks.Linea]: {
|
|
153
155
|
[types_1.Factory.SOLV2]: [
|
|
154
|
-
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
156
|
+
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmRrcv5oFamrAvfJkcuyzeAsNZ6KWMJXoMhiXCVVQdz99a',
|
|
155
157
|
],
|
|
156
158
|
[types_1.Factory.SOL_STABLE]: [
|
|
157
|
-
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
159
|
+
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmXSvwwRyAPjgtC3tPeESeB1F923bkmAK2usrZtgXkEjVy',
|
|
158
160
|
]
|
|
159
161
|
}
|
|
160
162
|
};
|
|
@@ -164,7 +166,8 @@ exports.VAULT_SUBGRAPH_URL = {
|
|
|
164
166
|
[types_1.Networks.Mainnet]: {},
|
|
165
167
|
[types_1.Networks.Polygon]: {
|
|
166
168
|
[types_1.VaultType.LENDING]: [
|
|
167
|
-
"https://
|
|
169
|
+
"https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/lending-vault-polygon/1.0.0/gn",
|
|
170
|
+
//"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/BNWJQpKBT24mYzLYZ7hdBiJpvfBoEwjSemNkQ1Rryknp" TODO: fix thegraph deployment
|
|
168
171
|
"https://polygon-lendingvaults-production.up.railway.app/"
|
|
169
172
|
],
|
|
170
173
|
[types_1.VaultType.HEDGED]: [],
|
|
@@ -172,7 +175,7 @@ exports.VAULT_SUBGRAPH_URL = {
|
|
|
172
175
|
},
|
|
173
176
|
[types_1.Networks.Arbitrum]: {
|
|
174
177
|
[types_1.VaultType.LENDING]: [
|
|
175
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
178
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmWhvDxbi8QscfMEvLizMSpSauEWUCykMpiSgVFfxhXB8q",
|
|
176
179
|
"https://arbitrum-lendingvaults-production.up.railway.app/"
|
|
177
180
|
],
|
|
178
181
|
[types_1.VaultType.HEDGED]: [],
|
|
@@ -190,7 +193,8 @@ exports.VAULT_SUBGRAPH_URL = {
|
|
|
190
193
|
[types_1.Networks.ZksyncEra]: {},
|
|
191
194
|
[types_1.Networks.Base]: {
|
|
192
195
|
[types_1.VaultType.LENDING]: [
|
|
193
|
-
"https://
|
|
196
|
+
"https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/lending-vault-base-v2/1.0.0/gn",
|
|
197
|
+
// "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/2TdbQKGWPRHUwuHJgxQzh8kZ7FVpBgZaFtnbjTS6iYng" TODO: fix thegraph deployment
|
|
194
198
|
"https://base-lendingvaults-production.up.railway.app/",
|
|
195
199
|
],
|
|
196
200
|
[types_1.VaultType.HEDGED]: [],
|
|
@@ -198,9 +202,8 @@ exports.VAULT_SUBGRAPH_URL = {
|
|
|
198
202
|
},
|
|
199
203
|
[types_1.Networks.Mantle]: {},
|
|
200
204
|
[types_1.Networks.Scroll]: {
|
|
201
|
-
// TODO: raiwlay endpoint
|
|
202
205
|
[types_1.VaultType.LENDING]: [
|
|
203
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
206
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmPUfHmFr2R8kaEJANb4ynFnKeq4cYrd7LgLmNiaWF1VA4",
|
|
204
207
|
"https://scroll-lendingvaults-production.up.railway.app/"
|
|
205
208
|
],
|
|
206
209
|
[types_1.VaultType.HEDGED]: [],
|
|
@@ -210,7 +213,7 @@ exports.VAULT_SUBGRAPH_URL = {
|
|
|
210
213
|
[types_1.Networks.Real]: {},
|
|
211
214
|
[types_1.Networks.Blast]: {
|
|
212
215
|
[types_1.VaultType.LENDING]: [
|
|
213
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
216
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmQni87Kadg6UMyQCaU9tKAgwhn4SWozMMuuXDoqMFjR4L",
|
|
214
217
|
"https://blast-lendingvaults-production.up.railway.app/"
|
|
215
218
|
],
|
|
216
219
|
[types_1.VaultType.HEDGED]: [],
|
|
@@ -218,7 +221,7 @@ exports.VAULT_SUBGRAPH_URL = {
|
|
|
218
221
|
},
|
|
219
222
|
[types_1.Networks.Sonic]: {
|
|
220
223
|
[types_1.VaultType.LENDING]: [
|
|
221
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
224
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmUQ9wcEidgq3azjLR3zhEokx8VRKJoFCeP6hLNZ6AU7Ro",
|
|
222
225
|
"https://sonic-lendingvaults-production.up.railway.app/"
|
|
223
226
|
]
|
|
224
227
|
},
|
|
@@ -274,30 +277,30 @@ exports.BLOCKS_SUBGRAPH_URL = {
|
|
|
274
277
|
[types_1.Networks.Linea]: "",
|
|
275
278
|
};
|
|
276
279
|
exports.XIBEX_SUBGRAPH_URL = {
|
|
277
|
-
[types_1.Networks.Arbitrum]: ["https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
280
|
+
[types_1.Networks.Arbitrum]: ["https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmZNQ3vScFpP14gfYmrVXrxwkZSWsfroC5dWyJZh6hpN3s"],
|
|
278
281
|
};
|
|
279
282
|
exports.CONFIG_MANAGER_SUBGRAPH_URL = {
|
|
280
283
|
[types_1.Networks.Ropsten]: "",
|
|
281
284
|
[types_1.Networks.Mainnet]: "",
|
|
282
|
-
[types_1.Networks.Polygon]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
285
|
+
[types_1.Networks.Polygon]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmaCLvTgR15D9sFbA644CtovUpAzwX9EQn43ADe2ojkfn4",
|
|
283
286
|
[types_1.Networks.Arbitrum]: "",
|
|
284
287
|
[types_1.Networks.Avalanche]: "",
|
|
285
288
|
[types_1.Networks.Moonriver]: "",
|
|
286
289
|
[types_1.Networks.Aurora]: "",
|
|
287
290
|
[types_1.Networks.Cronos]: "",
|
|
288
|
-
[types_1.Networks.Fantom]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
291
|
+
[types_1.Networks.Fantom]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmZ1vBxMJgjDUVUrgHnQDs6AhjwtJiWPcKcHHYYz6ttSrY",
|
|
289
292
|
[types_1.Networks.Canto]: "",
|
|
290
293
|
[types_1.Networks.ZksyncEra]: "",
|
|
291
294
|
[types_1.Networks.Harmony]: "",
|
|
292
295
|
[types_1.Networks.Moonbeam]: "",
|
|
293
296
|
[types_1.Networks.Sxnetwork]: "",
|
|
294
|
-
[types_1.Networks.Blast]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
295
|
-
[types_1.Networks.Scroll]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
296
|
-
[types_1.Networks.Base]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
297
|
-
[types_1.Networks.Optimism]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
297
|
+
[types_1.Networks.Blast]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmYXwyp3wc4FH5teGTKDqfDmLVK8Y6oqm5HJxPaRzhXpZp",
|
|
298
|
+
[types_1.Networks.Scroll]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmfMRbxLzG3va5u9ix2NBcyvnuHffTFqgmZoWewXPw8fqu",
|
|
299
|
+
[types_1.Networks.Base]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmQVBVNCv4vUtPUQA7o6nEXiaKnPJskmYjPMryvGnx9cWh",
|
|
300
|
+
[types_1.Networks.Optimism]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmYmppLvUHmYpxCsFA8t26oBNT85qDsFj47UM9iwR1yUhM",
|
|
298
301
|
[types_1.Networks.Real]: "https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-config-manager-real/1.0/gn",
|
|
299
|
-
[types_1.Networks.Sonic]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
300
|
-
[types_1.Networks.Linea]: 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/
|
|
302
|
+
[types_1.Networks.Sonic]: "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmVz8i4ACXuUNTT2re2cHnNqqw9UNco2mUrj4m6WYm1QM5",
|
|
303
|
+
[types_1.Networks.Linea]: 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmaTZ5eckYUp3YqTiaqMoGEc1CzndhA7e8x1FLZmvsUd5J',
|
|
301
304
|
};
|
|
302
305
|
exports.WHITELIST_SUBGRAPH_URL = {
|
|
303
306
|
[types_1.Networks.Ropsten]: "",
|
|
@@ -212,6 +212,7 @@ export interface VaultBorrowable {
|
|
|
212
212
|
amm: Amms | null;
|
|
213
213
|
factory: Factory;
|
|
214
214
|
borrowableType: Borrowable;
|
|
215
|
+
vaultBalance: number;
|
|
215
216
|
}
|
|
216
217
|
export interface LendingVaultData extends PoolTokenData {
|
|
217
218
|
underlying: TokenData;
|
|
@@ -221,6 +222,7 @@ export interface LendingVaultData extends PoolTokenData {
|
|
|
221
222
|
lastUpdate: string;
|
|
222
223
|
vaultType: VaultType.LENDING;
|
|
223
224
|
borrowables: VaultBorrowable[];
|
|
225
|
+
lendingVaultBorrowables?: VaultBorrowable[];
|
|
224
226
|
}
|
|
225
227
|
export interface HedgedVaultData extends PoolTokenData {
|
|
226
228
|
vaultType: VaultType.HEDGED;
|
|
@@ -4,6 +4,7 @@ import OffchainVault from "./offchainVault";
|
|
|
4
4
|
import { VaultBorrowable } from "../offchainTypes";
|
|
5
5
|
import { OffchainAccountBorrowable } from "../account/lendingPool";
|
|
6
6
|
import { LendingVaultEntity } from "../../utils/vault/lendingVaultEntity";
|
|
7
|
+
import { BorrowablePosition } from "../../utils/borrowable/borrowablePosition";
|
|
7
8
|
export declare enum RiskLevel {
|
|
8
9
|
LOW = 0,
|
|
9
10
|
MEDIUM = 1,
|
|
@@ -12,12 +13,13 @@ export declare enum RiskLevel {
|
|
|
12
13
|
export default class OffchainLendingVault extends OffchainVault {
|
|
13
14
|
protected vaultBorrowables: Array<VaultBorrowable> | null;
|
|
14
15
|
constructor(offchain: Offchain, vaultAddress: Address);
|
|
16
|
+
createLendingVaultBorrowablePositionObject(borrowable: VaultBorrowable, lockStateChange?: boolean): Promise<BorrowablePosition>;
|
|
15
17
|
createLendingVaultObject(lockStateChange?: boolean): Promise<LendingVaultEntity>;
|
|
16
18
|
getRiskLevel(): Promise<RiskLevel>;
|
|
17
19
|
getAvailableLiquidity(): Promise<number>;
|
|
18
20
|
getAvailableLiquidityUSD(): Promise<number>;
|
|
19
21
|
getAccountBorrowable(borrowable: VaultBorrowable): Promise<OffchainAccountBorrowable | null>;
|
|
20
22
|
getAccountBorrowables(): Promise<Array<OffchainAccountBorrowable>>;
|
|
21
|
-
getBorrowables(): Promise<Array<VaultBorrowable
|
|
22
|
-
|
|
23
|
+
getBorrowables(): Promise<Array<VaultBorrowable>>;
|
|
24
|
+
getLendingVaultBorrowables(): Promise<Array<VaultBorrowable>>;
|
|
23
25
|
}
|
|
@@ -7,6 +7,7 @@ exports.RiskLevel = void 0;
|
|
|
7
7
|
const types_1 = require("../../config/types");
|
|
8
8
|
const offchainVault_1 = __importDefault(require("./offchainVault"));
|
|
9
9
|
const lendingVaultEntity_1 = require("../../utils/vault/lendingVaultEntity");
|
|
10
|
+
const borrowablePosition_1 = require("../../utils/borrowable/borrowablePosition");
|
|
10
11
|
var RiskLevel;
|
|
11
12
|
(function (RiskLevel) {
|
|
12
13
|
RiskLevel[RiskLevel["LOW"] = 0] = "LOW";
|
|
@@ -19,8 +20,17 @@ class OffchainLendingVault extends offchainVault_1.default {
|
|
|
19
20
|
this.vaultBorrowables = null;
|
|
20
21
|
this.vaultType = types_1.VaultType.LENDING;
|
|
21
22
|
}
|
|
23
|
+
async createLendingVaultBorrowablePositionObject(borrowable, lockStateChange = false) {
|
|
24
|
+
const lendingPool = await this.getOffchain().getLendingPool(borrowable.factory, borrowable.pairAddress);
|
|
25
|
+
return new borrowablePosition_1.BorrowablePosition({
|
|
26
|
+
amount: borrowable.vaultBalance,
|
|
27
|
+
borrowable: await lendingPool.getBorrowable(borrowable.borrowableType).createBorrowableObject(lockStateChange),
|
|
28
|
+
lockStateChange,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
22
31
|
async createLendingVaultObject(lockStateChange = false) {
|
|
23
|
-
const
|
|
32
|
+
const vaultBorrowables = await this.getLendingVaultBorrowables();
|
|
33
|
+
const positions = await Promise.all(vaultBorrowables.map(async (i) => await this.createLendingVaultBorrowablePositionObject(i)));
|
|
24
34
|
return new lendingVaultEntity_1.LendingVaultEntity({
|
|
25
35
|
totalBalance: await this.getTotalBalance(),
|
|
26
36
|
reserveFactor: await this.getReserveFactor(),
|
|
@@ -62,6 +72,7 @@ class OffchainLendingVault extends offchainVault_1.default {
|
|
|
62
72
|
this.getPoolTokenData(),
|
|
63
73
|
this.getOffchain().getLendingPoolsData()
|
|
64
74
|
]);
|
|
75
|
+
vaultData["borrowables"] = vaultData.lendingVaultBorrowables ?? vaultData.borrowables;
|
|
65
76
|
// 2. Get vault borrowables from the subgraph data `id`, where id is `lendingVault-borrowableAddress`
|
|
66
77
|
const borrowableIds = vaultData.borrowables.map(i => i.id.split("-")[1]);
|
|
67
78
|
const results = [];
|
|
@@ -72,12 +83,9 @@ class OffchainLendingVault extends offchainVault_1.default {
|
|
|
72
83
|
const lendingPool = await this.getOffchain().getLendingPool(factory, pairAddress);
|
|
73
84
|
if (!lendingPool)
|
|
74
85
|
continue;
|
|
75
|
-
const [borrowable0, borrowable1] = await Promise.all([
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
]);
|
|
79
|
-
const borrowable = borrowableIds.find(i => i === borrowable0 || i === borrowable1);
|
|
80
|
-
if (borrowable) {
|
|
86
|
+
const [borrowable0, borrowable1] = await Promise.all([lendingPool.getBorrowableAddress(types_1.Borrowable.A), lendingPool.getBorrowableAddress(types_1.Borrowable.B)]);
|
|
87
|
+
const address = borrowableIds.find(i => i === borrowable0 || i === borrowable1);
|
|
88
|
+
if (address) {
|
|
81
89
|
const [underlyingAddress, pair, token0, token1, amm, factory] = await Promise.all([
|
|
82
90
|
this.getUnderlyingAddress(),
|
|
83
91
|
lendingPool.getCollateral().getSymbol(),
|
|
@@ -87,16 +95,18 @@ class OffchainLendingVault extends offchainVault_1.default {
|
|
|
87
95
|
lendingPool.getFactory()
|
|
88
96
|
]);
|
|
89
97
|
const borrowableType = underlyingAddress === token0.toLowerCase() ? types_1.Borrowable.A : types_1.Borrowable.B;
|
|
98
|
+
const vaultBalance = vaultData.borrowables.find(i => i.id.split("-")[1] === address)?.vaultBalance ?? 0;
|
|
90
99
|
results.push({
|
|
91
|
-
id: pairAddress.concat("-",
|
|
100
|
+
id: pairAddress.concat("-", address),
|
|
92
101
|
pair,
|
|
93
|
-
address
|
|
102
|
+
address,
|
|
94
103
|
pairAddress,
|
|
95
104
|
token0,
|
|
96
105
|
token1,
|
|
97
106
|
amm,
|
|
98
107
|
factory,
|
|
99
|
-
borrowableType
|
|
108
|
+
borrowableType,
|
|
109
|
+
vaultBalance
|
|
100
110
|
});
|
|
101
111
|
}
|
|
102
112
|
}
|
|
@@ -104,7 +114,7 @@ class OffchainLendingVault extends offchainVault_1.default {
|
|
|
104
114
|
return results;
|
|
105
115
|
}
|
|
106
116
|
// Avoid doing this through initializer and do it as-needed
|
|
107
|
-
async
|
|
117
|
+
async getLendingVaultBorrowables() {
|
|
108
118
|
if (this.vaultBorrowables)
|
|
109
119
|
return this.vaultBorrowables;
|
|
110
120
|
this.vaultBorrowables = await this.getBorrowables();
|