@scallop-io/sui-scallop-sdk 0.44.20 → 0.44.22
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 +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types/query/borrowIncentive.d.ts +1 -0
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +2 -2
- 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 +1 -1
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;
|
|
@@ -1211,7 +1211,7 @@ var calculateBorrowIncentivePoolPointData = (pasredBorrowIncentinvePoolData, par
|
|
|
1211
1211
|
-1 * rewardCoinDecimal
|
|
1212
1212
|
);
|
|
1213
1213
|
const rewardValueForYear = (0, import_bignumber.default)(rewardPerSec).multipliedBy(rateYearFactor).multipliedBy(rewardCoinPrice);
|
|
1214
|
-
const weightScale = (0, import_bignumber.default)(
|
|
1214
|
+
const weightScale = (0, import_bignumber.default)(1e12);
|
|
1215
1215
|
const rewardRate = rewardValueForYear.multipliedBy(
|
|
1216
1216
|
(0, import_bignumber.default)(parsedBorrowIncentivePoolPointData.baseWeight).dividedBy(
|
|
1217
1217
|
weightScale
|
|
@@ -2450,7 +2450,8 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames, indexer
|
|
|
2450
2450
|
coinType: poolCoinType,
|
|
2451
2451
|
coinDecimal: poolCoinDecimal,
|
|
2452
2452
|
coinPrice: poolCoinPrice,
|
|
2453
|
-
points: borrowIncentivePoolPoints
|
|
2453
|
+
points: borrowIncentivePoolPoints,
|
|
2454
|
+
staked: parsedBorrowIncentivePoolData.staked
|
|
2454
2455
|
};
|
|
2455
2456
|
}
|
|
2456
2457
|
return borrowIncentivePools;
|
|
@@ -2858,10 +2859,12 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
2858
2859
|
availableClaimCoin = availableClaimAmount.shiftedBy(
|
|
2859
2860
|
-1 * poolPoint.coinDecimal
|
|
2860
2861
|
);
|
|
2861
|
-
const weightScale = (0, import_bignumber3.default)(
|
|
2862
|
+
const weightScale = (0, import_bignumber3.default)(1e12);
|
|
2862
2863
|
const boostValue = (0, import_bignumber3.default)(accountPoint.weightedAmount).div(
|
|
2863
2864
|
(0, import_bignumber3.default)(borrowIncentiveAccount.debtAmount).multipliedBy(poolPoint.baseWeight).dividedBy(weightScale)
|
|
2864
|
-
).
|
|
2865
|
+
).isFinite() ? (0, import_bignumber3.default)(accountPoint.weightedAmount).div(
|
|
2866
|
+
(0, import_bignumber3.default)(borrowIncentiveAccount.debtAmount).multipliedBy(poolPoint.baseWeight).dividedBy(weightScale)
|
|
2867
|
+
).toNumber() : 1;
|
|
2865
2868
|
if (availableClaimAmount.isGreaterThan(0)) {
|
|
2866
2869
|
rewards.push({
|
|
2867
2870
|
coinName: poolPoint.coinName,
|
|
@@ -4899,7 +4902,7 @@ var requireObligationInfo2 = async (...params) => {
|
|
|
4899
4902
|
};
|
|
4900
4903
|
};
|
|
4901
4904
|
var getBindedObligationId = async (builder, veScaKey) => {
|
|
4902
|
-
const
|
|
4905
|
+
const borrowIncentiveObjectId = builder.address.get("borrowIncentive.object");
|
|
4903
4906
|
const incentivePoolsId = builder.address.get(
|
|
4904
4907
|
"borrowIncentive.incentivePools"
|
|
4905
4908
|
);
|
|
@@ -4915,7 +4918,7 @@ var getBindedObligationId = async (builder, veScaKey) => {
|
|
|
4915
4918
|
return false;
|
|
4916
4919
|
const incentivePoolFields = incentivePoolsResponse.data.content.fields;
|
|
4917
4920
|
const veScaBindTableId = incentivePoolFields.ve_sca_bind.fields.id.id;
|
|
4918
|
-
const keyType = `${
|
|
4921
|
+
const keyType = `${borrowIncentiveObjectId}::typed_id::TypedID<${veScaPkgId}::ve_sca::VeScaKey>`;
|
|
4919
4922
|
const veScaBindTableResponse = await client.getDynamicFieldObject({
|
|
4920
4923
|
parentId: veScaBindTableId,
|
|
4921
4924
|
name: {
|