dexe-mcp 0.5.7 → 0.6.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/CHANGELOG.md +641 -497
- package/README.md +193 -104
- package/SECURITY.md +96 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +60 -0
- package/dist/config.js.map +1 -1
- package/dist/governor/adapter.d.ts +90 -0
- package/dist/governor/adapter.d.ts.map +1 -0
- package/dist/governor/adapter.js +169 -0
- package/dist/governor/adapter.js.map +1 -0
- package/dist/governor/configs/compound.json +32 -0
- package/dist/governor/configs/optimism.json +28 -0
- package/dist/governor/configs/uniswap.json +32 -0
- package/dist/governor/encoder.d.ts +59 -0
- package/dist/governor/encoder.d.ts.map +1 -0
- package/dist/governor/encoder.js +290 -0
- package/dist/governor/encoder.js.map +1 -0
- package/dist/governor/index.d.ts +11 -0
- package/dist/governor/index.d.ts.map +1 -0
- package/dist/governor/index.js +20 -0
- package/dist/governor/index.js.map +1 -0
- package/dist/governor/loader.d.ts +42 -0
- package/dist/governor/loader.d.ts.map +1 -0
- package/dist/governor/loader.js +103 -0
- package/dist/governor/loader.js.map +1 -0
- package/dist/governor/tally.d.ts +48 -0
- package/dist/governor/tally.d.ts.map +1 -0
- package/dist/governor/tally.js +103 -0
- package/dist/governor/tally.js.map +1 -0
- package/dist/governor/tools/build.d.ts +3 -0
- package/dist/governor/tools/build.d.ts.map +1 -0
- package/dist/governor/tools/build.js +137 -0
- package/dist/governor/tools/build.js.map +1 -0
- package/dist/governor/tools/extras.d.ts +4 -0
- package/dist/governor/tools/extras.d.ts.map +1 -0
- package/dist/governor/tools/extras.js +197 -0
- package/dist/governor/tools/extras.js.map +1 -0
- package/dist/governor/tools/read.d.ts +4 -0
- package/dist/governor/tools/read.d.ts.map +1 -0
- package/dist/governor/tools/read.js +174 -0
- package/dist/governor/tools/read.js.map +1 -0
- package/dist/governor/tools/simulate.d.ts +6 -0
- package/dist/governor/tools/simulate.d.ts.map +1 -0
- package/dist/governor/tools/simulate.js +191 -0
- package/dist/governor/tools/simulate.js.map +1 -0
- package/dist/lib/broadcastGuards.d.ts +41 -0
- package/dist/lib/broadcastGuards.d.ts.map +1 -0
- package/dist/lib/broadcastGuards.js +85 -0
- package/dist/lib/broadcastGuards.js.map +1 -0
- package/dist/lib/ethersProvider.d.ts +96 -0
- package/dist/lib/ethersProvider.d.ts.map +1 -0
- package/dist/lib/ethersProvider.js +170 -0
- package/dist/lib/ethersProvider.js.map +1 -0
- package/dist/lib/ipfs.d.ts +7 -0
- package/dist/lib/ipfs.d.ts.map +1 -1
- package/dist/lib/ipfs.js +32 -1
- package/dist/lib/ipfs.js.map +1 -1
- package/dist/lib/signer.d.ts +2 -0
- package/dist/lib/signer.d.ts.map +1 -1
- package/dist/lib/signer.js +4 -0
- package/dist/lib/signer.js.map +1 -1
- package/dist/tools/flow.d.ts.map +1 -1
- package/dist/tools/flow.js +13 -0
- package/dist/tools/flow.js.map +1 -1
- package/dist/tools/getConfig.d.ts.map +1 -1
- package/dist/tools/getConfig.js +17 -0
- package/dist/tools/getConfig.js.map +1 -1
- package/dist/tools/inbox.js +8 -8
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/ipfs.d.ts.map +1 -1
- package/dist/tools/ipfs.js +437 -16
- package/dist/tools/ipfs.js.map +1 -1
- package/dist/tools/predict.js +17 -17
- package/dist/tools/safe.d.ts +5 -0
- package/dist/tools/safe.d.ts.map +1 -0
- package/dist/tools/safe.js +264 -0
- package/dist/tools/safe.js.map +1 -0
- package/dist/tools/simulate.d.ts +7 -0
- package/dist/tools/simulate.d.ts.map +1 -1
- package/dist/tools/simulate.js +8 -0
- package/dist/tools/simulate.js.map +1 -1
- package/dist/tools/subgraph.js +162 -162
- package/dist/tools/txSend.d.ts.map +1 -1
- package/dist/tools/txSend.js +25 -0
- package/dist/tools/txSend.js.map +1 -1
- package/package.json +95 -84
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAsDnE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAEpD,0EAA0E;IAC1E,0EAA0E;IAC1E,gEAAgE;IAChE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,kDAAkD,YAAY,mDAAmD,CAClH,CAAC;IACJ,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC;QACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,wCAAwC,YAAY,0GAA0G,CAC/J,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,YAAY;IACZ,uCAAuC;IACvC,uCAAuC;IACvC,iEAAiE;IACjE,+EAA+E;IAC/E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAElF,MAAM,UAAU,GAAG,O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
+
import type { GovernorConfig } from "./loader.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read surfaces for the two Governor families we target.
|
|
5
|
+
*
|
|
6
|
+
* - **OZ v4 / v5** (Optimism, post-2022 OZ Governor deploys): `state`,
|
|
7
|
+
* `proposalSnapshot`, `proposalDeadline`, `proposalVotes`, `quorum(uint256)`,
|
|
8
|
+
* `proposalThreshold`, etc.
|
|
9
|
+
* - **Bravo v3** (Uniswap, Compound): `state`, `proposals(uint256)` returning a
|
|
10
|
+
* flat struct, `quorumVotes()` (fixed quorum, no per-block snapshot),
|
|
11
|
+
* `proposalThreshold`. No `proposalSnapshot` / `proposalDeadline` /
|
|
12
|
+
* `quorum(blockNumber)`.
|
|
13
|
+
*
|
|
14
|
+
* The canonical `ProposalState` enum order is identical across both families.
|
|
15
|
+
*/
|
|
16
|
+
export declare const GOVERNOR_OZ_READ_ABI: readonly ["function state(uint256 proposalId) view returns (uint8)", "function proposalSnapshot(uint256 proposalId) view returns (uint256)", "function proposalDeadline(uint256 proposalId) view returns (uint256)", "function proposalVotes(uint256 proposalId) view returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes)", "function proposalThreshold() view returns (uint256)", "function quorum(uint256 blockNumber) view returns (uint256)", "function votingDelay() view returns (uint256)", "function votingPeriod() view returns (uint256)", "function hasVoted(uint256 proposalId, address account) view returns (bool)", "function hashProposal(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) pure returns (uint256)", "function name() view returns (string)", "function version() view returns (string)"];
|
|
17
|
+
export declare const GOVERNOR_BRAVO_READ_ABI: readonly ["function state(uint256 proposalId) view returns (uint8)", "function proposals(uint256 proposalId) view returns (uint256 id, address proposer, uint256 eta, uint256 startBlock, uint256 endBlock, uint256 forVotes, uint256 againstVotes, uint256 abstainVotes, bool canceled, bool executed)", "function proposalThreshold() view returns (uint256)", "function quorumVotes() view returns (uint256)", "function votingDelay() view returns (uint256)", "function votingPeriod() view returns (uint256)", "function hasVoted(uint256 proposalId, address account) view returns (bool)", "function name() view returns (string)"];
|
|
18
|
+
export declare const IVOTES_ABI: readonly ["function getVotes(address account) view returns (uint256)", "function getPastVotes(address account, uint256 blockNumber) view returns (uint256)", "function delegates(address account) view returns (address)"];
|
|
19
|
+
/**
|
|
20
|
+
* Compound-style vote getters. Bravo voting tokens (COMP, UNI) expose
|
|
21
|
+
* `getCurrentVotes(address)` / `getPriorVotes(address, uint256)` instead of the
|
|
22
|
+
* OZ `getVotes` / `getPastVotes`. Routing is static by `votingToken.type`
|
|
23
|
+
* (see `readVotingPower`) — `ERC20VotesComp` always uses these getters; there is
|
|
24
|
+
* no runtime fallback between the two interfaces.
|
|
25
|
+
*/
|
|
26
|
+
export declare const IVOTES_COMP_ABI: readonly ["function getCurrentVotes(address account) view returns (uint96)", "function getPriorVotes(address account, uint256 blockNumber) view returns (uint96)", "function delegates(address account) view returns (address)"];
|
|
27
|
+
export declare const PROPOSAL_STATE: readonly string[];
|
|
28
|
+
export declare function stateName(stateIndex: number): string;
|
|
29
|
+
export declare function isBravo(cfg: GovernorConfig): boolean;
|
|
30
|
+
export declare function governorContract(provider: JsonRpcProvider, cfg: GovernorConfig): Contract;
|
|
31
|
+
export declare function votesContract(provider: JsonRpcProvider, cfg: GovernorConfig): Contract;
|
|
32
|
+
/**
|
|
33
|
+
* Family-agnostic voting-power read. ERC20VotesComp (UNI, COMP) exposes
|
|
34
|
+
* `getCurrentVotes` / `getPriorVotes`; ERC20Votes (OP, modern OZ) exposes
|
|
35
|
+
* `getVotes` / `getPastVotes`. Returns wei + the actual method invoked.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readVotingPower(c: Contract, cfg: GovernorConfig, account: string, blockNumber: number | undefined): Promise<{
|
|
38
|
+
power: bigint;
|
|
39
|
+
method: string;
|
|
40
|
+
}>;
|
|
41
|
+
export interface ProposalReadout {
|
|
42
|
+
state: {
|
|
43
|
+
index: number;
|
|
44
|
+
name: string;
|
|
45
|
+
};
|
|
46
|
+
snapshotBlock: string;
|
|
47
|
+
deadlineBlock: string;
|
|
48
|
+
votes: {
|
|
49
|
+
against: string;
|
|
50
|
+
for: string;
|
|
51
|
+
abstain: string;
|
|
52
|
+
};
|
|
53
|
+
bravoExtra?: {
|
|
54
|
+
proposer: string;
|
|
55
|
+
eta: string;
|
|
56
|
+
canceled: boolean;
|
|
57
|
+
executed: boolean;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Family-agnostic proposal read. Maps Bravo's `proposals(uint256)` struct onto
|
|
62
|
+
* the OZ-style {snapshot, deadline, votes} shape so callers don't branch.
|
|
63
|
+
*/
|
|
64
|
+
export declare function readProposal(c: Contract, cfg: GovernorConfig, proposalId: bigint): Promise<ProposalReadout>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the active quorum value. For OZ v4+ this is `quorum(blockNumber)`;
|
|
67
|
+
* for Bravo it's the fixed `quorumVotes()` (blockNumber is ignored, surfaced
|
|
68
|
+
* as `latest` in the response).
|
|
69
|
+
*/
|
|
70
|
+
export declare function readQuorum(c: Contract, cfg: GovernorConfig, blockNumber: number): Promise<{
|
|
71
|
+
quorum: bigint;
|
|
72
|
+
method: "quorum(blockNumber)" | "quorumVotes()";
|
|
73
|
+
}>;
|
|
74
|
+
export interface VoteTally {
|
|
75
|
+
against: bigint;
|
|
76
|
+
for: bigint;
|
|
77
|
+
abstain: bigint;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Pure projection of a hypothetical vote onto current tallies. Quorum semantics
|
|
81
|
+
* branch by family: OZ `GovernorCountingSimple` counts `for + abstain` toward
|
|
82
|
+
* quorum, Bravo counts only `forVotes`. `willPass` requires quorum met AND
|
|
83
|
+
* strictly more For than Against. No I/O — unit-testable in isolation.
|
|
84
|
+
*/
|
|
85
|
+
export declare function projectVoteImpact(bravo: boolean, current: VoteTally, support: number, weight: bigint, quorum: bigint): {
|
|
86
|
+
projected: VoteTally;
|
|
87
|
+
quorumMet: boolean;
|
|
88
|
+
will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AC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,UAAU,CAAC,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,CAAC,EAAE,QAAQ,EACX,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAoC1B;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,CAAC,EAAE,QAAQ,EACX,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAAA;CAAE,CAAC,CAO9E;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAUjE"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Contract } from "ethers";
|
|
2
|
+
/**
|
|
3
|
+
* Read surfaces for the two Governor families we target.
|
|
4
|
+
*
|
|
5
|
+
* - **OZ v4 / v5** (Optimism, post-2022 OZ Governor deploys): `state`,
|
|
6
|
+
* `proposalSnapshot`, `proposalDeadline`, `proposalVotes`, `quorum(uint256)`,
|
|
7
|
+
* `proposalThreshold`, etc.
|
|
8
|
+
* - **Bravo v3** (Uniswap, Compound): `state`, `proposals(uint256)` returning a
|
|
9
|
+
* flat struct, `quorumVotes()` (fixed quorum, no per-block snapshot),
|
|
10
|
+
* `proposalThreshold`. No `proposalSnapshot` / `proposalDeadline` /
|
|
11
|
+
* `quorum(blockNumber)`.
|
|
12
|
+
*
|
|
13
|
+
* The canonical `ProposalState` enum order is identical across both families.
|
|
14
|
+
*/
|
|
15
|
+
export const GOVERNOR_OZ_READ_ABI = [
|
|
16
|
+
"function state(uint256 proposalId) view returns (uint8)",
|
|
17
|
+
"function proposalSnapshot(uint256 proposalId) view returns (uint256)",
|
|
18
|
+
"function proposalDeadline(uint256 proposalId) view returns (uint256)",
|
|
19
|
+
"function proposalVotes(uint256 proposalId) view returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes)",
|
|
20
|
+
"function proposalThreshold() view returns (uint256)",
|
|
21
|
+
"function quorum(uint256 blockNumber) view returns (uint256)",
|
|
22
|
+
"function votingDelay() view returns (uint256)",
|
|
23
|
+
"function votingPeriod() view returns (uint256)",
|
|
24
|
+
"function hasVoted(uint256 proposalId, address account) view returns (bool)",
|
|
25
|
+
"function hashProposal(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) pure returns (uint256)",
|
|
26
|
+
"function name() view returns (string)",
|
|
27
|
+
"function version() view returns (string)",
|
|
28
|
+
];
|
|
29
|
+
export const GOVERNOR_BRAVO_READ_ABI = [
|
|
30
|
+
"function state(uint256 proposalId) view returns (uint8)",
|
|
31
|
+
"function proposals(uint256 proposalId) view returns (uint256 id, address proposer, uint256 eta, uint256 startBlock, uint256 endBlock, uint256 forVotes, uint256 againstVotes, uint256 abstainVotes, bool canceled, bool executed)",
|
|
32
|
+
"function proposalThreshold() view returns (uint256)",
|
|
33
|
+
"function quorumVotes() view returns (uint256)",
|
|
34
|
+
"function votingDelay() view returns (uint256)",
|
|
35
|
+
"function votingPeriod() view returns (uint256)",
|
|
36
|
+
"function hasVoted(uint256 proposalId, address account) view returns (bool)",
|
|
37
|
+
"function name() view returns (string)",
|
|
38
|
+
];
|
|
39
|
+
export const IVOTES_ABI = [
|
|
40
|
+
"function getVotes(address account) view returns (uint256)",
|
|
41
|
+
"function getPastVotes(address account, uint256 blockNumber) view returns (uint256)",
|
|
42
|
+
"function delegates(address account) view returns (address)",
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* Compound-style vote getters. Bravo voting tokens (COMP, UNI) expose
|
|
46
|
+
* `getCurrentVotes(address)` / `getPriorVotes(address, uint256)` instead of the
|
|
47
|
+
* OZ `getVotes` / `getPastVotes`. Routing is static by `votingToken.type`
|
|
48
|
+
* (see `readVotingPower`) — `ERC20VotesComp` always uses these getters; there is
|
|
49
|
+
* no runtime fallback between the two interfaces.
|
|
50
|
+
*/
|
|
51
|
+
export const IVOTES_COMP_ABI = [
|
|
52
|
+
"function getCurrentVotes(address account) view returns (uint96)",
|
|
53
|
+
"function getPriorVotes(address account, uint256 blockNumber) view returns (uint96)",
|
|
54
|
+
"function delegates(address account) view returns (address)",
|
|
55
|
+
];
|
|
56
|
+
export const PROPOSAL_STATE = [
|
|
57
|
+
"Pending",
|
|
58
|
+
"Active",
|
|
59
|
+
"Canceled",
|
|
60
|
+
"Defeated",
|
|
61
|
+
"Succeeded",
|
|
62
|
+
"Queued",
|
|
63
|
+
"Expired",
|
|
64
|
+
"Executed",
|
|
65
|
+
];
|
|
66
|
+
export function stateName(stateIndex) {
|
|
67
|
+
return PROPOSAL_STATE[stateIndex] ?? `Unknown(${stateIndex})`;
|
|
68
|
+
}
|
|
69
|
+
export function isBravo(cfg) {
|
|
70
|
+
return cfg.governorVersion === "bravo-v3";
|
|
71
|
+
}
|
|
72
|
+
export function governorContract(provider, cfg) {
|
|
73
|
+
const abi = isBravo(cfg) ? GOVERNOR_BRAVO_READ_ABI : GOVERNOR_OZ_READ_ABI;
|
|
74
|
+
return new Contract(cfg.governorAddress, abi, provider);
|
|
75
|
+
}
|
|
76
|
+
export function votesContract(provider, cfg) {
|
|
77
|
+
const abi = cfg.votingToken.type === "ERC20VotesComp" ? IVOTES_COMP_ABI : IVOTES_ABI;
|
|
78
|
+
return new Contract(cfg.votingToken.address, abi, provider);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Family-agnostic voting-power read. ERC20VotesComp (UNI, COMP) exposes
|
|
82
|
+
* `getCurrentVotes` / `getPriorVotes`; ERC20Votes (OP, modern OZ) exposes
|
|
83
|
+
* `getVotes` / `getPastVotes`. Returns wei + the actual method invoked.
|
|
84
|
+
*/
|
|
85
|
+
export async function readVotingPower(c, cfg, account, blockNumber) {
|
|
86
|
+
const isComp = cfg.votingToken.type === "ERC20VotesComp";
|
|
87
|
+
if (blockNumber === undefined) {
|
|
88
|
+
const method = isComp ? "getCurrentVotes" : "getVotes";
|
|
89
|
+
const power = await c.getFunction(method).staticCall(account);
|
|
90
|
+
return { power, method };
|
|
91
|
+
}
|
|
92
|
+
const method = isComp ? "getPriorVotes" : "getPastVotes";
|
|
93
|
+
const power = await c.getFunction(method).staticCall(account, blockNumber);
|
|
94
|
+
return { power, method };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Family-agnostic proposal read. Maps Bravo's `proposals(uint256)` struct onto
|
|
98
|
+
* the OZ-style {snapshot, deadline, votes} shape so callers don't branch.
|
|
99
|
+
*/
|
|
100
|
+
export async function readProposal(c, cfg, proposalId) {
|
|
101
|
+
const stateIdx = Number(await c.getFunction("state").staticCall(proposalId));
|
|
102
|
+
if (isBravo(cfg)) {
|
|
103
|
+
const p = await c.getFunction("proposals").staticCall(proposalId);
|
|
104
|
+
return {
|
|
105
|
+
state: { index: stateIdx, name: stateName(stateIdx) },
|
|
106
|
+
snapshotBlock: p.startBlock.toString(),
|
|
107
|
+
deadlineBlock: p.endBlock.toString(),
|
|
108
|
+
votes: {
|
|
109
|
+
against: p.againstVotes.toString(),
|
|
110
|
+
for: p.forVotes.toString(),
|
|
111
|
+
abstain: p.abstainVotes.toString(),
|
|
112
|
+
},
|
|
113
|
+
bravoExtra: {
|
|
114
|
+
proposer: p.proposer,
|
|
115
|
+
eta: p.eta.toString(),
|
|
116
|
+
canceled: p.canceled,
|
|
117
|
+
executed: p.executed,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const [snapshot, deadline, votes] = await Promise.all([
|
|
122
|
+
c.getFunction("proposalSnapshot").staticCall(proposalId),
|
|
123
|
+
c.getFunction("proposalDeadline").staticCall(proposalId),
|
|
124
|
+
c.getFunction("proposalVotes").staticCall(proposalId),
|
|
125
|
+
]);
|
|
126
|
+
return {
|
|
127
|
+
state: { index: stateIdx, name: stateName(stateIdx) },
|
|
128
|
+
snapshotBlock: snapshot.toString(),
|
|
129
|
+
deadlineBlock: deadline.toString(),
|
|
130
|
+
votes: {
|
|
131
|
+
against: votes[0].toString(),
|
|
132
|
+
for: votes[1].toString(),
|
|
133
|
+
abstain: votes[2].toString(),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the active quorum value. For OZ v4+ this is `quorum(blockNumber)`;
|
|
139
|
+
* for Bravo it's the fixed `quorumVotes()` (blockNumber is ignored, surfaced
|
|
140
|
+
* as `latest` in the response).
|
|
141
|
+
*/
|
|
142
|
+
export async function readQuorum(c, cfg, blockNumber) {
|
|
143
|
+
if (isBravo(cfg)) {
|
|
144
|
+
const q = await c.getFunction("quorumVotes").staticCall();
|
|
145
|
+
return { quorum: q, method: "quorumVotes()" };
|
|
146
|
+
}
|
|
147
|
+
const q = await c.getFunction("quorum").staticCall(blockNumber);
|
|
148
|
+
return { quorum: q, method: "quorum(blockNumber)" };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Pure projection of a hypothetical vote onto current tallies. Quorum semantics
|
|
152
|
+
* branch by family: OZ `GovernorCountingSimple` counts `for + abstain` toward
|
|
153
|
+
* quorum, Bravo counts only `forVotes`. `willPass` requires quorum met AND
|
|
154
|
+
* strictly more For than Against. No I/O — unit-testable in isolation.
|
|
155
|
+
*/
|
|
156
|
+
export function projectVoteImpact(bravo, current, support, weight, quorum) {
|
|
157
|
+
const projected = { ...current };
|
|
158
|
+
if (support === 0)
|
|
159
|
+
projected.against += weight;
|
|
160
|
+
else if (support === 1)
|
|
161
|
+
projected.for += weight;
|
|
162
|
+
else
|
|
163
|
+
projected.abstain += weight;
|
|
164
|
+
const quorumPool = bravo ? projected.for : projected.for + projected.abstain;
|
|
165
|
+
const quorumMet = quorumPool >= quorum;
|
|
166
|
+
const willPass = quorumMet && projected.for > projected.against;
|
|
167
|
+
return { projected, quorumMet, willPass };
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/governor/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwB,MAAM,QAAQ,CAAC;AAGxD;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,yDAAyD;IACzD,sEAAsE;IACtE,sEAAsE;IACtE,wHAAwH;IACxH,qDAAqD;IACrD,6DAA6D;IAC7D,+CAA+C;IAC/C,gDAAgD;IAChD,4EAA4E;IAC5E,+HAA+H;IAC/H,uCAAuC;IACvC,0CAA0C;CAClC,CAAC;AAEX,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,yDAAyD;IACzD,mOAAmO;IACnO,qDAAqD;IACrD,+CAA+C;IAC/C,+CAA+C;IAC/C,gDAAgD;IAChD,4EAA4E;IAC5E,uCAAuC;CAC/B,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,2DAA2D;IAC3D,oFAAoF;IACpF,4DA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"address": "0xc00e94Cb662C3520282E6f5717214004A7f26888",
|
|
9
|
+
"symbol": "COMP",
|
|
10
|
+
"decimals": 18
|
|
11
|
+
},
|
|
12
|
+
"timelock": {
|
|
13
|
+
"address": "0x6d903f6003cca6255D85CcA4D3B5E5146dC33925",
|
|
14
|
+
"minDelay": 172800
|
|
15
|
+
},
|
|
16
|
+
"votingParams": {
|
|
17
|
+
"votingDelay": 13140,
|
|
18
|
+
"votingPeriod": 19710,
|
|
19
|
+
"proposalThreshold": "25000000000000000000000",
|
|
20
|
+
"quorumNumerator": 400000,
|
|
21
|
+
"quorumDenominator": 1
|
|
22
|
+
},
|
|
23
|
+
"executor": {
|
|
24
|
+
"type": "timelock",
|
|
25
|
+
"id": null
|
|
26
|
+
},
|
|
27
|
+
"explorer": {
|
|
28
|
+
"etherscanBase": "https://etherscan.io",
|
|
29
|
+
"tallyOrgSlug": "compound"
|
|
30
|
+
},
|
|
31
|
+
"notes": "Compound GovernorBravoDelegate. Bravo signatures, Compound-style votes interface (getPriorVotes / getCurrentVotes — NOT OZ getPastVotes). quorumVotes() is a fixed value (400k COMP); quorumNumerator/Denominator here are descriptive only."
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "optimism",
|
|
3
|
+
"chainId": 10,
|
|
4
|
+
"governorAddress": "0xcDF27F107725988f2261Ce2256bDfCdE8B382B10",
|
|
5
|
+
"governorVersion": "oz-v4",
|
|
6
|
+
"votingToken": {
|
|
7
|
+
"type": "ERC20Votes",
|
|
8
|
+
"address": "0x4200000000000000000000000000000000000042",
|
|
9
|
+
"symbol": "OP",
|
|
10
|
+
"decimals": 18
|
|
11
|
+
},
|
|
12
|
+
"votingParams": {
|
|
13
|
+
"votingDelay": 6646,
|
|
14
|
+
"votingPeriod": 46027,
|
|
15
|
+
"proposalThreshold": "0",
|
|
16
|
+
"quorumNumerator": 30,
|
|
17
|
+
"quorumDenominator": 100
|
|
18
|
+
},
|
|
19
|
+
"executor": {
|
|
20
|
+
"type": "governor-self",
|
|
21
|
+
"id": null
|
|
22
|
+
},
|
|
23
|
+
"explorer": {
|
|
24
|
+
"etherscanBase": "https://optimistic.etherscan.io",
|
|
25
|
+
"tallyOrgSlug": "optimism"
|
|
26
|
+
},
|
|
27
|
+
"notes": "Optimism's modified OZ Governor. ERC20Votes (OP token implements OZ-style getPastVotes). Custom ProposalTypesConfigurator is OUT OF SCOPE (research/06-execution-plan.md §6). Treated as vanilla oz-v4 surface for read+build tools."
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "uniswap",
|
|
3
|
+
"chainId": 1,
|
|
4
|
+
"governorAddress": "0x408ED6354d4973f66138C91495F2f2FCbd8724C3",
|
|
5
|
+
"governorVersion": "bravo-v3",
|
|
6
|
+
"votingToken": {
|
|
7
|
+
"type": "ERC20VotesComp",
|
|
8
|
+
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
|
|
9
|
+
"symbol": "UNI",
|
|
10
|
+
"decimals": 18
|
|
11
|
+
},
|
|
12
|
+
"timelock": {
|
|
13
|
+
"address": "0x1a9C8182C09F50355CeA8fFF4b7E1649A535498a",
|
|
14
|
+
"minDelay": 172800
|
|
15
|
+
},
|
|
16
|
+
"votingParams": {
|
|
17
|
+
"votingDelay": 1,
|
|
18
|
+
"votingPeriod": 50400,
|
|
19
|
+
"proposalThreshold": "2500000000000000000000000",
|
|
20
|
+
"quorumNumerator": 4,
|
|
21
|
+
"quorumDenominator": 100
|
|
22
|
+
},
|
|
23
|
+
"executor": {
|
|
24
|
+
"type": "timelock",
|
|
25
|
+
"id": null
|
|
26
|
+
},
|
|
27
|
+
"explorer": {
|
|
28
|
+
"etherscanBase": "https://etherscan.io",
|
|
29
|
+
"tallyOrgSlug": "uniswap"
|
|
30
|
+
},
|
|
31
|
+
"notes": "Uniswap GovernorBravoDelegate (proxy). Bravo signatures: propose has signatures[], queue/execute take proposalId, quorum is fixed quorumVotes(), snapshot/deadline via proposals(uint256). ProposalState enum matches OZ canonical order."
|
|
32
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { GovernorConfig } from "./loader.js";
|
|
2
|
+
/**
|
|
3
|
+
* Write-side ABI fragments per governor family. The exact selectors differ
|
|
4
|
+
* between OZ v4+ and Bravo for propose / queue / execute, so build tools
|
|
5
|
+
* MUST encode against the correct family. `castVote` and `castVoteWithReason`
|
|
6
|
+
* share signatures across families.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GOVERNOR_OZ_WRITE_ABI: readonly ["function propose(address[] targets, uint256[] values, bytes[] calldatas, string description) returns (uint256)", "function castVote(uint256 proposalId, uint8 support) returns (uint256)", "function castVoteWithReason(uint256 proposalId, uint8 support, string reason) returns (uint256)", "function queue(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) returns (uint256)", "function execute(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) payable returns (uint256)", "function cancel(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) returns (uint256)", "function hashProposal(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) pure returns (uint256)"];
|
|
9
|
+
export declare const GOVERNOR_BRAVO_WRITE_ABI: readonly ["function propose(address[] targets, uint256[] values, string[] signatures, bytes[] calldatas, string description) returns (uint256)", "function castVote(uint256 proposalId, uint8 support)", "function castVoteWithReason(uint256 proposalId, uint8 support, string reason)", "function queue(uint256 proposalId)", "function execute(uint256 proposalId) payable", "function cancel(uint256 proposalId)"];
|
|
10
|
+
export declare const IVOTES_WRITE_ABI: readonly ["function delegate(address delegatee)"];
|
|
11
|
+
export interface BuiltTx {
|
|
12
|
+
to: string;
|
|
13
|
+
value: string;
|
|
14
|
+
data: string;
|
|
15
|
+
selector: string;
|
|
16
|
+
method: string;
|
|
17
|
+
args: unknown;
|
|
18
|
+
family: "oz" | "bravo";
|
|
19
|
+
}
|
|
20
|
+
/** Upper bound on a proposal's action count. Guards the calldata builders
|
|
21
|
+
* against pathological array sizes; well above any real governance proposal. */
|
|
22
|
+
export declare const MAX_ACTIONS = 50;
|
|
23
|
+
export interface ProposeArgs {
|
|
24
|
+
targets: string[];
|
|
25
|
+
values: (string | number | bigint)[];
|
|
26
|
+
calldatas: string[];
|
|
27
|
+
description: string;
|
|
28
|
+
/** Bravo only: per-target function signature strings (e.g. "transfer(address,uint256)"). Defaults to []. */
|
|
29
|
+
signatures?: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare function buildPropose(cfg: GovernorConfig, args: ProposeArgs): BuiltTx;
|
|
32
|
+
export type Support = 0 | 1 | 2;
|
|
33
|
+
export declare function buildVoteCast(cfg: GovernorConfig, proposalId: string | bigint, support: Support, reason?: string): BuiltTx;
|
|
34
|
+
export interface QueueExecuteArgs {
|
|
35
|
+
/** Bravo: proposalId. OZ: hash will be recomputed from the rest. */
|
|
36
|
+
proposalId?: string | bigint;
|
|
37
|
+
/** OZ only. */
|
|
38
|
+
targets?: string[];
|
|
39
|
+
/** OZ only. */
|
|
40
|
+
values?: (string | number | bigint)[];
|
|
41
|
+
/** OZ only. */
|
|
42
|
+
calldatas?: string[];
|
|
43
|
+
/** OZ only. Either the raw description (we hash it) or descriptionHash. */
|
|
44
|
+
description?: string;
|
|
45
|
+
descriptionHash?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function buildQueue(cfg: GovernorConfig, args: QueueExecuteArgs): BuiltTx;
|
|
48
|
+
export declare function buildExecute(cfg: GovernorConfig, args: QueueExecuteArgs, msgValue?: string | bigint): BuiltTx;
|
|
49
|
+
export declare function buildCancel(cfg: GovernorConfig, args: QueueExecuteArgs): BuiltTx;
|
|
50
|
+
export declare function buildDelegate(cfg: GovernorConfig, delegatee: string): BuiltTx;
|
|
51
|
+
/**
|
|
52
|
+
* Round-trip helper exposed for tests: decode calldata back into named args
|
|
53
|
+
* for selector-validity + arg-roundtrip assertions.
|
|
54
|
+
*/
|
|
55
|
+
export declare function decodeGovernorWrite(cfg: GovernorConfig, data: string): {
|
|
56
|
+
method: string;
|
|
57
|
+
args: unknown[];
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=encoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/governor/encoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD;;;;;GAKG;AAEH,eAAO,MAAM,qBAAqB,qxBAQxB,CAAC;AAEX,eAAO,MAAM,wBAAwB,wZAO3B,CAAC;AAEX,eAAO,MAAM,gBAAgB,mDAEnB,CAAC;AAEX,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;CACxB;AAmDD;gFACgF;AAChF,eAAO,MAAM,WAAW,KAAK,CAAC;AAwB9B,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACrC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,4GAA4G;IAC5G,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CA+B5E;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhC,wBAAgB,aAAa,CAC3B,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,OAA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