@scallop-io/sui-scallop-sdk 1.4.23 → 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.
Files changed (43) hide show
  1. package/dist/constants/index.d.ts +1 -0
  2. package/dist/constants/xoracle.d.ts +2 -0
  3. package/dist/index.js +564 -619
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +574 -630
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/models/scallopIndexer.d.ts +1 -0
  8. package/dist/models/scallopPrice.d.ts +0 -0
  9. package/dist/models/scallopQuery.d.ts +25 -3
  10. package/dist/queries/coreQuery.d.ts +1 -1
  11. package/dist/queries/index.d.ts +1 -0
  12. package/dist/queries/poolAddressesQuery.d.ts +2 -2
  13. package/dist/queries/priceQuery.d.ts +1 -1
  14. package/dist/queries/xOracleQuery.d.ts +13 -0
  15. package/dist/types/address.d.ts +1 -0
  16. package/dist/types/constant/index.d.ts +1 -0
  17. package/dist/types/constant/xOracle.d.ts +9 -0
  18. package/package.json +1 -1
  19. package/src/builders/borrowIncentiveBuilder.ts +11 -25
  20. package/src/builders/coreBuilder.ts +15 -72
  21. package/src/builders/oracle.ts +73 -46
  22. package/src/builders/referralBuilder.ts +9 -20
  23. package/src/builders/spoolBuilder.ts +10 -38
  24. package/src/builders/vescaBuilder.ts +11 -26
  25. package/src/constants/enum.ts +10 -5
  26. package/src/constants/index.ts +1 -0
  27. package/src/constants/poolAddress.ts +343 -184
  28. package/src/constants/testAddress.ts +35 -252
  29. package/src/constants/xoracle.ts +25 -0
  30. package/src/models/scallopIndexer.ts +11 -0
  31. package/src/models/scallopPrice.ts +0 -0
  32. package/src/models/scallopQuery.ts +58 -11
  33. package/src/models/scallopUtils.ts +1 -1
  34. package/src/queries/coreQuery.ts +16 -6
  35. package/src/queries/index.ts +1 -0
  36. package/src/queries/poolAddressesQuery.ts +5 -2
  37. package/src/queries/priceQuery.ts +10 -3
  38. package/src/queries/vescaQuery.ts +8 -17
  39. package/src/queries/xOracleQuery.ts +124 -0
  40. package/src/types/address.ts +1 -0
  41. package/src/types/constant/index.ts +1 -0
  42. package/src/types/constant/xOracle.ts +11 -0
  43. package/src/utils/util.ts +1 -1
@@ -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
- '0xd318de9b0f6873879a82cbfcc2daa1d1591a8b54e7cea9f4b567da63c692a52b',
6
+ '0xee15d07800e2ad4852505c57cd86afea774af02c17388f8bd907de75f915b4f4',
9
7
  versionCap:
10
8
  '0x590a4011cb649b3878f3ea14b3a78674642a9548d79b7e091ef679574b158a07',
11
- // object:
12
- // '0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf',
13
9
  object:
14
- '0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d',
15
- // market:
16
- // '0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9',
10
+ '0xb03fa00e2d9f17d78a9d48bd94d8852abec68c19d55e819096b1e062e69bfad1',
17
11
  market:
18
- '0x9d6434e97f3f98fd9b0c0e1dca22632073985abcd22541feae7ee1e34cbe3af2',
12
+ '0xa7f41efe3b551c20ad6d6cea6ccd0fd68d2e2eaaacdca5e62d956209f6a51312',
19
13
  adminCap:
20
14
  '0x09689d018e71c337d9db6d67cbca06b74ed92196103624028ccc3ecea411777c',
21
15
  coinDecimalsRegistry:
22
16
  '0x200abe9bf19751cc566ae35aa58e2b7e4ff688fc1130f8d8909ea09bc137d668',
23
- // obligationAccessStore:
24
- // '0x733e30b7c94d619d78cb8f5bc4bfbb759ced9a531239028caabb2474e5be59c9',
25
17
  obligationAccessStore:
