@glowlabs-org/utils 0.1.1 → 0.1.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.
package/package.json
CHANGED
@@ -414,16 +414,6 @@ export async function createWeeklyReport({
|
|
414
414
|
shortIdToAdjustedCredit.set(String(sid), splitBigInt);
|
415
415
|
}
|
416
416
|
|
417
|
-
const farmShortIds = new Set(farms.map((f: any) => String(f.shortId)));
|
418
|
-
audits.forEach((audit: any) =>
|
419
|
-
audit.activeShortIds?.forEach((sid: string | number) => {
|
420
|
-
if (!farmShortIds.has(String(sid)))
|
421
|
-
throw new Error(
|
422
|
-
`activeShortId ${sid} from audit ${audit.id} missing in filteredFarms`
|
423
|
-
);
|
424
|
-
})
|
425
|
-
);
|
426
|
-
|
427
417
|
let totalCreditsProduced18dp = BigInt(0);
|
428
418
|
|
429
419
|
for (const farm of farms) {
|
@@ -438,7 +428,9 @@ export async function createWeeklyReport({
|
|
438
428
|
console.log(
|
439
429
|
`Farm: ${farm.shortId} has ${farm.carbonCreditsProduced} carbon credits produced`
|
440
430
|
);
|
441
|
-
throw new Error(
|
431
|
+
throw new Error(
|
432
|
+
"Carbon credits produced is less than 0 for farm " + farm.shortId
|
433
|
+
);
|
442
434
|
}
|
443
435
|
|
444
436
|
totalCreditsProduced18dp += parseUnits(
|
@@ -468,6 +460,11 @@ export async function createWeeklyReport({
|
|
468
460
|
const adjustedCreditBigInt =
|
469
461
|
shortIdToAdjustedCredit.get(String(farm.shortId)) ?? BigInt(0);
|
470
462
|
|
463
|
+
if (adjustedCreditBigInt <= BigInt(0))
|
464
|
+
throw new Error(
|
465
|
+
`Adjusted credit is less than or equal to 0 for farm ${farm.shortId}`
|
466
|
+
);
|
467
|
+
|
471
468
|
for (const split of farm.rewardSplits) {
|
472
469
|
const glowWeight = multiplyBigIntByDecimalPercentage(
|
473
470
|
glowBase,
|