@scallop-io/sui-scallop-sdk 2.4.5 → 2.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.4.5",
3
+ "version": "2.4.6",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -136,19 +136,26 @@ export const getBorrowIncentivePools = async (
136
136
  poolCoinDecimal
137
137
  );
138
138
 
139
- if (poolPoint.points > calculatedPoolPoint.accumulatedPoints) {
140
- borrowIncentivePoolPoints[coinName as string] = {
141
- symbol,
142
- coinName: rewardCoinName,
143
- coinType: rewardCoinType,
144
- coinDecimal,
145
- coinPrice: rewardCoinPrice,
146
- points: poolPoint.points,
147
- distributedPoint: poolPoint.distributedPoint,
148
- weightedAmount: poolPoint.weightedAmount,
149
- ...calculatedPoolPoint,
150
- };
151
- }
139
+ // A campaign is exhausted once every allocated point has been
140
+ // distributed (accumulatedPoints is min-capped at points). We still emit
141
+ // the pool point — the portfolio query needs it to surface users'
142
+ // already-accrued, unclaimed rewards — but zero out the APR so callers
143
+ // don't display a stale reward rate for an ended campaign.
144
+ const isExhausted =
145
+ poolPoint.points <= calculatedPoolPoint.accumulatedPoints;
146
+
147
+ borrowIncentivePoolPoints[coinName as string] = {
148
+ symbol,
149
+ coinName: rewardCoinName,
150
+ coinType: rewardCoinType,
151
+ coinDecimal,
152
+ coinPrice: rewardCoinPrice,
153
+ points: poolPoint.points,
154
+ distributedPoint: poolPoint.distributedPoint,
155
+ weightedAmount: poolPoint.weightedAmount,
156
+ ...calculatedPoolPoint,
157
+ ...(isExhausted ? { rewardApr: 0 } : {}),
158
+ };
152
159
  }
153
160
 
154
161
  const stakedAmount = BigNumber(parsedBorrowIncentivePoolData.staked);