@poa-box/core 0.1.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 +201 -0
- package/dist/abis/DirectDemocracyVotingNew.d.ts +749 -0
- package/dist/abis/DirectDemocracyVotingNew.js +961 -0
- package/dist/abis/ERC20.d.ts +90 -0
- package/dist/abis/ERC20.js +125 -0
- package/dist/abis/EducationHubNew.d.ts +590 -0
- package/dist/abis/EducationHubNew.js +762 -0
- package/dist/abis/EligibilityModuleNew.d.ts +1615 -0
- package/dist/abis/EligibilityModuleNew.js +2082 -0
- package/dist/abis/Executor.d.ts +619 -0
- package/dist/abis/Executor.js +796 -0
- package/dist/abis/HybridVotingNew.d.ts +898 -0
- package/dist/abis/HybridVotingNew.js +1149 -0
- package/dist/abis/ImplementationRegistry.d.ts +270 -0
- package/dist/abis/ImplementationRegistry.js +355 -0
- package/dist/abis/OrgDeployerNew.d.ts +1275 -0
- package/dist/abis/OrgDeployerNew.js +1630 -0
- package/dist/abis/OrgRegistry.d.ts +670 -0
- package/dist/abis/OrgRegistry.js +868 -0
- package/dist/abis/ParticipationToken.d.ts +1086 -0
- package/dist/abis/ParticipationToken.js +1415 -0
- package/dist/abis/PasskeyAccount.d.ts +788 -0
- package/dist/abis/PasskeyAccount.js +1019 -0
- package/dist/abis/PasskeyAccountFactory.d.ts +344 -0
- package/dist/abis/PasskeyAccountFactory.js +449 -0
- package/dist/abis/PaymasterHub.d.ts +1603 -0
- package/dist/abis/PaymasterHub.js +2048 -0
- package/dist/abis/PaymentManager.d.ts +520 -0
- package/dist/abis/PaymentManager.js +671 -0
- package/dist/abis/PoaManager.d.ts +344 -0
- package/dist/abis/PoaManager.js +449 -0
- package/dist/abis/QuickJoinNew.d.ts +855 -0
- package/dist/abis/QuickJoinNew.js +1098 -0
- package/dist/abis/TaskManagerNew.d.ts +1236 -0
- package/dist/abis/TaskManagerNew.js +1573 -0
- package/dist/abis/ToggleModule.d.ts +193 -0
- package/dist/abis/ToggleModule.js +255 -0
- package/dist/abis/UniversalAccountRegistry.d.ts +577 -0
- package/dist/abis/UniversalAccountRegistry.js +750 -0
- package/dist/abis/ZkEmailInvites.d.ts +823 -0
- package/dist/abis/ZkEmailInvites.js +1060 -0
- package/dist/abis/external/AaveGovernanceV2.d.ts +128 -0
- package/dist/abis/external/AaveGovernanceV2.js +177 -0
- package/dist/abis/external/AaveGovernanceV3.d.ts +160 -0
- package/dist/abis/external/AaveGovernanceV3.js +220 -0
- package/dist/abis/external/AragonVoting.d.ts +107 -0
- package/dist/abis/external/AragonVoting.js +150 -0
- package/dist/abis/external/CurveGaugeController.d.ts +95 -0
- package/dist/abis/external/CurveGaugeController.js +130 -0
- package/dist/abis/external/CurveVotingEscrow.d.ts +86 -0
- package/dist/abis/external/CurveVotingEscrow.js +116 -0
- package/dist/abis/external/GovernorAlpha.d.ts +172 -0
- package/dist/abis/external/GovernorAlpha.js +228 -0
- package/dist/abis/external/MakerDAOChief.d.ts +92 -0
- package/dist/abis/external/MakerDAOChief.js +129 -0
- package/dist/abis/external/OZGovernor.d.ts +227 -0
- package/dist/abis/external/OZGovernor.js +317 -0
- package/dist/abis/external/SolidlyVotingEscrow.d.ts +196 -0
- package/dist/abis/external/SolidlyVotingEscrow.js +260 -0
- package/dist/abis/index.d.ts +62 -0
- package/dist/abis/index.js +98 -0
- package/dist/chains.d.ts +150 -0
- package/dist/chains.js +320 -0
- package/dist/context.d.ts +48 -0
- package/dist/context.js +38 -0
- package/dist/contracts.d.ts +24 -0
- package/dist/contracts.js +41 -0
- package/dist/encoding.d.ts +58 -0
- package/dist/encoding.js +243 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.js +4 -0
- package/dist/error-catalog.d.ts +41 -0
- package/dist/error-catalog.js +941 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.js +60 -0
- package/dist/execute/ethers.d.ts +93 -0
- package/dist/execute/ethers.js +323 -0
- package/dist/execute/index.d.ts +7 -0
- package/dist/execute/index.js +23 -0
- package/dist/execute/sponsored.d.ts +68 -0
- package/dist/execute/sponsored.js +277 -0
- package/dist/exit-codes.d.ts +18 -0
- package/dist/exit-codes.js +21 -0
- package/dist/format.d.ts +21 -0
- package/dist/format.js +89 -0
- package/dist/graph/client.d.ts +298 -0
- package/dist/graph/client.js +702 -0
- package/dist/graph/documents/activity.d.ts +9 -0
- package/dist/graph/documents/activity.js +164 -0
- package/dist/graph/documents/beacons.d.ts +172 -0
- package/dist/graph/documents/beacons.js +345 -0
- package/dist/graph/documents/index.d.ts +21 -0
- package/dist/graph/documents/index.js +57 -0
- package/dist/graph/documents/infrastructure.d.ts +30 -0
- package/dist/graph/documents/infrastructure.js +34 -0
- package/dist/graph/documents/org.d.ts +15 -0
- package/dist/graph/documents/org.js +249 -0
- package/dist/graph/documents/paymaster.d.ts +95 -0
- package/dist/graph/documents/paymaster.js +101 -0
- package/dist/graph/documents/role.d.ts +6 -0
- package/dist/graph/documents/role.js +41 -0
- package/dist/graph/documents/roles.d.ts +50 -0
- package/dist/graph/documents/roles.js +112 -0
- package/dist/graph/documents/task.d.ts +84 -0
- package/dist/graph/documents/task.js +236 -0
- package/dist/graph/documents/token.d.ts +13 -0
- package/dist/graph/documents/token.js +126 -0
- package/dist/graph/documents/treasury.d.ts +39 -0
- package/dist/graph/documents/treasury.js +136 -0
- package/dist/graph/documents/user.d.ts +120 -0
- package/dist/graph/documents/user.js +302 -0
- package/dist/graph/documents/voting-classes.d.ts +69 -0
- package/dist/graph/documents/voting-classes.js +149 -0
- package/dist/graph/documents/voting.d.ts +28 -0
- package/dist/graph/documents/voting.js +163 -0
- package/dist/graph/documents/vouch.d.ts +79 -0
- package/dist/graph/documents/vouch.js +171 -0
- package/dist/graph/documents/zkemail.d.ts +63 -0
- package/dist/graph/documents/zkemail.js +188 -0
- package/dist/graph/index.d.ts +2 -0
- package/dist/graph/index.js +41 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +92 -0
- package/dist/ipfs.d.ts +39 -0
- package/dist/ipfs.js +214 -0
- package/dist/label-aliases.d.ts +31 -0
- package/dist/label-aliases.js +70 -0
- package/dist/metadata/education.d.ts +30 -0
- package/dist/metadata/education.js +31 -0
- package/dist/metadata/index.d.ts +12 -0
- package/dist/metadata/index.js +48 -0
- package/dist/metadata/org.d.ts +92 -0
- package/dist/metadata/org.js +93 -0
- package/dist/metadata/proposal.d.ts +44 -0
- package/dist/metadata/proposal.js +45 -0
- package/dist/metadata/role.d.ts +38 -0
- package/dist/metadata/role.js +35 -0
- package/dist/metadata/task.d.ts +108 -0
- package/dist/metadata/task.js +81 -0
- package/dist/metadata/token.d.ts +32 -0
- package/dist/metadata/token.js +36 -0
- package/dist/metadata/user.d.ts +63 -0
- package/dist/metadata/user.js +70 -0
- package/dist/multicall.d.ts +32 -0
- package/dist/multicall.js +96 -0
- package/dist/payout.d.ts +59 -0
- package/dist/payout.js +96 -0
- package/dist/perms.d.ts +47 -0
- package/dist/perms.js +120 -0
- package/dist/preflight.d.ts +72 -0
- package/dist/preflight.js +269 -0
- package/dist/reads/education.d.ts +79 -0
- package/dist/reads/education.js +122 -0
- package/dist/reads/eligibility.d.ts +377 -0
- package/dist/reads/eligibility.js +687 -0
- package/dist/reads/index.d.ts +16 -0
- package/dist/reads/index.js +55 -0
- package/dist/reads/org.d.ts +258 -0
- package/dist/reads/org.js +220 -0
- package/dist/reads/paymaster.d.ts +147 -0
- package/dist/reads/paymaster.js +235 -0
- package/dist/reads/project.d.ts +33 -0
- package/dist/reads/project.js +62 -0
- package/dist/reads/resolve.d.ts +34 -0
- package/dist/reads/resolve.js +64 -0
- package/dist/reads/task.d.ts +286 -0
- package/dist/reads/task.js +280 -0
- package/dist/reads/token.d.ts +94 -0
- package/dist/reads/token.js +75 -0
- package/dist/reads/treasury.d.ts +222 -0
- package/dist/reads/treasury.js +241 -0
- package/dist/reads/user.d.ts +229 -0
- package/dist/reads/user.js +155 -0
- package/dist/reads/vote.d.ts +296 -0
- package/dist/reads/vote.js +392 -0
- package/dist/reads/zkemail.d.ts +117 -0
- package/dist/reads/zkemail.js +217 -0
- package/dist/similarity.d.ts +36 -0
- package/dist/similarity.js +67 -0
- package/dist/sponsorship-config.d.ts +47 -0
- package/dist/sponsorship-config.js +41 -0
- package/dist/stats.d.ts +11 -0
- package/dist/stats.js +27 -0
- package/dist/task-lens.d.ts +113 -0
- package/dist/task-lens.js +210 -0
- package/dist/tx/education.d.ts +169 -0
- package/dist/tx/education.js +344 -0
- package/dist/tx/eligibility.d.ts +511 -0
- package/dist/tx/eligibility.js +818 -0
- package/dist/tx/governance.d.ts +85 -0
- package/dist/tx/governance.js +87 -0
- package/dist/tx/index.d.ts +17 -0
- package/dist/tx/index.js +56 -0
- package/dist/tx/intent.d.ts +67 -0
- package/dist/tx/intent.js +48 -0
- package/dist/tx/org.d.ts +321 -0
- package/dist/tx/org.js +544 -0
- package/dist/tx/paymaster.d.ts +140 -0
- package/dist/tx/paymaster.js +251 -0
- package/dist/tx/project.d.ts +146 -0
- package/dist/tx/project.js +217 -0
- package/dist/tx/task.d.ts +480 -0
- package/dist/tx/task.js +1149 -0
- package/dist/tx/token.d.ts +96 -0
- package/dist/tx/token.js +165 -0
- package/dist/tx/treasury.d.ts +474 -0
- package/dist/tx/treasury.js +911 -0
- package/dist/tx/user.d.ts +177 -0
- package/dist/tx/user.js +292 -0
- package/dist/tx/vote.d.ts +332 -0
- package/dist/tx/vote.js +762 -0
- package/dist/tx/zkemail.d.ts +90 -0
- package/dist/tx/zkemail.js +210 -0
- package/dist/validation.d.ts +8 -0
- package/dist/validation.js +39 -0
- package/dist/version.d.ts +142 -0
- package/dist/version.js +257 -0
- package/dist/zkemail.d.ts +161 -0
- package/dist/zkemail.js +299 -0
- package/package.json +130 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Treasury transaction builders — ports of `pop treasury *` write paths
|
|
3
|
+
* (src/commands/treasury/).
|
|
4
|
+
*
|
|
5
|
+
* Direct writes (Level 1, PaymentManager / ERC20):
|
|
6
|
+
* buildApproveErc20 + buildPayErc20 — pop treasury deposit (two txs)
|
|
7
|
+
* buildClaimDistribution — pop treasury claim / claim-mine
|
|
8
|
+
* buildOptOut — pop treasury opt-out / opt-in
|
|
9
|
+
*
|
|
10
|
+
* Governance wraps (option-0 execution batch on HybridVoting, via ./governance):
|
|
11
|
+
* buildSendProposal — pop treasury send
|
|
12
|
+
* buildDistributionProposal — pop treasury propose-distribution
|
|
13
|
+
* buildSwapProposal — pop treasury propose-swap
|
|
14
|
+
* buildSdaiProposal — pop treasury propose-sdai
|
|
15
|
+
* buildFinalizeDistributionProposal — pop treasury propose-finalize
|
|
16
|
+
*
|
|
17
|
+
* Merkle machinery: the PT-proportional allocation + OZ StandardMerkleTree
|
|
18
|
+
* logic that was DUPLICATED between compute-merkle.ts (builder) and
|
|
19
|
+
* claim-mine.ts (reconstructor) lives here once, as pure functions.
|
|
20
|
+
*/
|
|
21
|
+
import { ethers } from 'ethers';
|
|
22
|
+
import { StandardMerkleTree } from '@openzeppelin/merkle-tree';
|
|
23
|
+
import type { TxIntent } from './intent';
|
|
24
|
+
import type { PopContext } from '../context';
|
|
25
|
+
/** Gnosis mainnet WXDAI/sDAI — the propose-sdai strategy is Gnosis-only. */
|
|
26
|
+
export declare const GNOSIS_CHAIN_ID = 100;
|
|
27
|
+
export declare const WXDAI = "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d";
|
|
28
|
+
export declare const SDAI = "0xaf204776c7245bF4147c2612BF6e5972Ee483701";
|
|
29
|
+
export interface ApproveErc20Args {
|
|
30
|
+
tokenAddress: string;
|
|
31
|
+
spender: string;
|
|
32
|
+
amountWei: ethers.BigNumberish;
|
|
33
|
+
orgId?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Port of `pop treasury deposit` step 1 — src/commands/treasury/deposit.ts:
|
|
37
|
+
* ERC20.approve(paymentManagerAddress, amountWei).
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildApproveErc20(a: ApproveErc20Args): TxIntent;
|
|
40
|
+
export interface PayErc20Args {
|
|
41
|
+
paymentManagerAddress: string;
|
|
42
|
+
tokenAddress: string;
|
|
43
|
+
amountWei: ethers.BigNumberish;
|
|
44
|
+
orgId?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Port of `pop treasury deposit` step 2 — src/commands/treasury/deposit.ts:
|
|
48
|
+
* PaymentManager.payERC20(token, amountWei) (pulls via transferFrom, emits
|
|
49
|
+
* PaymentReceived). DESTRUCTIVE for the depositor: withdrawing later requires
|
|
50
|
+
* a governance vote.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildPayErc20(a: PayErc20Args): TxIntent;
|
|
53
|
+
export interface ClaimDistributionArgs {
|
|
54
|
+
paymentManagerAddress: string;
|
|
55
|
+
distributionId: ethers.BigNumberish;
|
|
56
|
+
amountWei: ethers.BigNumberish;
|
|
57
|
+
/** bytes32[] merkle proof — must hash against the raw amount exactly. */
|
|
58
|
+
proof: string[];
|
|
59
|
+
orgId?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Port of `pop treasury claim` / `pop treasury claim-mine` —
|
|
63
|
+
* src/commands/treasury/claim.ts, claim-mine.ts:
|
|
64
|
+
* PaymentManager.claimDistribution(distId, amountWei, proof).
|
|
65
|
+
*
|
|
66
|
+
* Host-side revert predictors the CLI runs before this (deliberately NOT in
|
|
67
|
+
* the builder — they need a provider and gate broadcasting, not encoding):
|
|
68
|
+
* finalized, hasClaimed(dist, addr), isOptedOut(addr). Opt-out BLOCKS on the
|
|
69
|
+
* deployed PaymentManager (pre-L-19 vintage still reverts OptedOut).
|
|
70
|
+
*/
|
|
71
|
+
export declare function buildClaimDistribution(a: ClaimDistributionArgs): TxIntent;
|
|
72
|
+
export interface OptOutArgs {
|
|
73
|
+
paymentManagerAddress: string;
|
|
74
|
+
/** true = opt out of distributions, false = opt back in. */
|
|
75
|
+
optOut: boolean;
|
|
76
|
+
orgId?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Port of `pop treasury opt-out` / `pop treasury opt-in` —
|
|
80
|
+
* src/commands/treasury/opt-out.ts: PaymentManager.optOut(bool).
|
|
81
|
+
* Permissionless and idempotent; the CLI's no-op short-circuit reads
|
|
82
|
+
* isOptedOut over RPC (deliberately never the subgraph — the OptOutToggle
|
|
83
|
+
* table is empty on every live deployment AND the read gates a write).
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildOptOut(a: OptOutArgs): TxIntent;
|
|
86
|
+
export interface TreasuryRecipient {
|
|
87
|
+
to: string;
|
|
88
|
+
amount: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Parse recipients into a validated list (max 8 — the Executor batch cap).
|
|
92
|
+
* Port of parseRecipients in src/commands/treasury/send.ts; accepts the
|
|
93
|
+
* already-parsed array or the CLI's raw --recipients JSON string.
|
|
94
|
+
*/
|
|
95
|
+
export declare function parseRecipients(input: {
|
|
96
|
+
to?: string;
|
|
97
|
+
amount?: number;
|
|
98
|
+
recipients?: string | Array<{
|
|
99
|
+
to: string;
|
|
100
|
+
amount: number;
|
|
101
|
+
}>;
|
|
102
|
+
}): TreasuryRecipient[];
|
|
103
|
+
/**
|
|
104
|
+
* Validate a merkle proof array — port of the shape check in parseProof
|
|
105
|
+
* (src/commands/treasury/claim.ts), minus the fs half. Accepts the array or
|
|
106
|
+
* the CLI's inline JSON string; the allocation-object form ({ proof: [...] })
|
|
107
|
+
* is unwrapped like the CLI's --proof-file path.
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseProof(input: string | string[] | {
|
|
110
|
+
proof: string[];
|
|
111
|
+
}): string[];
|
|
112
|
+
/**
|
|
113
|
+
* Convert an amount to the raw claim value: decimal token units, or raw wei
|
|
114
|
+
* with `wei`. Port of parseClaimAmount in src/commands/treasury/claim.ts.
|
|
115
|
+
* The merkle leaf hashes the raw amount, so exactness matters.
|
|
116
|
+
*/
|
|
117
|
+
export declare function parseClaimAmount(amount: string, wei: boolean, decimals: number): ethers.BigNumber;
|
|
118
|
+
/**
|
|
119
|
+
* Merkle tree — OpenZeppelin StandardMerkleTree, matching PaymentManager on-chain.
|
|
120
|
+
*
|
|
121
|
+
* PaymentManager.claim recomputes the leaf as
|
|
122
|
+
* keccak256(bytes.concat(keccak256(abi.encode(msg.sender, claimAmount))))
|
|
123
|
+
* and verifies it with OZ `MerkleProof.verify`, so the tree must be built exactly the way the
|
|
124
|
+
* OZ library builds it.
|
|
125
|
+
*
|
|
126
|
+
* The CLI previously used a hand-rolled tree that paired leaves left-to-right per layer and
|
|
127
|
+
* promoted an odd trailing leaf unchanged. That agrees with OZ for 1, 2, 3, 4, 6 and 8 leaves
|
|
128
|
+
* but DIVERGES at 5 and 7 (OZ builds a complete 2n-1 tree and pairs by node index). For an org
|
|
129
|
+
* with 5 or 7 members the computed root and proofs were rejected by MerkleProof.verify, so a
|
|
130
|
+
* distribution created from them could never be claimed. Pinned by
|
|
131
|
+
* test/commands/treasury-compute-merkle.test.ts. This module is the single copy that ends the
|
|
132
|
+
* builder/reconstructor drift class of bug.
|
|
133
|
+
*/
|
|
134
|
+
export interface DistributionMemberInput {
|
|
135
|
+
address: string;
|
|
136
|
+
/** 18-decimal wei string (subgraph participationTokenBalance). */
|
|
137
|
+
participationTokenBalance: string;
|
|
138
|
+
membershipStatus: string;
|
|
139
|
+
username?: string | null;
|
|
140
|
+
}
|
|
141
|
+
export interface DistributionAllocation {
|
|
142
|
+
/** EIP-55 checksummed. */
|
|
143
|
+
address: string;
|
|
144
|
+
username: string | null;
|
|
145
|
+
ptBalance: ethers.BigNumber;
|
|
146
|
+
/** Raw allocation in payout-token wei. */
|
|
147
|
+
amount: ethers.BigNumber;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* PT-proportional allocations — the shared rule of compute-merkle.ts (builder)
|
|
151
|
+
* and claim-mine.ts (reconstructor):
|
|
152
|
+
* - eligible = membershipStatus 'Active' AND PT > 0 AND not opted out
|
|
153
|
+
* - allocation = totalAmount * memberPT / eligiblePT
|
|
154
|
+
* - rounding dust goes to the FIRST member — callers must pass members
|
|
155
|
+
* ordered by PT balance desc (both member queries do), so that is the
|
|
156
|
+
* largest holder.
|
|
157
|
+
*
|
|
158
|
+
* Throws with the CLI's messages when no one is eligible.
|
|
159
|
+
*/
|
|
160
|
+
export declare function computeDistributionAllocations(members: DistributionMemberInput[], totalAmountWei: ethers.BigNumberish, optedOut?: Set<string>): DistributionAllocation[];
|
|
161
|
+
/**
|
|
162
|
+
* Build the OZ StandardMerkleTree over ['address', 'uint256'] leaves —
|
|
163
|
+
* exactly what compute-merkle.ts commits and claim-mine.ts reconstructs.
|
|
164
|
+
* StandardMerkleTree hashes each value pair itself (double-keccak over
|
|
165
|
+
* abi.encode) and sorts leaves internally, so proofs are looked up by the
|
|
166
|
+
* ORIGINAL value, not by index.
|
|
167
|
+
*/
|
|
168
|
+
export declare function buildDistributionTree(allocations: Array<Pick<DistributionAllocation, 'address' | 'amount'>>): StandardMerkleTree<[string, string]>;
|
|
169
|
+
/** Proof for one allocation — looked up by VALUE (OZ sorts leaves internally). */
|
|
170
|
+
export declare function getAllocationProof(tree: StandardMerkleTree<[string, string]>, allocation: Pick<DistributionAllocation, 'address' | 'amount'>): string[];
|
|
171
|
+
export interface SendProposalArgs {
|
|
172
|
+
hybridVotingAddress: string;
|
|
173
|
+
/** Validated via parseRecipients (max 8). */
|
|
174
|
+
recipients: TreasuryRecipient[];
|
|
175
|
+
/** null for the chain's native token. */
|
|
176
|
+
tokenAddress: string | null;
|
|
177
|
+
/** 18 for native; getTokenDecimals(token) otherwise — as the CLI does. */
|
|
178
|
+
decimals: number;
|
|
179
|
+
/** Native currency symbol for native sends, the token address otherwise. */
|
|
180
|
+
tokenLabel: string;
|
|
181
|
+
/** bytes32 — ipfsCidToBytes32 of the pinned proposal metadata. */
|
|
182
|
+
descriptionHash: string;
|
|
183
|
+
durationMinutes: ethers.BigNumberish;
|
|
184
|
+
orgId?: string;
|
|
185
|
+
ipfs?: {
|
|
186
|
+
cid: string;
|
|
187
|
+
metadata: unknown;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Port of `pop treasury send` — src/commands/treasury/send.ts.
|
|
192
|
+
* HybridVoting.createProposal wrapping an option-0 batch of at most 8 calls:
|
|
193
|
+
* native transfers as [to, amountWei, '0x'], ERC20 as
|
|
194
|
+
* [token, 0, transfer(to, amountWei)]. Option 1 is a no-op.
|
|
195
|
+
*/
|
|
196
|
+
export declare function buildSendProposal(a: SendProposalArgs): TxIntent;
|
|
197
|
+
export interface DistributionProposalArgs {
|
|
198
|
+
hybridVotingAddress: string;
|
|
199
|
+
paymentManagerAddress: string;
|
|
200
|
+
/** As committed in merkle-distribution.json — passed through verbatim. */
|
|
201
|
+
tokenAddress: string;
|
|
202
|
+
totalAmountWei: ethers.BigNumberish;
|
|
203
|
+
merkleRoot: string;
|
|
204
|
+
checkpointBlock: ethers.BigNumberish;
|
|
205
|
+
memberCount: number;
|
|
206
|
+
/** formatUnits(totalAmountWei, payout decimals) — drives the title text. */
|
|
207
|
+
totalHuman: string;
|
|
208
|
+
descriptionHash: string;
|
|
209
|
+
durationMinutes: ethers.BigNumberish;
|
|
210
|
+
orgId?: string;
|
|
211
|
+
ipfs?: {
|
|
212
|
+
cid: string;
|
|
213
|
+
metadata: unknown;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Port of `pop treasury propose-distribution` —
|
|
218
|
+
* src/commands/treasury/propose-distribution.ts. HybridVoting.createProposal
|
|
219
|
+
* wrapping PaymentManager.createDistribution(payoutToken, amount, merkleRoot,
|
|
220
|
+
* checkpointBlock) — an executor-only call, hence the governance wrap.
|
|
221
|
+
* createDistribution reverts InsufficientFunds at EXECUTION time if the
|
|
222
|
+
* PaymentManager's balance can't cover total committed + this amount.
|
|
223
|
+
*/
|
|
224
|
+
export declare function buildDistributionProposal(a: DistributionProposalArgs): TxIntent;
|
|
225
|
+
export interface SwapProposalArgs {
|
|
226
|
+
hybridVotingAddress: string;
|
|
227
|
+
paymentManagerAddress: string;
|
|
228
|
+
/** Receives the withdrawn tokens and the swap output. */
|
|
229
|
+
executorAddress: string;
|
|
230
|
+
fromToken: string;
|
|
231
|
+
poolAddress: string;
|
|
232
|
+
fromIndex: number;
|
|
233
|
+
toIndex: number;
|
|
234
|
+
/** In from-token wei. */
|
|
235
|
+
amountWei: ethers.BigNumberish;
|
|
236
|
+
/** In to-token wei — min_dy slippage guard at execution time. */
|
|
237
|
+
minOut: ethers.BigNumberish;
|
|
238
|
+
/** The human --amount figure — drives the title text. */
|
|
239
|
+
amountLabel: string | number;
|
|
240
|
+
descriptionHash: string;
|
|
241
|
+
durationMinutes: ethers.BigNumberish;
|
|
242
|
+
orgId?: string;
|
|
243
|
+
ipfs?: {
|
|
244
|
+
cid: string;
|
|
245
|
+
metadata: unknown;
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Port of `pop treasury propose-swap` — src/commands/treasury/propose-swap.ts.
|
|
250
|
+
* HybridVoting.createProposal wrapping THREE option-0 calls:
|
|
251
|
+
* 1. PaymentManager.withdraw(fromToken, executor, amountWei) (executor-only)
|
|
252
|
+
* 2. ERC20.approve(pool, amountWei)
|
|
253
|
+
* 3. CurvePool.exchange(int128 i, int128 j, dx, min_dy)
|
|
254
|
+
*/
|
|
255
|
+
export declare function buildSwapProposal(a: SwapProposalArgs): TxIntent;
|
|
256
|
+
export interface SdaiProposalArgs {
|
|
257
|
+
hybridVotingAddress: string;
|
|
258
|
+
/** Receives the sDAI shares. */
|
|
259
|
+
executorAddress: string;
|
|
260
|
+
/** In xDAI wei (parseEther of the human amount). */
|
|
261
|
+
amountWei: ethers.BigNumberish;
|
|
262
|
+
/** The human --amount figure — drives the title text. */
|
|
263
|
+
amountLabel: string | number;
|
|
264
|
+
descriptionHash: string;
|
|
265
|
+
durationMinutes: ethers.BigNumberish;
|
|
266
|
+
orgId?: string;
|
|
267
|
+
ipfs?: {
|
|
268
|
+
cid: string;
|
|
269
|
+
metadata: unknown;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Port of `pop treasury propose-sdai` — src/commands/treasury/propose-sdai.ts.
|
|
274
|
+
* Gnosis-only (the WXDAI/SDAI constants are Gnosis mainnet deployments) —
|
|
275
|
+
* callers must enforce chainId === 100 (the Level-2 builder does).
|
|
276
|
+
* Option 0 executes three calls from the Executor:
|
|
277
|
+
* 1. [WXDAI, amountWei, deposit()] (wraps the Executor's xDAI)
|
|
278
|
+
* 2. [WXDAI, 0, approve(SDAI, amountWei)]
|
|
279
|
+
* 3. [SDAI, 0, deposit(amountWei, executor)]
|
|
280
|
+
*/
|
|
281
|
+
export declare function buildSdaiProposal(a: SdaiProposalArgs): TxIntent;
|
|
282
|
+
export interface FinalizeDistributionProposalArgs {
|
|
283
|
+
hybridVotingAddress: string;
|
|
284
|
+
paymentManagerAddress: string;
|
|
285
|
+
distributionId: number;
|
|
286
|
+
/**
|
|
287
|
+
* On-chain guard: execution reverts ClaimPeriodNotExpired until this many
|
|
288
|
+
* blocks have passed since the distribution's CHECKPOINT block — the
|
|
289
|
+
* DEPLOYED contract's anchor, proven by live eth_call (audit M-08's
|
|
290
|
+
* creation-block re-anchor is NOT deployed; see propose-finalize.ts).
|
|
291
|
+
*/
|
|
292
|
+
minClaimPeriodBlocks: number;
|
|
293
|
+
descriptionHash: string;
|
|
294
|
+
durationMinutes: ethers.BigNumberish;
|
|
295
|
+
orgId?: string;
|
|
296
|
+
ipfs?: {
|
|
297
|
+
cid: string;
|
|
298
|
+
metadata: unknown;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Port of `pop treasury propose-finalize` —
|
|
303
|
+
* src/commands/treasury/propose-finalize.ts. HybridVoting.createProposal
|
|
304
|
+
* wrapping PaymentManager.finalizeDistribution(distId, minClaimPeriodBlocks)
|
|
305
|
+
* (onlyOwner = the Executor, hence the wrap). On success the unclaimed
|
|
306
|
+
* remainder returns to the Executor treasury and further claims are blocked.
|
|
307
|
+
*/
|
|
308
|
+
export declare function buildFinalizeDistributionProposal(a: FinalizeDistributionProposalArgs): TxIntent;
|
|
309
|
+
export interface SendProposalParams {
|
|
310
|
+
org: string;
|
|
311
|
+
to?: string;
|
|
312
|
+
amount?: number;
|
|
313
|
+
recipients?: string | Array<{
|
|
314
|
+
to: string;
|
|
315
|
+
amount: number;
|
|
316
|
+
}>;
|
|
317
|
+
/** Token address or 'native' (default) for the chain's gas token. */
|
|
318
|
+
token?: string;
|
|
319
|
+
/** Vote duration in minutes (CLI default 60). */
|
|
320
|
+
durationMinutes?: number;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Resolved port of `pop treasury send` — src/commands/treasury/send.ts.
|
|
324
|
+
* Resolves the org's HybridVoting, derives token label/decimals, pins the
|
|
325
|
+
* proposal metadata {description, optionNames, createdAt}, and delegates to
|
|
326
|
+
* buildSendProposal.
|
|
327
|
+
*/
|
|
328
|
+
export declare function sendProposalIntent(ctx: PopContext, params: SendProposalParams): Promise<TxIntent>;
|
|
329
|
+
/** Parsed merkle-distribution.json contents (compute-merkle output). */
|
|
330
|
+
export interface MerkleDistributionData {
|
|
331
|
+
merkleRoot: string;
|
|
332
|
+
/** Raw wei string. */
|
|
333
|
+
totalAmount: string;
|
|
334
|
+
tokenAddress: string;
|
|
335
|
+
checkpointBlock: number | string;
|
|
336
|
+
memberCount: number;
|
|
337
|
+
allocations?: Array<{
|
|
338
|
+
address: string;
|
|
339
|
+
username?: string | null;
|
|
340
|
+
share?: string;
|
|
341
|
+
}>;
|
|
342
|
+
}
|
|
343
|
+
export interface ProposeDistributionParams {
|
|
344
|
+
org: string;
|
|
345
|
+
/** Parsed merkle-distribution.json (the CLI reads it from --merkle-file). */
|
|
346
|
+
merkle: MerkleDistributionData;
|
|
347
|
+
/** Vote duration in minutes (CLI default 1440). */
|
|
348
|
+
durationMinutes?: number;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Resolved port of `pop treasury propose-distribution` —
|
|
352
|
+
* src/commands/treasury/propose-distribution.ts. Takes the parsed
|
|
353
|
+
* merkle-distribution.json (file I/O stays in the host), resolves modules and
|
|
354
|
+
* payout-token decimals, pins the metadata and delegates to
|
|
355
|
+
* buildDistributionProposal. The CLI's PaymentManager-balance check is an
|
|
356
|
+
* advisory warning only (InsufficientFunds fires at execution time) and is
|
|
357
|
+
* not ported.
|
|
358
|
+
*/
|
|
359
|
+
export declare function proposeDistributionIntent(ctx: PopContext, params: ProposeDistributionParams): Promise<TxIntent>;
|
|
360
|
+
export interface ProposeSwapParams {
|
|
361
|
+
org: string;
|
|
362
|
+
fromToken: string;
|
|
363
|
+
toToken: string;
|
|
364
|
+
/** Human units of from-token. */
|
|
365
|
+
amount: number;
|
|
366
|
+
/** Minimum output in to-token units (default: 95% of the pool quote). */
|
|
367
|
+
minOut?: number;
|
|
368
|
+
pool: string;
|
|
369
|
+
fromIndex: number;
|
|
370
|
+
toIndex: number;
|
|
371
|
+
/** Vote duration in minutes (CLI default 1440). */
|
|
372
|
+
durationMinutes?: number;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Resolved port of `pop treasury propose-swap` —
|
|
376
|
+
* src/commands/treasury/propose-swap.ts. Decimals come from the static
|
|
377
|
+
* known-token table only (no live read — same as the CLI); the pool quote
|
|
378
|
+
* (get_dy) requires ctx.provider and falls back exactly like the CLI when
|
|
379
|
+
* unavailable WITH a provider present: min_dy defaults to 95% of the quote,
|
|
380
|
+
* or 95% of the input when get_dy reverted — the CLI's exact fallback ladder.
|
|
381
|
+
* With NO provider and no explicit minOut this refuses instead: the CLI can
|
|
382
|
+
* never reach that state (it always has a provider), and silently deriving
|
|
383
|
+
* min_dy from the INPUT amount across a decimals mismatch would let a
|
|
384
|
+
* governance swap execute at a catastrophic rate.
|
|
385
|
+
*/
|
|
386
|
+
export declare function proposeSwapIntent(ctx: PopContext, params: ProposeSwapParams): Promise<TxIntent>;
|
|
387
|
+
export interface ProposeSdaiParams {
|
|
388
|
+
org: string;
|
|
389
|
+
/** xDAI amount to deposit into sDAI (human units). */
|
|
390
|
+
amount: number;
|
|
391
|
+
/** Vote duration in minutes (CLI default 60). */
|
|
392
|
+
durationMinutes?: number;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Resolved port of `pop treasury propose-sdai` —
|
|
396
|
+
* src/commands/treasury/propose-sdai.ts. Gnosis-only. REQUIRES ctx.provider:
|
|
397
|
+
* the proposal metadata interpolates the Executor's live xDAI balance and
|
|
398
|
+
* current sDAI holdings, so the exact CLI document cannot be built without the
|
|
399
|
+
* reads. Replicates the CLI's Executor-balance precondition (execution would
|
|
400
|
+
* fail if the wrap call can't be funded).
|
|
401
|
+
*/
|
|
402
|
+
export declare function proposeSdaiIntent(ctx: PopContext, params: ProposeSdaiParams): Promise<TxIntent>;
|
|
403
|
+
export interface ProposeFinalizeParams {
|
|
404
|
+
org: string;
|
|
405
|
+
distribution: number;
|
|
406
|
+
/** Blocks since the distribution's CHECKPOINT block before execution may succeed (CLI default 0). */
|
|
407
|
+
minClaimBlocks?: number;
|
|
408
|
+
/** Vote duration in minutes (CLI default 60). */
|
|
409
|
+
durationMinutes?: number;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Resolved port of `pop treasury propose-finalize` —
|
|
413
|
+
* src/commands/treasury/propose-finalize.ts. When ctx.provider is present the
|
|
414
|
+
* CLI's authoritative pre-flight runs (getDistribution →
|
|
415
|
+
* DistributionNotFound / AlreadyFinalized fail fast, and the metadata carries
|
|
416
|
+
* the payout token + unclaimed remainder); without a provider it behaves like
|
|
417
|
+
* the CLI under --no-preflight (generic 'tokens' label, no unclaimed figure).
|
|
418
|
+
*/
|
|
419
|
+
export declare function proposeFinalizeIntent(ctx: PopContext, params: ProposeFinalizeParams): Promise<TxIntent>;
|
|
420
|
+
export interface DepositParams {
|
|
421
|
+
org: string;
|
|
422
|
+
/** ERC20 token address. */
|
|
423
|
+
token: string;
|
|
424
|
+
/** Human token units. */
|
|
425
|
+
amount: number;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Resolved port of `pop treasury deposit` — src/commands/treasury/deposit.ts.
|
|
429
|
+
* Returns BOTH intents of the two-transaction flow (approve, then payERC20);
|
|
430
|
+
* hosts execute them in order and stop if the approve fails. Decimals follow
|
|
431
|
+
* the CLI exactly: known-token table first (unknown tokens throw), then a
|
|
432
|
+
* live decimals()/symbol() override when a provider is available.
|
|
433
|
+
*/
|
|
434
|
+
export declare function depositIntents(ctx: PopContext, params: DepositParams): Promise<{
|
|
435
|
+
approve: TxIntent;
|
|
436
|
+
payERC20: TxIntent;
|
|
437
|
+
amountWei: ethers.BigNumber;
|
|
438
|
+
decimals: number;
|
|
439
|
+
symbol?: string;
|
|
440
|
+
}>;
|
|
441
|
+
export interface ClaimDistributionParams {
|
|
442
|
+
org: string;
|
|
443
|
+
distribution: number;
|
|
444
|
+
/** Decimal token units by default; the exact raw integer with wei=true. */
|
|
445
|
+
amount: string;
|
|
446
|
+
wei?: boolean;
|
|
447
|
+
/** Merkle proof — array, inline JSON string, or allocation object. */
|
|
448
|
+
proof: string | string[] | {
|
|
449
|
+
proof: string[];
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Resolved port of `pop treasury claim` — src/commands/treasury/claim.ts.
|
|
454
|
+
* Resolves the payout token's decimals subgraph-FIRST (FETCH_DISTRIBUTION_BY_ID
|
|
455
|
+
* — null means "not indexed yet" and falls through to getDistribution() when a
|
|
456
|
+
* provider is available, never DistributionNotFound), converts the amount with
|
|
457
|
+
* parseClaimAmount, and delegates to buildClaimDistribution.
|
|
458
|
+
*
|
|
459
|
+
* The CLI's revert-predicting pre-flight (finalized / hasClaimed / isOptedOut
|
|
460
|
+
* — all authoritative eth_calls) stays host-side; opt-out BLOCKS on the
|
|
461
|
+
* deployed pre-L-19 PaymentManager.
|
|
462
|
+
*/
|
|
463
|
+
export declare function claimDistributionIntent(ctx: PopContext, params: ClaimDistributionParams): Promise<TxIntent>;
|
|
464
|
+
export interface OptOutParams {
|
|
465
|
+
org: string;
|
|
466
|
+
/** true = opt out, false = opt back in. */
|
|
467
|
+
optOut: boolean;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Resolved port of `pop treasury opt-out` / `opt-in` —
|
|
471
|
+
* src/commands/treasury/opt-out.ts. The CLI's isOptedOut no-op short-circuit
|
|
472
|
+
* is a host-side pre-flight (the call is idempotent on-chain anyway).
|
|
473
|
+
*/
|
|
474
|
+
export declare function optOutIntent(ctx: PopContext, params: OptOutParams): Promise<TxIntent>;
|