@glowlabs-org/utils 0.0.5 → 0.0.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.
Files changed (173) hide show
  1. package/.github/workflows/publish.yml +25 -0
  2. package/dist/constants/index.js.map +1 -0
  3. package/dist/default-values/gca-to-server-urls.js.map +1 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.js +4 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/tsconfig.tsbuildinfo +1 -0
  8. package/dist/types/AuditCompleted.js.map +1 -0
  9. package/dist/types/AuditInherited.js.map +1 -0
  10. package/{lib/esm → dist}/types/Device.js.map +1 -1
  11. package/dist/types/DuplicatedButPastAuditCompleted.js.map +1 -0
  12. package/{lib/cjs → dist}/types/Farm.js.map +1 -1
  13. package/{lib/cjs → dist}/types/FarmStatus.js.map +1 -1
  14. package/dist/types/GCAAndServerUrl.js.map +1 -0
  15. package/dist/types/GCAServerResponse.js.map +1 -0
  16. package/dist/types/GetEquipmentDataHandlerParams.js.map +1 -0
  17. package/dist/types/PayoutWalletAndSplit.js.map +1 -0
  18. package/dist/types/PayoutWalletAndSplitWithRewardSplits.js.map +1 -0
  19. package/dist/types/RewardSplit.js.map +1 -0
  20. package/{lib/cjs → dist}/types/RewardSplits.js.map +1 -1
  21. package/dist/types/SlotRange.js.map +1 -0
  22. package/dist/types/WeekAndSlotRange.js.map +1 -0
  23. package/dist/types/index.js.map +1 -0
  24. package/{lib/cjs → dist}/types/stashed-Farm.js.map +1 -1
  25. package/package.json +10 -17
  26. package/src/constants/index.ts +1 -0
  27. package/{lib/esm/default-values/gca-to-server-urls.js → src/default-values/gca-to-server-urls.ts} +2 -2
  28. package/src/index.ts +3 -0
  29. package/src/types/AuditCompleted.ts +3 -0
  30. package/src/types/AuditInherited.ts +3 -0
  31. package/src/types/Device.ts +3 -0
  32. package/src/types/DuplicatedButPastAuditCompleted.ts +4 -0
  33. package/src/types/Farm.ts +22 -0
  34. package/src/types/FarmStatus.ts +12 -0
  35. package/src/types/GCAAndServerUrl.ts +5 -0
  36. package/src/types/GCAServerResponse.ts +4 -0
  37. package/src/types/GetEquipmentDataHandlerParams.ts +3 -0
  38. package/src/types/PayoutWalletAndSplit.ts +5 -0
  39. package/src/types/PayoutWalletAndSplitWithRewardSplits.ts +6 -0
  40. package/src/types/RewardSplit.ts +3 -0
  41. package/src/types/RewardSplits.ts +4 -0
  42. package/src/types/SlotRange.ts +3 -0
  43. package/src/types/WeekAndSlotRange.ts +4 -0
  44. package/src/types/stashed-Farm.ts +22 -0
  45. package/tsconfig.json +31 -0
  46. package/lib/cjs/constants/index.js +0 -5
  47. package/lib/cjs/constants/index.js.map +0 -1
  48. package/lib/cjs/default-values/gca-to-server-urls.js.map +0 -1
  49. package/lib/cjs/index.d.ts +0 -3
  50. package/lib/cjs/index.js +0 -23
  51. package/lib/cjs/index.js.map +0 -1
  52. package/lib/cjs/lib/create-weekly-report/index.d.ts +0 -43
  53. package/lib/cjs/lib/create-weekly-report/index.js +0 -177
  54. package/lib/cjs/lib/create-weekly-report/index.js.map +0 -1
  55. package/lib/cjs/lib/create-weekly-report/utils/hash-leaf.d.ts +0 -7
  56. package/lib/cjs/lib/create-weekly-report/utils/hash-leaf.js +0 -16
  57. package/lib/cjs/lib/create-weekly-report/utils/hash-leaf.js.map +0 -1
  58. package/lib/cjs/package.json +0 -1
  59. package/lib/cjs/types/AuditCompleted.js +0 -4
  60. package/lib/cjs/types/AuditCompleted.js.map +0 -1
  61. package/lib/cjs/types/AuditInherited.js +0 -4
  62. package/lib/cjs/types/AuditInherited.js.map +0 -1
  63. package/lib/cjs/types/Device.js +0 -4
  64. package/lib/cjs/types/Device.js.map +0 -1
  65. package/lib/cjs/types/DuplicatedButPastAuditCompleted.js +0 -3
  66. package/lib/cjs/types/DuplicatedButPastAuditCompleted.js.map +0 -1
  67. package/lib/cjs/types/Farm.js +0 -3
  68. package/lib/cjs/types/FarmStatus.js +0 -3
  69. package/lib/cjs/types/GCAAndServerUrl.js +0 -3
  70. package/lib/cjs/types/GCAAndServerUrl.js.map +0 -1
  71. package/lib/cjs/types/GCAServerResponse.js +0 -3
  72. package/lib/cjs/types/GCAServerResponse.js.map +0 -1
  73. package/lib/cjs/types/GetEquipmentDataHandlerParams.js +0 -4
  74. package/lib/cjs/types/GetEquipmentDataHandlerParams.js.map +0 -1
  75. package/lib/cjs/types/PayoutWalletAndSplit.js +0 -3
  76. package/lib/cjs/types/PayoutWalletAndSplit.js.map +0 -1
  77. package/lib/cjs/types/PayoutWalletAndSplitWithRewardSplits.js +0 -3
  78. package/lib/cjs/types/PayoutWalletAndSplitWithRewardSplits.js.map +0 -1
  79. package/lib/cjs/types/RewardSplit.js +0 -4
  80. package/lib/cjs/types/RewardSplit.js.map +0 -1
  81. package/lib/cjs/types/RewardSplits.js +0 -3
  82. package/lib/cjs/types/SlotRange.js +0 -4
  83. package/lib/cjs/types/SlotRange.js.map +0 -1
  84. package/lib/cjs/types/WeekAndSlotRange.js +0 -3
  85. package/lib/cjs/types/WeekAndSlotRange.js.map +0 -1
  86. package/lib/cjs/types/index.js +0 -31
  87. package/lib/cjs/types/index.js.map +0 -1
  88. package/lib/cjs/types/stashed-Farm.js +0 -3
  89. package/lib/esm/constants/index.d.ts +0 -1
  90. package/lib/esm/constants/index.js.map +0 -1
  91. package/lib/esm/default-values/gca-to-server-urls.d.ts +0 -0
  92. package/lib/esm/default-values/gca-to-server-urls.js.map +0 -1
  93. package/lib/esm/index.d.ts +0 -3
  94. package/lib/esm/index.js +0 -5
  95. package/lib/esm/index.js.map +0 -1
  96. package/lib/esm/lib/create-weekly-report/index.d.ts +0 -43
  97. package/lib/esm/lib/create-weekly-report/index.js +0 -170
  98. package/lib/esm/lib/create-weekly-report/index.js.map +0 -1
  99. package/lib/esm/lib/create-weekly-report/utils/hash-leaf.d.ts +0 -7
  100. package/lib/esm/lib/create-weekly-report/utils/hash-leaf.js +0 -12
  101. package/lib/esm/lib/create-weekly-report/utils/hash-leaf.js.map +0 -1
  102. package/lib/esm/package.json +0 -1
  103. package/lib/esm/types/AuditCompleted.d.ts +0 -3
  104. package/lib/esm/types/AuditCompleted.js.map +0 -1
  105. package/lib/esm/types/AuditInherited.d.ts +0 -6
  106. package/lib/esm/types/AuditInherited.js.map +0 -1
  107. package/lib/esm/types/Device.d.ts +0 -5
  108. package/lib/esm/types/DuplicatedButPastAuditCompleted.d.ts +0 -8
  109. package/lib/esm/types/DuplicatedButPastAuditCompleted.js.map +0 -1
  110. package/lib/esm/types/Farm.d.ts +0 -20
  111. package/lib/esm/types/Farm.js.map +0 -1
  112. package/lib/esm/types/FarmStatus.d.ts +0 -14
  113. package/lib/esm/types/FarmStatus.js.map +0 -1
  114. package/lib/esm/types/GCAAndServerUrl.d.ts +0 -5
  115. package/lib/esm/types/GCAAndServerUrl.js.map +0 -1
  116. package/lib/esm/types/GCAServerResponse.d.ts +0 -6
  117. package/lib/esm/types/GCAServerResponse.js.map +0 -1
  118. package/lib/esm/types/GetEquipmentDataHandlerParams.d.ts +0 -5
  119. package/lib/esm/types/GetEquipmentDataHandlerParams.js.map +0 -1
  120. package/lib/esm/types/PayoutWalletAndSplit.d.ts +0 -17
  121. package/lib/esm/types/PayoutWalletAndSplit.js.map +0 -1
  122. package/lib/esm/types/PayoutWalletAndSplitWithRewardSplits.d.ts +0 -15
  123. package/lib/esm/types/PayoutWalletAndSplitWithRewardSplits.js.map +0 -1
  124. package/lib/esm/types/RewardSplit.d.ts +0 -5
  125. package/lib/esm/types/RewardSplit.js.map +0 -1
  126. package/lib/esm/types/RewardSplits.d.ts +0 -2
  127. package/lib/esm/types/RewardSplits.js.map +0 -1
  128. package/lib/esm/types/SlotRange.d.ts +0 -4
  129. package/lib/esm/types/SlotRange.js.map +0 -1
  130. package/lib/esm/types/WeekAndSlotRange.d.ts +0 -5
  131. package/lib/esm/types/WeekAndSlotRange.js.map +0 -1
  132. package/lib/esm/types/index.js.map +0 -1
  133. package/lib/esm/types/stashed-Farm.d.ts +0 -20
  134. package/lib/esm/types/stashed-Farm.js.map +0 -1
  135. /package/{lib/cjs → dist}/constants/index.d.ts +0 -0
  136. /package/{lib/esm → dist}/constants/index.js +0 -0
  137. /package/{lib/cjs → dist}/default-values/gca-to-server-urls.d.ts +0 -0
  138. /package/{lib/cjs → dist}/default-values/gca-to-server-urls.js +0 -0
  139. /package/{lib/cjs → dist}/types/AuditCompleted.d.ts +0 -0
  140. /package/{lib/esm → dist}/types/AuditCompleted.js +0 -0
  141. /package/{lib/cjs → dist}/types/AuditInherited.d.ts +0 -0
  142. /package/{lib/esm → dist}/types/AuditInherited.js +0 -0
  143. /package/{lib/cjs → dist}/types/Device.d.ts +0 -0
  144. /package/{lib/esm → dist}/types/Device.js +0 -0
  145. /package/{lib/cjs → dist}/types/DuplicatedButPastAuditCompleted.d.ts +0 -0
  146. /package/{lib/esm → dist}/types/DuplicatedButPastAuditCompleted.js +0 -0
  147. /package/{lib/cjs → dist}/types/Farm.d.ts +0 -0
  148. /package/{lib/esm → dist}/types/Farm.js +0 -0
  149. /package/{lib/cjs → dist}/types/FarmStatus.d.ts +0 -0
  150. /package/{lib/esm → dist}/types/FarmStatus.js +0 -0
  151. /package/{lib/cjs → dist}/types/GCAAndServerUrl.d.ts +0 -0
  152. /package/{lib/esm → dist}/types/GCAAndServerUrl.js +0 -0
  153. /package/{lib/cjs → dist}/types/GCAServerResponse.d.ts +0 -0
  154. /package/{lib/esm → dist}/types/GCAServerResponse.js +0 -0
  155. /package/{lib/cjs → dist}/types/GetEquipmentDataHandlerParams.d.ts +0 -0
  156. /package/{lib/esm → dist}/types/GetEquipmentDataHandlerParams.js +0 -0
  157. /package/{lib/cjs → dist}/types/PayoutWalletAndSplit.d.ts +0 -0
  158. /package/{lib/esm → dist}/types/PayoutWalletAndSplit.js +0 -0
  159. /package/{lib/cjs → dist}/types/PayoutWalletAndSplitWithRewardSplits.d.ts +0 -0
  160. /package/{lib/esm → dist}/types/PayoutWalletAndSplitWithRewardSplits.js +0 -0
  161. /package/{lib/cjs → dist}/types/RewardSplit.d.ts +0 -0
  162. /package/{lib/esm → dist}/types/RewardSplit.js +0 -0
  163. /package/{lib/cjs → dist}/types/RewardSplits.d.ts +0 -0
  164. /package/{lib/esm → dist}/types/RewardSplits.js +0 -0
  165. /package/{lib/cjs → dist}/types/SlotRange.d.ts +0 -0
  166. /package/{lib/esm → dist}/types/SlotRange.js +0 -0
  167. /package/{lib/cjs → dist}/types/WeekAndSlotRange.d.ts +0 -0
  168. /package/{lib/esm → dist}/types/WeekAndSlotRange.js +0 -0
  169. /package/{lib/cjs → dist}/types/index.d.ts +0 -0
  170. /package/{lib/esm → dist}/types/index.js +0 -0
  171. /package/{lib/cjs → dist}/types/stashed-Farm.d.ts +0 -0
  172. /package/{lib/esm → dist}/types/stashed-Farm.js +0 -0
  173. /package/{lib/esm/types/index.d.ts → src/types/index.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { SlotRange } from "./SlotRange";
3
+
4
+ export interface WeekAndSlotRange { week: number, slot_ranges: Array<SlotRange>, }
@@ -0,0 +1,22 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { FarmStatus } from "./FarmStatus";
3
+ import type { RewardSplits } from "./RewardSplits";
4
+ import type { SlotRange } from "./SlotRange";
5
+
6
+ export interface Farm {
7
+ hexlifiedPublicKey: string;
8
+ carbonCreditsProduced: number;
9
+ powerOutputs: Array<number>;
10
+ impactRates: Array<number>;
11
+ weeklyPayment: number;
12
+ rollingImpactPoints: number;
13
+ powerOutput: number;
14
+ shortId: bigint;
15
+ protocolFee: number;
16
+ rewardSplits: RewardSplits | null;
17
+ status: FarmStatus;
18
+ protocolFeePaymentHash: string | null;
19
+ weeksAndSlotRangesToInvertPowerMap: Record<number, Array<SlotRange>> | null;
20
+ weeksAndSlotsToInvalidatePowerMap: Record<number, Array<SlotRange>> | null;
21
+ timestampAuditedComplete: bigint | null;
22
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "baseUrl": ".",
6
+ "outDir": "dist",
7
+ "declaration": true,
8
+ "esModuleInterop": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "incremental": true,
11
+ "isolatedModules": true,
12
+ "jsx": "preserve",
13
+ "lib": ["es2020", "esnext", "dom"],
14
+ "module": "esnext",
15
+ "moduleResolution": "node",
16
+ "noErrorTruncation": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "noImplicitReturns": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "resolveJsonModule": true,
22
+ "skipLibCheck": true,
23
+ "sourceMap": true,
24
+ "strict": true,
25
+ "target": "esnext",
26
+ "typeRoots": ["node_modules/@types", "src/types"],
27
+ "types": ["node"]
28
+ },
29
+ "include": ["src/**/*.ts", "src/index.ts", "test/**/*.ts"],
30
+ "exclude": ["node_modules", "dist", "lib"]
31
+ }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GENESIS_TIMESTAMP = void 0;
4
- exports.GENESIS_TIMESTAMP = 1700352000;
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAW,UAAU,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gca-to-server-urls.js","sourceRoot":"","sources":["../../../src/default-values/gca-to-server-urls.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAE/D,sDAAsD;AACtD,QAAQ;AACR,4DAA4D;AAC5D,gBAAgB;AAChB,QAAQ;AAER,kDAAkD"}
@@ -1,3 +0,0 @@
1
- export * from "./types";
2
- export { createWeeklyReport } from "./lib/create-weekly-report";
3
- export * from "./constants";
package/lib/cjs/index.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createWeeklyReport = void 0;
18
- __exportStar(require("./types"), exports);
19
- var create_weekly_report_1 = require("./lib/create-weekly-report");
20
- Object.defineProperty(exports, "createWeeklyReport", { enumerable: true, get: function () { return create_weekly_report_1.createWeeklyReport; } });
21
- __exportStar(require("./constants"), exports);
22
- //
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,mEAAgE;AAAvD,0HAAA,kBAAkB,OAAA;AAC3B,8CAA4B;AAC5B,EAAE"}
@@ -1,43 +0,0 @@
1
- import { Farm } from "src/types/Farm";
2
- import { GCAServerResponse } from "src/types/GCAServerResponse";
3
- export type ApiRes = {
4
- filteredFarms: Farm[];
5
- rawData: GCAServerResponse;
6
- multiplier: number;
7
- };
8
- export type MerkleLeafIntermediary = {
9
- wallet: string;
10
- glowWeight: number;
11
- usdgWeight: number;
12
- };
13
- export type FinalLeaf = {
14
- wallet: string;
15
- glowWeight: string;
16
- usdgWeight: string;
17
- };
18
- export type CreateWeeklyReportArgs = {
19
- week: number;
20
- gcaUrls: string[];
21
- apiUrl: string;
22
- };
23
- export declare function createWeeklyReport(args: CreateWeeklyReportArgs): Promise<{
24
- headlineStats: {
25
- weekNumber: number;
26
- totalCreditsProduced: number;
27
- totalCreditsProducedBN: string;
28
- totalGlowWeightInFinalized: string;
29
- totalGlowWeightHuman: string;
30
- totalUSDGWeightInFinalized: string;
31
- totalUSDGWeightHuman: string;
32
- root: string;
33
- };
34
- finalLeaves: FinalLeaf[];
35
- farmsWithMerkleProofs: {
36
- proof: string[];
37
- wallet: string;
38
- glowWeight: string;
39
- usdgWeight: string;
40
- }[];
41
- farms: Farm[];
42
- rawData: GCAServerResponse;
43
- }>;
@@ -1,177 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createWeeklyReport = void 0;
7
- const hash_leaf_1 = require("./utils/hash-leaf");
8
- const merkletreejs_1 = __importDefault(require("merkletreejs"));
9
- const ethers_1 = require("ethers");
10
- const viem_1 = require("viem");
11
- /**
12
- * @dev This is actually not as intuitive as it seems.
13
- * Glow actually has 18 decimals, but glow weight is based on the amount of protocol fees (USDC) that the farm paid
14
- * Therefore, the weight is based on the amount of USDC that was paid, which has 6 decimals
15
- */
16
- const GLOW_WEIGHT_DECIMAL_PRECISION = 6;
17
- /**
18
- * @dev This is actually not as intuitive as it seems.
19
- * USDG weight is based on the amount of carbon credits produced, but the max value of a weight is ((2*64)-1) / 5 so we need to choose sensible precision to make sure that number never overflows
20
- */
21
- const USDG_WEIGHT_DECIMAL_PRECISION = 6;
22
- // const GCA_URLS = ["http://95.217.194.59:35015"];
23
- async function getFarmsForWeek(args) {
24
- const { week: weekNumber, gcaUrls, apiUrl } = args;
25
- const url = apiUrl;
26
- // const url = "http://0.0.0.0:3005/headline_farm_stats";
27
- const body = {
28
- urls: gcaUrls,
29
- week_number: weekNumber,
30
- with_full_data: true,
31
- include_unassigned_farms: false,
32
- with_raw_data: true,
33
- };
34
- const res = await fetch(url, {
35
- method: "POST",
36
- body: JSON.stringify(body),
37
- headers: {
38
- "Content-Type": "application/json",
39
- },
40
- });
41
- const _json = await res.json();
42
- return _json;
43
- }
44
- async function createWeeklyReport(args) {
45
- const map = new Map();
46
- function addValueToMap(key, value, map) {
47
- if (map.has(key)) {
48
- //+= everything
49
- const existingValue = map.get(key);
50
- existingValue.glowWeight += value.glowWeight;
51
- existingValue.usdgWeight += value.usdgWeight;
52
- map.set(key, existingValue);
53
- }
54
- else {
55
- map.set(key, value);
56
- }
57
- }
58
- const apiResposne = await getFarmsForWeek(args);
59
- const farms = apiResposne.filteredFarms;
60
- const rawData = apiResposne.rawData;
61
- let totalCreditsProduced = 0;
62
- //log the total farms in farms
63
- for (const farm of farms) {
64
- // const {
65
- // shortId,
66
- // payoutWallet,
67
- // installerGlowFeePercent,
68
- // installerUsdgFeePercent,
69
- // } = farm;
70
- // const key = farm.payoutWallet;
71
- // farm.carbonCreditsProduced =
72
- farm.status === "Unassigned" ? 0 : farm.carbonCreditsProduced;
73
- console.log(farm.status);
74
- if (farm.carbonCreditsProduced < 0) {
75
- throw new Error("Carbon credits produced is less than 0");
76
- }
77
- totalCreditsProduced += farm.carbonCreditsProduced;
78
- // const value = {
79
- // wallet: payoutWallet,
80
- // glowWeight: farm.weeklyPayment * (1 - installerGlowFeePercent),
81
- // usdgWeight: farm.carbonCreditsProduced * (1 - installerUsdgFeePercent),
82
- // };
83
- // const installerKey = farm.installerWallet;
84
- // const installerValue = {
85
- // wallet: farm.installerWallet,
86
- // glowWeight: farm.weeklyPayment * installerGlowFeePercent,
87
- // usdgWeight: farm.carbonCreditsProduced * installerUsdgFeePercent,
88
- // };
89
- if (!farm.rewardSplits)
90
- throw new Error("No reward splits");
91
- const sumOfRewardSplitsGlowWeight = farm.rewardSplits.reduce((acc, rewardSplit) => acc + rewardSplit.glowSplitPercent, 0);
92
- const sumOfRewardSplitsUSDGWeight = farm.rewardSplits.reduce((acc, rewardSplit) => acc + rewardSplit.usdgSplitPercent, 0);
93
- if (sumOfRewardSplitsGlowWeight !== 1)
94
- throw new Error("Glow weight splits do not add up to 1");
95
- if (sumOfRewardSplitsUSDGWeight !== 1)
96
- throw new Error("USDG weight splits do not add up to 1");
97
- for (const rewardSplit of farm.rewardSplits) {
98
- const value = {
99
- wallet: rewardSplit.walletAddress,
100
- glowWeight: farm.weeklyPayment * rewardSplit.glowSplitPercent,
101
- usdgWeight: farm.carbonCreditsProduced * rewardSplit.usdgSplitPercent,
102
- };
103
- addValueToMap(rewardSplit.walletAddress, value, map);
104
- }
105
- // addValueToMap(key, value, map);
106
- // addValueToMap(installerKey, installerValue, map);
107
- }
108
- const merkleLeaves = Array.from(map.values());
109
- const finalLeaves = merkleLeaves.map(({ wallet, glowWeight, usdgWeight }) => ({
110
- wallet,
111
- glowWeight: (0, viem_1.parseUnits)(glowWeight.toString(), GLOW_WEIGHT_DECIMAL_PRECISION).toString(),
112
- usdgWeight: (0, viem_1.parseUnits)(usdgWeight.toString(), USDG_WEIGHT_DECIMAL_PRECISION).toString(),
113
- }));
114
- const leaves = finalLeaves.map((leaf) => (0, hash_leaf_1.hashLeaf)({
115
- address: leaf.wallet,
116
- glowWeight: leaf.glowWeight,
117
- usdcWeight: leaf.usdgWeight,
118
- }));
119
- const tree = new merkletreejs_1.default(leaves, ethers_1.ethers.utils.keccak256, { sort: true });
120
- const root = tree.getHexRoot();
121
- const totalGlowWeightFinalizedLeavesSum = finalLeaves.reduce((acc, { glowWeight }) => acc.add(glowWeight), ethers_1.ethers.BigNumber.from(0));
122
- const totalGCCWeightFinalizedLeavesSum = finalLeaves.reduce((acc, { usdgWeight }) => acc.add(usdgWeight), ethers_1.ethers.BigNumber.from(0));
123
- const headlineStats = {
124
- weekNumber: args.week,
125
- totalCreditsProduced,
126
- totalCreditsProducedBN: (0, viem_1.parseUnits)(totalCreditsProduced.toString(), 18).toString(),
127
- totalGlowWeightInFinalized: totalGlowWeightFinalizedLeavesSum.toString(),
128
- totalGlowWeightHuman: (0, viem_1.formatUnits)(BigInt(totalGlowWeightFinalizedLeavesSum.toString()), GLOW_WEIGHT_DECIMAL_PRECISION).toString(),
129
- totalUSDGWeightInFinalized: totalGCCWeightFinalizedLeavesSum.toString(),
130
- totalUSDGWeightHuman: (0, viem_1.formatUnits)(BigInt(totalGCCWeightFinalizedLeavesSum.toString()), USDG_WEIGHT_DECIMAL_PRECISION).toString(),
131
- root: root,
132
- };
133
- const farmsWithMerkleProofs = finalLeaves.map((leaf) => {
134
- const hashedLeaf = (0, hash_leaf_1.hashLeaf)({
135
- address: leaf.wallet,
136
- glowWeight: leaf.glowWeight,
137
- usdcWeight: leaf.usdgWeight,
138
- });
139
- const proof = tree.getHexProof(hashedLeaf);
140
- const isValid = tree.verify(proof, hashedLeaf, root);
141
- if (!isValid) {
142
- throw new Error("Invalid proof");
143
- }
144
- return {
145
- ...leaf,
146
- proof,
147
- };
148
- });
149
- //-----------------------------------------------------//
150
- //-Some invariant tests in case something got messed up//
151
- //-----------------------------------------------------//
152
- //Make sure that the sum of all the glow weight is equal to the sum of all the glow weight in the final leaves
153
- let forLoopedGlowWeightSum = ethers_1.ethers.BigNumber.from(0);
154
- for (const farm of farmsWithMerkleProofs) {
155
- forLoopedGlowWeightSum = forLoopedGlowWeightSum.add(ethers_1.BigNumber.from(farm.glowWeight));
156
- }
157
- if (!forLoopedGlowWeightSum.eq(totalGlowWeightFinalizedLeavesSum)) {
158
- throw new Error("Glow weight sum is not equal");
159
- }
160
- //do the same for gcc
161
- let forLoopedGCCWeightSum = ethers_1.ethers.BigNumber.from(0);
162
- for (const farm of farmsWithMerkleProofs) {
163
- forLoopedGCCWeightSum = forLoopedGCCWeightSum.add(ethers_1.BigNumber.from(farm.usdgWeight));
164
- }
165
- if (!forLoopedGCCWeightSum.eq(totalGCCWeightFinalizedLeavesSum)) {
166
- throw new Error("GCC weight sum is not equal");
167
- }
168
- return {
169
- headlineStats,
170
- finalLeaves,
171
- farmsWithMerkleProofs,
172
- farms,
173
- rawData,
174
- };
175
- }
176
- exports.createWeeklyReport = createWeeklyReport;
177
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/create-weekly-report/index.ts"],"names":[],"mappings":";;;;;;AACA,iDAA6C;AAC7C,gEAAsC;AACtC,mCAA2C;AAE3C,+BAA+C;AAoB/C;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAMxC,mDAAmD;AACnD,KAAK,UAAU,eAAe,CAAC,IAA4B;IACzD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnD,MAAM,GAAG,GAAG,MAAM,CAAC;IACnB,yDAAyD;IACzD,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,UAAU;QACvB,cAAc,EAAE,IAAI;QACpB,wBAAwB,EAAE,KAAK;QAC/B,aAAa,EAAE,IAAI;KACpB,CAAC;IAEF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC/B,OAAO,KAAe,CAAC;AACzB,CAAC;AAEM,KAAK,UAAU,kBAAkB,CAAC,IAA4B;IACnE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkC,CAAC;IAEtD,SAAS,aAAa,CACpB,GAAW,EACX,KAA6B,EAC7B,GAAwC;QAExC,IAAI,GAAG,CAAC,GAAG,CAA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ACJ,CAAC;IAED,IAAI,CAAC,sBAAsB,CAAC,EAAE,CAAC,iCAAiC,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,qBAAqB;IACrB,IAAI,qBAAqB,GAAqB,eAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvE,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;QACzC,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAC/C,kBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAChC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,gCAAgC,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAED,OAAO;QACL,aAAa;QACb,WAAW;QACX,qBAAqB;QACrB,KAAK;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AArLD,gDAqLC"}
@@ -1,7 +0,0 @@
1
- type HashLeafArgs = {
2
- address: string;
3
- glowWeight: string;
4
- usdcWeight: string;
5
- };
6
- export declare function hashLeaf({ address, glowWeight, usdcWeight, }: HashLeafArgs): string;
7
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hashLeaf = void 0;
4
- const ethers_1 = require("ethers");
5
- const leafTypes = ["address", "uint256", "uint256"];
6
- function hashLeaf({ address, glowWeight, usdcWeight, }) {
7
- const hash = ethers_1.ethers.utils.solidityKeccak256(leafTypes, [
8
- address,
9
- glowWeight,
10
- usdcWeight,
11
- ]);
12
- return hash;
13
- }
14
- exports.hashLeaf = hashLeaf;
15
- //
16
- //# sourceMappingURL=hash-leaf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash-leaf.js","sourceRoot":"","sources":["../../../../../src/lib/create-weekly-report/utils/hash-leaf.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAOpD,SAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,UAAU,EACV,UAAU,GACG;IACb,MAAM,IAAI,GAAG,eAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,EAAE;QACrD,OAAO;QACP,UAAU;QACV,UAAU;KACX,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC;AAXD,4BAWC;AAED,EAAE"}
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=AuditCompleted.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuditCompleted.js","sourceRoot":"","sources":["../../../src/types/AuditCompleted.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=AuditInherited.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuditInherited.js","sourceRoot":"","sources":["../../../src/types/AuditInherited.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=Device.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Device.js","sourceRoot":"","sources":["../../../src/types/Device.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=DuplicatedButPastAuditCompleted.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DuplicatedButPastAuditCompleted.js","sourceRoot":"","sources":["../../../src/types/DuplicatedButPastAuditCompleted.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Farm.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=FarmStatus.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=GCAAndServerUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GCAAndServerUrl.js","sourceRoot":"","sources":["../../../src/types/GCAAndServerUrl.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=GCAServerResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GCAServerResponse.js","sourceRoot":"","sources":["../../../src/types/GCAServerResponse.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=GetEquipmentDataHandlerParams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetEquipmentDataHandlerParams.js","sourceRoot":"","sources":["../../../src/types/GetEquipmentDataHandlerParams.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PayoutWalletAndSplit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PayoutWalletAndSplit.js","sourceRoot":"","sources":["../../../src/types/PayoutWalletAndSplit.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PayoutWalletAndSplitWithRewardSplits.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PayoutWalletAndSplitWithRewardSplits.js","sourceRoot":"","sources":["../../../src/types/PayoutWalletAndSplitWithRewardSplits.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=RewardSplit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RewardSplit.js","sourceRoot":"","sources":["../../../src/types/RewardSplit.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=RewardSplits.js.map
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=SlotRange.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SlotRange.js","sourceRoot":"","sources":["../../../src/types/SlotRange.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=WeekAndSlotRange.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WeekAndSlotRange.js","sourceRoot":"","sources":["../../../src/types/WeekAndSlotRange.ts"],"names":[],"mappings":""}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./AuditCompleted"), exports);
18
- __exportStar(require("./AuditInherited"), exports);
19
- __exportStar(require("./Device"), exports);
20
- __exportStar(require("./DuplicatedButPastAuditCompleted"), exports);
21
- __exportStar(require("./Farm"), exports);
22
- __exportStar(require("./FarmStatus"), exports);
23
- __exportStar(require("./GCAServerResponse"), exports);
24
- __exportStar(require("./GetEquipmentDataHandlerParams"), exports);
25
- __exportStar(require("./PayoutWalletAndSplit"), exports);
26
- __exportStar(require("./PayoutWalletAndSplitWithRewardSplits"), exports);
27
- __exportStar(require("./RewardSplit"), exports);
28
- __exportStar(require("./RewardSplits"), exports);
29
- __exportStar(require("./SlotRange"), exports);
30
- __exportStar(require("./WeekAndSlotRange"), exports);
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,2CAAyB;AACzB,oEAAkD;AAClD,yCAAuB;AACvB,+CAA6B;AAC7B,sDAAoC;AACpC,kEAAgD;AAChD,yDAAuC;AACvC,yEAAuD;AACvD,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,qDAAmC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=stashed-Farm.js.map
@@ -1 +0,0 @@
1
- export declare const GENESIS_TIMESTAMP: number;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAW,UAAU,CAAC"}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"file":"gca-to-server-urls.js","sourceRoot":"","sources":["../../../src/default-values/gca-to-server-urls.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAE/D,sDAAsD;AACtD,QAAQ;AACR,4DAA4D;AAC5D,gBAAgB;AAChB,QAAQ;AAER,kDAAkD"}
@@ -1,3 +0,0 @@
1
- export * from "./types";
2
- export { createWeeklyReport } from "./lib/create-weekly-report";
3
- export * from "./constants";
package/lib/esm/index.js DELETED
@@ -1,5 +0,0 @@
1
- export * from "./types";
2
- export { createWeeklyReport } from "./lib/create-weekly-report";
3
- export * from "./constants";
4
- //
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,cAAc,aAAa,CAAC;AAC5B,EAAE"}
@@ -1,43 +0,0 @@
1
- import { Farm } from "src/types/Farm";
2
- import { GCAServerResponse } from "src/types/GCAServerResponse";
3
- export type ApiRes = {
4
- filteredFarms: Farm[];
5
- rawData: GCAServerResponse;
6
- multiplier: number;
7
- };
8
- export type MerkleLeafIntermediary = {
9
- wallet: string;
10
- glowWeight: number;
11
- usdgWeight: number;
12
- };
13
- export type FinalLeaf = {
14
- wallet: string;
15
- glowWeight: string;
16
- usdgWeight: string;
17
- };
18
- export type CreateWeeklyReportArgs = {
19
- week: number;
20
- gcaUrls: string[];
21
- apiUrl: string;
22
- };
23
- export declare function createWeeklyReport(args: CreateWeeklyReportArgs): Promise<{
24
- headlineStats: {
25
- weekNumber: number;
26
- totalCreditsProduced: number;
27
- totalCreditsProducedBN: string;
28
- totalGlowWeightInFinalized: string;
29
- totalGlowWeightHuman: string;
30
- totalUSDGWeightInFinalized: string;
31
- totalUSDGWeightHuman: string;
32
- root: string;
33
- };
34
- finalLeaves: FinalLeaf[];
35
- farmsWithMerkleProofs: {
36
- proof: string[];
37
- wallet: string;
38
- glowWeight: string;
39
- usdgWeight: string;
40
- }[];
41
- farms: Farm[];
42
- rawData: GCAServerResponse;
43
- }>;