@glowlabs-org/utils 0.1.2 → 0.1.4

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.
@@ -1,3 +1,3 @@
1
1
  export * from "./lib/create-weekly-report/types/index";
2
2
  export * from "./constants/index";
3
- export { createWeeklyReport } from "./lib/create-weekly-report/index";
3
+ export { createWeeklyReport, createWeeklyReportLegacy, } from "./lib/create-weekly-report/index";
package/dist/cjs/index.js CHANGED
@@ -18897,9 +18897,6 @@ async function createWeeklyReportLegacy(args) {
18897
18897
  };
18898
18898
  }
18899
18899
  async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
18900
- if (week < 72) {
18901
- return createWeeklyReportLegacy({ week, gcaUrls, apiUrl });
18902
- }
18903
18900
  const map = new Map();
18904
18901
  const [apiResponse, auditsRes] = await Promise.all([
18905
18902
  fetchFarmsForWeek(week, gcaUrls, apiUrl),
@@ -18923,11 +18920,6 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
18923
18920
  for (const sid of activeShortIds)
18924
18921
  shortIdToAdjustedCredit.set(String(sid), splitBigInt);
18925
18922
  }
18926
- const farmShortIds = new Set(farms.map((f) => String(f.shortId)));
18927
- audits.forEach((audit) => audit.activeShortIds?.forEach((sid) => {
18928
- if (!farmShortIds.has(String(sid)))
18929
- throw new Error(`activeShortId ${sid} from audit ${audit.id} missing in filteredFarms`);
18930
- }));
18931
18923
  let totalCreditsProduced18dp = BigInt(0);
18932
18924
  for (const farm of farms) {
18933
18925
  if (farm.status === "Unassigned") {
@@ -18949,6 +18941,8 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
18949
18941
  throw new Error(`USDG splits ≠1 for farm ${farm.shortId}`);
18950
18942
  const glowBase = viem.parseUnits(customToFixed(farm.weeklyPayment, GLOW_WEIGHT_DECIMAL_PRECISION), GLOW_WEIGHT_DECIMAL_PRECISION);
18951
18943
  const adjustedCreditBigInt = shortIdToAdjustedCredit.get(String(farm.shortId)) ?? BigInt(0);
18944
+ if (adjustedCreditBigInt <= BigInt(0))
18945
+ throw new Error(`Adjusted credit is less than or equal to 0 for farm ${farm.shortId}`);
18952
18946
  for (const split of farm.rewardSplits) {
18953
18947
  const glowWeight = multiplyBigIntByDecimalPercentage(glowBase, GLOW_WEIGHT_DECIMAL_PRECISION, split.glowSplitPercent);
18954
18948
  const usdgWeight = multiplyBigIntByDecimalPercentage(adjustedCreditBigInt, USDG_WEIGHT_DECIMAL_PRECISION, split.usdgSplitPercent);
@@ -19088,4 +19082,5 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
19088
19082
 
19089
19083
  exports.GENESIS_TIMESTAMP = GENESIS_TIMESTAMP;
19090
19084
  exports.createWeeklyReport = createWeeklyReport;
19085
+ exports.createWeeklyReportLegacy = createWeeklyReportLegacy;
19091
19086
  //# sourceMappingURL=index.js.map