@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.mjs CHANGED
@@ -168,7 +168,7 @@ var voloCoinIds = {
168
168
 
169
169
  // src/constants/vesca.ts
170
170
  var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
171
- var MAX_LOCK_ROUNDS = 1460;
171
+ var MAX_LOCK_ROUNDS = IS_VE_SCA_TEST ? 9 : 1460;
172
172
  var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
173
173
  var MIN_INITIAL_LOCK_AMOUNT = 1e10;
174
174
  var MIN_TOP_UP_AMOUNT = 1e9;
@@ -1135,12 +1135,20 @@ var calculateBorrowIncentivePoolPointData = (pasredBorrowIncentinvePoolData, par
1135
1135
  );
1136
1136
  const weightedStakedValue = weightedStakedCoin.multipliedBy(poolCoinPrice);
1137
1137
  const rateYearFactor = 365 * 24 * 60 * 60;
1138
- const rewardPerSec = BigNumber(distributedPointPerSec).dividedBy(
1139
- parsedBorrowIncentivePoolPointData.period
1138
+ const rewardPerSec = BigNumber(distributedPointPerSec).shiftedBy(
1139
+ -1 * rewardCoinDecimal
1140
1140
  );
1141
- const rewardValueForYear = BigNumber(rewardPerSec).shiftedBy(-1 * rewardCoinDecimal).multipliedBy(rateYearFactor).multipliedBy(rewardCoinPrice);
1142
- const weightScale = BigNumber("1000000000000");
1143
- const rewardRate = rewardValueForYear.dividedBy(weightedStakedValue).multipliedBy(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(weightScale).isFinite() ? rewardValueForYear.dividedBy(weightedStakedValue).multipliedBy(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(weightScale).toNumber() : Infinity;
1141
+ const rewardValueForYear = BigNumber(rewardPerSec).multipliedBy(rateYearFactor).multipliedBy(rewardCoinPrice);
1142
+ const weightScale = BigNumber(1e12);
1143
+ const rewardRate = rewardValueForYear.multipliedBy(
1144
+ BigNumber(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
1145
+ weightScale
1146
+ )
1147
+ ).dividedBy(weightedStakedValue).isFinite() ? rewardValueForYear.multipliedBy(
1148
+ BigNumber(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
1149
+ weightScale
1150
+ )
1151
+ ).dividedBy(weightedStakedValue).toNumber() : Infinity;
1144
1152
  return {
1145
1153
  distributedPointPerSec: distributedPointPerSec.toNumber(),
1146
1154
  accumulatedPoints: accumulatedPoints.toNumber(),
@@ -1233,7 +1241,12 @@ var parseAssetSymbol = (coinName) => {
1233
1241
  };
1234
1242
  var parseDataFromPythPriceFeed = (feed, address) => {
1235
1243
  const assetCoinNames = [
1236
- .../* @__PURE__ */ new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS])
1244
+ .../* @__PURE__ */ new Set([
1245
+ ...SUPPORT_POOLS,
1246
+ ...SUPPORT_COLLATERALS,
1247
+ ...SUPPORT_SPOOLS_REWARDS,
1248
+ ...SUPPORT_BORROW_INCENTIVE_REWARDS
1249
+ ])
1237
1250
  ];
1238
1251
  const assetCoinName = assetCoinNames.find((assetCoinName2) => {
1239
1252
  return address.get(`core.coins.${assetCoinName2}.oracle.pyth.feed`) === feed.id;
@@ -2365,7 +2378,8 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames, indexer
2365
2378
  coinType: poolCoinType,
2366
2379
  coinDecimal: poolCoinDecimal,
2367
2380
  coinPrice: poolCoinPrice,
2368
- points: borrowIncentivePoolPoints
2381
+ points: borrowIncentivePoolPoints,
2382
+ staked: parsedBorrowIncentivePoolData.staked
2369
2383
  };
2370
2384
  }
2371
2385
  return borrowIncentivePools;
@@ -2773,10 +2787,12 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
2773
2787
  availableClaimCoin = availableClaimAmount.shiftedBy(
2774
2788
  -1 * poolPoint.coinDecimal
2775
2789
  );
2776
- const weightScale = BigNumber3("1000000000000");
2790
+ const weightScale = BigNumber3(1e12);
2777
2791
  const boostValue = BigNumber3(accountPoint.weightedAmount).div(
2778
2792
  BigNumber3(borrowIncentiveAccount.debtAmount).multipliedBy(poolPoint.baseWeight).dividedBy(weightScale)
2779
- ).toNumber();
2793
+ ).isFinite() ? BigNumber3(accountPoint.weightedAmount).div(
2794
+ BigNumber3(borrowIncentiveAccount.debtAmount).multipliedBy(poolPoint.baseWeight).dividedBy(weightScale)
2795
+ ).toNumber() : 1;
2780
2796
  if (availableClaimAmount.isGreaterThan(0)) {
2781
2797
  rewards.push({
2782
2798
  coinName: poolPoint.coinName,