@scallop-io/sui-scallop-sdk 1.4.24-alpha.1 → 1.5.0-alpha.1
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/dist/constants/common.d.ts +4 -4
- package/dist/constants/enum.d.ts +2 -2
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/xoracle.d.ts +2 -0
- package/dist/index.js +580 -685
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +590 -696
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopIndexer.d.ts +1 -0
- package/dist/models/scallopPrice.d.ts +0 -0
- package/dist/models/scallopQuery.d.ts +30 -13
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +0 -2
- package/dist/queries/coreQuery.d.ts +1 -1
- package/dist/queries/index.d.ts +1 -0
- package/dist/queries/poolAddressesQuery.d.ts +1 -1
- package/dist/queries/portfolioQuery.d.ts +3 -4
- package/dist/queries/priceQuery.d.ts +1 -3
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/dist/queries/xOracleQuery.d.ts +13 -0
- package/dist/types/address.d.ts +1 -0
- package/dist/types/constant/index.d.ts +1 -0
- package/dist/types/constant/xOracle.d.ts +9 -0
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +11 -25
- package/src/builders/coreBuilder.ts +15 -72
- package/src/builders/oracle.ts +73 -46
- package/src/builders/referralBuilder.ts +9 -20
- package/src/builders/spoolBuilder.ts +10 -38
- package/src/builders/vescaBuilder.ts +11 -26
- package/src/constants/coinGecko.ts +4 -12
- package/src/constants/common.ts +0 -2
- package/src/constants/enum.ts +10 -13
- package/src/constants/index.ts +1 -0
- package/src/constants/poolAddress.ts +343 -218
- package/src/constants/pyth.ts +0 -1
- package/src/constants/testAddress.ts +35 -254
- package/src/constants/xoracle.ts +25 -0
- package/src/models/scallopIndexer.ts +11 -0
- package/src/models/scallopPrice.ts +0 -0
- package/src/models/scallopQuery.ts +58 -13
- package/src/models/scallopUtils.ts +1 -1
- package/src/queries/coreQuery.ts +16 -6
- package/src/queries/index.ts +1 -0
- package/src/queries/poolAddressesQuery.ts +2 -2
- package/src/queries/priceQuery.ts +10 -3
- package/src/queries/vescaQuery.ts +8 -17
- package/src/queries/xOracleQuery.ts +124 -0
- package/src/types/address.ts +1 -0
- package/src/types/constant/index.ts +1 -0
- package/src/types/constant/xOracle.ts +11 -0
- package/src/utils/util.ts +4 -9
|
@@ -2,28 +2,20 @@ import { AddressesInterface } from 'src/types';
|
|
|
2
2
|
|
|
3
3
|
export const TEST_ADDRESSES: AddressesInterface = {
|
|
4
4
|
core: {
|
|
5
|
-
// version:
|
|
6
|
-
// '0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7',
|
|
7
5
|
version:
|
|
8
|
-
'
|
|
6
|
+
'0xee15d07800e2ad4852505c57cd86afea774af02c17388f8bd907de75f915b4f4',
|
|
9
7
|
versionCap:
|
|
10
8
|
'0x590a4011cb649b3878f3ea14b3a78674642a9548d79b7e091ef679574b158a07',
|
|
11
|
-
// object:
|
|
12
|
-
// '0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf',
|
|
13
9
|
object:
|
|
14
|
-
'
|
|
15
|
-
// market:
|
|
16
|
-
// '0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9',
|
|
10
|
+
'0xb03fa00e2d9f17d78a9d48bd94d8852abec68c19d55e819096b1e062e69bfad1',
|
|
17
11
|
market:
|
|
18
|
-
'
|
|
12
|
+
'0xa7f41efe3b551c20ad6d6cea6ccd0fd68d2e2eaaacdca5e62d956209f6a51312',
|
|
19
13
|
adminCap:
|
|
20
14
|
'0x09689d018e71c337d9db6d67cbca06b74ed92196103624028ccc3ecea411777c',
|
|
21
15
|
coinDecimalsRegistry:
|
|
22
16
|
'0x200abe9bf19751cc566ae35aa58e2b7e4ff688fc1130f8d8909ea09bc137d668',
|
|
23
|
-
// obligationAccessStore:
|
|
24
|
-
// '0x733e30b7c94d619d78cb8f5bc4bfbb759ced9a531239028caabb2474e5be59c9',
|
|
25
17
|
obligationAccessStore:
|
|
26
|
-
'
|
|
18
|
+
'0xb7d7e1464936fbdcdd4913308b40335e662401029635289bdb317c7dde9d6c68',
|
|
27
19
|
coins: {
|
|
28
20
|
usdc: {
|
|
29
21
|
id: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
|
|
@@ -40,111 +32,6 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
40
32
|
},
|
|
41
33
|
},
|
|
42
34
|
},
|
|
43
|
-
cetus: {
|
|
44
|
-
id: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b',
|
|
45
|
-
metaData:
|
|
46
|
-
'0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da',
|
|
47
|
-
treasury: '',
|
|
48
|
-
oracle: {
|
|
49
|
-
supra: '',
|
|
50
|
-
switchboard: '',
|
|
51
|
-
pyth: {
|
|
52
|
-
feed: 'e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef',
|
|
53
|
-
feedObject:
|
|
54
|
-
'0x24c0247fb22457a719efac7f670cdc79be321b521460bd6bd2ccfa9f80713b14',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
wapt: {
|
|
59
|
-
id: '0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37',
|
|
60
|
-
metaData:
|
|
61
|
-
'0xc969c5251f372c0f34c32759f1d315cf1ea0ee5e4454b52aea08778eacfdd0a8',
|
|
62
|
-
treasury: '',
|
|
63
|
-
oracle: {
|
|
64
|
-
supra: '',
|
|
65
|
-
switchboard: '',
|
|
66
|
-
pyth: {
|
|
67
|
-
feed: '03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5',
|
|
68
|
-
feedObject:
|
|
69
|
-
'0x7c5b7837c44a69b469325463ac0673ac1aa8435ff44ddb4191c9ae380463647f',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
wsol: {
|
|
74
|
-
id: '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8',
|
|
75
|
-
metaData:
|
|
76
|
-
'0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e',
|
|
77
|
-
treasury: '',
|
|
78
|
-
oracle: {
|
|
79
|
-
supra: '',
|
|
80
|
-
switchboard: '',
|
|
81
|
-
pyth: {
|
|
82
|
-
feed: 'ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d',
|
|
83
|
-
feedObject:
|
|
84
|
-
'0x9d0d275efbd37d8a8855f6f2c761fa5983293dd8ce202ee5196626de8fcd4469',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
wbtc: {
|
|
89
|
-
id: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881',
|
|
90
|
-
metaData:
|
|
91
|
-
'0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd',
|
|
92
|
-
treasury: '',
|
|
93
|
-
oracle: {
|
|
94
|
-
supra: '',
|
|
95
|
-
switchboard: '',
|
|
96
|
-
pyth: {
|
|
97
|
-
feed: 'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
|
|
98
|
-
feedObject:
|
|
99
|
-
'0x9a62b4863bdeaabdc9500fce769cf7e72d5585eeb28a6d26e4cafadc13f76ab2',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
weth: {
|
|
104
|
-
id: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5',
|
|
105
|
-
metaData:
|
|
106
|
-
'0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f',
|
|
107
|
-
treasury: '',
|
|
108
|
-
oracle: {
|
|
109
|
-
supra: '',
|
|
110
|
-
switchboard: '',
|
|
111
|
-
pyth: {
|
|
112
|
-
feed: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
|
|
113
|
-
feedObject:
|
|
114
|
-
'0x9193fd47f9a0ab99b6e365a464c8a9ae30e6150fc37ed2a89c1586631f6fc4ab',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
wusdc: {
|
|
119
|
-
id: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf',
|
|
120
|
-
metaData:
|
|
121
|
-
'0x4fbf84f3029bd0c0b77164b587963be957f853eccf834a67bb9ecba6ec80f189',
|
|
122
|
-
treasury: '',
|
|
123
|
-
oracle: {
|
|
124
|
-
supra: '',
|
|
125
|
-
switchboard: '',
|
|
126
|
-
pyth: {
|
|
127
|
-
feed: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
|
|
128
|
-
feedObject:
|
|
129
|
-
'0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
wusdt: {
|
|
134
|
-
id: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c',
|
|
135
|
-
metaData:
|
|
136
|
-
'0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c',
|
|
137
|
-
treasury: '',
|
|
138
|
-
oracle: {
|
|
139
|
-
supra: '',
|
|
140
|
-
switchboard: '',
|
|
141
|
-
pyth: {
|
|
142
|
-
feed: '2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b',
|
|
143
|
-
feedObject:
|
|
144
|
-
'0x985e3db9f93f76ee8bace7c3dd5cc676a096accd5d9e09e9ae0fb6e492b14572',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
35
|
sui: {
|
|
149
36
|
id: '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
150
37
|
metaData:
|
|
@@ -161,51 +48,6 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
161
48
|
},
|
|
162
49
|
},
|
|
163
50
|
},
|
|
164
|
-
afsui: {
|
|
165
|
-
id: '0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc',
|
|
166
|
-
metaData:
|
|
167
|
-
'0x2f9217f533e51334873a39b8026a4aa6919497b47f49d0986a4f1aec66f8a34d',
|
|
168
|
-
treasury: '',
|
|
169
|
-
oracle: {
|
|
170
|
-
supra: '',
|
|
171
|
-
switchboard: '',
|
|
172
|
-
pyth: {
|
|
173
|
-
feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
174
|
-
feedObject:
|
|
175
|
-
'0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
hasui: {
|
|
180
|
-
id: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d',
|
|
181
|
-
metaData:
|
|
182
|
-
'0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
|
|
183
|
-
treasury: '',
|
|
184
|
-
oracle: {
|
|
185
|
-
supra: '',
|
|
186
|
-
switchboard: '',
|
|
187
|
-
pyth: {
|
|
188
|
-
feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
189
|
-
feedObject:
|
|
190
|
-
'0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
vsui: {
|
|
195
|
-
id: '0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55',
|
|
196
|
-
metaData:
|
|
197
|
-
'0xabd84a23467b33854ab25cf862006fd97479f8f6f53e50fe732c43a274d939bd',
|
|
198
|
-
treasury: '',
|
|
199
|
-
oracle: {
|
|
200
|
-
supra: '',
|
|
201
|
-
switchboard: '',
|
|
202
|
-
pyth: {
|
|
203
|
-
feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
204
|
-
feedObject:
|
|
205
|
-
'0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
51
|
sca: {
|
|
210
52
|
id: '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
|
|
211
53
|
metaData:
|
|
@@ -221,45 +63,6 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
221
63
|
},
|
|
222
64
|
},
|
|
223
65
|
},
|
|
224
|
-
sbeth: {
|
|
225
|
-
id: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
|
|
226
|
-
metaData:
|
|
227
|
-
'0x89b04ba87f8832d4d76e17a1c9dce72eb3e64d372cf02012b8d2de5384faeef0',
|
|
228
|
-
treasury: '',
|
|
229
|
-
oracle: {
|
|
230
|
-
supra: '',
|
|
231
|
-
switchboard: '',
|
|
232
|
-
pyth: {
|
|
233
|
-
feed: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
|
|
234
|
-
feedObject:
|
|
235
|
-
'0x9193fd47f9a0ab99b6e365a464c8a9ae30e6150fc37ed2a89c1586631f6fc4ab',
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
// @TODO: add test address
|
|
240
|
-
// @ts-ignore
|
|
241
|
-
sbusdt: {},
|
|
242
|
-
// @ts-ignore
|
|
243
|
-
sbwbtc: {},
|
|
244
|
-
// @ts-ignore
|
|
245
|
-
blub: {},
|
|
246
|
-
// @ts-ignore
|
|
247
|
-
musd: {},
|
|
248
|
-
fdusd: {
|
|
249
|
-
id: '0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a',
|
|
250
|
-
metaData:
|
|
251
|
-
'0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7',
|
|
252
|
-
treasury: '',
|
|
253
|
-
oracle: {
|
|
254
|
-
supra: '',
|
|
255
|
-
switchboard: '',
|
|
256
|
-
pyth: {
|
|
257
|
-
feed: '0xccdc1a08923e2e4f4b1e6ea89de6acbc5fe1948e9706f5604b8cb50bc1ed3979',
|
|
258
|
-
feedObject:
|
|
259
|
-
'0x5f6583b2b0fe1ecf94aaffeaab8a838794693960cea48c0da282d5f4a24be027',
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
66
|
deep: {
|
|
264
67
|
id: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
|
|
265
68
|
metaData:
|
|
@@ -293,14 +96,14 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
293
96
|
},
|
|
294
97
|
oracles: {
|
|
295
98
|
xOracle:
|
|
296
|
-
'
|
|
99
|
+
'0x0c09daac413e834f2fe69601c41e836022fa9a185df6b56a80f6bcd8a3ecb8a2',
|
|
297
100
|
xOracleCap:
|
|
298
101
|
'0x1edeae568fde99e090dbdec4bcdbd33a15f53a1ce1f87aeef1a560dedf4b4a90',
|
|
299
102
|
supra: { registry: '', registryCap: '', holder: '' },
|
|
300
103
|
switchboard: { registry: '', registryCap: '' },
|
|
301
104
|
pyth: {
|
|
302
105
|
registry:
|
|
303
|
-
'
|
|
106
|
+
'0xdcf813893649521abd27816ba8d946b0cb7fc98d776cc9adcecba54688ccc109',
|
|
304
107
|
registryCap:
|
|
305
108
|
'0xbcb07141eb1f7e01fbda4130ecf5f5adaeabb77f5d9c32158b7532bcd2197acd',
|
|
306
109
|
state:
|
|
@@ -333,39 +136,34 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
333
136
|
'0x3f203f6fff6a69d151e4f1cd931f22b68c489ef2759765662fc7baf673943c9e',
|
|
334
137
|
},
|
|
335
138
|
protocol: {
|
|
336
|
-
id: '
|
|
139
|
+
id: '0xb03fa00e2d9f17d78a9d48bd94d8852abec68c19d55e819096b1e062e69bfad1',
|
|
337
140
|
upgradeCap:
|
|
338
141
|
'0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
|
|
339
142
|
},
|
|
340
|
-
// protocol: {
|
|
341
|
-
// id: '0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe8745086ff1195eb3e',
|
|
342
|
-
// upgradeCap:
|
|
343
|
-
// '0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
|
|
344
|
-
// },
|
|
345
143
|
protocolWhitelist: {
|
|
346
144
|
id: '0x4c262d9343dac53ecb28f482a2a3f62c73d0ebac5b5f03d57383d56ff219acdf',
|
|
347
145
|
upgradeCap:
|
|
348
146
|
'0x4a5e88a75039b00988f633f811f58117f31b8627a46bf822aa114d9010049449',
|
|
349
147
|
},
|
|
350
|
-
// query: {
|
|
351
|
-
// id: '0xb8d603a39114a5efef3dd0bf84df0bed1be1fbd39b78b7dd6e8a61ccc5e6006f',
|
|
352
|
-
// upgradeCap:
|
|
353
|
-
// '0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
|
|
354
|
-
// },
|
|
355
148
|
query: {
|
|
356
|
-
id: '
|
|
149
|
+
id: '0x3a0dbce719fc56a96bf8e8dd53cd57eb9c313642a88d99b86f51208762eba258',
|
|
150
|
+
object: '',
|
|
357
151
|
upgradeCap:
|
|
358
152
|
'0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
|
|
359
153
|
},
|
|
360
|
-
supra: { id: '', upgradeCap: '' },
|
|
154
|
+
supra: { id: '', object: '', upgradeCap: '' },
|
|
361
155
|
pyth: {
|
|
362
|
-
id: '
|
|
156
|
+
id: '0xe622909f9252d4ef1737c41ea430ef44203d8f5dc8e01e1b3950a31405bc54eb',
|
|
157
|
+
object:
|
|
158
|
+
'0xe622909f9252d4ef1737c41ea430ef44203d8f5dc8e01e1b3950a31405bc54eb',
|
|
363
159
|
upgradeCap:
|
|
364
160
|
'0xdf0ffbae1ea5bb25fbca5efba433dcf00c7cced65679af2f04728901275c6157',
|
|
365
161
|
},
|
|
366
162
|
switchboard: { id: '', upgradeCap: '' },
|
|
367
163
|
xOracle: {
|
|
368
|
-
id: '
|
|
164
|
+
id: '0xe7511600c924f1d0ac4b3fa5de3ae26b8845545902b015dc5fc7894307365d7b',
|
|
165
|
+
object:
|
|
166
|
+
'0xe7511600c924f1d0ac4b3fa5de3ae26b8845545902b015dc5fc7894307365d7b',
|
|
369
167
|
upgradeCap:
|
|
370
168
|
'0x0f928a6b2e26b73330fecaf9b44acfc9800a4a9794d6415c2a3153bc70e3c1f0',
|
|
371
169
|
},
|
|
@@ -373,12 +171,9 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
373
171
|
},
|
|
374
172
|
},
|
|
375
173
|
spool: {
|
|
376
|
-
// id: '0x7c4fdabe81c31b19a45d1e572a52a539997a90903fbb5bfab71480abe0fa62c3',
|
|
377
174
|
id: '0x1742655fe5872dfa6456673f9e38612a4965e6979e6cd7696a7f1225f28bae21',
|
|
378
175
|
adminCap:
|
|
379
176
|
'0xdd8a047cbbf802bfcde5288b8ef1910965d789cc614da11d39af05fca0bd020a',
|
|
380
|
-
// object:
|
|
381
|
-
// '0xe87f1b2d498106a2c61421cec75b7b5c5e348512b0dc263949a0e7a3c256571a',
|
|
382
177
|
object:
|
|
383
178
|
'0x1742655fe5872dfa6456673f9e38612a4965e6979e6cd7696a7f1225f28bae21',
|
|
384
179
|
pools: {
|
|
@@ -388,10 +183,8 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
388
183
|
'0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077',
|
|
389
184
|
},
|
|
390
185
|
ssui: {
|
|
391
|
-
// id: '0x4f0ba970d3c11db05c8f40c64a15b6a33322db3702d634ced6536960ab6f3ee4',
|
|
392
186
|
id: '0xb9617f83c06ebdeac0a8834782b1015e1cc7ea23739e30c132c4bfb95c37a579',
|
|
393
187
|
rewardPoolId:
|
|
394
|
-
// '0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9',
|
|
395
188
|
'0xc3206071a8d43212efb6e3b5504f2321f8df97ab122b466c0bc7cfdf398dc13a',
|
|
396
189
|
},
|
|
397
190
|
susdc: {
|
|
@@ -400,17 +193,13 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
400
193
|
'0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166',
|
|
401
194
|
},
|
|
402
195
|
swusdc: {
|
|
403
|
-
// id: '0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0',
|
|
404
196
|
id: '0xf1b383b9cf2e9f515fc69567df1053098f273849d09cd84b0278a773429bd2b2',
|
|
405
197
|
rewardPoolId:
|
|
406
|
-
// '0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8',
|
|
407
198
|
'0xc71c53ee6505d928ba15bea4fe4f45d98c9c31eced94b72d00a7827d4b7ba3ff',
|
|
408
199
|
},
|
|
409
200
|
swusdt: {
|
|
410
|
-
// id: '0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f',
|
|
411
201
|
id: '0xb5567dfa5c7fc17a249e959732664c50713dd8c23db1a11376b27df800c17418',
|
|
412
202
|
rewardPoolId:
|
|
413
|
-
// '0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080',
|
|
414
203
|
'0x60768b0687ff0235e376a039709a683e4c436098785e473b67b32dbab47b69ab',
|
|
415
204
|
},
|
|
416
205
|
scetus: {
|
|
@@ -419,42 +208,36 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
419
208
|
'0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f',
|
|
420
209
|
},
|
|
421
210
|
safsui: {
|
|
422
|
-
// id: '0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800',
|
|
423
211
|
id: '0xc568bb4c991258e839aa54802ecda04fcd9838c826bc3b42b40af81b23c458c8',
|
|
424
212
|
rewardPoolId:
|
|
425
|
-
// '0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e',
|
|
426
213
|
'0x389a3cbeda742b918941bb24fd00e077bad3367484394d6234f8209b9a6aa03d',
|
|
427
214
|
},
|
|
428
215
|
shasui: {
|
|
429
|
-
// id: '0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa',
|
|
430
216
|
id: '0x93f3f4499bf89f2d05ddc1f8b15f51701a7c6c4d0ac0b9c3bc99462cbbd8e321',
|
|
431
217
|
rewardPoolId:
|
|
432
|
-
// '0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66',
|
|
433
218
|
'0x94cee1be7f5ff34193f3aabef0b14142cb28af4d905fe487a9a7d85a15edb6aa',
|
|
434
219
|
},
|
|
435
220
|
svsui: {
|
|
436
|
-
// id: '0x69ce8e537e750a95381e6040794afa5ab1758353a1a2e1de7760391b01f91670',
|
|
437
221
|
id: '0xa970e9087f80cb59e9299b8e7af7175d977ad6c9af0322aa4440e138fbd7ae00',
|
|
438
222
|
rewardPoolId:
|
|
439
|
-
// '0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a',
|
|
440
223
|
'0x38eee9699c4fc132a6623e54b865f047df4fc6eb83af807300f44e8f4b235ff0',
|
|
441
224
|
},
|
|
442
225
|
},
|
|
443
226
|
config: '',
|
|
444
227
|
},
|
|
445
228
|
borrowIncentive: {
|
|
446
|
-
id: '
|
|
229
|
+
id: '0x8fe05c796e779c71e7739dcaecefb8757ff9482f62e419dbd0dd9c35b740054f',
|
|
447
230
|
adminCap:
|
|
448
231
|
'0x56ac8e6f2b360b2b35c0168d72cc6cd17d9592afb83709865cb87af24bb2025b',
|
|
449
232
|
object:
|
|
450
|
-
'
|
|
451
|
-
query: '
|
|
233
|
+
'0x8fe05c796e779c71e7739dcaecefb8757ff9482f62e419dbd0dd9c35b740054f',
|
|
234
|
+
query: '0x5fba54ac5862f087112c54c02339623bd245721f5e21ea3330fc8c8afc8f51f4',
|
|
452
235
|
incentivePools:
|
|
453
|
-
'
|
|
236
|
+
'0xcace4f4736229043d9f897667d046370b8a4d6534bfd307787c40b4c9f42514a',
|
|
454
237
|
incentiveAccounts:
|
|
455
|
-
'
|
|
238
|
+
'0x41ff558f580ca0f711910fd6ef687fce9df76ee8e7fc5e150bdfae08e17fae62',
|
|
456
239
|
config:
|
|
457
|
-
'
|
|
240
|
+
'0x9636e7b947b806b9fe438d037f02bb24026c5b2691d2f6bad349c2e117f77cc3',
|
|
458
241
|
},
|
|
459
242
|
referral: {
|
|
460
243
|
id: '0x1bf5a8ce77050d8052549d743e16b469f15aa6b81b752b78b6ebb65179665f5a',
|
|
@@ -474,8 +257,6 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
474
257
|
'0x144350f3db9b46d11b140084cd54e6de0b9c3b8d265ce8059b51d0ef58ea464b',
|
|
475
258
|
tiersTableId:
|
|
476
259
|
'0xeac755a7a8b7798530905ac79e8c114f19d0f130f6eab012954f08faac29c75d',
|
|
477
|
-
// authorizedWitnessList:
|
|
478
|
-
// '0xf21b0ed043c9bb70842c0129159f4943dbcc3c9ef2f2f808af65f8be25cfd20e',
|
|
479
260
|
authorizedWitnessList:
|
|
480
261
|
'0x9d6223dc52015b8a3986a573590ef2af8f1b8f3e4685513888c052f001b87e7f',
|
|
481
262
|
version:
|
|
@@ -505,25 +286,25 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
505
286
|
'0x748a80395849ed37db1b0e14f2ab5d1d96458d2359ab3a84eb079d0f4ac7cf2e',
|
|
506
287
|
},
|
|
507
288
|
scoin: {
|
|
508
|
-
id: '
|
|
289
|
+
id: '0x826a4934bee9487e558eed603cf42f30cdc4321d6f31083930791b95f903b9f9',
|
|
509
290
|
coins: {
|
|
510
291
|
ssui: {
|
|
511
292
|
coinType:
|
|
512
|
-
'
|
|
293
|
+
'0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
|
|
513
294
|
treasury:
|
|
514
|
-
'
|
|
295
|
+
'0x03f1d94a40bd9f5d556bacb5c5245732b185572f6a29b36ad8b555d9a8a24f09',
|
|
515
296
|
},
|
|
516
|
-
|
|
297
|
+
ssca: {
|
|
517
298
|
coinType:
|
|
518
|
-
'
|
|
299
|
+
'0x9f64a180373a6b66595025ae16a4ab701f0af1dd5c7ce1ac91dc112e52c2a3f8::scallop_sca::SCALLOP_SCA',
|
|
519
300
|
treasury:
|
|
520
|
-
'
|
|
301
|
+
'0x1b05d2cd8b20dba19da073a54195fc52d2f438ea19dea0713bae7a7dab308199',
|
|
521
302
|
},
|
|
522
|
-
|
|
303
|
+
susdc: {
|
|
523
304
|
coinType:
|
|
524
|
-
'
|
|
305
|
+
'0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
|
|
525
306
|
treasury:
|
|
526
|
-
'
|
|
307
|
+
'0x6ef82ef94472dcb8c2cdeac8df38874024c08570ca165986ba56d1e38fe0c0a3',
|
|
527
308
|
},
|
|
528
309
|
swusdc: {
|
|
529
310
|
coinType:
|
|
@@ -575,15 +356,15 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
575
356
|
},
|
|
576
357
|
sdeep: {
|
|
577
358
|
coinType:
|
|
578
|
-
'
|
|
359
|
+
'0x34f0a2e793e1f79ceac72cfe3bb95f65541da449418289ccd12922d16140c882::scallop_deep::SCALLOP_DEEP',
|
|
579
360
|
treasury:
|
|
580
|
-
'
|
|
361
|
+
'0x71d41465cf2d16fa0206126526bebdf65c8871d1fcfbd0c2237db2306afd67ba',
|
|
581
362
|
},
|
|
582
363
|
sfud: {
|
|
583
364
|
coinType:
|
|
584
|
-
'
|
|
365
|
+
'0x3b23c05f917052255a0b16a534dbd4446911aa4a30bd3497cdf5b736551e7ef8::scallop_fud::SCALLOP_FUD',
|
|
585
366
|
treasury:
|
|
586
|
-
'
|
|
367
|
+
'0x858c492d51425b922c040c1a389e185b3b00d565e7d72ead1a81dc733104660d',
|
|
587
368
|
},
|
|
588
369
|
},
|
|
589
370
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { xOracleListType } from 'src/types';
|
|
2
|
+
|
|
3
|
+
export const xOracleList: xOracleListType = {
|
|
4
|
+
// @TODO: Update to real oracle list
|
|
5
|
+
usdc: { primary: ['pyth'], secondary: [] },
|
|
6
|
+
sbeth: { primary: [], secondary: [] },
|
|
7
|
+
sbusdt: { primary: [], secondary: [] },
|
|
8
|
+
sbwbtc: { primary: [], secondary: [] },
|
|
9
|
+
weth: { primary: [], secondary: [] },
|
|
10
|
+
wbtc: { primary: [], secondary: [] },
|
|
11
|
+
wusdc: { primary: [], secondary: [] },
|
|
12
|
+
wusdt: { primary: [], secondary: [] },
|
|
13
|
+
sui: { primary: ['pyth'], secondary: [] },
|
|
14
|
+
wapt: { primary: [], secondary: [] },
|
|
15
|
+
wsol: { primary: [], secondary: [] },
|
|
16
|
+
cetus: { primary: [], secondary: [] },
|
|
17
|
+
afsui: { primary: [], secondary: [] },
|
|
18
|
+
hasui: { primary: [], secondary: [] },
|
|
19
|
+
vsui: { primary: [], secondary: [] },
|
|
20
|
+
sca: { primary: ['pyth'], secondary: [] },
|
|
21
|
+
fud: { primary: ['pyth'], secondary: [] },
|
|
22
|
+
deep: { primary: ['pyth'], secondary: [] },
|
|
23
|
+
fdusd: { primary: [], secondary: [] },
|
|
24
|
+
blub: { primary: [], secondary: [] },
|
|
25
|
+
};
|
|
@@ -269,4 +269,15 @@ export class ScallopIndexer {
|
|
|
269
269
|
public async getCoinPrice(poolCoinName: SupportPoolCoins): Promise<number> {
|
|
270
270
|
return (await this.getMarketPool(poolCoinName))?.coinPrice ?? 0;
|
|
271
271
|
}
|
|
272
|
+
|
|
273
|
+
public async getCoinPrices(): Promise<Record<string, number>> {
|
|
274
|
+
const marketPools = await this.getMarketPools();
|
|
275
|
+
return Object.entries(marketPools).reduce(
|
|
276
|
+
(prev, [coinName, market]) => {
|
|
277
|
+
prev[coinName] = market.coinPrice;
|
|
278
|
+
return prev;
|
|
279
|
+
},
|
|
280
|
+
{} as Record<string, number>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
272
283
|
}
|
|
File without changes
|
|
@@ -43,6 +43,8 @@ import {
|
|
|
43
43
|
getAllAddresses,
|
|
44
44
|
isIsolatedAsset,
|
|
45
45
|
getUserPortfolio,
|
|
46
|
+
getPriceUpdatePolicies,
|
|
47
|
+
getAssetOracles,
|
|
46
48
|
} from '../queries';
|
|
47
49
|
import {
|
|
48
50
|
ScallopQueryParams,
|
|
@@ -60,6 +62,7 @@ import {
|
|
|
60
62
|
CoinPrices,
|
|
61
63
|
MarketPools,
|
|
62
64
|
MarketCollaterals,
|
|
65
|
+
xOracleRules,
|
|
63
66
|
} from '../types';
|
|
64
67
|
import { ScallopAddress } from './scallopAddress';
|
|
65
68
|
import { ScallopUtils } from './scallopUtils';
|
|
@@ -294,8 +297,14 @@ export class ScallopQuery {
|
|
|
294
297
|
* @param obligationId - The obligation id.
|
|
295
298
|
* @return Obligation data.
|
|
296
299
|
*/
|
|
297
|
-
public async queryObligation(
|
|
298
|
-
|
|
300
|
+
public async queryObligation(
|
|
301
|
+
obligationId: SuiObjectArg,
|
|
302
|
+
args?: {
|
|
303
|
+
version: SuiObjectArg;
|
|
304
|
+
market: SuiObjectArg;
|
|
305
|
+
}
|
|
306
|
+
) {
|
|
307
|
+
return queryObligation(this, obligationId, args?.version, args?.market);
|
|
299
308
|
}
|
|
300
309
|
|
|
301
310
|
/**
|
|
@@ -659,12 +668,6 @@ export class ScallopQuery {
|
|
|
659
668
|
return Object.values(results).find(
|
|
660
669
|
(obligation) => obligation?.obligationId === obligationId
|
|
661
670
|
);
|
|
662
|
-
// return await getObligationAccount(
|
|
663
|
-
// this,
|
|
664
|
-
// obligationId,
|
|
665
|
-
// ownerAddress,
|
|
666
|
-
// args?.indexer
|
|
667
|
-
// );
|
|
668
671
|
}
|
|
669
672
|
|
|
670
673
|
/**
|
|
@@ -851,6 +854,14 @@ export class ScallopQuery {
|
|
|
851
854
|
return this.indexer.getCoinPrice(poolName);
|
|
852
855
|
}
|
|
853
856
|
|
|
857
|
+
/**
|
|
858
|
+
* Get all supported pool price from indexer
|
|
859
|
+
* @returns prices data
|
|
860
|
+
*/
|
|
861
|
+
public async getCoinPricesByIndexer() {
|
|
862
|
+
return this.indexer.getCoinPrices();
|
|
863
|
+
}
|
|
864
|
+
|
|
854
865
|
/**
|
|
855
866
|
* Get all coin prices, including sCoin
|
|
856
867
|
* @returns prices data
|
|
@@ -858,18 +869,22 @@ export class ScallopQuery {
|
|
|
858
869
|
public async getAllCoinPrices(args?: {
|
|
859
870
|
marketPools?: MarketPools;
|
|
860
871
|
coinPrices?: CoinPrices;
|
|
872
|
+
indexer?: boolean;
|
|
861
873
|
}) {
|
|
862
|
-
return getAllCoinPrices(
|
|
874
|
+
return getAllCoinPrices(
|
|
875
|
+
this,
|
|
876
|
+
args?.marketPools,
|
|
877
|
+
args?.coinPrices,
|
|
878
|
+
args?.indexer
|
|
879
|
+
);
|
|
863
880
|
}
|
|
864
881
|
|
|
865
882
|
/**
|
|
866
883
|
* Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
|
|
867
884
|
* @returns
|
|
868
885
|
*/
|
|
869
|
-
public async getPoolAddresses(
|
|
870
|
-
|
|
871
|
-
) {
|
|
872
|
-
return getAllAddresses(this, pools);
|
|
886
|
+
public async getPoolAddresses(poolNames?: SupportPoolCoins[]) {
|
|
887
|
+
return getAllAddresses(this, poolNames);
|
|
873
888
|
}
|
|
874
889
|
|
|
875
890
|
/**
|
|
@@ -885,4 +900,34 @@ export class ScallopQuery {
|
|
|
885
900
|
args?.indexer ?? false
|
|
886
901
|
);
|
|
887
902
|
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Get both primary and secondary price update policy objects
|
|
906
|
+
* @returns price update policies
|
|
907
|
+
*/
|
|
908
|
+
public async getPriceUpdatePolicies() {
|
|
909
|
+
return await getPriceUpdatePolicies(this.address);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Return the supported primary and secondary oracles for all supported pool assets
|
|
914
|
+
* @returns
|
|
915
|
+
*/
|
|
916
|
+
public async getAssetOracles() {
|
|
917
|
+
const [primary, secondary] = await Promise.all([
|
|
918
|
+
getAssetOracles(this.utils, 'primary'),
|
|
919
|
+
getAssetOracles(this.utils, 'secondary'),
|
|
920
|
+
]);
|
|
921
|
+
|
|
922
|
+
return SUPPORT_POOLS.reduce(
|
|
923
|
+
(acc, pool) => {
|
|
924
|
+
acc[pool] = {
|
|
925
|
+
primary: primary[pool] ?? [],
|
|
926
|
+
secondary: secondary[pool] ?? [],
|
|
927
|
+
};
|
|
928
|
+
return acc;
|
|
929
|
+
},
|
|
930
|
+
{} as Record<SupportAssetCoins, xOracleRules>
|
|
931
|
+
);
|
|
932
|
+
}
|
|
888
933
|
}
|
|
@@ -289,7 +289,7 @@ export class ScallopUtils {
|
|
|
289
289
|
*/
|
|
290
290
|
public parseMarketCoinType(coinName: SupportCoins) {
|
|
291
291
|
const protocolObjectId =
|
|
292
|
-
this.address.get('core.object')
|
|
292
|
+
this.address.get('core.object') || PROTOCOL_OBJECT_ID;
|
|
293
293
|
const coinType = this.parseCoinType(coinName, true);
|
|
294
294
|
return `${protocolObjectId}::reserve::MarketCoin<${coinType}>`;
|
|
295
295
|
}
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeStructTag } from '@mysten/sui/utils';
|
|
1
|
+
import { normalizeStructTag, SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils';
|
|
2
2
|
import {
|
|
3
3
|
SUPPORT_POOLS,
|
|
4
4
|
PROTOCOL_OBJECT_ID,
|
|
@@ -898,7 +898,7 @@ export const getObligations = async (
|
|
|
898
898
|
ownerAddress: string
|
|
899
899
|
) => {
|
|
900
900
|
const owner = ownerAddress;
|
|
901
|
-
const protocolObjectId = address.get('core.object')
|
|
901
|
+
const protocolObjectId = address.get('core.object') || PROTOCOL_OBJECT_ID;
|
|
902
902
|
const keyObjectsResponse: SuiObjectResponse[] = [];
|
|
903
903
|
let hasNextPage = false;
|
|
904
904
|
let nextCursor: string | null | undefined = null;
|
|
@@ -1007,14 +1007,24 @@ export const queryObligation = async (
|
|
|
1007
1007
|
}: {
|
|
1008
1008
|
address: ScallopAddress;
|
|
1009
1009
|
},
|
|
1010
|
-
obligationId: SuiObjectArg
|
|
1010
|
+
obligationId: SuiObjectArg,
|
|
1011
|
+
version: SuiObjectArg = address.get('core.version'),
|
|
1012
|
+
market: SuiObjectArg = address.get('core.market')
|
|
1011
1013
|
) => {
|
|
1012
1014
|
const packageId = address.get('core.packages.query.id');
|
|
1013
1015
|
const queryTarget = `${packageId}::obligation_query::obligation_data`;
|
|
1014
|
-
const args = [obligationId];
|
|
1015
1016
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1017
|
+
const args = [
|
|
1018
|
+
version,
|
|
1019
|
+
market,
|
|
1020
|
+
obligationId,
|
|
1021
|
+
{
|
|
1022
|
+
objectId: SUI_CLOCK_OBJECT_ID,
|
|
1023
|
+
mutable: false,
|
|
1024
|
+
initialSharedVersion: '1',
|
|
1025
|
+
},
|
|
1026
|
+
]; // @TODO: recheck and confirm on production, need to re-deploy the query package (remind Nathan)
|
|
1027
|
+
|
|
1018
1028
|
const queryResult = await address.cache.queryInspectTxn(
|
|
1019
1029
|
{ queryTarget, args }
|
|
1020
1030
|
// txBlock
|