@scallop-io/sui-scallop-sdk 0.44.19 → 0.44.21

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/index.js CHANGED
@@ -240,7 +240,7 @@ var voloCoinIds = {
240
240
 
241
241
  // src/constants/vesca.ts
242
242
  var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
243
- var MAX_LOCK_ROUNDS = 1460;
243
+ var MAX_LOCK_ROUNDS = IS_VE_SCA_TEST ? 9 : 1460;
244
244
  var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
245
245
  var MIN_INITIAL_LOCK_AMOUNT = 1e10;
246
246
  var MIN_TOP_UP_AMOUNT = 1e9;
@@ -1207,12 +1207,20 @@ var calculateBorrowIncentivePoolPointData = (pasredBorrowIncentinvePoolData, par
1207
1207
  );
1208
1208
  const weightedStakedValue = weightedStakedCoin.multipliedBy(poolCoinPrice);
1209
1209
  const rateYearFactor = 365 * 24 * 60 * 60;
1210
- const rewardPerSec = (0, import_bignumber.default)(distributedPointPerSec).dividedBy(
1211
- parsedBorrowIncentivePoolPointData.period
1210
+ const rewardPerSec = (0, import_bignumber.default)(distributedPointPerSec).shiftedBy(
1211
+ -1 * rewardCoinDecimal
1212
1212
  );
1213
- const rewardValueForYear = (0, import_bignumber.default)(rewardPerSec).shiftedBy(-1 * rewardCoinDecimal).multipliedBy(rateYearFactor).multipliedBy(rewardCoinPrice);
1214
- const weightScale = (0, import_bignumber.default)("1000000000000");
1215
- const rewardRate = rewardValueForYear.dividedBy(weightedStakedValue).multipliedBy(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(weightScale).isFinite() ? rewardValueForYear.dividedBy(weightedStakedValue).multipliedBy(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(weightScale).toNumber() : Infinity;
1213
+ const rewardValueForYear = (0, import_bignumber.default)(rewardPerSec).multipliedBy(rateYearFactor).multipliedBy(rewardCoinPrice);
1214
+ const weightScale = (0, import_bignumber.default)(1e12);
1215
+ const rewardRate = rewardValueForYear.multipliedBy(
1216
+ (0, import_bignumber.default)(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
1217
+ weightScale
1218
+ )
1219
+ ).dividedBy(weightedStakedValue).isFinite() ? rewardValueForYear.multipliedBy(
1220
+ (0, import_bignumber.default)(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
1221
+ weightScale
1222
+ )
1223
+ ).dividedBy(weightedStakedValue).toNumber() : Infinity;
1216
1224
  return {
1217
1225
  distributedPointPerSec: distributedPointPerSec.toNumber(),
1218
1226
  accumulatedPoints: accumulatedPoints.toNumber(),
@@ -1305,7 +1313,12 @@ var parseAssetSymbol = (coinName) => {
1305
1313
  };
1306
1314
  var parseDataFromPythPriceFeed = (feed, address) => {
1307
1315
  const assetCoinNames = [
1308
- .../* @__PURE__ */ new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS])
1316
+ .../* @__PURE__ */ new Set([
1317
+ ...SUPPORT_POOLS,
1318
+ ...SUPPORT_COLLATERALS,
1319
+ ...SUPPORT_SPOOLS_REWARDS,
1320
+ ...SUPPORT_BORROW_INCENTIVE_REWARDS
1321
+ ])
1309
1322
  ];
1310
1323
  const assetCoinName = assetCoinNames.find((assetCoinName2) => {
1311
1324
  return address.get(`core.coins.${assetCoinName2}.oracle.pyth.feed`) === feed.id;
@@ -2437,7 +2450,8 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames, indexer
2437
2450
  coinType: poolCoinType,
2438
2451
  coinDecimal: poolCoinDecimal,
2439
2452
  coinPrice: poolCoinPrice,
2440
- points: borrowIncentivePoolPoints
2453
+ points: borrowIncentivePoolPoints,
2454
+ staked: parsedBorrowIncentivePoolData.staked
2441
2455
  };
2442
2456
  }
2443
2457
  return borrowIncentivePools;
@@ -2845,10 +2859,12 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
2845
2859
  availableClaimCoin = availableClaimAmount.shiftedBy(
2846
2860
  -1 * poolPoint.coinDecimal
2847
2861
  );
2848
- const weightScale = (0, import_bignumber3.default)("1000000000000");
2862
+ const weightScale = (0, import_bignumber3.default)(1e12);
2849
2863
  const boostValue = (0, import_bignumber3.default)(accountPoint.weightedAmount).div(
2850
2864
  (0, import_bignumber3.default)(borrowIncentiveAccount.debtAmount).multipliedBy(poolPoint.baseWeight).dividedBy(weightScale)
2851
- ).toNumber();
2865
+ ).isFinite() ? (0, import_bignumber3.default)(accountPoint.weightedAmount).div(
2866
+ (0, import_bignumber3.default)(borrowIncentiveAccount.debtAmount).multipliedBy(poolPoint.baseWeight).dividedBy(weightScale)
2867
+ ).toNumber() : 1;
2852
2868
  if (availableClaimAmount.isGreaterThan(0)) {
2853
2869
  rewards.push({
2854
2870
  coinName: poolPoint.coinName,