@gzeoneth/gov-tracker 0.4.0 → 0.5.0
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/README.md +95 -11
- package/dist/abis-json.d.ts +2315 -0
- package/dist/abis-json.d.ts.map +1 -0
- package/dist/abis-json.js +3207 -0
- package/dist/abis-json.js.map +1 -0
- package/dist/abis.d.ts +12 -7
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +32 -1
- package/dist/abis.js.map +1 -1
- package/dist/calldata/decoder.d.ts.map +1 -1
- package/dist/calldata/decoder.js +33 -28
- package/dist/calldata/decoder.js.map +1 -1
- package/dist/calldata/parameter-decoder.d.ts.map +1 -1
- package/dist/calldata/parameter-decoder.js +19 -25
- package/dist/calldata/parameter-decoder.js.map +1 -1
- package/dist/calldata/retryable-ticket.d.ts +2 -2
- package/dist/calldata/retryable-ticket.d.ts.map +1 -1
- package/dist/calldata/retryable-ticket.js +17 -12
- package/dist/calldata/retryable-ticket.js.map +1 -1
- package/dist/calldata/signature-lookup.js +5 -4
- package/dist/calldata/signature-lookup.js.map +1 -1
- package/dist/cli/cli.js +112 -20
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/lib/cli.d.ts +4 -2
- package/dist/cli/lib/cli.d.ts.map +1 -1
- package/dist/cli/lib/cli.js +34 -18
- package/dist/cli/lib/cli.js.map +1 -1
- package/dist/cli/lib/election-check.d.ts.map +1 -1
- package/dist/cli/lib/election-check.js +2 -1
- package/dist/cli/lib/election-check.js.map +1 -1
- package/dist/cli/lib/json-state.js +1 -1
- package/dist/cli/lib/json-state.js.map +1 -1
- package/dist/cli/tui/components/StageProgress.js +1 -1
- package/dist/cli/tui/components/StageProgress.js.map +1 -1
- package/dist/cli/tui/components/StageRow.d.ts.map +1 -1
- package/dist/cli/tui/components/StageRow.js +15 -20
- package/dist/cli/tui/components/StageRow.js.map +1 -1
- package/dist/cli/tui/components/VotingStats.d.ts.map +1 -1
- package/dist/cli/tui/components/VotingStats.js +2 -1
- package/dist/cli/tui/components/VotingStats.js.map +1 -1
- package/dist/cli/tui/hooks/useCache.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useCache.js +2 -1
- package/dist/cli/tui/hooks/useCache.js.map +1 -1
- package/dist/cli/tui/hooks/useElectionData.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useElectionData.js +3 -2
- package/dist/cli/tui/hooks/useElectionData.js.map +1 -1
- package/dist/cli/tui/hooks/useNavigation.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useNavigation.js +2 -3
- package/dist/cli/tui/hooks/useNavigation.js.map +1 -1
- package/dist/cli/tui/hooks/useProposals.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useProposals.js +26 -36
- package/dist/cli/tui/hooks/useProposals.js.map +1 -1
- package/dist/cli/tui/hooks/useStageCalldata.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useStageCalldata.js +2 -1
- package/dist/cli/tui/hooks/useStageCalldata.js.map +1 -1
- package/dist/cli/tui/utils/index.d.ts +7 -7
- package/dist/cli/tui/utils/index.d.ts.map +1 -1
- package/dist/cli/tui/utils/index.js +18 -13
- package/dist/cli/tui/utils/index.js.map +1 -1
- package/dist/cli/tui/utils/markdown-parser.d.ts +5 -0
- package/dist/cli/tui/utils/markdown-parser.d.ts.map +1 -1
- package/dist/cli/tui/utils/markdown-parser.js +16 -0
- package/dist/cli/tui/utils/markdown-parser.js.map +1 -1
- package/dist/cli/tui/utils/navigation.d.ts +1 -0
- package/dist/cli/tui/utils/navigation.d.ts.map +1 -1
- package/dist/cli/tui/utils/navigation.js +9 -5
- package/dist/cli/tui/utils/navigation.js.map +1 -1
- package/dist/cli/tui/utils/proposal-detail-helpers.js +6 -6
- package/dist/cli/tui/utils/proposal-detail-helpers.js.map +1 -1
- package/dist/cli/tui/utils/stage-status.d.ts +4 -0
- package/dist/cli/tui/utils/stage-status.d.ts.map +1 -1
- package/dist/cli/tui/utils/stage-status.js +47 -1
- package/dist/cli/tui/utils/stage-status.js.map +1 -1
- package/dist/cli/tui/utils/time.d.ts +4 -4
- package/dist/cli/tui/utils/time.d.ts.map +1 -1
- package/dist/cli/tui/utils/time.js +13 -11
- package/dist/cli/tui/utils/time.js.map +1 -1
- package/dist/cli/tui/views/CalldataView.d.ts.map +1 -1
- package/dist/cli/tui/views/CalldataView.js +3 -2
- package/dist/cli/tui/views/CalldataView.js.map +1 -1
- package/dist/cli/tui/views/DescriptionView.d.ts.map +1 -1
- package/dist/cli/tui/views/DescriptionView.js +4 -2
- package/dist/cli/tui/views/DescriptionView.js.map +1 -1
- package/dist/cli/tui/views/ElectionView.d.ts.map +1 -1
- package/dist/cli/tui/views/ElectionView.js +4 -9
- package/dist/cli/tui/views/ElectionView.js.map +1 -1
- package/dist/constants.d.ts +54 -23
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +78 -21
- package/dist/constants.js.map +1 -1
- package/dist/data/bundled-cache.json +393 -20
- package/dist/data/delegate-cache.json +118014 -0
- package/dist/deduplication.d.ts.map +1 -1
- package/dist/deduplication.js +34 -54
- package/dist/deduplication.js.map +1 -1
- package/dist/delegates/cache.d.ts +44 -0
- package/dist/delegates/cache.d.ts.map +1 -0
- package/dist/delegates/cache.js +202 -0
- package/dist/delegates/cache.js.map +1 -0
- package/dist/delegates/index.d.ts +13 -0
- package/dist/delegates/index.d.ts.map +1 -0
- package/dist/delegates/index.js +32 -0
- package/dist/delegates/index.js.map +1 -0
- package/dist/delegates/indexer.d.ts +32 -0
- package/dist/delegates/indexer.d.ts.map +1 -0
- package/dist/delegates/indexer.js +191 -0
- package/dist/delegates/indexer.js.map +1 -0
- package/dist/delegates/queries.d.ts +30 -0
- package/dist/delegates/queries.d.ts.map +1 -0
- package/dist/delegates/queries.js +79 -0
- package/dist/delegates/queries.js.map +1 -0
- package/dist/discovery/governor-discovery.d.ts +21 -1
- package/dist/discovery/governor-discovery.d.ts.map +1 -1
- package/dist/discovery/governor-discovery.js +47 -13
- package/dist/discovery/governor-discovery.js.map +1 -1
- package/dist/discovery/timelock-discovery.d.ts.map +1 -1
- package/dist/discovery/timelock-discovery.js +27 -30
- package/dist/discovery/timelock-discovery.js.map +1 -1
- package/dist/election/contracts.d.ts.map +1 -1
- package/dist/election/contracts.js +4 -1
- package/dist/election/contracts.js.map +1 -1
- package/dist/election/details.d.ts.map +1 -1
- package/dist/election/details.js +7 -3
- package/dist/election/details.js.map +1 -1
- package/dist/election/index.d.ts +3 -1
- package/dist/election/index.d.ts.map +1 -1
- package/dist/election/index.js +12 -1
- package/dist/election/index.js.map +1 -1
- package/dist/election/params.d.ts.map +1 -1
- package/dist/election/params.js +14 -28
- package/dist/election/params.js.map +1 -1
- package/dist/election/participants.d.ts.map +1 -1
- package/dist/election/participants.js +21 -26
- package/dist/election/participants.js.map +1 -1
- package/dist/election/proposal-ids.js +19 -22
- package/dist/election/proposal-ids.js.map +1 -1
- package/dist/election/status.d.ts +28 -1
- package/dist/election/status.d.ts.map +1 -1
- package/dist/election/status.js +116 -3
- package/dist/election/status.js.map +1 -1
- package/dist/election/write.d.ts +132 -0
- package/dist/election/write.d.ts.map +1 -0
- package/dist/election/write.js +184 -0
- package/dist/election/write.js.map +1 -0
- package/dist/governance/index.d.ts +5 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +28 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/read.d.ts +50 -0
- package/dist/governance/read.d.ts.map +1 -0
- package/dist/governance/read.js +194 -0
- package/dist/governance/read.js.map +1 -0
- package/dist/governance/write.d.ts +54 -0
- package/dist/governance/write.d.ts.map +1 -0
- package/dist/governance/write.js +132 -0
- package/dist/governance/write.js.map +1 -0
- package/dist/index.d.ts +40 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +149 -15
- package/dist/index.js.map +1 -1
- package/dist/simulation/index.d.ts +4 -1
- package/dist/simulation/index.d.ts.map +1 -1
- package/dist/simulation/index.js +5 -1
- package/dist/simulation/index.js.map +1 -1
- package/dist/simulation/simulation-data.d.ts +33 -2
- package/dist/simulation/simulation-data.d.ts.map +1 -1
- package/dist/simulation/simulation-data.js +68 -24
- package/dist/simulation/simulation-data.js.map +1 -1
- package/dist/simulation/tenderly-payloads.d.ts +107 -0
- package/dist/simulation/tenderly-payloads.d.ts.map +1 -0
- package/dist/simulation/tenderly-payloads.js +103 -0
- package/dist/simulation/tenderly-payloads.js.map +1 -0
- package/dist/stages/l2-to-l1-message.d.ts.map +1 -1
- package/dist/stages/l2-to-l1-message.js +43 -63
- package/dist/stages/l2-to-l1-message.js.map +1 -1
- package/dist/stages/proposal-queued.js.map +1 -1
- package/dist/stages/retryables.d.ts.map +1 -1
- package/dist/stages/retryables.js +10 -9
- package/dist/stages/retryables.js.map +1 -1
- package/dist/stages/timelock.d.ts +43 -3
- package/dist/stages/timelock.d.ts.map +1 -1
- package/dist/stages/timelock.js +170 -53
- package/dist/stages/timelock.js.map +1 -1
- package/dist/stages/utils.d.ts +56 -1
- package/dist/stages/utils.d.ts.map +1 -1
- package/dist/stages/utils.js +146 -30
- package/dist/stages/utils.js.map +1 -1
- package/dist/tracker/bundled-cache.d.ts +136 -0
- package/dist/tracker/bundled-cache.d.ts.map +1 -0
- package/dist/tracker/bundled-cache.js +207 -0
- package/dist/tracker/bundled-cache.js.map +1 -0
- package/dist/tracker/checkpoint-helpers.d.ts +20 -1
- package/dist/tracker/checkpoint-helpers.d.ts.map +1 -1
- package/dist/tracker/checkpoint-helpers.js +41 -7
- package/dist/tracker/checkpoint-helpers.js.map +1 -1
- package/dist/tracker/discovery.d.ts +3 -0
- package/dist/tracker/discovery.d.ts.map +1 -1
- package/dist/tracker/discovery.js +59 -34
- package/dist/tracker/discovery.js.map +1 -1
- package/dist/tracker/pipeline.d.ts +3 -10
- package/dist/tracker/pipeline.d.ts.map +1 -1
- package/dist/tracker/pipeline.js +18 -32
- package/dist/tracker/pipeline.js.map +1 -1
- package/dist/tracker/query.d.ts +1 -0
- package/dist/tracker/query.d.ts.map +1 -1
- package/dist/tracker/query.js +28 -36
- package/dist/tracker/query.js.map +1 -1
- package/dist/tracker/state.d.ts +3 -2
- package/dist/tracker/state.d.ts.map +1 -1
- package/dist/tracker/state.js +5 -4
- package/dist/tracker/state.js.map +1 -1
- package/dist/tracker.d.ts +33 -11
- package/dist/tracker.d.ts.map +1 -1
- package/dist/tracker.js +76 -43
- package/dist/tracker.js.map +1 -1
- package/dist/types/config.d.ts +39 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/delegates.d.ts +55 -0
- package/dist/types/delegates.d.ts.map +1 -0
- package/dist/types/delegates.js +9 -0
- package/dist/types/delegates.js.map +1 -0
- package/dist/types/election.d.ts +23 -0
- package/dist/types/election.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/simulation.d.ts +2 -2
- package/dist/types/simulation.d.ts.map +1 -1
- package/dist/types/tracking.d.ts +2 -2
- package/dist/types/tracking.d.ts.map +1 -1
- package/dist/utils/chain.d.ts +5 -1
- package/dist/utils/chain.d.ts.map +1 -1
- package/dist/utils/chain.js +7 -0
- package/dist/utils/chain.js.map +1 -1
- package/dist/utils/formatters.d.ts +2 -6
- package/dist/utils/formatters.d.ts.map +1 -1
- package/dist/utils/formatters.js +9 -12
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/log-filters.js +1 -1
- package/dist/utils/log-filters.js.map +1 -1
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +2 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/multicall.d.ts +0 -1
- package/dist/utils/multicall.d.ts.map +1 -1
- package/dist/utils/rpc-utils.d.ts +5 -0
- package/dist/utils/rpc-utils.d.ts.map +1 -1
- package/dist/utils/rpc-utils.js +9 -1
- package/dist/utils/rpc-utils.js.map +1 -1
- package/dist/utils/stage-metadata.d.ts +19 -0
- package/dist/utils/stage-metadata.d.ts.map +1 -1
- package/dist/utils/stage-metadata.js +44 -0
- package/dist/utils/stage-metadata.js.map +1 -1
- package/dist/utils/timing.d.ts +3 -10
- package/dist/utils/timing.d.ts.map +1 -1
- package/dist/utils/timing.js +9 -22
- package/dist/utils/timing.js.map +1 -1
- package/package.json +7 -3
- package/dist/cli/tui/utils/calldata-formatter.d.ts +0 -7
- package/dist/cli/tui/utils/calldata-formatter.d.ts.map +0 -1
- package/dist/cli/tui/utils/calldata-formatter.js +0 -14
- package/dist/cli/tui/utils/calldata-formatter.js.map +0 -1
- package/dist/cli/tui/utils/stage-formatter.d.ts +0 -7
- package/dist/cli/tui/utils/stage-formatter.d.ts.map +0 -1
- package/dist/cli/tui/utils/stage-formatter.js +0 -13
- package/dist/cli/tui/utils/stage-formatter.js.map +0 -1
- package/dist/cli/tui/utils/text.d.ts +0 -7
- package/dist/cli/tui/utils/text.d.ts.map +0 -1
- package/dist/cli/tui/utils/text.js +0 -12
- package/dist/cli/tui/utils/text.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
-
import { ElectionPhase, ElectionStatus, ProposalState } from "../types";
|
|
2
|
+
import { ElectionConfig, ElectionPhase, ElectionProposalStatus, ElectionStatus, ProposalState } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Get the current election count without fetching full status.
|
|
5
5
|
* This is a lightweight call that only fetches the count (single multicall).
|
|
@@ -12,4 +12,31 @@ export declare function getElectionCount(l2Provider: ethers.providers.Provider,
|
|
|
12
12
|
export declare function determineElectionPhase(nomineeProposalState: ProposalState | null, memberProposalId: string | null, memberProposalState: ProposalState | null, isInVettingPeriod: boolean): ElectionPhase;
|
|
13
13
|
export declare function checkElectionStatus(l2Provider: ethers.providers.Provider, l1Provider: ethers.providers.Provider, nomineeGovernorAddress?: string): Promise<ElectionStatus>;
|
|
14
14
|
export declare function hasVettingPeriod(governorAddress: string, provider: ethers.providers.Provider): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Full status + phase lookup for a specific election.
|
|
17
|
+
*
|
|
18
|
+
* Returns a complete `ElectionProposalStatus` with all fields populated from
|
|
19
|
+
* on-chain data: proposal states, compliant nominee count, vetting deadline,
|
|
20
|
+
* cohort, and derived phase. Replaces the pattern of calling multiple SDK
|
|
21
|
+
* functions and manually assembling the result.
|
|
22
|
+
*
|
|
23
|
+
* The returned `ElectionProposalStatus.stages` field is not populated (use
|
|
24
|
+
* the full tracking pipeline via `ProposalStageTracker.trackElection()` for
|
|
25
|
+
* stage-level tracking).
|
|
26
|
+
*
|
|
27
|
+
* @param l2Provider - L2 provider (also used for L1 block number via ArbSys)
|
|
28
|
+
* @param electionIndex - The election index to check (0-based)
|
|
29
|
+
* @param config - Deployment config with contract addresses (defaults to mainnet)
|
|
30
|
+
*/
|
|
31
|
+
export declare function getElectionStatus(l2Provider: ethers.providers.Provider, electionIndex: number, config?: ElectionConfig): Promise<ElectionProposalStatus>;
|
|
32
|
+
/**
|
|
33
|
+
* Batch fetch status for all elections.
|
|
34
|
+
*
|
|
35
|
+
* Fetches the election count once, then queries each election in parallel
|
|
36
|
+
* via `getElectionStatus`. Individual failures are logged and skipped.
|
|
37
|
+
*
|
|
38
|
+
* @param l2Provider - L2 provider
|
|
39
|
+
* @param config - Deployment config (defaults to mainnet)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getAllElectionStatuses(l2Provider: ethers.providers.Provider, config?: ElectionConfig): Promise<ElectionProposalStatus[]>;
|
|
15
42
|
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +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,
|
|
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,EAEL,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,aAAa,EACd,MAAM,UAAU,CAAC;AAWlB;;;;;;;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,CA0Bf;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,CAwEzB;AAED,wBAAsB,gBAAgB,CACpC,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,GAClC,OAAO,CAAC,OAAO,CAAC,CASlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACrC,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,cAAwC,GAC/C,OAAO,CAAC,sBAAsB,CAAC,CAwFjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EACrC,MAAM,GAAE,cAAwC,GAC/C,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAanC"}
|
package/dist/election/status.js
CHANGED
|
@@ -4,14 +4,19 @@ exports.getElectionCount = getElectionCount;
|
|
|
4
4
|
exports.determineElectionPhase = determineElectionPhase;
|
|
5
5
|
exports.checkElectionStatus = checkElectionStatus;
|
|
6
6
|
exports.hasVettingPeriod = hasVettingPeriod;
|
|
7
|
+
exports.getElectionStatus = getElectionStatus;
|
|
8
|
+
exports.getAllElectionStatuses = getAllElectionStatuses;
|
|
9
|
+
const ethers_1 = require("ethers");
|
|
7
10
|
const constants_1 = require("../constants");
|
|
8
11
|
const formatters_1 = require("../utils/formatters");
|
|
9
12
|
const rpc_utils_1 = require("../utils/rpc-utils");
|
|
13
|
+
const constants_2 = require("../constants");
|
|
10
14
|
const timing_1 = require("../utils/timing");
|
|
11
15
|
const logger_1 = require("../utils/logger");
|
|
12
16
|
const abis_1 = require("../abis");
|
|
13
17
|
const contracts_1 = require("./contracts");
|
|
14
18
|
const multicall_1 = require("../utils/multicall");
|
|
19
|
+
const proposal_ids_1 = require("./proposal-ids");
|
|
15
20
|
const log = logger_1.loggers.election;
|
|
16
21
|
/**
|
|
17
22
|
* Get the current election count without fetching full status.
|
|
@@ -41,15 +46,15 @@ function determineElectionPhase(nomineeProposalState, memberProposalId, memberPr
|
|
|
41
46
|
if (nomineeProposalState === "Executed") {
|
|
42
47
|
return "PENDING_EXECUTION";
|
|
43
48
|
}
|
|
44
|
-
if (isInVettingPeriod) {
|
|
45
|
-
return "VETTING_PERIOD";
|
|
46
|
-
}
|
|
47
49
|
if (nomineeProposalState === "Pending") {
|
|
48
50
|
return "CONTENDER_SUBMISSION";
|
|
49
51
|
}
|
|
50
52
|
if (nomineeProposalState === "Active") {
|
|
51
53
|
return "NOMINEE_SELECTION";
|
|
52
54
|
}
|
|
55
|
+
if (isInVettingPeriod) {
|
|
56
|
+
return "VETTING_PERIOD";
|
|
57
|
+
}
|
|
53
58
|
if (nomineeProposalState === "Succeeded") {
|
|
54
59
|
return "PENDING_EXECUTION";
|
|
55
60
|
}
|
|
@@ -64,6 +69,9 @@ async function checkElectionStatus(l2Provider, l1Provider, nomineeGovernorAddres
|
|
|
64
69
|
]),
|
|
65
70
|
]);
|
|
66
71
|
const electionCount = electionCountResult[0];
|
|
72
|
+
if (!electionCount) {
|
|
73
|
+
throw new Error("Failed to fetch election count from nominee governor");
|
|
74
|
+
}
|
|
67
75
|
log("L1 block number from L2: %s", l1BlockNumber.toString());
|
|
68
76
|
const l1Block = await (0, rpc_utils_1.queryWithRetry)(() => l1Provider.getBlock(l1BlockNumber.toNumber()));
|
|
69
77
|
if (!l1Block) {
|
|
@@ -78,6 +86,9 @@ async function checkElectionStatus(l2Provider, l1Provider, nomineeGovernorAddres
|
|
|
78
86
|
]);
|
|
79
87
|
const nextElectionTimestamp = electionResults[0];
|
|
80
88
|
const cohort = electionResults[1];
|
|
89
|
+
if (!nextElectionTimestamp || cohort === undefined) {
|
|
90
|
+
throw new Error("Failed to fetch election details from nominee governor");
|
|
91
|
+
}
|
|
81
92
|
log("electionCount=%s nextTimestamp=%s cohort=%d", electionCount.toString(), nextElectionTimestamp.toString(), cohort);
|
|
82
93
|
const secondsUntilElection = Math.max(0, nextElectionTimestamp.toNumber() - currentL1Timestamp);
|
|
83
94
|
const canCreateElection = secondsUntilElection === 0;
|
|
@@ -102,4 +113,106 @@ async function hasVettingPeriod(governorAddress, provider) {
|
|
|
102
113
|
return false;
|
|
103
114
|
}
|
|
104
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Full status + phase lookup for a specific election.
|
|
118
|
+
*
|
|
119
|
+
* Returns a complete `ElectionProposalStatus` with all fields populated from
|
|
120
|
+
* on-chain data: proposal states, compliant nominee count, vetting deadline,
|
|
121
|
+
* cohort, and derived phase. Replaces the pattern of calling multiple SDK
|
|
122
|
+
* functions and manually assembling the result.
|
|
123
|
+
*
|
|
124
|
+
* The returned `ElectionProposalStatus.stages` field is not populated (use
|
|
125
|
+
* the full tracking pipeline via `ProposalStageTracker.trackElection()` for
|
|
126
|
+
* stage-level tracking).
|
|
127
|
+
*
|
|
128
|
+
* @param l2Provider - L2 provider (also used for L1 block number via ArbSys)
|
|
129
|
+
* @param electionIndex - The election index to check (0-based)
|
|
130
|
+
* @param config - Deployment config with contract addresses (defaults to mainnet)
|
|
131
|
+
*/
|
|
132
|
+
async function getElectionStatus(l2Provider, electionIndex, config = constants_1.MAINNET_ELECTION_CONFIG) {
|
|
133
|
+
const { nomineeGovernorAddress, memberGovernorAddress } = config;
|
|
134
|
+
const nominee = (0, contracts_1.getNomineeGovernor)(nomineeGovernorAddress, l2Provider);
|
|
135
|
+
const [proposalIds, cohortRaw] = await Promise.all([
|
|
136
|
+
(0, proposal_ids_1.getElectionProposalIds)(electionIndex, l2Provider, {
|
|
137
|
+
nomineeGovernorAddress,
|
|
138
|
+
memberGovernorAddress,
|
|
139
|
+
}),
|
|
140
|
+
(0, rpc_utils_1.queryWithRetry)(() => nominee.electionIndexToCohort(electionIndex)),
|
|
141
|
+
]);
|
|
142
|
+
const { nomineeProposalId } = proposalIds;
|
|
143
|
+
let { memberProposalId } = proposalIds;
|
|
144
|
+
const cohort = cohortRaw;
|
|
145
|
+
let nomineeProposalState = null;
|
|
146
|
+
let memberProposalState = null;
|
|
147
|
+
let isInVettingPeriod = false;
|
|
148
|
+
let vettingDeadline = null;
|
|
149
|
+
let compliantNomineeCount = 0;
|
|
150
|
+
if (nomineeProposalId) {
|
|
151
|
+
const [stateNum, compliantCount] = await Promise.all([
|
|
152
|
+
(0, rpc_utils_1.queryWithRetry)(() => nominee.state(nomineeProposalId)),
|
|
153
|
+
(0, rpc_utils_1.queryWithRetry)(() => nominee.compliantNomineeCount(nomineeProposalId)).catch(() => ethers_1.BigNumber.from(0)),
|
|
154
|
+
]);
|
|
155
|
+
nomineeProposalState = (0, constants_1.proposalStateToString)(stateNum);
|
|
156
|
+
compliantNomineeCount = compliantCount.toNumber();
|
|
157
|
+
if (nomineeProposalState === "Succeeded") {
|
|
158
|
+
try {
|
|
159
|
+
const deadline = await (0, rpc_utils_1.queryWithRetry)(() => nominee.proposalVettingDeadline(nomineeProposalId));
|
|
160
|
+
vettingDeadline = deadline.toNumber();
|
|
161
|
+
const l1BlockNumber = await (0, timing_1.getL1BlockNumberFromL2)(l2Provider);
|
|
162
|
+
isInVettingPeriod = l1BlockNumber.lte(deadline);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// No vetting period on this governor
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (memberProposalId) {
|
|
170
|
+
const member = (0, contracts_1.getMemberGovernor)(memberGovernorAddress, l2Provider);
|
|
171
|
+
try {
|
|
172
|
+
const stateNum = await (0, rpc_utils_1.queryWithRetry)(() => member.state(memberProposalId));
|
|
173
|
+
memberProposalState = (0, constants_1.proposalStateToString)(stateNum);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
memberProposalId = null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const phase = determineElectionPhase(nomineeProposalState, memberProposalId, memberProposalState, isInVettingPeriod);
|
|
180
|
+
const canProceedToMemberPhase = nomineeProposalState === "Succeeded" &&
|
|
181
|
+
!isInVettingPeriod &&
|
|
182
|
+
compliantNomineeCount >= constants_2.TIMING.SECURITY_COUNCIL_TARGET_NOMINEES &&
|
|
183
|
+
!memberProposalId;
|
|
184
|
+
const canExecuteMember = memberProposalState === "Succeeded" || memberProposalState === "Queued";
|
|
185
|
+
return {
|
|
186
|
+
electionIndex,
|
|
187
|
+
phase,
|
|
188
|
+
cohort,
|
|
189
|
+
nomineeProposalId,
|
|
190
|
+
memberProposalId,
|
|
191
|
+
nomineeProposalState,
|
|
192
|
+
memberProposalState,
|
|
193
|
+
compliantNomineeCount,
|
|
194
|
+
targetNomineeCount: constants_2.TIMING.SECURITY_COUNCIL_TARGET_NOMINEES,
|
|
195
|
+
vettingDeadline,
|
|
196
|
+
isInVettingPeriod,
|
|
197
|
+
canProceedToMemberPhase,
|
|
198
|
+
canExecuteMember,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Batch fetch status for all elections.
|
|
203
|
+
*
|
|
204
|
+
* Fetches the election count once, then queries each election in parallel
|
|
205
|
+
* via `getElectionStatus`. Individual failures are logged and skipped.
|
|
206
|
+
*
|
|
207
|
+
* @param l2Provider - L2 provider
|
|
208
|
+
* @param config - Deployment config (defaults to mainnet)
|
|
209
|
+
*/
|
|
210
|
+
async function getAllElectionStatuses(l2Provider, config = constants_1.MAINNET_ELECTION_CONFIG) {
|
|
211
|
+
const count = await getElectionCount(l2Provider, config.nomineeGovernorAddress);
|
|
212
|
+
const results = await Promise.all(Array.from({ length: count }, (_, i) => getElectionStatus(l2Provider, i, config).catch((err) => {
|
|
213
|
+
log("Failed to fetch election %d: %s", i, err instanceof Error ? err.message : err);
|
|
214
|
+
return null;
|
|
215
|
+
})));
|
|
216
|
+
return results.filter((r) => r !== null);
|
|
217
|
+
}
|
|
105
218
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/election/status.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/election/status.ts"],"names":[],"mappings":";;AA8BA,4CAgBC;AAED,wDA+BC;AAED,kDA4EC;AAED,4CAYC;AAkBD,8CA4FC;AAWD,wDAgBC;AApTD,mCAA2C;AAC3C,4CAAyF;AACzF,oDAAqD;AACrD,kDAAoD;AASpD,4CAAsC;AACtC,4CAAyD;AACzD,4CAA0C;AAC1C,kCAA2D;AAC3D,2CAAoE;AACpE,kDAA+D;AAC/D,iDAAwD;AAExD,MAAM,GAAG,GAAG,gBAAO,CAAC,QAAQ,CAAC;AAE7B;;;;;;;GAOG;AACI,KAAK,UAAU,gBAAgB,CACpC,UAAqC,EACrC,yBAAiC,qBAAS,CAAC,yBAAyB;IAEpE,GAAG,CAAC,yBAAyB,EAAE,sBAAsB,CAAC,CAAC;IAEvD,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,IAAA,qBAAS,EAAC,UAAU,EAAE;QAClD,IAAA,0BA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UAAU,sBAAsB,CAC1C,UAAqC,EACrC,SAAyB,mCAAuB;IAEhD,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAEhF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACrC,iBAAiB,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACrD,GAAG,CAAC,iCAAiC,EAAE,CAAC,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACH,CACF,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAA+B,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Election write action preparation
|
|
3
|
+
*
|
|
4
|
+
* Prepares transactions and typed data for election participation:
|
|
5
|
+
* - Contender registration (EIP-712 sign → addContender)
|
|
6
|
+
* - Vote casting (castVoteWithReasonAndParams with encoded params)
|
|
7
|
+
*
|
|
8
|
+
* Following the SDK's prepare-only philosophy: this module builds
|
|
9
|
+
* transaction data and typed data structures, but never executes.
|
|
10
|
+
*/
|
|
11
|
+
import { BigNumber } from "ethers";
|
|
12
|
+
import { PreparedTransaction } from "../types";
|
|
13
|
+
/**
|
|
14
|
+
* EIP-712 typed data for wallet signing (framework-agnostic)
|
|
15
|
+
*
|
|
16
|
+
* Compatible with:
|
|
17
|
+
* - ethers v5: signer._signTypedData(domain, types, message)
|
|
18
|
+
* - ethers v6: signer.signTypedData(domain, types, message)
|
|
19
|
+
* - wagmi v2: useSignTypedData({ domain, types, primaryType, message })
|
|
20
|
+
* - viem: signTypedData(client, { domain, types, primaryType, message })
|
|
21
|
+
*/
|
|
22
|
+
export interface AddContenderTypedData {
|
|
23
|
+
domain: {
|
|
24
|
+
name: string;
|
|
25
|
+
version: string;
|
|
26
|
+
chainId: number;
|
|
27
|
+
verifyingContract: `0x${string}`;
|
|
28
|
+
};
|
|
29
|
+
types: {
|
|
30
|
+
AddContenderMessage: Array<{
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
primaryType: "AddContenderMessage";
|
|
36
|
+
message: {
|
|
37
|
+
proposalId: bigint;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Result of preparing a contender registration.
|
|
42
|
+
* The caller must first get the user's signature using the typedData,
|
|
43
|
+
* then submit the transaction.
|
|
44
|
+
*/
|
|
45
|
+
export interface PreparedContenderRegistration {
|
|
46
|
+
typedData: AddContenderTypedData;
|
|
47
|
+
buildTransaction: (signature: string) => PreparedTransaction;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Encode vote parameters for election castVoteWithReasonAndParams.
|
|
51
|
+
*
|
|
52
|
+
* Both NomineeElectionGovernor and MemberElectionGovernor use the same
|
|
53
|
+
* param encoding: abi.encode(address target, uint256 votes).
|
|
54
|
+
*
|
|
55
|
+
* @param target - Address of the contender/nominee to vote for
|
|
56
|
+
* @param votes - Vote amount in wei (full 18-decimal precision)
|
|
57
|
+
* @returns ABI-encoded bytes string
|
|
58
|
+
*/
|
|
59
|
+
export declare function encodeElectionVoteParams(target: string, votes: string | BigNumber): string;
|
|
60
|
+
/**
|
|
61
|
+
* Decode vote parameters from election castVoteWithReasonAndParams.
|
|
62
|
+
*
|
|
63
|
+
* @param params - ABI-encoded bytes from castVoteWithReasonAndParams
|
|
64
|
+
* @returns Decoded target address and vote amount
|
|
65
|
+
*/
|
|
66
|
+
export declare function decodeElectionVoteParams(params: string): {
|
|
67
|
+
target: string;
|
|
68
|
+
votes: BigNumber;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Build EIP-712 typed data for contender registration signing.
|
|
72
|
+
*
|
|
73
|
+
* The nominee election governor requires an EIP-712 signature of
|
|
74
|
+
* AddContenderMessage(uint256 proposalId) to register as a contender.
|
|
75
|
+
*
|
|
76
|
+
* @param governorName - The name() of the nominee election governor
|
|
77
|
+
* @param proposalId - The nominee election proposal ID
|
|
78
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
79
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
80
|
+
*/
|
|
81
|
+
export declare function getAddContenderTypedData(governorName: string, proposalId: string, governorAddress?: string, chainId?: number): AddContenderTypedData;
|
|
82
|
+
/**
|
|
83
|
+
* Prepare the addContender transaction.
|
|
84
|
+
*
|
|
85
|
+
* @param proposalId - The nominee election proposal ID
|
|
86
|
+
* @param signature - The EIP-712 signature bytes
|
|
87
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
88
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
89
|
+
*/
|
|
90
|
+
export declare function prepareAddContender(proposalId: string, signature: string, governorAddress?: string, chainId?: number): PreparedTransaction;
|
|
91
|
+
/**
|
|
92
|
+
* Prepare contender registration with both typed data and transaction builder.
|
|
93
|
+
*
|
|
94
|
+
* Usage:
|
|
95
|
+
* 1. Get governorName from the contract (e.g., via provider)
|
|
96
|
+
* 2. Call prepareContenderRegistration(governorName, proposalId)
|
|
97
|
+
* 3. Have the user sign the typedData
|
|
98
|
+
* 4. Call result.buildTransaction(signature) to get the PreparedTransaction
|
|
99
|
+
*
|
|
100
|
+
* @param governorName - The name() of the nominee election governor
|
|
101
|
+
* @param proposalId - The nominee election proposal ID
|
|
102
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
103
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
104
|
+
*/
|
|
105
|
+
export declare function prepareContenderRegistration(governorName: string, proposalId: string, governorAddress?: string, chainId?: number): PreparedContenderRegistration;
|
|
106
|
+
/**
|
|
107
|
+
* Prepare a castVoteWithReasonAndParams transaction for a nominee election.
|
|
108
|
+
*
|
|
109
|
+
* Used during NOMINEE_SELECTION phase to vote for contenders.
|
|
110
|
+
*
|
|
111
|
+
* @param proposalId - The nominee election proposal ID
|
|
112
|
+
* @param target - Address of the contender to vote for
|
|
113
|
+
* @param votes - Vote amount in wei
|
|
114
|
+
* @param reason - Optional vote reason (default: "")
|
|
115
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
116
|
+
* @param chainId - Chain ID (default: 42161)
|
|
117
|
+
*/
|
|
118
|
+
export declare function prepareNomineeElectionVote(proposalId: string, target: string, votes: string | BigNumber, reason?: string, governorAddress?: string, chainId?: number): PreparedTransaction;
|
|
119
|
+
/**
|
|
120
|
+
* Prepare a castVoteWithReasonAndParams transaction for a member election.
|
|
121
|
+
*
|
|
122
|
+
* Used during MEMBER_ELECTION phase to vote for nominees.
|
|
123
|
+
*
|
|
124
|
+
* @param proposalId - The member election proposal ID
|
|
125
|
+
* @param target - Address of the nominee to vote for
|
|
126
|
+
* @param votes - Vote amount in wei
|
|
127
|
+
* @param reason - Optional vote reason (default: "")
|
|
128
|
+
* @param governorAddress - MemberElectionGovernor contract address
|
|
129
|
+
* @param chainId - Chain ID (default: 42161)
|
|
130
|
+
*/
|
|
131
|
+
export declare function prepareMemberElectionVote(proposalId: string, target: string, votes: string | BigNumber, reason?: string, governorAddress?: string, chainId?: number): PreparedTransaction;
|
|
132
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/election/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAU,SAAS,EAAE,MAAM,QAAQ,CAAC;AAG3C,OAA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;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,eAAe,GAAE,MAA4C,EAC7D,OAAO,GAAE,MAA0B,GAClC,6BAA6B,CAQ/B;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,GAAE,MAAW,EACnB,eAAe,GAAE,MAA4C,EAC7D,OAAO,GAAE,MAA0B,GAClC,mBAAmB,CAiBrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,GAAE,MAAW,EACnB,eAAe,GAAE,MAA2C,EAC5D,OAAO,GAAE,MAA0B,GAClC,mBAAmB,CAiBrB"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Election write action preparation
|
|
4
|
+
*
|
|
5
|
+
* Prepares transactions and typed data for election participation:
|
|
6
|
+
* - Contender registration (EIP-712 sign → addContender)
|
|
7
|
+
* - Vote casting (castVoteWithReasonAndParams with encoded params)
|
|
8
|
+
*
|
|
9
|
+
* Following the SDK's prepare-only philosophy: this module builds
|
|
10
|
+
* transaction data and typed data structures, but never executes.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.encodeElectionVoteParams = encodeElectionVoteParams;
|
|
14
|
+
exports.decodeElectionVoteParams = decodeElectionVoteParams;
|
|
15
|
+
exports.getAddContenderTypedData = getAddContenderTypedData;
|
|
16
|
+
exports.prepareAddContender = prepareAddContender;
|
|
17
|
+
exports.prepareContenderRegistration = prepareContenderRegistration;
|
|
18
|
+
exports.prepareNomineeElectionVote = prepareNomineeElectionVote;
|
|
19
|
+
exports.prepareMemberElectionVote = prepareMemberElectionVote;
|
|
20
|
+
const ethers_1 = require("ethers");
|
|
21
|
+
const constants_1 = require("../constants");
|
|
22
|
+
const abis_1 = require("../abis");
|
|
23
|
+
const types_1 = require("../types");
|
|
24
|
+
const logger_1 = require("../utils/logger");
|
|
25
|
+
const log = logger_1.loggers.election;
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Vote Parameter Encoding
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Encode vote parameters for election castVoteWithReasonAndParams.
|
|
31
|
+
*
|
|
32
|
+
* Both NomineeElectionGovernor and MemberElectionGovernor use the same
|
|
33
|
+
* param encoding: abi.encode(address target, uint256 votes).
|
|
34
|
+
*
|
|
35
|
+
* @param target - Address of the contender/nominee to vote for
|
|
36
|
+
* @param votes - Vote amount in wei (full 18-decimal precision)
|
|
37
|
+
* @returns ABI-encoded bytes string
|
|
38
|
+
*/
|
|
39
|
+
function encodeElectionVoteParams(target, votes) {
|
|
40
|
+
if (!ethers_1.ethers.utils.isAddress(target)) {
|
|
41
|
+
throw new Error(`Invalid target address: ${target}`);
|
|
42
|
+
}
|
|
43
|
+
const votesBN = ethers_1.BigNumber.isBigNumber(votes) ? votes : ethers_1.BigNumber.from(votes);
|
|
44
|
+
return ethers_1.ethers.utils.defaultAbiCoder.encode(["address", "uint256"], [target, votesBN]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Decode vote parameters from election castVoteWithReasonAndParams.
|
|
48
|
+
*
|
|
49
|
+
* @param params - ABI-encoded bytes from castVoteWithReasonAndParams
|
|
50
|
+
* @returns Decoded target address and vote amount
|
|
51
|
+
*/
|
|
52
|
+
function decodeElectionVoteParams(params) {
|
|
53
|
+
const [target, votes] = ethers_1.ethers.utils.defaultAbiCoder.decode(["address", "uint256"], params);
|
|
54
|
+
return { target: target, votes: votes };
|
|
55
|
+
}
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// Contender Registration
|
|
58
|
+
// ============================================================================
|
|
59
|
+
/**
|
|
60
|
+
* Build EIP-712 typed data for contender registration signing.
|
|
61
|
+
*
|
|
62
|
+
* The nominee election governor requires an EIP-712 signature of
|
|
63
|
+
* AddContenderMessage(uint256 proposalId) to register as a contender.
|
|
64
|
+
*
|
|
65
|
+
* @param governorName - The name() of the nominee election governor
|
|
66
|
+
* @param proposalId - The nominee election proposal ID
|
|
67
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
68
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
69
|
+
*/
|
|
70
|
+
function getAddContenderTypedData(governorName, proposalId, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
71
|
+
return {
|
|
72
|
+
domain: {
|
|
73
|
+
name: governorName,
|
|
74
|
+
version: "1",
|
|
75
|
+
chainId,
|
|
76
|
+
verifyingContract: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
77
|
+
},
|
|
78
|
+
types: {
|
|
79
|
+
AddContenderMessage: [{ name: "proposalId", type: "uint256" }],
|
|
80
|
+
},
|
|
81
|
+
primaryType: "AddContenderMessage",
|
|
82
|
+
message: {
|
|
83
|
+
proposalId: BigInt(proposalId),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Prepare the addContender transaction.
|
|
89
|
+
*
|
|
90
|
+
* @param proposalId - The nominee election proposal ID
|
|
91
|
+
* @param signature - The EIP-712 signature bytes
|
|
92
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
93
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
94
|
+
*/
|
|
95
|
+
function prepareAddContender(proposalId, signature, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
96
|
+
log("prepareAddContender for proposal %s", proposalId);
|
|
97
|
+
const calldata = abis_1.nomineeElectionGovernorInterface.encodeFunctionData("addContender", [
|
|
98
|
+
ethers_1.BigNumber.from(proposalId),
|
|
99
|
+
signature,
|
|
100
|
+
]);
|
|
101
|
+
return {
|
|
102
|
+
to: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
103
|
+
data: calldata,
|
|
104
|
+
value: "0",
|
|
105
|
+
chain: (0, types_1.chainIdToChain)(chainId),
|
|
106
|
+
chainId,
|
|
107
|
+
description: `addContender(${proposalId}) on NomineeElectionGovernor`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Prepare contender registration with both typed data and transaction builder.
|
|
112
|
+
*
|
|
113
|
+
* Usage:
|
|
114
|
+
* 1. Get governorName from the contract (e.g., via provider)
|
|
115
|
+
* 2. Call prepareContenderRegistration(governorName, proposalId)
|
|
116
|
+
* 3. Have the user sign the typedData
|
|
117
|
+
* 4. Call result.buildTransaction(signature) to get the PreparedTransaction
|
|
118
|
+
*
|
|
119
|
+
* @param governorName - The name() of the nominee election governor
|
|
120
|
+
* @param proposalId - The nominee election proposal ID
|
|
121
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
122
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
123
|
+
*/
|
|
124
|
+
function prepareContenderRegistration(governorName, proposalId, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
125
|
+
log("prepareContenderRegistration for proposal %s", proposalId);
|
|
126
|
+
return {
|
|
127
|
+
typedData: getAddContenderTypedData(governorName, proposalId, governorAddress, chainId),
|
|
128
|
+
buildTransaction: (signature) => prepareAddContender(proposalId, signature, governorAddress, chainId),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// Vote Casting
|
|
133
|
+
// ============================================================================
|
|
134
|
+
/**
|
|
135
|
+
* Prepare a castVoteWithReasonAndParams transaction for a nominee election.
|
|
136
|
+
*
|
|
137
|
+
* Used during NOMINEE_SELECTION phase to vote for contenders.
|
|
138
|
+
*
|
|
139
|
+
* @param proposalId - The nominee election proposal ID
|
|
140
|
+
* @param target - Address of the contender to vote for
|
|
141
|
+
* @param votes - Vote amount in wei
|
|
142
|
+
* @param reason - Optional vote reason (default: "")
|
|
143
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
144
|
+
* @param chainId - Chain ID (default: 42161)
|
|
145
|
+
*/
|
|
146
|
+
function prepareNomineeElectionVote(proposalId, target, votes, reason = "", governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
147
|
+
log("prepareNomineeElectionVote for proposal %s, target %s", proposalId, target);
|
|
148
|
+
const params = encodeElectionVoteParams(target, votes);
|
|
149
|
+
const calldata = abis_1.nomineeElectionGovernorInterface.encodeFunctionData("castVoteWithReasonAndParams", [ethers_1.BigNumber.from(proposalId), 1, reason, params]);
|
|
150
|
+
return {
|
|
151
|
+
to: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
152
|
+
data: calldata,
|
|
153
|
+
value: "0",
|
|
154
|
+
chain: (0, types_1.chainIdToChain)(chainId),
|
|
155
|
+
chainId,
|
|
156
|
+
description: `castVoteWithReasonAndParams on NomineeElectionGovernor for ${target}`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Prepare a castVoteWithReasonAndParams transaction for a member election.
|
|
161
|
+
*
|
|
162
|
+
* Used during MEMBER_ELECTION phase to vote for nominees.
|
|
163
|
+
*
|
|
164
|
+
* @param proposalId - The member election proposal ID
|
|
165
|
+
* @param target - Address of the nominee to vote for
|
|
166
|
+
* @param votes - Vote amount in wei
|
|
167
|
+
* @param reason - Optional vote reason (default: "")
|
|
168
|
+
* @param governorAddress - MemberElectionGovernor contract address
|
|
169
|
+
* @param chainId - Chain ID (default: 42161)
|
|
170
|
+
*/
|
|
171
|
+
function prepareMemberElectionVote(proposalId, target, votes, reason = "", governorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
172
|
+
log("prepareMemberElectionVote for proposal %s, target %s", proposalId, target);
|
|
173
|
+
const params = encodeElectionVoteParams(target, votes);
|
|
174
|
+
const calldata = abis_1.memberElectionGovernorInterface.encodeFunctionData("castVoteWithReasonAndParams", [ethers_1.BigNumber.from(proposalId), 1, reason, params]);
|
|
175
|
+
return {
|
|
176
|
+
to: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
177
|
+
data: calldata,
|
|
178
|
+
value: "0",
|
|
179
|
+
chain: (0, types_1.chainIdToChain)(chainId),
|
|
180
|
+
chainId,
|
|
181
|
+
description: `castVoteWithReasonAndParams on MemberElectionGovernor for ${target}`,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/election/write.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AA+DH,4DAMC;AAQD,4DAMC;AAiBD,4DAqBC;AAUD,kDAqBC;AAgBD,oEAaC;AAkBD,gEAwBC;AAcD,8DAwBC;AAnQD,mCAA2C;AAC3C,4CAAoD;AACpD,kCAA4F;AAC5F,oCAA+D;AAC/D,4CAA0C;AAE1C,MAAM,GAAG,GAAG,gBAAO,CAAC,QAAQ,CAAC;AAyC7B,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E;;;;;;;;;GASG;AACH,SAAgB,wBAAwB,CAAC,MAAc,EAAE,KAAyB;IAChF,IAAI,CAAC,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,OAA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CastVoteWithReason, prepareCastVoteWithReasonAndParams, } from "./write";
|
|
2
|
+
export type { GovernorTarget } from "./write";
|
|
3
|
+
export { readProposalState, readProposalVotes, readProposalSnapshot, readProposalDeadline, readQuorum, readVotingPower, readGetVotes, readHasVoted, readCurrentVotingPower, readDelegate, readNomineeElectionState, readMemberElectionState, readElectionCount, readVotesUsed, readIsContender, readGovernorName, } from "./read";
|
|
4
|
+
export type { ReadContractParameters } from "./read";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Governance Module Public API
|
|
4
|
+
// ============================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readGovernorName = exports.readIsContender = exports.readVotesUsed = exports.readElectionCount = exports.readMemberElectionState = exports.readNomineeElectionState = exports.readDelegate = exports.readCurrentVotingPower = exports.readHasVoted = exports.readGetVotes = exports.readVotingPower = exports.readQuorum = exports.readProposalDeadline = exports.readProposalSnapshot = exports.readProposalVotes = exports.readProposalState = exports.prepareCastVoteWithReasonAndParams = exports.prepareCastVoteWithReason = exports.prepareCastVote = void 0;
|
|
7
|
+
var write_1 = require("./write");
|
|
8
|
+
Object.defineProperty(exports, "prepareCastVote", { enumerable: true, get: function () { return write_1.prepareCastVote; } });
|
|
9
|
+
Object.defineProperty(exports, "prepareCastVoteWithReason", { enumerable: true, get: function () { return write_1.prepareCastVoteWithReason; } });
|
|
10
|
+
Object.defineProperty(exports, "prepareCastVoteWithReasonAndParams", { enumerable: true, get: function () { return write_1.prepareCastVoteWithReasonAndParams; } });
|
|
11
|
+
var read_1 = require("./read");
|
|
12
|
+
Object.defineProperty(exports, "readProposalState", { enumerable: true, get: function () { return read_1.readProposalState; } });
|
|
13
|
+
Object.defineProperty(exports, "readProposalVotes", { enumerable: true, get: function () { return read_1.readProposalVotes; } });
|
|
14
|
+
Object.defineProperty(exports, "readProposalSnapshot", { enumerable: true, get: function () { return read_1.readProposalSnapshot; } });
|
|
15
|
+
Object.defineProperty(exports, "readProposalDeadline", { enumerable: true, get: function () { return read_1.readProposalDeadline; } });
|
|
16
|
+
Object.defineProperty(exports, "readQuorum", { enumerable: true, get: function () { return read_1.readQuorum; } });
|
|
17
|
+
Object.defineProperty(exports, "readVotingPower", { enumerable: true, get: function () { return read_1.readVotingPower; } });
|
|
18
|
+
Object.defineProperty(exports, "readGetVotes", { enumerable: true, get: function () { return read_1.readGetVotes; } });
|
|
19
|
+
Object.defineProperty(exports, "readHasVoted", { enumerable: true, get: function () { return read_1.readHasVoted; } });
|
|
20
|
+
Object.defineProperty(exports, "readCurrentVotingPower", { enumerable: true, get: function () { return read_1.readCurrentVotingPower; } });
|
|
21
|
+
Object.defineProperty(exports, "readDelegate", { enumerable: true, get: function () { return read_1.readDelegate; } });
|
|
22
|
+
Object.defineProperty(exports, "readNomineeElectionState", { enumerable: true, get: function () { return read_1.readNomineeElectionState; } });
|
|
23
|
+
Object.defineProperty(exports, "readMemberElectionState", { enumerable: true, get: function () { return read_1.readMemberElectionState; } });
|
|
24
|
+
Object.defineProperty(exports, "readElectionCount", { enumerable: true, get: function () { return read_1.readElectionCount; } });
|
|
25
|
+
Object.defineProperty(exports, "readVotesUsed", { enumerable: true, get: function () { return read_1.readVotesUsed; } });
|
|
26
|
+
Object.defineProperty(exports, "readIsContender", { enumerable: true, get: function () { return read_1.readIsContender; } });
|
|
27
|
+
Object.defineProperty(exports, "readGovernorName", { enumerable: true, get: function () { return read_1.readGovernorName; } });
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;;;AAE/E,iCAIiB;AAHf,wGAAA,eAAe,OAAA;AACf,kHAAA,yBAAyB,OAAA;AACzB,2HAAA,kCAAkC,OAAA;AAIpC,+BAiBgB;AAhBd,yGAAA,iBAAiB,OAAA;AACjB,yGAAA,iBAAiB,OAAA;AACjB,4GAAA,oBAAoB,OAAA;AACpB,4GAAA,oBAAoB,OAAA;AACpB,kGAAA,UAAU,OAAA;AACV,uGAAA,eAAe,OAAA;AACf,oGAAA,YAAY,OAAA;AACZ,oGAAA,YAAY,OAAA;AACZ,8GAAA,sBAAsB,OAAA;AACtB,oGAAA,YAAY,OAAA;AACZ,gHAAA,wBAAwB,OAAA;AACxB,+GAAA,uBAAuB,OAAA;AACvB,yGAAA,iBAAiB,OAAA;AACjB,qGAAA,aAAa,OAAA;AACb,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA"}
|