@gzeoneth/gov-tracker 0.2.1-beta.c266765 → 0.2.1-beta.d575294

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 (172) hide show
  1. package/README.md +40 -0
  2. package/dist/abis.d.ts +3 -0
  3. package/dist/abis.d.ts.map +1 -1
  4. package/dist/abis.js +8 -1
  5. package/dist/abis.js.map +1 -1
  6. package/dist/cli/cli.js +88 -44
  7. package/dist/cli/cli.js.map +1 -1
  8. package/dist/cli/lib/cli.d.ts +41 -3
  9. package/dist/cli/lib/cli.d.ts.map +1 -1
  10. package/dist/cli/lib/cli.js +333 -116
  11. package/dist/cli/lib/cli.js.map +1 -1
  12. package/dist/cli/lib/json-state.d.ts +23 -0
  13. package/dist/cli/lib/json-state.d.ts.map +1 -1
  14. package/dist/cli/lib/json-state.js +51 -4
  15. package/dist/cli/lib/json-state.js.map +1 -1
  16. package/dist/constants.d.ts +39 -1
  17. package/dist/constants.d.ts.map +1 -1
  18. package/dist/constants.js +47 -2
  19. package/dist/constants.js.map +1 -1
  20. package/dist/data/bundled-cache.json +10988 -1580
  21. package/dist/discovery/governor-discovery.d.ts.map +1 -1
  22. package/dist/discovery/governor-discovery.js +50 -35
  23. package/dist/discovery/governor-discovery.js.map +1 -1
  24. package/dist/discovery/timelock-discovery.d.ts +15 -6
  25. package/dist/discovery/timelock-discovery.d.ts.map +1 -1
  26. package/dist/discovery/timelock-discovery.js +27 -11
  27. package/dist/discovery/timelock-discovery.js.map +1 -1
  28. package/dist/election/contracts.d.ts +8 -0
  29. package/dist/election/contracts.d.ts.map +1 -0
  30. package/dist/election/contracts.js +28 -0
  31. package/dist/election/contracts.js.map +1 -0
  32. package/dist/election/details.d.ts +15 -0
  33. package/dist/election/details.d.ts.map +1 -0
  34. package/dist/election/details.js +157 -0
  35. package/dist/election/details.js.map +1 -0
  36. package/dist/election/index.d.ts +11 -0
  37. package/dist/election/index.d.ts.map +1 -0
  38. package/dist/election/index.js +48 -0
  39. package/dist/election/index.js.map +1 -0
  40. package/dist/election/params.d.ts +13 -0
  41. package/dist/election/params.d.ts.map +1 -0
  42. package/dist/election/params.js +93 -0
  43. package/dist/election/params.js.map +1 -0
  44. package/dist/election/participants.d.ts +6 -0
  45. package/dist/election/participants.d.ts.map +1 -0
  46. package/dist/election/participants.js +104 -0
  47. package/dist/election/participants.js.map +1 -0
  48. package/dist/election/prepare.d.ts +10 -0
  49. package/dist/election/prepare.d.ts.map +1 -0
  50. package/dist/election/prepare.js +52 -0
  51. package/dist/election/prepare.js.map +1 -0
  52. package/dist/election/proposal-ids.d.ts +18 -0
  53. package/dist/election/proposal-ids.d.ts.map +1 -0
  54. package/dist/election/proposal-ids.js +77 -0
  55. package/dist/election/proposal-ids.js.map +1 -0
  56. package/dist/election/status.d.ts +15 -0
  57. package/dist/election/status.d.ts.map +1 -0
  58. package/dist/election/status.js +102 -0
  59. package/dist/election/status.js.map +1 -0
  60. package/dist/election/tracking.d.ts +28 -0
  61. package/dist/election/tracking.d.ts.map +1 -0
  62. package/dist/election/tracking.js +412 -0
  63. package/dist/election/tracking.js.map +1 -0
  64. package/dist/index.d.ts +6 -4
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +51 -11
  67. package/dist/index.js.map +1 -1
  68. package/dist/stages/l2-to-l1-message.d.ts +3 -1
  69. package/dist/stages/l2-to-l1-message.d.ts.map +1 -1
  70. package/dist/stages/l2-to-l1-message.js +6 -6
  71. package/dist/stages/l2-to-l1-message.js.map +1 -1
  72. package/dist/stages/proposal-created.d.ts +1 -0
  73. package/dist/stages/proposal-created.d.ts.map +1 -1
  74. package/dist/stages/proposal-created.js +1 -0
  75. package/dist/stages/proposal-created.js.map +1 -1
  76. package/dist/stages/proposal-queued.d.ts +1 -0
  77. package/dist/stages/proposal-queued.d.ts.map +1 -1
  78. package/dist/stages/proposal-queued.js +3 -1
  79. package/dist/stages/proposal-queued.js.map +1 -1
  80. package/dist/stages/retryables.js +2 -2
  81. package/dist/stages/retryables.js.map +1 -1
  82. package/dist/stages/timelock.d.ts +3 -1
  83. package/dist/stages/timelock.d.ts.map +1 -1
  84. package/dist/stages/timelock.js +12 -12
  85. package/dist/stages/timelock.js.map +1 -1
  86. package/dist/stages/utils.d.ts +5 -9
  87. package/dist/stages/utils.d.ts.map +1 -1
  88. package/dist/stages/utils.js +34 -29
  89. package/dist/stages/utils.js.map +1 -1
  90. package/dist/tracker/cache.d.ts +10 -6
  91. package/dist/tracker/cache.d.ts.map +1 -1
  92. package/dist/tracker/cache.js +36 -13
  93. package/dist/tracker/cache.js.map +1 -1
  94. package/dist/tracker/checkpoint-helpers.d.ts +81 -0
  95. package/dist/tracker/checkpoint-helpers.d.ts.map +1 -0
  96. package/dist/tracker/checkpoint-helpers.js +201 -0
  97. package/dist/tracker/checkpoint-helpers.js.map +1 -0
  98. package/dist/tracker/discovery.d.ts +1 -1
  99. package/dist/tracker/discovery.d.ts.map +1 -1
  100. package/dist/tracker/discovery.js +11 -3
  101. package/dist/tracker/discovery.js.map +1 -1
  102. package/dist/tracker/execute.d.ts.map +1 -1
  103. package/dist/tracker/execute.js +1 -25
  104. package/dist/tracker/execute.js.map +1 -1
  105. package/dist/tracker/pipeline.d.ts.map +1 -1
  106. package/dist/tracker/pipeline.js +26 -11
  107. package/dist/tracker/pipeline.js.map +1 -1
  108. package/dist/tracker/query.d.ts +1 -0
  109. package/dist/tracker/query.d.ts.map +1 -1
  110. package/dist/tracker/query.js +14 -61
  111. package/dist/tracker/query.js.map +1 -1
  112. package/dist/tracker/state.d.ts +0 -10
  113. package/dist/tracker/state.d.ts.map +1 -1
  114. package/dist/tracker/state.js +1 -28
  115. package/dist/tracker/state.js.map +1 -1
  116. package/dist/tracker.d.ts +79 -7
  117. package/dist/tracker.d.ts.map +1 -1
  118. package/dist/tracker.js +357 -43
  119. package/dist/tracker.js.map +1 -1
  120. package/dist/types/config.d.ts +49 -0
  121. package/dist/types/config.d.ts.map +1 -1
  122. package/dist/types/core.d.ts +3 -1
  123. package/dist/types/core.d.ts.map +1 -1
  124. package/dist/types/election.d.ts +66 -11
  125. package/dist/types/election.d.ts.map +1 -1
  126. package/dist/types/index.d.ts +4 -6
  127. package/dist/types/index.d.ts.map +1 -1
  128. package/dist/types/index.js +2 -3
  129. package/dist/types/index.js.map +1 -1
  130. package/dist/types/stages.d.ts +66 -7
  131. package/dist/types/stages.d.ts.map +1 -1
  132. package/dist/types/stages.js.map +1 -1
  133. package/dist/types/tracking.d.ts +10 -10
  134. package/dist/types/tracking.d.ts.map +1 -1
  135. package/dist/utils/block-cache.d.ts +50 -0
  136. package/dist/utils/block-cache.d.ts.map +1 -0
  137. package/dist/utils/block-cache.js +80 -0
  138. package/dist/utils/block-cache.js.map +1 -0
  139. package/dist/utils/formatters.d.ts +91 -0
  140. package/dist/utils/formatters.d.ts.map +1 -0
  141. package/dist/utils/formatters.js +327 -0
  142. package/dist/utils/formatters.js.map +1 -0
  143. package/dist/utils/multicall.d.ts +52 -0
  144. package/dist/utils/multicall.d.ts.map +1 -0
  145. package/dist/utils/multicall.js +75 -0
  146. package/dist/utils/multicall.js.map +1 -0
  147. package/dist/utils/rpc-utils.d.ts +7 -1
  148. package/dist/utils/rpc-utils.d.ts.map +1 -1
  149. package/dist/utils/rpc-utils.js +42 -29
  150. package/dist/utils/rpc-utils.js.map +1 -1
  151. package/dist/utils/salt-computation.d.ts.map +1 -1
  152. package/dist/utils/salt-computation.js +33 -7
  153. package/dist/utils/salt-computation.js.map +1 -1
  154. package/dist/utils/sanitize.d.ts.map +1 -1
  155. package/dist/utils/sanitize.js +3 -0
  156. package/dist/utils/sanitize.js.map +1 -1
  157. package/dist/utils/stage-metadata.d.ts +0 -20
  158. package/dist/utils/stage-metadata.d.ts.map +1 -1
  159. package/dist/utils/stage-metadata.js +29 -44
  160. package/dist/utils/stage-metadata.js.map +1 -1
  161. package/dist/utils/timing.d.ts.map +1 -1
  162. package/dist/utils/timing.js +2 -1
  163. package/dist/utils/timing.js.map +1 -1
  164. package/package.json +3 -2
  165. package/dist/election.d.ts +0 -312
  166. package/dist/election.d.ts.map +0 -1
  167. package/dist/election.js +0 -884
  168. package/dist/election.js.map +0 -1
  169. package/dist/types/cross-chain.d.ts +0 -24
  170. package/dist/types/cross-chain.d.ts.map +0 -1
  171. package/dist/types/cross-chain.js +0 -6
  172. package/dist/types/cross-chain.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"details.js","sourceRoot":"","sources":["../../src/election/details.ts"],"names":[],"mappings":";;AAmBA,8DAsCC;AAED,4DAwFC;AAMD,0DAsCC;AAMD,wDAcC;AAnND,mCAA2C;AAC3C,4CAAiD;AACjD,kDAAoD;AACpD,kCAA0D;AAC1D,4CAA0C;AAQ1C,kDAA+D;AAC/D,2CAAoE;AACpE,iDAAkF;AAClF,iDAAqE;AAErE,MAAM,GAAG,GAAG,gBAAO,CAAC,QAAQ,CAAC;AAEtB,KAAK,UAAU,yBAAyB,CAC7C,aAAqB,EACrB,QAAmC,EACnC,yBAAiC,qBAAS,CAAC,yBAAyB;IAEpE,GAAG,CAAC,2CAA2C,EAAE,aAAa,CAAC,CAAC;IAEhE,MAAM,UAAU,GAAG,MAAM,IAAA,oCAAqB,EAAC,aAAa,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAAC;IAChG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,GAAG,CAAC,mCAAmC,EAAE,aAAa,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,8BAAkB,EAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;IAEtE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9D,IAAA,4BAAa,EAAC,UAAU,EAAE,QAAQ,EAAE,sBAAsB,CAAC;QAC3D,IAAA,mCAAoB,EAAC,UAAU,EAAE,QAAQ,EAAE,sBAAsB,C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AU,EAAE,CAAC,CAAC,UAAU;YACxB,gBAAgB,EAAE,CAAC,CAAC,gBAAgB;YACpC,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,eAAe,EAAE,CAAC,CAAC,eAAe;SACnC,CAAC,CAAC;QACH,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE;QACnD,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;KAC/C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAA8B;IACnE,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrC,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,cAAc,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE;YAC3C,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { getNomineeGovernor, getMemberGovernor } from "./contracts";
