@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/dist/esm/index.js CHANGED
@@ -18921,11 +18921,6 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
18921
18921
  for (const sid of activeShortIds)
18922
18922
  shortIdToAdjustedCredit.set(String(sid), splitBigInt);
18923
18923
  }
18924
- const farmShortIds = new Set(farms.map((f) => String(f.shortId)));
18925
- audits.forEach((audit) => audit.activeShortIds?.forEach((sid) => {
18926
- if (!farmShortIds.has(String(sid)))
18927
- throw new Error(`activeShortId ${sid} from audit ${audit.id} missing in filteredFarms`);
18928
- }));
18929
18924
  let totalCreditsProduced18dp = BigInt(0);
18930
18925
  for (const farm of farms) {
18931
18926
  if (farm.status === "Unassigned") {
@@ -18935,7 +18930,7 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
18935
18930
  throw new Error(`farm ${farm.shortId} has no rewardSplits`);
18936
18931
  if (farm.carbonCreditsProduced < 0) {
18937
18932
  console.log(`Farm: ${farm.shortId} has ${farm.carbonCreditsProduced} carbon credits produced`);
18938
- throw new Error("Carbon credits produced is less than 0");
18933
+ throw new Error("Carbon credits produced is less than 0 for farm " + farm.shortId);
18939
18934
  }
18940
18935
  totalCreditsProduced18dp += parseUnits(customToFixed(farm.carbonCreditsProduced, 18), 18);
18941
18936
  const sumGlow = farm.rewardSplits.reduce((acc, r) => acc + r.glowSplitPercent, 0);
@@ -18947,6 +18942,8 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
18947
18942
  throw new Error(`USDG splits ≠1 for farm ${farm.shortId}`);
18948
18943
  const glowBase = parseUnits(customToFixed(farm.weeklyPayment, GLOW_WEIGHT_DECIMAL_PRECISION), GLOW_WEIGHT_DECIMAL_PRECISION);
18949
18944
  const adjustedCreditBigInt = shortIdToAdjustedCredit.get(String(farm.shortId)) ?? BigInt(0);
18945
+ if (adjustedCreditBigInt <= BigInt(0))
18946
+ throw new Error(`Adjusted credit is less than or equal to 0 for farm ${farm.shortId}`);
18950
18947
  for (const split of farm.rewardSplits) {
18951
18948
  const glowWeight = multiplyBigIntByDecimalPercentage(glowBase, GLOW_WEIGHT_DECIMAL_PRECISION, split.glowSplitPercent);
18952
18949
  const usdgWeight = multiplyBigIntByDecimalPercentage(adjustedCreditBigInt, USDG_WEIGHT_DECIMAL_PRECISION, split.usdgSplitPercent);