@scallop-io/sui-scallop-sdk 2.3.10 → 2.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.3.10",
3
+ "version": "2.3.12",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -34,17 +34,21 @@ export const updateOracles = async (
34
34
  const useOnChainXOracleList =
35
35
  options?.useOnChainXOracleList ?? builder.useOnChainXOracleList;
36
36
  const sponsoredFeeds = new Set(
37
- options?.sponsoredFeeds ?? builder.sponsoredFeeds
37
+ (options?.sponsoredFeeds ?? builder.sponsoredFeeds).filter((t) =>
38
+ // Ensure only valid feeds are included.
39
+ {
40
+ if (!builder.constants.whitelist.lending.has(t)) {
41
+ console.error(
42
+ `Sponsored feed ${t} is not in the whitelist lending assets.`
43
+ );
44
+ return false;
45
+ }
46
+ return true;
47
+ }
48
+ )
38
49
  );
39
50
  const isSponsoredTx = options?.isSponsoredTx ?? false;
40
51
 
41
- // Validate the sponsoredFeeds content.
42
- sponsoredFeeds.forEach((feed) => {
43
- if (!builder.constants.whitelist.lending.has(feed)) {
44
- throw new Error(`${feed} is not valid feed`);
45
- }
46
- });
47
-
48
52
  const xOracleList = useOnChainXOracleList
49
53
  ? await builder.query.getAssetOracles()
50
54
  : X_ORACLE_LIST;
@@ -3,19 +3,19 @@ import { AddressesInterface } from 'src/types';
3
3
  export const TEST_ADDRESSES: AddressesInterface = {
4
4
  core: {
5
5
  version:
6
- '0xee15d07800e2ad4852505c57cd86afea774af02c17388f8bd907de75f915b4f4',
6
+ '0x72bc09c4ce413d76d07f6e712413aebbe3ce3747eadfbc2331fbdb1dbde2d43a',
7
7
  versionCap:
8
8
  '0x590a4011cb649b3878f3ea14b3a78674642a9548d79b7e091ef679574b158a07',
9
9
  object:
10
- '0xb03fa00e2d9f17d78a9d48bd94d8852abec68c19d55e819096b1e062e69bfad1',
10
+ '0xd971609b7feb6230585831e7aeb3c121fb21b9431337a30fc99185eb459a05ee',
11
11
  market:
12
- '0xa7f41efe3b551c20ad6d6cea6ccd0fd68d2e2eaaacdca5e62d956209f6a51312',
12
+ '0xed80ed898df1e0b7a14b78c92527b47ef88591d5722ded16050d7e101687bb20',
13
13
  adminCap:
14
14
  '0x09689d018e71c337d9db6d67cbca06b74ed92196103624028ccc3ecea411777c',
15
15
  coinDecimalsRegistry:
16
16
  '0x200abe9bf19751cc566ae35aa58e2b7e4ff688fc1130f8d8909ea09bc137d668',
17
17
  obligationAccessStore:
18
- '0xb7d7e1464936fbdcdd4913308b40335e662401029635289bdb317c7dde9d6c68',
18
+ '0x861bfea382072bdd060fa3a33f65387a71d5a75dbb0fedd92aa62f8a048b0ff9',
19
19
  coins: {
20
20
  usdc: {
21
21
  id: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
@@ -114,10 +114,29 @@ export const TEST_ADDRESSES: AddressesInterface = {
114
114
  },
115
115
  },
116
116
  },
117
+ hasui: {
118
+ id: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d',
119
+ metaData:
120
+ '0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
121
+ treasury: '',
122
+ coinType:
123
+ '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
124
+ symbol: 'haSUI',
125
+ decimals: 9,
126
+ oracle: {
127
+ supra: '',
128
+ switchboard: '',
129
+ pyth: {
130
+ feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
131
+ feedObject:
132
+ '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
133
+ },
134
+ },
135
+ },
117
136
  },
118
137
  oracles: {
119
138
  xOracle:
120
- '0x0c09daac413e834f2fe69601c41e836022fa9a185df6b56a80f6bcd8a3ecb8a2',
139
+ '0xb112727f380857fd711f89b450a3b22dc4cc55f82b2212b001f2461d6257b0b9',
121
140
  xOracleCap:
122
141
  '0x1edeae568fde99e090dbdec4bcdbd33a15f53a1ce1f87aeef1a560dedf4b4a90',
123
142
  primaryPriceUpdatePolicyObject:
@@ -147,7 +166,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
147
166
  },
148
167
  pyth: {
149
168
  registry:
150
- '0xdcf813893649521abd27816ba8d946b0cb7fc98d776cc9adcecba54688ccc109',
169
+ '0xbc477946f0c8c9a09d7a9bab57eb01f0320c1d1f7f9aeee2503d0a71f50379c6',
151
170
  registryCap:
152
171
  '0xe4995aaca4e70d4203790fbd22332107131e88b92b81bc976e6fc3a7d5005efd',
153
172
  state:
@@ -180,7 +199,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
180
199
  '0x3f203f6fff6a69d151e4f1cd931f22b68c489ef2759765662fc7baf673943c9e',
181
200
  },
182
201
  protocol: {
183
- id: '0xb03fa00e2d9f17d78a9d48bd94d8852abec68c19d55e819096b1e062e69bfad1',
202
+ id: '0xd971609b7feb6230585831e7aeb3c121fb21b9431337a30fc99185eb459a05ee',
184
203
  upgradeCap:
185
204
  '0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
186
205
  },
@@ -190,15 +209,15 @@ export const TEST_ADDRESSES: AddressesInterface = {
190
209
  '0x4a5e88a75039b00988f633f811f58117f31b8627a46bf822aa114d9010049449',
191
210
  },
192
211
  query: {
193
- id: '0x3a0dbce719fc56a96bf8e8dd53cd57eb9c313642a88d99b86f51208762eba258',
212
+ id: '0x15f353b593733a6eeb37f67a8a0f6e6b863ef5e813df39cb263f5f40c29a2195',
194
213
  upgradeCap:
195
214
  '0x14220f035f4cfc2ce442c30703fb44d24f00846eb7077907a231a56051a1d9b2',
196
215
  },
197
216
  supra: { id: '', object: '', upgradeCap: '' },
198
217
  pyth: {
199
- id: '0xe622909f9252d4ef1737c41ea430ef44203d8f5dc8e01e1b3950a31405bc54eb',
218
+ id: '0xde99692957a424f4701e55b77b014cf24612ded4608225090867d1d2990eaea9',
200
219
  object:
201
- '0xe622909f9252d4ef1737c41ea430ef44203d8f5dc8e01e1b3950a31405bc54eb',
220
+ '0xde99692957a424f4701e55b77b014cf24612ded4608225090867d1d2990eaea9',
202
221
  upgradeCap:
203
222
  '0xb1f167889643ff766df31745b6e93b92462d8165b0a4f1b095499e15180370f7',
204
223
  },
@@ -209,9 +228,9 @@ export const TEST_ADDRESSES: AddressesInterface = {
209
228
  upgradeCap: '',
210
229
  },
211
230
  xOracle: {
212
- id: '0xe7511600c924f1d0ac4b3fa5de3ae26b8845545902b015dc5fc7894307365d7b',
231
+ id: '0xe2785270b2e6179e68204dd5901a43f9a0e1c566baf656cad705d45a419c4d3a',
213
232
  object:
214
- '0xe7511600c924f1d0ac4b3fa5de3ae26b8845545902b015dc5fc7894307365d7b',
233
+ '0xe2785270b2e6179e68204dd5901a43f9a0e1c566baf656cad705d45a419c4d3a',
215
234
  upgradeCap:
216
235
  '0x0f928a6b2e26b73330fecaf9b44acfc9800a4a9794d6415c2a3153bc70e3c1f0',
217
236
  },
@@ -319,15 +338,16 @@ export const TEST_ADDRESSES: AddressesInterface = {
319
338
  '0x85d3e557d9bbed617b9cbc09982a0c9a6f6f4fc9ecce49b59124206c409c4774',
320
339
  },
321
340
  scoin: {
322
- id: '0x826a4934bee9487e558eed603cf42f30cdc4321d6f31083930791b95f903b9f9',
341
+ id: '0xde8fe7f73fcaff729de640b1a67afff5028019aefa67c151250a8d47db37aa1c',
323
342
  coins: {
324
343
  ssui: {
325
344
  coinType:
326
- '0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
327
- metaData: '',
345
+ '0x9d81d8a20e9ffc462839c23346edb69604f7b4deffc9253262e1caca473fd3e3::scallop_sui::SCALLOP_SUI',
346
+ metaData:
347
+ '0x13d07ec4114e36b6d9b69cab9e4722c4dc76d9f623db9fcb5b26a01cb0a861a4',
328
348
  symbol: 'sSUI',
329
349
  treasury:
330
- '0x03f1d94a40bd9f5d556bacb5c5245732b185572f6a29b36ad8b555d9a8a24f09',
350
+ '0x8d2cd566acf9f38629bab1e5aba888c85b177432e91cf7f9a204c3f730281059',
331
351
  },
332
352
  ssca: {
333
353
  coinType:
@@ -339,12 +359,12 @@ export const TEST_ADDRESSES: AddressesInterface = {
339
359
  },
340
360
  susdc: {
341
361
  coinType:
342
- '0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
362
+ '0x55588ffc90718301696fd5497a7b6e82c0f86c15d58e41fc9750a24329ee2523::scallop_usdc::SCALLOP_USDC',
343
363
  treasury:
344
- '0x6ef82ef94472dcb8c2cdeac8df38874024c08570ca165986ba56d1e38fe0c0a3',
364
+ '0xe028cf6c656e410502c931ed265524d48ff16e000db1f50305b54d8a6c421150',
345
365
  symbol: 'sUSDC',
346
366
  metaData:
347
- '0x763a21eba338e00bc684aaad80491c89eea5f247b59c47df45b17610c9ad58f2',
367
+ '0x752b2f407601cbbc335c3d1623e0f5a2b8cb254bc35847c4586bd7cd8bcac7f8',
348
368
  },
349
369
  sdeep: {
350
370
  coinType:
@@ -362,48 +382,17 @@ export const TEST_ADDRESSES: AddressesInterface = {
362
382
  treasury:
363
383
  '0x858c492d51425b922c040c1a389e185b3b00d565e7d72ead1a81dc733104660d',
364
384
  },
385
+ shasui: {
386
+ coinType:
387
+ '0xf2f52fede69abafa2439665bb5bebc8e60fe0f8c5d9d240dd143b5f74f73c867::scallop_ha_sui::SCALLOP_HA_SUI',
388
+ metaData:
389
+ '0xb174a5642133c5a7409187c80e2ef090cc0169147a1dcedce8a0f208397578d3',
390
+ symbol: 'shaSUI',
391
+ treasury:
392
+ '0x33b0013a52205955a0af9ceaa4d3f4b7cf4bd8179fe14ac2de29d8f4d656eb0a',
393
+ },
365
394
  },
366
395
  },
367
- // scoin: {
368
- // id: '0x826a4934bee9487e558eed603cf42f30cdc4321d6f31083930791b95f903b9f9',
369
- // coins: {
370
- // ssui: {
371
- // coinType:
372
- // '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
373
- // metaData: '0xac724644f481f4870ecdc29b9549aa8ea5180f10827c0d97b493f9f65a91455d',
374
- // symbol: 'sSUI',
375
- // treasury: '0x5c1678c8261ac9eec024d4d630006a9f55c80dc0b1aa38a003fcb1d425818c6b',
376
- // },
377
- // ssca: {
378
- // coinType:
379
- // '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
380
- // treasury: '0xe04bfc95e00252bd654ee13c08edef9ac5e4b6ae4074e8390db39e9a0109c529',
381
- // metaData: '0x27e3877491b308dfac46fb3d9f7dfa6a1e8b7dc3c374e92ecda7976055746964',
382
- // symbol: 'sSCA',
383
- // },
384
- // susdc: {
385
- // coinType:
386
- // '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
387
- // treasury: '0xbe6b63021f3d82e0e7e977cdd718ed7c019cf2eba374b7b546220402452f938e',
388
- // metaData: '0x763a21eba338e00bc684aaad80491c89eea5f247b59c47df45b17610c9ad58f2',
389
- // symbol: 'sUSDC',
390
- // },
391
- // sdeep: {
392
- // coinType:
393
- // '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
394
- // treasury: '0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88',
395
- // metaData: '0x2443014594a500a9119e11c6c6a86e865834f496c4614280ce8cace33c0b072e',
396
- // symbol: 'sDEEP',
397
- // },
398
- // sfud: {
399
- // coinType:
400
- // '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
401
- // treasury: '0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867',
402
- // metaData: '0x4e03390de36b8c84e0a8297d3d0d08a8a34bed93787e37fcb26bfc26df33226c',
403
- // symbol: 'sFUD',
404
- // },
405
- // },
406
- // },
407
396
  };
408
397
 
409
398
  export const WHITELIST = {
@@ -421,11 +410,11 @@ export const WHITELIST = {
421
410
  // 'wsol',
422
411
  // 'cetus',
423
412
  // 'afsui',
424
- // 'hasui',
413
+ 'hasui',
425
414
  // 'vsui',
426
- 'sca',
427
- 'fud',
428
- 'deep',
415
+ // 'sca',
416
+ // 'fud',
417
+ // 'deep',
429
418
  // 'fdusd',
430
419
  // 'blub',
431
420
  // 'musd',
@@ -447,13 +436,13 @@ export const WHITELIST = {
447
436
  // 'wsol',
448
437
  // 'cetus',
449
438
  // 'afsui',
450
- // 'hasui',
439
+ 'hasui',
451
440
  // 'vsui',
452
- 'sca',
441
+ // 'sca',
453
442
  // 'fdusd',
454
443
  // 'usdy',
455
444
  // 'wal',
456
- 'deep',
445
+ // 'deep',
457
446
  ]),
458
447
  borrowing: new Set([
459
448
  'usdc',
@@ -469,11 +458,11 @@ export const WHITELIST = {
469
458
  // 'wsol',
470
459
  // 'cetus',
471
460
  // 'afsui',
472
- // 'hasui',
461
+ 'hasui',
473
462
  // 'vsui',
474
- 'sca',
475
- 'fud',
476
- 'deep',
463
+ // 'sca',
464
+ // 'fud',
465
+ // 'deep',
477
466
  // 'fdusd',
478
467
  // 'blub',
479
468
  // 'musd',
@@ -515,15 +504,15 @@ export const WHITELIST = {
515
504
  // 'swusdc',
516
505
  // 'swusdt',
517
506
  // 'safsui',
518
- // 'shasui',
507
+ 'shasui',
519
508
  // 'svsui',
520
509
  // 'sweth',
521
- 'ssca',
510
+ // 'ssca',
522
511
  // 'scetus',
523
512
  // 'swsol',
524
513
  // 'swbtc',
525
- 'sdeep',
526
- 'sfud',
514
+ // 'sdeep',
515
+ // 'sfud',
527
516
  // 'sfdusd',
528
517
  // 'sblub',
529
518
  // 'smusd',
@@ -546,15 +535,15 @@ export const POOL_ADDRESSES = {
546
535
  coinName: 'usdc',
547
536
  symbol: 'USDC',
548
537
  lendingPoolAddress:
549
- '0x13319d295914b390b22484373f20f822bca10314c34c227ae6e28df3d9aa8e01',
538
+ '0x9a5bc993b18fb2a27414ae7adc43f343509fd5162f796b025d08ebeca4e02317',
550
539
  collateralPoolAddress:
551
- '0x2fdcf63682577f6bfdd4296500067543ba9877d5d5e41ebd9e51b97ab071ce69',
540
+ '0x35275c590b5f754b67ae0da7fbf530d40e90d66076dd7f687e13f7586effba8c',
552
541
  borrowDynamic:
553
- '0x7fd0660f0102789ad039542165c6cbc2d90ba3c1d9dbd4ac4ae8804d80817542',
542
+ '0xe7ea2c5a01a7a286d76d135896edbb1ffb199ba100a618beb9c2180c8d547d91',
554
543
  interestModel:
555
- '0xd4e7b06a79f63706523167f055296db641b0f8ddd6734c05e205f2de0fcefdd0',
544
+ '0xcde221c16ddbf7d9ea41d6d3dcbff230fc2da9d957a563194c3d9025152ed93b',
556
545
  riskModel:
557
- '0x19e5993350186f192ffeb2cba0650b04c291390e149c8ac9b324ecf394daaa1a',
546
+ '0xa15d4c5c56f4afcd604f6db8b1b5c104d91d3ad95a743212ae270375877baa6d',
558
547
  borrowFeeKey: '',
559
548
  supplyLimitKey:
560
549
  '0x4be9ae54ac4d320f4f9c14cae78cb85c8e0e67791dd9bdba6d2db20614a28a24',
@@ -566,15 +555,15 @@ export const POOL_ADDRESSES = {
566
555
  spoolReward:
567
556
  '0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166',
568
557
  sCoinType:
569
- '0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
558
+ '0x55588ffc90718301696fd5497a7b6e82c0f86c15d58e41fc9750a24329ee2523::scallop_usdc::SCALLOP_USDC',
570
559
  sCoinTreasury:
571
- '0x6ef82ef94472dcb8c2cdeac8df38874024c08570ca165986ba56d1e38fe0c0a3',
560
+ '0xe028cf6c656e410502c931ed265524d48ff16e000db1f50305b54d8a6c421150',
572
561
  sCoinMetadataId:
573
562
  '0x763a21eba338e00bc684aaad80491c89eea5f247b59c47df45b17610c9ad58f2',
574
563
  sCoinSymbol: 'sUSDC',
575
564
  sCoinName: 'susdc',
576
565
  coinMetadataId:
577
- '0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6',
566
+ '0x752b2f407601cbbc335c3d1623e0f5a2b8cb254bc35847c4586bd7cd8bcac7f8',
578
567
  coinType:
579
568
  '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
580
569
  spoolName: 'susdc',
@@ -590,15 +579,15 @@ export const POOL_ADDRESSES = {
590
579
  coinName: 'sui',
591
580
  symbol: 'SUI',
592
581
  lendingPoolAddress:
593
- '0xeb86ad67543c1ac2c4cbaf178d38a45ab27c2e69d60f0f8badd83f563f012c3c',
582
+ '0x885330fd03acdcf7d0ba10b6722f91140bc77f6fb62a593d5d025ccd6d160c04',
594
583
  collateralPoolAddress:
595
- '0xcba7bb07d4d3ce01d81e71d9def680aa8b417347bfd7834aee8fc3b85b61c9a1',
584
+ '0x1a75bdcb07a64f3a87cff0156c9d470fc9ce0be14ec8093195a27921186afbb8',
596
585
  borrowDynamic:
597
- '0xd47c2fd3dbb95ed06e5da92f6b99611ba94a36efa6a13d9b33b02519761cc84e',
586
+ '0xec6749d4fb51841a728e6f0dda1b43047ca76a89690f67c7e496f2c0b6ea67b5',
598
587
  interestModel:
599
- '0x4742bb49aa49ab4e5d9dfa119cddc027d1b7811ac42ca1ce794818d4a4da68e7',
588
+ '0x769b1653eb11e85903b0834e0f83d65405e5467a60389b2d86960dc2582c6595',
600
589
  riskModel:
601
- '0x6dc356e829cfca2d79f0d68a79b5ddd5296ad0c955a38e2fc397485e2b629367',
590
+ '0xbaf399f7cd7c13e15cf8e5979e4b8baa13513e9068f13c0a0ccdc9e4d3739314',
602
591
  borrowFeeKey: '',
603
592
  supplyLimitKey:
604
593
  '0x0602418e66fb7a73fa997077bd66f248ad5b090d43344a14b9f1db598ecc1d47',
@@ -610,10 +599,11 @@ export const POOL_ADDRESSES = {
610
599
  spoolReward:
611
600
  '0xc3206071a8d43212efb6e3b5504f2321f8df97ab122b466c0bc7cfdf398dc13a',
612
601
  sCoinType:
613
- '0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
602
+ '0x9d81d8a20e9ffc462839c23346edb69604f7b4deffc9253262e1caca473fd3e3::scallop_sui::SCALLOP_SUI',
614
603
  sCoinTreasury:
615
- '0x03f1d94a40bd9f5d556bacb5c5245732b185572f6a29b36ad8b555d9a8a24f09',
616
- sCoinMetadataId: '',
604
+ '0x8d2cd566acf9f38629bab1e5aba888c85b177432e91cf7f9a204c3f730281059',
605
+ sCoinMetadataId:
606
+ '0x13d07ec4114e36b6d9b69cab9e4722c4dc76d9f623db9fcb5b26a01cb0a861a4',
617
607
  sCoinSymbol: 'sSUI',
618
608
  sCoinName: 'ssui',
619
609
  coinMetadataId:
@@ -749,4 +739,45 @@ export const POOL_ADDRESSES = {
749
739
  flashloanFeeObject:
750
740
  '0xd54dfb677e9e011e2451375a7a2e318b4f2225c2a0b369bde0afcef8cbb1a863',
751
741
  },
742
+ hasui: {
743
+ coinName: 'hasui',
744
+ symbol: 'haSUI',
745
+ lendingPoolAddress:
746
+ '0x7e9c2b3105e0999410305dfd2c649ca473a9c04be87c53ce5e4566559f6818ea',
747
+ collateralPoolAddress:
748
+ '0x0446c27ce7e6fac2d0b359caad042bd436727b6f498a2efc4ceaa071d9fce4b5',
749
+ borrowDynamic:
750
+ '0xa1ba968ebc70685fc5fbdeb5edbd346cbc13223abef556109dc08f26962d3765',
751
+ interestModel:
752
+ '0x8440be8ab46d572fefaf0c21a225ebb9e6fe9239112de8de0a2654e6827fd5c7',
753
+ riskModel:
754
+ '0xa246e59a3686b63ce4b914c2d1c784cff0ae3288e7b3db5b146925684a6380c0',
755
+ borrowFeeKey: '',
756
+ supplyLimitKey: '',
757
+ borrowLimitKey: '',
758
+ isolatedAssetKey: '',
759
+ isIsolated: false,
760
+ spool: '',
761
+ spoolReward: '',
762
+ sCoinType:
763
+ '0xf2f52fede69abafa2439665bb5bebc8e60fe0f8c5d9d240dd143b5f74f73c867::scallop_ha_sui::SCALLOP_HA_SUI',
764
+ sCoinTreasury:
765
+ '0x33b0013a52205955a0af9ceaa4d3f4b7cf4bd8179fe14ac2de29d8f4d656eb0a',
766
+ sCoinMetadataId:
767
+ '0xb174a5642133c5a7409187c80e2ef090cc0169147a1dcedce8a0f208397578d3',
768
+ sCoinSymbol: 'sHASUI',
769
+ sCoinName: 'shasui',
770
+ coinMetadataId:
771
+ '0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
772
+ coinType:
773
+ '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
774
+ spoolName: 'shasui',
775
+ decimals: 9,
776
+ pythFeed:
777
+ '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
778
+ pythFeedObjectId:
779
+ '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
780
+ flashloanFeeObject:
781
+ '0xb9f505d532de1d6c9f3a8522a2d16f2958b75c0ed939d4f80b96f584a2a8ed5e',
782
+ },
752
783
  };
@@ -442,7 +442,7 @@ class ScallopAddress {
442
442
  public readonly scallopAxios: ScallopAxios;
443
443
  private readonly addressMap = new Map<NetworkType, AddressesInterface>();
444
444
  private readonly defaultParamValues = {
445
- addressId: '67c44a103fe1b8c454eb9699',
445
+ addressId: '695fcdc084f790c04eb068dc',
446
446
  network: 'mainnet' as NetworkType,
447
447
  } as const;
448
448
 
@@ -37,8 +37,6 @@ import {
37
37
  getOnDemandAggObjectIds,
38
38
  getPoolAddresses,
39
39
  getPriceUpdatePolicies,
40
- getPythPrice,
41
- getPythPrices,
42
40
  getSCoinAmount,
43
41
  getSCoinAmounts,
44
42
  getSCoinSwapRate,
@@ -321,7 +319,7 @@ class ScallopQuery implements ScallopQueryInterface {
321
319
  * @return Asset coin price.
322
320
  */
323
321
  async getPriceFromPyth(assetCoinName: string) {
324
- return await getPythPrice(this, assetCoinName);
322
+ return await this.utils.getPythPrice(assetCoinName);
325
323
  }
326
324
 
327
325
  /**
@@ -331,7 +329,7 @@ class ScallopQuery implements ScallopQueryInterface {
331
329
  * @return Array of asset coin prices.
332
330
  */
333
331
  async getPricesFromPyth(assetCoinNames: string[]) {
334
- return await getPythPrices(this, assetCoinNames);
332
+ return await this.utils.getPythPrices(assetCoinNames);
335
333
  }
336
334
 
337
335
  /* ==================== Spool Query Methods ==================== */
@@ -855,8 +853,11 @@ class ScallopQuery implements ScallopQueryInterface {
855
853
  /**
856
854
  * Check if asset is an isolated asset
857
855
  */
858
- async isIsolatedAsset(assetCoinName: string) {
859
- return isIsolatedAsset(this.utils, assetCoinName);
856
+ async isIsolatedAsset(
857
+ assetCoinName: string,
858
+ useOnChainQuery: boolean = false
859
+ ) {
860
+ return isIsolatedAsset(this.utils, assetCoinName, useOnChainQuery);
860
861
  }
861
862
 
862
863
  /**
@@ -483,13 +483,15 @@ class ScallopUtils implements ScallopUtilsInterface {
483
483
  return (
484
484
  await Promise.all(
485
485
  Object.entries(assetToPriceFeedMapping).map(
486
- async ([assetCoinName, priceFeedObject]) => ({
487
- coinName: assetCoinName,
488
- price: await this.getPythPrice(
489
- assetCoinName as string,
490
- priceFeedObject
491
- ),
492
- })
486
+ async ([coinName, feed]) => {
487
+ try {
488
+ const price = await this.getPythPrice(coinName, feed);
489
+ return { coinName, price };
490
+ } catch (e) {
491
+ console.error(e);
492
+ return { coinName, price: 0 };
493
+ }
494
+ }
493
495
  )
494
496
  )
495
497
  ).reduce(
@@ -31,7 +31,7 @@ import { queryKeys } from 'src/constants';
31
31
  * @param address
32
32
  * @returns
33
33
  */
34
- export const queryBorrowIncentivePools = async ({
34
+ const queryBorrowIncentivePools = async ({
35
35
  address,
36
36
  scallopSuiKit,
37
37
  }: {
@@ -135,17 +135,19 @@ export const getBorrowIncentivePools = async (
135
135
  poolCoinDecimal
136
136
  );
137
137
 
138
- borrowIncentivePoolPoints[coinName as string] = {
139
- symbol,
140
- coinName: rewardCoinName,
141
- coinType: rewardCoinType,
142
- coinDecimal,
143
- coinPrice: rewardCoinPrice,
144
- points: poolPoint.points,
145
- distributedPoint: poolPoint.distributedPoint,
146
- weightedAmount: poolPoint.weightedAmount,
147
- ...calculatedPoolPoint,
148
- };
138
+ if (poolPoint.points > calculatedPoolPoint.accumulatedPoints) {
139
+ borrowIncentivePoolPoints[coinName as string] = {
140
+ symbol,
141
+ coinName: rewardCoinName,
142
+ coinType: rewardCoinType,
143
+ coinDecimal,
144
+ coinPrice: rewardCoinPrice,
145
+ points: poolPoint.points,
146
+ distributedPoint: poolPoint.distributedPoint,
147
+ weightedAmount: poolPoint.weightedAmount,
148
+ ...calculatedPoolPoint,
149
+ };
150
+ }
149
151
  }
150
152
 
151
153
  const stakedAmount = BigNumber(parsedBorrowIncentivePoolData.staked);
@@ -186,13 +188,18 @@ export const queryBorrowIncentiveAccounts = async (
186
188
  'borrowIncentive.incentiveAccounts'
187
189
  );
188
190
  const queryTarget = `${queryPkgId}::incentive_account_query::incentive_account_data`;
191
+ const [incentiveAccountVersion, obligationDataVersion] = await Promise.all([
192
+ getSharedObjectData(incentiveAccountsId, utils.scallopSuiKit),
193
+ getSharedObjectData(obligationId, utils.scallopSuiKit),
194
+ ]);
195
+
189
196
  const args = [
190
197
  txBlock.sharedObjectRef({
191
- ...(await getSharedObjectData(incentiveAccountsId, utils.scallopSuiKit)),
198
+ ...incentiveAccountVersion,
192
199
  mutable: true,
193
200
  }),
194
201
  txBlock.sharedObjectRef({
195
- ...(await getSharedObjectData(obligationId, utils.scallopSuiKit)),
202
+ ...obligationDataVersion,
196
203
  mutable: true,
197
204
  }),
198
205
  ];
@@ -956,17 +956,23 @@ export const queryObligation = async (
956
956
  const market = address.get('core.market');
957
957
  const queryTarget = `${packageId}::obligation_query::obligation_data`;
958
958
 
959
+ const [versionData, marketData, obligationData] = await Promise.all([
960
+ getSharedObjectData(version, scallopSuiKit),
961
+ getSharedObjectData(market, scallopSuiKit),
962
+ getSharedObjectData(obligationId, scallopSuiKit),
963
+ ]);
964
+
959
965
  const args = [
960
966
  txBlock.sharedObjectRef({
961
- ...(await getSharedObjectData(version, scallopSuiKit)),
967
+ ...versionData,
962
968
  mutable: false,
963
969
  }),
964
970
  txBlock.sharedObjectRef({
965
- ...(await getSharedObjectData(market, scallopSuiKit)),
971
+ ...marketData,
966
972
  mutable: true,
967
973
  }),
968
974
  txBlock.sharedObjectRef({
969
- ...(await getSharedObjectData(obligationId, scallopSuiKit)),
975
+ ...obligationData,
970
976
  mutable: true,
971
977
  }),
972
978
  {
@@ -81,15 +81,18 @@ export const getIsolatedAssets = async (
81
81
 
82
82
  /**
83
83
  * Check if the coin type is an isolated asset
84
+ * @param utils ScallopUtils
84
85
  * @param coinName coin name
86
+ * @param useOnChainQuery whether to use on-chain query
85
87
  * @returns true if the coin type is an isolated asset
86
88
  */
87
89
  export const isIsolatedAsset = async (
88
90
  utils: ScallopUtils,
89
- coinName: string
91
+ coinName: string,
92
+ useOnChainQuery?: boolean
90
93
  ): Promise<boolean> => {
91
94
  const assetInPoolAddresses = utils.constants.poolAddresses[coinName];
92
- if (assetInPoolAddresses) {
95
+ if (assetInPoolAddresses && !useOnChainQuery) {
93
96
  return assetInPoolAddresses.isIsolated;
94
97
  }
95
98