@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/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/queries/borrowIncentiveQuery.ts +20 -13
package/package.json
CHANGED
|
@@ -136,19 +136,26 @@ export const getBorrowIncentivePools = async (
|
|
|
136
136
|
poolCoinDecimal
|
|
137
137
|
);
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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);
|