@scallop-io/sui-scallop-sdk 0.44.20 → 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.
@@ -20,6 +20,7 @@ export type BorrowIncentivePool = {
20
20
  coinType: string;
21
21
  coinDecimal: number;
22
22
  coinPrice: number;
23
+ staked: number;
23
24
  points: OptionalKeys<Record<SupportBorrowIncentiveRewardCoins, BorrowIncentivePoolPoints>>;
24
25
  };
25
26
  export type OriginBorrowIncentivePoolPointData = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.44.20",
3
+ "version": "0.44.21",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -1,5 +1,7 @@
1
+ import { IS_VE_SCA_TEST } from './common';
2
+
1
3
  export const UNLOCK_ROUND_DURATION = 60 * 60 * 24; // 1 days in seconds
2
- export const MAX_LOCK_ROUNDS: number = 1460; // 4 years in days
4
+ export const MAX_LOCK_ROUNDS: number = IS_VE_SCA_TEST ? 9 : 1460; // 4 years in days (or 9 days for testing)
3
5
  export const MAX_LOCK_DURATION: number =
4
6
  MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION; // 4 years in seconds
5
7
 
@@ -142,6 +142,7 @@ export const queryBorrowIncentivePools = async (
142
142
  coinDecimal: poolCoinDecimal,
143
143
  coinPrice: poolCoinPrice,
144
144
  points: borrowIncentivePoolPoints,
145
+ staked: parsedBorrowIncentivePoolData.staked,
145
146
  };
146
147
  }
147
148
 
@@ -511,20 +511,22 @@ export const getObligationAccount = async (
511
511
  );
512
512
 
513
513
  // for veSCA
514
- // console.log('poolPoint.weightedAmount', poolPoint.weightedAmount);
515
- // console.log(
516
- // 'borrowIncentiveAccount.amount',
517
- // borrowIncentiveAccount.debtAmount
518
- // );
519
- const weightScale = BigNumber('1000000000000');
520
-
514
+ const weightScale = BigNumber(1_000_000_000_000);
521
515
  const boostValue = BigNumber(accountPoint.weightedAmount)
522
516
  .div(
523
517
  BigNumber(borrowIncentiveAccount.debtAmount)
524
518
  .multipliedBy(poolPoint.baseWeight)
525
519
  .dividedBy(weightScale)
526
520
  )
527
- .toNumber();
521
+ .isFinite()
522
+ ? BigNumber(accountPoint.weightedAmount)
523
+ .div(
524
+ BigNumber(borrowIncentiveAccount.debtAmount)
525
+ .multipliedBy(poolPoint.baseWeight)
526
+ .dividedBy(weightScale)
527
+ )
528
+ .toNumber()
529
+ : 1;
528
530
 
529
531
  if (availableClaimAmount.isGreaterThan(0)) {
530
532
  rewards.push({
@@ -54,6 +54,7 @@ export type BorrowIncentivePool = {
54
54
  coinType: string;
55
55
  coinDecimal: number;
56
56
  coinPrice: number;
57
+ staked: number;
57
58
  points: OptionalKeys<
58
59
  Record<SupportBorrowIncentiveRewardCoins, BorrowIncentivePoolPoints>
59
60
  >;
@@ -510,7 +510,7 @@ export const calculateBorrowIncentivePoolPointData = (
510
510
  .multipliedBy(rateYearFactor)
511
511
  .multipliedBy(rewardCoinPrice);
512
512
 
513
- const weightScale = BigNumber('1000000000000');
513
+ const weightScale = BigNumber(1_000_000_000_000);
514
514
  const rewardRate = rewardValueForYear
515
515
  .multipliedBy(
516
516
  BigNumber(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(