@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 +26 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -10
- package/dist/index.mjs.map +1 -1
- package/dist/types/query/borrowIncentive.d.ts +1 -0
- package/package.json +1 -1
- package/src/constants/vesca.ts +3 -1
- package/src/queries/borrowIncentiveQuery.ts +1 -0
- package/src/queries/portfolioQuery.ts +10 -8
- package/src/types/query/borrowIncentive.ts +1 -0
- package/src/utils/query.ts +13 -8
- package/src/utils/util.ts +6 -1
|
@@ -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
package/src/constants/vesca.ts
CHANGED
|
@@ -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
|
|
|
@@ -511,20 +511,22 @@ export const getObligationAccount = async (
|
|
|
511
511
|
);
|
|
512
512
|
|
|
513
513
|
// for veSCA
|
|
514
|
-
|
|
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
|
-
.
|
|
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({
|
package/src/utils/query.ts
CHANGED
|
@@ -502,25 +502,30 @@ export const calculateBorrowIncentivePoolPointData = (
|
|
|
502
502
|
|
|
503
503
|
// Calculate the reward rate
|
|
504
504
|
const rateYearFactor = 365 * 24 * 60 * 60;
|
|
505
|
-
const rewardPerSec = BigNumber(distributedPointPerSec).
|
|
506
|
-
|
|
505
|
+
const rewardPerSec = BigNumber(distributedPointPerSec).shiftedBy(
|
|
506
|
+
-1 * rewardCoinDecimal
|
|
507
507
|
);
|
|
508
508
|
|
|
509
509
|
const rewardValueForYear = BigNumber(rewardPerSec)
|
|
510
|
-
.shiftedBy(-1 * rewardCoinDecimal)
|
|
511
510
|
.multipliedBy(rateYearFactor)
|
|
512
511
|
.multipliedBy(rewardCoinPrice);
|
|
513
512
|
|
|
514
|
-
const weightScale = BigNumber(
|
|
513
|
+
const weightScale = BigNumber(1_000_000_000_000);
|
|
515
514
|
const rewardRate = rewardValueForYear
|
|
515
|
+
.multipliedBy(
|
|
516
|
+
BigNumber(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
|
|
517
|
+
weightScale
|
|
518
|
+
)
|
|
519
|
+
)
|
|
516
520
|
.dividedBy(weightedStakedValue)
|
|
517
|
-
.multipliedBy(parsedBorrowIncentivePoolPointData.baseWeight)
|
|
518
|
-
.dividedBy(weightScale)
|
|
519
521
|
.isFinite()
|
|
520
522
|
? rewardValueForYear
|
|
523
|
+
.multipliedBy(
|
|
524
|
+
BigNumber(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
|
|
525
|
+
weightScale
|
|
526
|
+
)
|
|
527
|
+
)
|
|
521
528
|
.dividedBy(weightedStakedValue)
|
|
522
|
-
.multipliedBy(parsedBorrowIncentivePoolPointData.baseWeight)
|
|
523
|
-
.dividedBy(weightScale)
|
|
524
529
|
.toNumber()
|
|
525
530
|
: Infinity;
|
|
526
531
|
|
package/src/utils/util.ts
CHANGED
|
@@ -55,7 +55,12 @@ export const parseDataFromPythPriceFeed = (
|
|
|
55
55
|
address: ScallopAddress
|
|
56
56
|
) => {
|
|
57
57
|
const assetCoinNames = [
|
|
58
|
-
...new Set([
|
|
58
|
+
...new Set([
|
|
59
|
+
...SUPPORT_POOLS,
|
|
60
|
+
...SUPPORT_COLLATERALS,
|
|
61
|
+
...SUPPORT_SPOOLS_REWARDS,
|
|
62
|
+
...SUPPORT_BORROW_INCENTIVE_REWARDS,
|
|
63
|
+
]),
|
|
59
64
|
] as SupportAssetCoins[];
|
|
60
65
|
const assetCoinName = assetCoinNames.find((assetCoinName) => {
|
|
61
66
|
return (
|