2
+ export { clearElectionCache, getElectionProposalId, getMemberElectionProposalId, } from "./proposal-ids";
3
+ export { getElectionProposalParams, getMemberElectionProposalParams } from "./params";
4
+ export type { ElectionProposalParams } from "./params";
5
+ export { getContenders, getNomineesWithVotes, getExcludedNominees } from "./participants";
6
+ export { getNomineeElectionDetails, getMemberElectionDetails, serializeNomineeDetails, serializeMemberDetails, } from "./details";
7
+ export { prepareElectionCreation, prepareMemberElectionTrigger, prepareMemberElectionExecution, } from "./prepare";
8
+ export type { PreparedElectionCreation } from "./prepare";
9
+ export { getElectionCount, checkElectionStatus, hasVettingPeriod, determineElectionPhase, } from "./status";
10
+ export { trackElectionProposal, trackAllElections, trackIncompleteElections, getElectionIndexForProposalId, } from "./tracking";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/election/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGpE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AACtF,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1F,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAG1D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Election Module Public API
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getElectionIndexForProposalId = exports.trackIncompleteElections = exports.trackAllElections = exports.trackElectionProposal = exports.determineElectionPhase = exports.hasVettingPeriod = exports.checkElectionStatus = exports.getElectionCount = exports.prepareMemberElectionExecution = exports.prepareMemberElectionTrigger = exports.prepareElectionCreation = exports.serializeMemberDetails = exports.serializeNomineeDetails = exports.getMemberElectionDetails = exports.getNomineeElectionDetails = exports.getExcludedNominees = exports.getNomineesWithVotes = exports.getContenders = exports.getMemberElectionProposalParams = exports.getElectionProposalParams = exports.getMemberElectionProposalId = exports.getElectionProposalId = exports.clearElectionCache = exports.getMemberGovernor = exports.getNomineeGovernor = void 0;
7
+ // Contracts
8
+ var contracts_1 = require("./contracts");
9
+ Object.defineProperty(exports, "getNomineeGovernor", { enumerable: true, get: function () { return contracts_1.getNomineeGovernor; } });
10
+ Object.defineProperty(exports, "getMemberGovernor", { enumerable: true, get: function () { return contracts_1.getMemberGovernor; } });
11
+ // Proposal IDs
12
+ var proposal_ids_1 = require("./proposal-ids");
13
+ Object.defineProperty(exports, "clearElectionCache", { enumerable: true, get: function () { return proposal_ids_1.clearElectionCache; } });
14
+ Object.defineProperty(exports, "getElectionProposalId", { enumerable: true, get: function () { return proposal_ids_1.getElectionProposalId; } });
15
+ Object.defineProperty(exports, "getMemberElectionProposalId", { enumerable: true, get: function () { return proposal_ids_1.getMemberElectionProposalId; } });
16
+ // Params
17
+ var params_1 = require("./params");
18
+ Object.defineProperty(exports, "getElectionProposalParams", { enumerable: true, get: function () { return params_1.getElectionProposalParams; } });
19
+ Object.defineProperty(exports, "getMemberElectionProposalParams", { enumerable: true, get: function () { return params_1.getMemberElectionProposalParams; } });
20
+ // Participants
21
+ var participants_1 = require("./participants");
22
+ Object.defineProperty(exports, "getContenders", { enumerable: true, get: function () { return participants_1.getContenders; } });
23
+ Object.defineProperty(exports, "getNomineesWithVotes", { enumerable: true, get: function () { return participants_1.getNomineesWithVotes; } });
24
+ Object.defineProperty(exports, "getExcludedNominees", { enumerable: true, get: function () { return participants_1.getExcludedNominees; } });
25
+ // Details
26
+ var details_1 = require("./details");
27
+ Object.defineProperty(exports, "getNomineeElectionDetails", { enumerable: true, get: function () { return details_1.getNomineeElectionDetails; } });
28
+ Object.defineProperty(exports, "getMemberElectionDetails", { enumerable: true, get: function () { return details_1.getMemberElectionDetails; } });
29
+ Object.defineProperty(exports, "serializeNomineeDetails", { enumerable: true, get: function () { return details_1.serializeNomineeDetails; } });
30
+ Object.defineProperty(exports, "serializeMemberDetails", { enumerable: true, get: function () { return details_1.serializeMemberDetails; } });
31
+ // Prepare
32
+ var prepare_1 = require("./prepare");
33
+ Object.defineProperty(exports, "prepareElectionCreation", { enumerable: true, get: function () { return prepare_1.prepareElectionCreation; } });
34
+ Object.defineProperty(exports, "prepareMemberElectionTrigger", { enumerable: true, get: function () { return prepare_1.prepareMemberElectionTrigger; } });
35
+ Object.defineProperty(exports, "prepareMemberElectionExecution", { enumerable: true, get: function () { return prepare_1.prepareMemberElectionExecution; } });
36
+ // Status
37
+ var status_1 = require("./status");
38
+ Object.defineProperty(exports, "getElectionCount", { enumerable: true, get: function () { return status_1.getElectionCount; } });
39
+ Object.defineProperty(exports, "checkElectionStatus", { enumerable: true, get: function () { return status_1.checkElectionStatus; } });
40
+ Object.defineProperty(exports, "hasVettingPeriod", { enumerable: true, get: function () { return status_1.hasVettingPeriod; } });
41
+ Object.defineProperty(exports, "determineElectionPhase", { enumerable: true, get: function () { return status_1.determineElectionPhase; } });
42
+ // Tracking
43
+ var tracking_1 = require("./tracking");
44
+ Object.defineProperty(exports, "trackElectionProposal", { enumerable: true, get: function () { return tracking_1.trackElectionProposal; } });
45
+ Object.defineProperty(exports, "trackAllElections", { enumerable: true, get: function () { return tracking_1.trackAllElections; } });
46
+ Object.defineProperty(exports, "trackIncompleteElections", { enumerable: true, get: function () { return tracking_1.trackIncompleteElections; } });
47
+ Object.defineProperty(exports, "getElectionIndexForProposalId", { enumerable: true, get: function () { return tracking_1.getElectionIndexForProposalId; } });
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/election/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;;;AAE/E,YAAY;AACZ,yCAAoE;AAA3D,+GAAA,kBAAkB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAE9C,eAAe;AACf,+CAIwB;AAHtB,kHAAA,kBAAkB,OAAA;AAClB,qHAAA,qBAAqB,OAAA;AACrB,2HAAA,2BAA2B,OAAA;AAG7B,SAAS;AACT,mCAAsF;AAA7E,mHAAA,yBAAyB,OAAA;AAAE,yHAAA,+BAA+B,OAAA;AAGnE,eAAe;AACf,+CAA0F;AAAjF,6GAAA,aAAa,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAEjE,UAAU;AACV,qCAKmB;AAJjB,oHAAA,yBAAyB,OAAA;AACzB,mHAAA,wBAAwB,OAAA;AACxB,kHAAA,uBAAuB,OAAA;AACvB,iHAAA,sBAAsB,OAAA;AAGxB,UAAU;AACV,qCAImB;AAHjB,kHAAA,uBAAuB,OAAA;AACvB,uHAAA,4BAA4B,OAAA;AAC5B,yHAAA,8BAA8B,OAAA;AAIhC,SAAS;AACT,mCAKkB;AAJhB,0GAAA,gBAAgB,OAAA;AAChB,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAChB,gHAAA,sBAAsB,OAAA;AAGxB,WAAW;AACX,uCAKoB;AAJlB,iHAAA,qBAAqB,OAAA;AACrB,6GAAA,iBAAiB,OAAA;AACjB,oHAAA,wBAAwB,OAAA;AACxB,yHAAA,6BAA6B,OAAA"}
@@ -0,0 +1,13 @@
1
+ import { ethers, BigNumber } from "ethers";
2
+ import { PreparedTransaction } from "../types";
3
+ export interface ElectionProposalParams {
4
+ targets: string[];
5
+ values: BigNumber[];
6
+ calldatas: string[];
7
+ description: string;
8
+ descriptionHash: string;
9
+ }
10
+ export declare function buildExecuteTransaction(params: ElectionProposalParams, governorAddress: string, description: string): PreparedTransaction;
11
+ export declare function getElectionProposalParams(electionIndex: number, provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<ElectionProposalParams | null>;
12
+ export declare function getMemberElectionProposalParams(electionIndex: number, provider: ethers.providers.Provider, memberGovernorAddress?: string): Promise<ElectionProposalParams | null>;
13
+ //# sourceMappingURL=params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/election/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAM3C,OAAO,EAAE,mBAAmB,EAA4B,MAAM,UAAU,CAAC;AAMzE,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAqDD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,sBAAsB,EAC9B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,GAClB,mBAAmB,CAgBrB;AAED,wBAAsB,yBAAyB,CAC7C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAWxC;AAED,wBAAsB,+BAA+B,CACnD,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,qBAAqB,GAAE,MAA2C,GACjE,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAmBxC"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildExecuteTransaction = buildExecuteTransaction;
4
+ exports.getElectionProposalParams = getElectionProposalParams;
5
+ exports.getMemberElectionProposalParams = getMemberElectionProposalParams;
6
+ const constants_1 = require("../constants");
7
+ const rpc_utils_1 = require("../utils/rpc-utils");
8
+ const abis_1 = require("../abis");
9
+ const salt_computation_1 = require("../utils/salt-computation");
10
+ const logger_1 = require("../utils/logger");
11
+ const contracts_1 = require("./contracts");
12
+ const proposal_ids_1 = require("./proposal-ids");
13
+ const log = logger_1.loggers.election;
14
+ async function findProposalCreatedParams(proposalId, governorAddress, governor, provider) {
15
+ const topic = abis_1.proposalCreatedInterface.getEventTopic("ProposalCreated");
16
+ let startBlock;
17
+ try {
18
+ const snapshot = await (0, rpc_utils_1.queryWithRetry)(() => governor.proposalSnapshot(proposalId));
19
+ startBlock = Math.max(0, snapshot.toNumber() - 1000);
20
+ }
21
+ catch {
22
+ const currentBlock = await (0, rpc_utils_1.queryWithRetry)(() => provider.getBlockNumber());
23
+ startBlock = Math.max(0, currentBlock - 10000);
24
+ }
25
+ const currentBlock = await (0, rpc_utils_1.queryWithRetry)(() => provider.getBlockNumber());
26
+ const logs = await (0, rpc_utils_1.queryWithRetry)(() => provider.getLogs({
27
+ address: governorAddress,
28
+ topics: [topic],
29
+ fromBlock: startBlock,
30
+ toBlock: currentBlock,
31
+ }));
32
+ for (const eventLog of logs) {
33
+ try {
34
+ const parsed = abis_1.proposalCreatedInterface.parseLog(eventLog);
35
+ const args = parsed.args;
36
+ if (args.proposalId.toString() === proposalId) {
37
+ log("Found ProposalCreated event for proposal %s", proposalId);
38
+ return {
39
+ targets: args.targets,
40
+ values: args.values,
41
+ calldatas: args.calldatas,
42
+ description: args.description,
43
+ descriptionHash: (0, salt_computation_1.saltFromDescription)(args.description),
44
+ };
45
+ }
46
+ }
47
+ catch {
48
+ continue;
49
+ }
50
+ }
51
+ log("ProposalCreated event not found for proposal %s", proposalId);
52
+ return null;
53
+ }
54
+ function buildExecuteTransaction(params, governorAddress, description) {
55
+ const calldata = abis_1.governorInterface.encodeFunctionData("execute", [
56
+ params.targets,
57
+ params.values,
58
+ params.calldatas,
59
+ params.descriptionHash,
60
+ ]);
61
+ return {
62
+ to: governorAddress,
63
+ data: calldata,
64
+ value: "0",
65
+ chain: "arb1",
66
+ chainId: 42161,
67
+ description,
68
+ };
69
+ }
70
+ async function getElectionProposalParams(electionIndex, provider, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
71
+ log("getElectionProposalParams for index %d", electionIndex);
72
+ const proposalId = await (0, proposal_ids_1.getElectionProposalId)(electionIndex, provider, nomineeGovernorAddress);
73
+ if (!proposalId) {
74
+ log("No proposal ID found for election %d", electionIndex);
75
+ return null;
76
+ }
77
+ const governor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, provider);
78
+ return findProposalCreatedParams(proposalId, nomineeGovernorAddress, governor, provider);
79
+ }
80
+ async function getMemberElectionProposalParams(electionIndex, provider, memberGovernorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR) {
81
+ log("getMemberElectionProposalParams for index %d", electionIndex);
82
+ const memberGovernor = (0, contracts_1.getMemberGovernor)(memberGovernorAddress, provider);
83
+ const memberProposalId = await (0, proposal_ids_1.computeElectionProposalId)(electionIndex, memberGovernor);
84
+ try {
85
+ await (0, rpc_utils_1.queryWithRetry)(() => memberGovernor.state(memberProposalId));
86
+ }
87
+ catch {
88
+ log("No member proposal found for election %d", electionIndex);
89
+ return null;
90
+ }
91
+ return findProposalCreatedParams(memberProposalId, memberGovernorAddress, memberGovernor, provider);
92
+ }
93
+ //# sourceMappingURL=params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.js","sourceRoot":"","sources":["../../src/election/params.ts"],"names":[],"mappings":";;AAuEA,0DAoBC;AAED,8DAeC;AAED,0EAuBC;AApID,4CAAyC;AACzC,kDAAoD;AACpD,kCAAsE;AACtE,gEAAgE;AAChE,4CAA0C;AAE1C,2CAAoE;AACpE,iDAAkF;AAElF,MAAM,GAAG,GAAG,gBAAO,CAAC,QAAQ,CAAC;AAU7B,KAAK,UAAU,yBAAyB,CACtC,UAAkB,EAClB,eAAuB,EACvB,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,CAAC,CAAC;IACtE,OAAO,yBAAyB,CAAC,UAAU,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3F,CAAC;AAEM,KAAK,UAAU,+BAA+B,CACnD,aAAqB,EACrB,QAAmC,EACnC,wBAAgC,qBAAS,CAAC,wBAAwB;IAElE,GAAG,CAAC,8CAA8C,EAAE,aAAa,CAAC,CAAC;IAEnE,MAAM,cAAc,GAAG,IAAA,6BAAiB,EAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IAC1E,MAAM,gBAAgB,GAAG,MAAM,IAAA,wCAAyB,EAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAExF,IAAI,CAAC;QACH,MAAM,IAAA,0BAAc,EAAS,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,CAAC,0CAA0C,EAAE,aAAa,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,yBAAyB,CAC9B,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,QAAQ,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ethers } from "ethers";
2
+ import { ElectionContender, ElectionNominee } from "../types";
3
+ export declare function getContenders(proposalId: string, provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<ElectionContender[]>;
4
+ export declare function getNomineesWithVotes(proposalId: string, provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<ElectionNominee[]>;
5
+ export declare function getExcludedNominees(proposalId: string, provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<ElectionNominee[]>;
6
+ //# sourceMappingURL=participants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participants.d.ts","sourceRoot":"","sources":["../../src/election/participants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAK3C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM9D,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAoC9B;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,eAAe,EAAE,CAAC,CAmC5B;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,eAAe,EAAE,CAAC,CAqD5B"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getContenders = getContenders;
4
+ exports.getNomineesWithVotes = getNomineesWithVotes;
5
+ exports.getExcludedNominees = getExcludedNominees;
6
+ const ethers_1 = require("ethers");
7
+ const constants_1 = require("../constants");
8
+ const rpc_utils_1 = require("../utils/rpc-utils");
9
+ const abis_1 = require("../abis");
10
+ const logger_1 = require("../utils/logger");
11
+ const multicall_1 = require("../utils/multicall");
12
+ const contracts_1 = require("./contracts");
13
+ const log = logger_1.loggers.election;
14
+ async function getContenders(proposalId, provider, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
15
+ log("getContenders for proposal %s", proposalId);
16
+ const governor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, provider);
17
+ const iface = abis_1.nomineeElectionGovernorInterface;
18
+ const { fromBlock, toBlock } = await (0, contracts_1.getLogQueryBlockRange)(governor, proposalId, provider);
19
+ const logs = await (0, rpc_utils_1.queryWithRetry)(() => provider.getLogs({
20
+ address: nomineeGovernorAddress,
21
+ topics: [
22
+ iface.getEventTopic("ContenderAdded"),
23
+ ethers_1.ethers.utils.hexZeroPad(ethers_1.BigNumber.from(proposalId).toHexString(), 32),
24
+ ],
25
+ fromBlock,
26
+ toBlock,
27
+ }));
28
+ const contenders = logs.flatMap((eventLog) => {
29
+ try {
30
+ const parsed = iface.parseLog(eventLog);
31
+ return [
32
+ {
33
+ address: parsed.args.contender.toLowerCase(),
34
+ registeredAtBlock: eventLog.blockNumber,
35
+ registrationTxHash: eventLog.transactionHash,
36
+ },
37
+ ];
38
+ }
39
+ catch {
40
+ return [];
41
+ }
42
+ });
43
+ log("Found %d contenders for proposal %s", contenders.length, proposalId);
44
+ return contenders;
45
+ }
46
+ async function getNomineesWithVotes(proposalId, provider, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
47
+ log("getNomineesWithVotes for proposal %s", proposalId);
48
+ const governor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, provider);
49
+ const nomineeAddresses = await (0, rpc_utils_1.queryWithRetry)(() => governor.nominees(proposalId));
50
+ if (nomineeAddresses.length === 0) {
51
+ return [];
52
+ }
53
+ const calls = nomineeAddresses.flatMap((addr) => [
54
+ (0, multicall_1.buildCallInput)(nomineeGovernorAddress, abis_1.nomineeElectionGovernorInterface, "votesReceived", [proposalId, addr]),
55
+ (0, multicall_1.buildCallInput)(nomineeGovernorAddress, abis_1.nomineeElectionGovernorInterface, "isExcluded", [proposalId, addr]),
56
+ ]);
57
+ const results = await (0, multicall_1.multicall)(provider, calls);
58
+ const nominees = nomineeAddresses.map((addr, i) => ({
59
+ address: addr.toLowerCase(),
60
+ votesReceived: results[i * 2] ?? ethers_1.BigNumber.from(0),
61
+ isExcluded: results[i * 2 + 1] ?? false,
62
+ }));
63
+ log("Found %d nominees for proposal %s", nominees.length, proposalId);
64
+ return nominees;
65
+ }
66
+ async function getExcludedNominees(proposalId, provider, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
67
+ log("getExcludedNominees for proposal %s", proposalId);
68
+ const governor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, provider);
69
+ const iface = abis_1.nomineeElectionGovernorInterface;
70
+ const { fromBlock, toBlock } = await (0, contracts_1.getLogQueryBlockRange)(governor, proposalId, provider, 0);
71
+ const logs = await (0, rpc_utils_1.queryWithRetry)(() => provider.getLogs({
72
+ address: nomineeGovernorAddress,
73
+ topics: [
74
+ iface.getEventTopic("NomineeExcluded"),
75
+ ethers_1.ethers.utils.hexZeroPad(ethers_1.BigNumber.from(proposalId).toHexString(), 32),
76
+ ],
77
+ fromBlock,
78
+ toBlock,
79
+ }));
80
+ const parsedLogs = logs.flatMap((eventLog) => {
81
+ try {
82
+ const parsed = iface.parseLog(eventLog);
83
+ return [{ eventLog, nominee: parsed.args.nominee }];
84
+ }
85
+ catch {
86
+ return [];
87
+ }
88
+ });
89
+ if (parsedLogs.length === 0) {
90
+ return [];
91
+ }
92
+ const calls = parsedLogs.map(({ nominee }) => (0, multicall_1.buildCallInput)(nomineeGovernorAddress, abis_1.nomineeElectionGovernorInterface, "votesReceived", [proposalId, nominee]));
93
+ const results = await (0, multicall_1.multicall)(provider, calls);
94
+ const excluded = parsedLogs.map(({ eventLog, nominee }, i) => ({
95
+ address: nominee.toLowerCase(),
96
+ votesReceived: results[i] ?? ethers_1.BigNumber.from(0),
97
+ isExcluded: true,
98
+ excludedAtBlock: eventLog.blockNumber,
99
+ exclusionTxHash: eventLog.transactionHash,
100
+ }));
101
+ log("Found %d excluded nominees for proposal %s", excluded.length, proposalId);
102
+ return excluded;
103
+ }
104
+ //# sourceMappingURL=participants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participants.js","sourceRoot":"","sources":["../../src/election/participants.ts"],"names":[],"mappings":";;AAWA,sCAwCC;AAED,oDAuCC;AAED,kDAyDC;AAvJD,mCAA2C;AAC3C,4CAAyC;AACzC,kDAAo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O,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAC3C,IAAA,0BAAc,EACZ,sBAAsB,EACtB,uCAAgC,EAChC,eAAe,EACf,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAS,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7D,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;QAC9B,aAAa,EAAG,OAAO,CAAC,CAAC,CAAe,IAAI,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,QAAQ,CAAC,WAAW;QACrC,eAAe,EAAE,QAAQ,CAAC,eAAe;KAC1C,CAAC,CAAC,CAAC;IAEJ,GAAG,CAAC,4CAA4C,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC/E,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ethers } from "ethers";
2
+ import { ElectionProposalStatus, ElectionStatus, PreparedTransaction } from "../types";
3
+ export interface PreparedElectionCreation {
4
+ transaction: PreparedTransaction;
5
+ electionIndex: number;
6
+ }
7
+ export declare function prepareElectionCreation(electionStatus: Pick<ElectionStatus, "electionCount">, nomineeGovernorAddress?: string): PreparedElectionCreation;
8
+ export declare function prepareMemberElectionTrigger(electionStatus: Pick<ElectionProposalStatus, "electionIndex" | "canProceedToMemberPhase">, provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<PreparedTransaction | null>;
9
+ export declare function prepareMemberElectionExecution(electionStatus: Pick<ElectionProposalStatus, "electionIndex" | "canExecuteMember">, provider: ethers.providers.Provider, memberGovernorAddress?: string): Promise<PreparedTransaction | null>;
10
+ //# sourceMappingURL=prepare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/election/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAWvF,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,mBAAmB,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EACrD,sBAAsB,GAAE,MAA4C,GACnE,wBAAwB,CAe1B;AAED,wBAAsB,4BAA4B,CAChD,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAAE,eAAe,GAAG,yBAAyB,CAAC,EACzF,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAwBrC;AAED,wBAAsB,8BAA8B,CAClD,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAAE,eAAe,GAAG,kBAAkB,CAAC,EAClF,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,qBAAqB,GAAE,MAA2C,GACjE,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAwBrC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareElectionCreation = prepareElectionCreation;
4
+ exports.prepareMemberElectionTrigger = prepareMemberElectionTrigger;
5
+ exports.prepareMemberElectionExecution = prepareMemberElectionExecution;
6
+ const constants_1 = require("../constants");
7
+ const logger_1 = require("../utils/logger");
8
+ const contracts_1 = require("./contracts");
9
+ const params_1 = require("./params");
10
+ const log = logger_1.loggers.election;
11
+ function prepareElectionCreation(electionStatus, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
12
+ const governor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress);
13
+ const calldata = governor.interface.encodeFunctionData("createElection", []);
14
+ return {
15
+ transaction: {
16
+ to: nomineeGovernorAddress,
17
+ data: calldata,
18
+ value: "0",
19
+ chain: "arb1",
20
+ chainId: 42161,
21
+ description: `createElection() on SecurityCouncilNomineeElectionGovernor for election #${electionStatus.electionCount}`,
22
+ },
23
+ electionIndex: electionStatus.electionCount,
24
+ };
25
+ }
26
+ async function prepareMemberElectionTrigger(electionStatus, provider, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
27
+ log("prepareMemberElectionTrigger for election %d", electionStatus.electionIndex);
28
+ if (!electionStatus.canProceedToMemberPhase) {
29
+ log("Cannot proceed to member phase - not ready");
30
+ return null;
31
+ }
32
+ const params = await (0, params_1.getElectionProposalParams)(electionStatus.electionIndex, provider, nomineeGovernorAddress);
33
+ if (!params) {
34
+ log("Could not find proposal params for election %d", electionStatus.electionIndex);
35
+ return null;
36
+ }
37
+ return (0, params_1.buildExecuteTransaction)(params, nomineeGovernorAddress, `execute() on NomineeElectionGovernor to trigger member election #${electionStatus.electionIndex}`);
38
+ }
39
+ async function prepareMemberElectionExecution(electionStatus, provider, memberGovernorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR) {
40
+ log("prepareMemberElectionExecution for election %d", electionStatus.electionIndex);
41
+ if (!electionStatus.canExecuteMember) {
42
+ log("Cannot execute member election - not ready");
43
+ return null;
44
+ }
45
+ const params = await (0, params_1.getMemberElectionProposalParams)(electionStatus.electionIndex, provider, memberGovernorAddress);
46
+ if (!params) {
47
+ log("Could not find proposal params for member election %d", electionStatus.electionIndex);
48
+ return null;
49
+ }
50
+ return (0, params_1.buildExecuteTransaction)(params, memberGovernorAddress, `execute() on MemberElectionGovernor to install new Security Council members for election #${electionStatus.electionIndex}`);
51
+ }
52
+ //# sourceMappingURL=prepare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/election/prepare.ts"],"names":[],"mappings":";;AAkBA,0DAkBC;AAED,oEA4BC;AAED,wEA4BC;AA/FD,4CAAyC;AAEzC,4CAA0C;AAC1C,2CAAiD;AACjD,qCAIkB;AAElB,MAAM,GAAG,GAAG,gBAAO,CAAC,QAAQ,CAAC;AAO7B,SAAgB,uBAAuB,CACrC,cAAqD,EACrD,yBAAiC,qBAAS,CAAC,yBAAyB;IAEpE,MAAM,QAAQ,GAAG,IAAA,8BAAkB,EAAC,sBAAsB,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAE7E,OAAO;QACL,WAAW,EAAE;YACX,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,4EAA4E,cAAc,CAAC,aAAa,EAAE;SACxH;QACD,aAAa,EAAE,cAAc,CAAC,aAAa;KAC5C,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,4BAA4B,CAChD,cAAyF,EACzF,QAAmC,EACnC,yBAAiC,qBAAS,CAAC,yBAAyB;IAEpE,GAAG,CAAC,8CAA8C,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAElF,IAAI,CAAC,cAAc,CAAC,uBAAuB,EAAE,CAAC;QAC5C,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAA,kCAAyB,EAC5C,cAAc,CAAC,aAAa,EAC5B,QAAQ,EACR,sBAAsB,CACvB,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,GAAG,CAAC,gDAAgD,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAA,gCAAuB,EAC5B,MAAM,EACN,sBAAsB,EACtB,oEAAoE,cAAc,CAAC,aAAa,EAAE,CACnG,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,8BAA8B,CAClD,cAAkF,EAClF,QAAmC,EACnC,wBAAgC,qBAAS,CAAC,wBAAwB;IAElE,GAAG,CAAC,gDAAgD,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAEpF,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACrC,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAA,wCAA+B,EAClD,cAAc,CAAC,aAAa,EAC5B,QAAQ,EACR,qBAAqB,CACtB,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,GAAG,CAAC,uDAAuD,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAA,gCAAuB,EAC5B,MAAM,EACN,qBAAqB,EACrB,6FAA6F,cAAc,CAAC,aAAa,EAAE,CAC5H,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ethers } from "ethers";
2
+ export interface ElectionProposalIds {
3
+ nomineeProposalId: string | null;
4
+ memberProposalId: string | null;
5
+ }
6
+ export interface GetElectionProposalIdsOptions {
7
+ nomineeGovernorAddress?: string;
8
+ memberGovernorAddress?: string;
9
+ blockNumber?: number;
10
+ skipCache?: boolean;
11
+ }
12
+ export declare function clearElectionProposalIdsCache(): void;
13
+ export declare function clearElectionCache(): void;
14
+ export declare function computeElectionProposalId(electionIndex: number, governor: ethers.Contract): Promise<string>;
15
+ export declare function getElectionProposalId(electionIndex: number, provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<string | null>;
16
+ export declare function getMemberElectionProposalId(electionIndex: number, provider: ethers.providers.Provider, memberGovernorAddress?: string): Promise<string>;
17
+ export declare function getElectionProposalIds(electionIndex: number, provider: ethers.providers.Provider, options?: GetElectionProposalIdsOptions): Promise<ElectionProposalIds>;
18
+ //# sourceMappingURL=proposal-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal-ids.d.ts","sourceRoot":"","sources":["../../src/election/proposal-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAS3C,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,6BAA6B;IAC5C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAQD,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED,wBAAsB,yBAAyB,CAC7C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ,GACxB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUxB;AAED,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,qBAAqB,GAAE,MAA2C,GACjE,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACnC,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,mBAAmB,CAAC,CAuC9B"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearElectionProposalIdsCache = clearElectionProposalIdsCache;
4
+ exports.clearElectionCache = clearElectionCache;
5
+ exports.computeElectionProposalId = computeElectionProposalId;
6
+ exports.getElectionProposalId = getElectionProposalId;
7
+ exports.getMemberElectionProposalId = getMemberElectionProposalId;
8
+ exports.getElectionProposalIds = getElectionProposalIds;
9
+ const ethers_1 = require("ethers");
10
+ const constants_1 = require("../constants");
11
+ const rpc_utils_1 = require("../utils/rpc-utils");
12
+ const abis_1 = require("../abis");
13
+ const multicall_1 = require("../utils/multicall");
14
+ const salt_computation_1 = require("../utils/salt-computation");
15
+ const block_cache_1 = require("../utils/block-cache");
16
+ const contracts_1 = require("./contracts");
17
+ const electionProposalIdsCache = new block_cache_1.BlockScopedCache({
18
+ isImmutable: (result) => {
19
+ return result.nomineeProposalId === null || result.memberProposalId !== null;
20
+ },
21
+ });
22
+ function clearElectionProposalIdsCache() {
23
+ electionProposalIdsCache.clear();
24
+ }
25
+ function clearElectionCache() {
26
+ clearElectionProposalIdsCache();
27
+ }
28
+ async function computeElectionProposalId(electionIndex, governor) {
29
+ const proposeArgs = (await (0, rpc_utils_1.queryWithRetry)(() => governor.getProposeArgs(electionIndex)));
30
+ const [targets, values, calldatas, description] = proposeArgs;
31
+ const descriptionHash = (0, salt_computation_1.saltFromDescription)(description);
32
+ const proposalId = await (0, rpc_utils_1.queryWithRetry)(() => governor.hashProposal(targets, values, calldatas, descriptionHash));
33
+ return ethers_1.BigNumber.from(proposalId).toString();
34
+ }
35
+ async function getElectionProposalId(electionIndex, provider, nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR) {
36
+ const governor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, provider);
37
+ const proposalId = await computeElectionProposalId(electionIndex, governor);
38
+ try {
39
+ await (0, rpc_utils_1.queryWithRetry)(() => governor.state(proposalId));
40
+ return proposalId;
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ }
46
+ async function getMemberElectionProposalId(electionIndex, provider, memberGovernorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR) {
47
+ const governor = (0, contracts_1.getMemberGovernor)(memberGovernorAddress, provider);
48
+ return computeElectionProposalId(electionIndex, governor);
49
+ }
50
+ async function getElectionProposalIds(electionIndex, provider, options = {}) {
51
+ const { nomineeGovernorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, memberGovernorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR, blockNumber, skipCache, } = options;
52
+ const cached = electionProposalIdsCache.get(electionIndex, blockNumber, { skipCache });
53
+ if (cached) {
54
+ return cached;
55
+ }
56
+ const nomineeGovernor = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, provider);
57
+ const memberGovernor = (0, contracts_1.getMemberGovernor)(memberGovernorAddress, provider);
58
+ const [nomineeProposalId, computedMemberProposalId] = await Promise.all([
59
+ computeElectionProposalId(electionIndex, nomineeGovernor),
60
+ computeElectionProposalId(electionIndex, memberGovernor),
61
+ ]);
62
+ const stateResults = await (0, multicall_1.multicall)(provider, [
63
+ (0, multicall_1.buildCallInput)(nomineeGovernorAddress, abis_1.governorInterface, "state", [nomineeProposalId]),
64
+ (0, multicall_1.buildCallInput)(memberGovernorAddress, abis_1.governorInterface, "state", [
65
+ computedMemberProposalId,
66
+ ]),
67
+ ]);
68
+ const nomineeStateResult = stateResults[0];
69
+ const memberStateResult = stateResults[1];
70
+ const result = {
71
+ nomineeProposalId: nomineeStateResult !== null ? nomineeProposalId : null,
72
+ memberProposalId: memberStateResult !== null ? computedMemberProposalId : null,
73
+ };
74
+ electionProposalIdsCache.set(electionIndex, result, blockNumber);
75
+ return result;
76
+ }
77
+ //# sourceMappingURL=proposal-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal-ids.js","sourceRoot":"","sources":["../../src/election/proposal-ids.ts"],"names":[],"mappings":";;AA2BA,sEAEC;AAED,gDAEC;AAED,8DAmBC;AAED,sDAcC;AAED,kEAOC;AAED,wDA2CC;AA5HD,mCAA2C;AAC3C,4CAAyC;AACzC,kDAAoD;AACpD,kCAA4C;AAC5C,kDAA+D;AAC/D,gEAAgE;AAChE,sDAAwD;AACxD,2CAAoE;AAcpE,MAAM,wBAAwB,GAAG,IAAI,8BAAgB,CAA8B;IACjF,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE;QACtB,OAAO,MAAM,CAAC,iBAAiB,KAAK,IAAI,IAAI,MAAM,CAAC,gBAAgB,KAAK,IAAI,CAAC;IAC/E,CAAC;CACF,CAAC,CAAC;AAEH,SAAgB,6BAA6B;IAC3C,wBAAwB,CAAC,KAAK,EAAE,CAAC;AACnC,CAAC;AAED,SAAgB,kBAAkB;IAChC,6BAA6B,EAAE,CAAC;AAClC,CAAC;AAEM,KAAK,UAAU,yBAAyB,CAC7C,aAAqB,EACrB,QAAyB;IAEzB,MAAM,WAAW,GAAG,CAAC,MAAM,IAAA,0BAAc,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAKtF,CAAC;IAEF,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,GAAG,WAAW,CAAC;IAC9D,MAAM,eAAe,GAAG,IAAA,sCAAmB,EAAC,WAAW,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,MA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+ * Get the current election count without fetching full status.
5
+ * This is a lightweight call that only fetches the count (single multicall).
6
+ *
7
+ * @param l2Provider - Arbitrum One provider
8
+ * @param nomineeGovernorAddress - Optional custom nominee governor address
9
+ * @returns The number of elections that have been created
10
+ */
11
+ export declare function getElectionCount(l2Provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<number>;
12
+ export declare function determineElectionPhase(nomineeProposalState: ProposalState | null, memberProposalId: string | null, memberProposalState: ProposalState | null, isInVettingPeriod: boolean): ElectionPhase;
13
+ export declare function checkElectionStatus(l2Provider: ethers.providers.Provider, l1Provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<ElectionStatus>;
14
+ export declare function hasVettingPeriod(governorAddress: string, provider: ethers.providers.Provider): Promise<boolean>;
15
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/election/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAI3C,OAAO,EAAc,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AASpF;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACrC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,wBAAgB,sBAAsB,CACpC,oBAAoB,EAAE,aAAa,GAAG,IAAI,EAC1C,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAC/B,mBAAmB,EAAE,aAAa,GAAG,IAAI,EACzC,iBAAiB,EAAE,OAAO,GACzB,aAAa,CAuBf;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACrC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACrC,sBAAsB,GAAE,MAA4C,GACnE,OAAO,CAAC,cAAc,CAAC,CAkEzB;AAED,wBAAsB,gBAAgB,CACpC,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,GAClC,OAAO,CAAC,OAAO,CAAC,CASlB"}