26
- '0x46e9b44a77ee9c9d33cc2689ecdfbb8f681935cbc6bdf6ac3df048e396c36c82',
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,43 +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
- fdusd: {
247
- id: '0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a',
248
- metaData:
249
- '0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7',
250
- treasury: '',
251
- oracle: {
252
- supra: '',
253
- switchboard: '',
254
- pyth: {
255
- feed: '0xccdc1a08923e2e4f4b1e6ea89de6acbc5fe1948e9706f5604b8cb50bc1ed3979',
256
- feedObject:
257
- '0x5f6583b2b0fe1ecf94aaffeaab8a838794693960cea48c0da282d5f4a24be027',
258
- },
259
- },
260
- },
261
66
  deep: {
262
67
  id: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
263
68
  metaData:
@@ -291,14 +96,14 @@ export const TEST_ADDRESSES: AddressesInterface = {
291
96
  },
292
97
  oracles: {
293
98
  xOracle:
294
- '0x93d5bf0936b71eb27255941e532fac33b5a5c7759e377b4923af0a1359ad494f',
99
+ '0x0c09daac413e834f2fe69601c41e836022fa9a185df6b56a80f6bcd8a3ecb8a2',
295
100
  xOracleCap:
296
101
  '0x1edeae568fde99e090dbdec4bcdbd33a15f53a1ce1f87aeef1a560dedf4b4a90',
297
102
  supra: { registry: '', registryCap: '', holder: '' },
298
103
  switchboard: { registry: '', registryCap: '' },
299
104
  pyth: {
300
105
  registry:
301
- '0xedc293f9413a5a7a5d53bdba1fd889d0a4030894469228f0acdae4aa3c55a213',
106
+ '0xdcf813893649521abd27816ba8d946b0cb7fc98d776cc9adcecba54688ccc109',
302
107
  registryCap:
303
108
  '0xbcb07141eb1f7e01fbda4130ecf5f5adaeabb77f5d9c32158b7532bcd2197acd',
304
109
  state:
@@ -331,39 +136,34 @@ export const TEST_ADDRESSES: AddressesInterface = {
331
136
  '0x3f203f6fff6a69d151e4f1cd931f22b68c489ef2759765662fc7baf673943c9e',
332
137
  },
333
138
  protocol: {
334
- id: '0xb784ea287d944e478a3ceaa071f8885072cce6b7224cf245914dc2f9963f460e',
139
+ id: '0xb03fa00e2d9f17d78a9d48bd94d8852abec68c19d55e819096b1e062e69bfad1',
335
140
  upgradeCap:
336
141
  '0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
337
142
  },
338
- // protocol: {
339
- // id: '0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe8745086ff1195eb3e',
340
- // upgradeCap:
341
- // '0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
342
- // },
343
143
  protocolWhitelist: {
344
144
  id: '0x4c262d9343dac53ecb28f482a2a3f62c73d0ebac5b5f03d57383d56ff219acdf',
345
145
  upgradeCap:
346
146
  '0x4a5e88a75039b00988f633f811f58117f31b8627a46bf822aa114d9010049449',
347
147
  },
348
- // query: {
349
- // id: '0xb8d603a39114a5efef3dd0bf84df0bed1be1fbd39b78b7dd6e8a61ccc5e6006f',
350
- // upgradeCap:
351
- // '0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
352
- // },
353
148
  query: {
354
- id: '0x89706958f43fb170de134579e3fbc53972b946ee78bd2442d8e1adc36074fbdc',
149
+ id: '0x3a0dbce719fc56a96bf8e8dd53cd57eb9c313642a88d99b86f51208762eba258',
150
+ object: '',
355
151
  upgradeCap:
356
152
  '0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
357
153
  },
358
- supra: { id: '', upgradeCap: '' },
154
+ supra: { id: '', object: '', upgradeCap: '' },
359
155
  pyth: {
360
- id: '0x910f30cbc7f601f75a5141a01265cd47c62d468707c5e1aecb32a18f448cb25a',
156
+ id: '0xe622909f9252d4ef1737c41ea430ef44203d8f5dc8e01e1b3950a31405bc54eb',
157
+ object:
158
+ '0xe622909f9252d4ef1737c41ea430ef44203d8f5dc8e01e1b3950a31405bc54eb',
361
159
  upgradeCap:
362
160
  '0xdf0ffbae1ea5bb25fbca5efba433dcf00c7cced65679af2f04728901275c6157',
363
161
  },
364
162
  switchboard: { id: '', upgradeCap: '' },
365
163
  xOracle: {
366
- id: '0x1478a432123e4b3d61878b629f2c692969fdb375644f1251cd278a4b1e7d7cd6',
164
+ id: '0xe7511600c924f1d0ac4b3fa5de3ae26b8845545902b015dc5fc7894307365d7b',
165
+ object:
166
+ '0xe7511600c924f1d0ac4b3fa5de3ae26b8845545902b015dc5fc7894307365d7b',
367
167
  upgradeCap:
368
168
  '0x0f928a6b2e26b73330fecaf9b44acfc9800a4a9794d6415c2a3153bc70e3c1f0',
369
169
  },
@@ -371,12 +171,9 @@ export const TEST_ADDRESSES: AddressesInterface = {
371
171
  },
372
172
  },
373
173
  spool: {
374
- // id: '0x7c4fdabe81c31b19a45d1e572a52a539997a90903fbb5bfab71480abe0fa62c3',
375
174
  id: '0x1742655fe5872dfa6456673f9e38612a4965e6979e6cd7696a7f1225f28bae21',
376
175
  adminCap:
377
176
  '0xdd8a047cbbf802bfcde5288b8ef1910965d789cc614da11d39af05fca0bd020a',
378
- // object:
379
- // '0xe87f1b2d498106a2c61421cec75b7b5c5e348512b0dc263949a0e7a3c256571a',
380
177
  object:
381
178
  '0x1742655fe5872dfa6456673f9e38612a4965e6979e6cd7696a7f1225f28bae21',
382
179
  pools: {
@@ -386,10 +183,8 @@ export const TEST_ADDRESSES: AddressesInterface = {
386
183
  '0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077',
387
184
  },
388
185
  ssui: {
389
- // id: '0x4f0ba970d3c11db05c8f40c64a15b6a33322db3702d634ced6536960ab6f3ee4',
390
186
  id: '0xb9617f83c06ebdeac0a8834782b1015e1cc7ea23739e30c132c4bfb95c37a579',
391
187
  rewardPoolId:
392
- // '0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9',
393
188
  '0xc3206071a8d43212efb6e3b5504f2321f8df97ab122b466c0bc7cfdf398dc13a',
394
189
  },
395
190
  susdc: {
@@ -398,17 +193,13 @@ export const TEST_ADDRESSES: AddressesInterface = {
398
193
  '0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166',
399
194
  },
400
195
  swusdc: {
401
- // id: '0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0',
402
196
  id: '0xf1b383b9cf2e9f515fc69567df1053098f273849d09cd84b0278a773429bd2b2',
403
197
  rewardPoolId:
404
- // '0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8',
405
198
  '0xc71c53ee6505d928ba15bea4fe4f45d98c9c31eced94b72d00a7827d4b7ba3ff',
406
199
  },
407
200
  swusdt: {
408
- // id: '0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f',
409
201
  id: '0xb5567dfa5c7fc17a249e959732664c50713dd8c23db1a11376b27df800c17418',
410
202
  rewardPoolId:
411
- // '0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080',
412
203
  '0x60768b0687ff0235e376a039709a683e4c436098785e473b67b32dbab47b69ab',
413
204
  },
414
205
  scetus: {
@@ -417,42 +208,36 @@ export const TEST_ADDRESSES: AddressesInterface = {
417
208
  '0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f',
418
209
  },
419
210
  safsui: {
420
- // id: '0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800',
421
211
  id: '0xc568bb4c991258e839aa54802ecda04fcd9838c826bc3b42b40af81b23c458c8',
422
212
  rewardPoolId:
423
- // '0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e',
424
213
  '0x389a3cbeda742b918941bb24fd00e077bad3367484394d6234f8209b9a6aa03d',
425
214
  },
426
215
  shasui: {
427
- // id: '0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa',
428
216
  id: '0x93f3f4499bf89f2d05ddc1f8b15f51701a7c6c4d0ac0b9c3bc99462cbbd8e321',
429
217
  rewardPoolId:
430
- // '0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66',
431
218
  '0x94cee1be7f5ff34193f3aabef0b14142cb28af4d905fe487a9a7d85a15edb6aa',
432
219
  },
433
220
  svsui: {
434
- // id: '0x69ce8e537e750a95381e6040794afa5ab1758353a1a2e1de7760391b01f91670',
435
221
  id: '0xa970e9087f80cb59e9299b8e7af7175d977ad6c9af0322aa4440e138fbd7ae00',
436
222
  rewardPoolId:
437
- // '0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a',
438
223
  '0x38eee9699c4fc132a6623e54b865f047df4fc6eb83af807300f44e8f4b235ff0',
439
224
  },
440
225
  },
441
226
  config: '',
442
227
  },
443
228
  borrowIncentive: {
444
- id: '0x85769d63565ce99c7622f8e336ca1460926ddf29738ad2a39407b5cac29f61fe',
229
+ id: '0x8fe05c796e779c71e7739dcaecefb8757ff9482f62e419dbd0dd9c35b740054f',
445
230
  adminCap:
446
231
  '0x56ac8e6f2b360b2b35c0168d72cc6cd17d9592afb83709865cb87af24bb2025b',
447
232
  object:
448
- '0x85769d63565ce99c7622f8e336ca1460926ddf29738ad2a39407b5cac29f61fe',
449
- query: '0x8e0d00f8ff1199d7c5fe56cea0e901a525daeefff0445a1635ace8282ae3302c',
233
+ '0x8fe05c796e779c71e7739dcaecefb8757ff9482f62e419dbd0dd9c35b740054f',
234
+ query: '0x5fba54ac5862f087112c54c02339623bd245721f5e21ea3330fc8c8afc8f51f4',
450
235
  incentivePools:
451
- '0x9d564c93128c6ab0c0d3e050a47f11df0b91494f3bb779bdc1301c1c637f15eb',
236
+ '0xcace4f4736229043d9f897667d046370b8a4d6534bfd307787c40b4c9f42514a',
452
237
  incentiveAccounts:
453
- '0x09e6040e798246de04941bc79a3ba62d3eca6d7a218cc30f21fb07f478fa2926',
238
+ '0x41ff558f580ca0f711910fd6ef687fce9df76ee8e7fc5e150bdfae08e17fae62',
454
239
  config:
455
- '0x43d4ca1dfc90b161c4240facd119e74e4b850cca2957f88c2ec289c9380da064',
240
+ '0x9636e7b947b806b9fe438d037f02bb24026c5b2691d2f6bad349c2e117f77cc3',
456
241
  },
457
242
  referral: {
458
243
  id: '0x1bf5a8ce77050d8052549d743e16b469f15aa6b81b752b78b6ebb65179665f5a',
@@ -472,8 +257,6 @@ export const TEST_ADDRESSES: AddressesInterface = {
472
257
  '0x144350f3db9b46d11b140084cd54e6de0b9c3b8d265ce8059b51d0ef58ea464b',
473
258
  tiersTableId:
474
259
  '0xeac755a7a8b7798530905ac79e8c114f19d0f130f6eab012954f08faac29c75d',
475
- // authorizedWitnessList:
476
- // '0xf21b0ed043c9bb70842c0129159f4943dbcc3c9ef2f2f808af65f8be25cfd20e',
477
260
  authorizedWitnessList:
478
261
  '0x9d6223dc52015b8a3986a573590ef2af8f1b8f3e4685513888c052f001b87e7f',
479
262
  version:
@@ -503,25 +286,25 @@ export const TEST_ADDRESSES: AddressesInterface = {
503
286
  '0x748a80395849ed37db1b0e14f2ab5d1d96458d2359ab3a84eb079d0f4ac7cf2e',
504
287
  },
505
288
  scoin: {
506
- id: '0x773dab39c90fe05439b06a2d061795e52a974ff92c2aef90b2ee467acf7f33c8',
289
+ id: '0x826a4934bee9487e558eed603cf42f30cdc4321d6f31083930791b95f903b9f9',
507
290
  coins: {
508
291
  ssui: {
509
292
  coinType:
510
- '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
293
+ '0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
511
294
  treasury:
512
- '0x0e499640a12c38dd9cc44532f5bc5fd1b6da86d2f9a8810357250f4b26e9e5c7',
295
+ '0x03f1d94a40bd9f5d556bacb5c5245732b185572f6a29b36ad8b555d9a8a24f09',
513
296
  },
514
- scetus: {
297
+ ssca: {
515
298
  coinType:
516
- '0x8b71e6d323ed78515af2bead13bf3d0da1562ba4a99234eb7c4f14fd39ef0427::scallop_cetus::SCALLOP_CETUS',
299
+ '0x9f64a180373a6b66595025ae16a4ab701f0af1dd5c7ce1ac91dc112e52c2a3f8::scallop_sca::SCALLOP_SCA',
517
300
  treasury:
518
- '0xd786f4b2d26278cc7911a3445b1b085eab60f269ef9dbb6b87e803d52f155003',
301
+ '0x1b05d2cd8b20dba19da073a54195fc52d2f438ea19dea0713bae7a7dab308199',
519
302
  },
520
- ssca: {
303
+ susdc: {
521
304
  coinType:
522
- '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
305
+ '0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
523
306
  treasury:
524
- '0x5f1c5de1df7341075d119570269b7b452af50afe8363080638f1ae29a554c038',
307
+ '0x6ef82ef94472dcb8c2cdeac8df38874024c08570ca165986ba56d1e38fe0c0a3',
525
308
  },
526
309
  swusdc: {
527
310
  coinType:
@@ -573,15 +356,15 @@ export const TEST_ADDRESSES: AddressesInterface = {
573
356
  },
574
357
  sdeep: {
575
358
  coinType:
576
- '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
359
+ '0x34f0a2e793e1f79ceac72cfe3bb95f65541da449418289ccd12922d16140c882::scallop_deep::SCALLOP_DEEP',
577
360
  treasury:
578
- '0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88',
361
+ '0x71d41465cf2d16fa0206126526bebdf65c8871d1fcfbd0c2237db2306afd67ba',
579
362
  },
580
363
  sfud: {
581
364
  coinType:
582
- '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
365
+ '0x3b23c05f917052255a0b16a534dbd4446911aa4a30bd3497cdf5b736551e7ef8::scallop_fud::SCALLOP_FUD',
583
366
  treasury:
584
- '0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867',
367
+ '0x858c492d51425b922c040c1a389e185b3b00d565e7d72ead1a81dc733104660d',
585
368
  },
586
369
  },
587
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(obligationId: string | SuiObjectArg) {
298
- return queryObligation(this, obligationId);
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,16 +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(this, args?.marketPools, args?.coinPrices);
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
- return getAllAddresses(this);
886
+ public async getPoolAddresses(poolNames?: SupportPoolCoins[]) {
887
+ return getAllAddresses(this, poolNames);
871
888
  }
872
889
 
873
890
  /**
@@ -883,4 +900,34 @@ export class ScallopQuery {
883
900
  args?.indexer ?? false
884
901
  );
885
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
+ }
886
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') ?? PROTOCOL_OBJECT_ID;
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
  }
@@ -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') ?? PROTOCOL_OBJECT_ID;
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
- // const txBlock = new SuiKitTxBlock();
1017
- // txBlock.moveCall(queryTarget, args);
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
@@ -12,3 +12,4 @@ export * from './vescaQuery';
12
12
  export * from './borrowLimitQuery';
13
13
  export * from './poolAddressesQuery';
14
14
  export * from './objectsQuery';
15
+ export * from './xOracleQuery';