@gearbox-protocol/sdk 3.0.2 → 3.0.3
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.
|
@@ -233,32 +233,32 @@ class GearboxRewardsApi {
|
|
|
233
233
|
acc[p.dieselToken] = p.address;
|
|
234
234
|
return acc;
|
|
235
235
|
}, {});
|
|
236
|
-
const extraRewards = (merkleXYZLm || []).reduce(
|
|
237
|
-
(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
236
|
+
const extraRewards = (merkleXYZLm || []).reduce((acc, chainRewards) => {
|
|
237
|
+
chainRewards.rewards.forEach((reward) => {
|
|
238
|
+
const rewardToken = reward.token.address.toLowerCase();
|
|
239
|
+
reward.breakdowns.forEach((reason) => {
|
|
240
|
+
const poolToken = ((reason.reason || "").split("_").find((part) => part.startsWith("0x")) || "").toLowerCase();
|
|
241
|
+
const pool = poolByItsToken[poolToken];
|
|
242
|
+
const total = (0, import_utils.toBigInt)(reason.amount || 0);
|
|
243
|
+
const claimed = (0, import_utils.toBigInt)(reason.claimed || 0);
|
|
244
|
+
const claimable = import_math.BigIntMath.max(total - claimed, 0n);
|
|
245
|
+
const key = [pool, poolToken, rewardToken].join("_");
|
|
246
|
+
if (pool && claimable > 0n) {
|
|
247
|
+
const prevAmount = acc[key]?.amount || 0n;
|
|
248
|
+
acc[key] = {
|
|
249
|
+
pool,
|
|
250
|
+
poolToken,
|
|
251
|
+
rewardToken,
|
|
252
|
+
rewardTokenSymbol: reward.token.symbol,
|
|
253
|
+
rewardTokenDecimals: reward.token.decimals || 18,
|
|
254
|
+
amount: prevAmount + claimable,
|
|
255
|
+
type: "extraMerkle"
|
|
256
|
+
};
|
|
257
|
+
}
|
|
257
258
|
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
);
|
|
259
|
+
});
|
|
260
|
+
return acc;
|
|
261
|
+
}, {});
|
|
262
262
|
const gearboxLmRewards = poolTokens.map((address, i) => {
|
|
263
263
|
const info = baseRewardPoolsInfo[address];
|
|
264
264
|
const rewardToken = currentTokenData[info.symbol];
|
|
@@ -285,7 +285,7 @@ class GearboxRewardsApi {
|
|
|
285
285
|
{ nonZero: [], zero: [] }
|
|
286
286
|
);
|
|
287
287
|
return {
|
|
288
|
-
rewards: [...nonZero, ...extraRewards, zero]
|
|
288
|
+
rewards: [...nonZero, ...Object.values(extraRewards), zero]
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
291
|
static extractFulfilled(r, reportError, description) {
|
|
@@ -200,32 +200,32 @@ class GearboxRewardsApi {
|
|
|
200
200
|
acc[p.dieselToken] = p.address;
|
|
201
201
|
return acc;
|
|
202
202
|
}, {});
|
|
203
|
-
const extraRewards = (merkleXYZLm || []).reduce(
|
|
204
|
-
(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
203
|
+
const extraRewards = (merkleXYZLm || []).reduce((acc, chainRewards) => {
|
|
204
|
+
chainRewards.rewards.forEach((reward) => {
|
|
205
|
+
const rewardToken = reward.token.address.toLowerCase();
|
|
206
|
+
reward.breakdowns.forEach((reason) => {
|
|
207
|
+
const poolToken = ((reason.reason || "").split("_").find((part) => part.startsWith("0x")) || "").toLowerCase();
|
|
208
|
+
const pool = poolByItsToken[poolToken];
|
|
209
|
+
const total = toBigInt(reason.amount || 0);
|
|
210
|
+
const claimed = toBigInt(reason.claimed || 0);
|
|
211
|
+
const claimable = BigIntMath.max(total - claimed, 0n);
|
|
212
|
+
const key = [pool, poolToken, rewardToken].join("_");
|
|
213
|
+
if (pool && claimable > 0n) {
|
|
214
|
+
const prevAmount = acc[key]?.amount || 0n;
|
|
215
|
+
acc[key] = {
|
|
216
|
+
pool,
|
|
217
|
+
poolToken,
|
|
218
|
+
rewardToken,
|
|
219
|
+
rewardTokenSymbol: reward.token.symbol,
|
|
220
|
+
rewardTokenDecimals: reward.token.decimals || 18,
|
|
221
|
+
amount: prevAmount + claimable,
|
|
222
|
+
type: "extraMerkle"
|
|
223
|
+
};
|
|
224
|
+
}
|
|
224
225
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
);
|
|
226
|
+
});
|
|
227
|
+
return acc;
|
|
228
|
+
}, {});
|
|
229
229
|
const gearboxLmRewards = poolTokens.map((address, i) => {
|
|
230
230
|
const info = baseRewardPoolsInfo[address];
|
|
231
231
|
const rewardToken = currentTokenData[info.symbol];
|
|
@@ -252,7 +252,7 @@ class GearboxRewardsApi {
|
|
|
252
252
|
{ nonZero: [], zero: [] }
|
|
253
253
|
);
|
|
254
254
|
return {
|
|
255
|
-
rewards: [...nonZero, ...extraRewards, zero]
|
|
255
|
+
rewards: [...nonZero, ...Object.values(extraRewards), zero]
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
static extractFulfilled(r, reportError, description) {
|