@massalabs/multisig-contract 0.1.1-dev.20260420091552 → 0.1.1-dev.20260506131730

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +286 -169
  2. package/package.json +13 -1
package/README.md CHANGED
@@ -1,169 +1,286 @@
1
- # Massa Multisignature Wallet
2
-
3
- The purpose of multisig wallets is to increase security by requiring multiple parties to agree on transactions before execution. Transactions can be executed only when confirmed by a predefined number of owners.
4
-
5
- Features
6
- Can hold Massa and all kinds of tokens
7
- Integration with web3 wallets
8
- Interacting with any contracts
9
- @dev Most important concepts:
10
- * Threshold/required: Number of required confirmations for a Multisig transaction.
11
- * Owners: List of addresses that control the Multisig. They are the only ones that
12
- can submit, approve, and execute transactions.
13
- * UpgradeDelay: Delay necessary between an upgrade proposition and the actual upgrade
14
- * executionDelay: Delay necessary between the time the threshold is met for a specific transaction and its execution.
15
- * Id: Each transaction has a different ID to prevent replay attacks.
16
- * Signature: A valid signature of an owner of the Multisig for a transaction hash.
17
- * Owners can only be added/removed by the multisig (same for changing the threshold
18
- and upgrading the contract)
19
- * Change the owners, required,& upgradeDelay to your needs in src/deploy.ts
20
-
21
- The executionDelay starts once the threshold is met, and is not reset when another wallet approves the tx. It can be reset if a wallet revokes approval and the approval count goes below the threshold.
22
-
23
- Anyone can send coins to the multisig using the receiveCoins functions.
24
- Only owners can call submit, approve, execute & revoke functions.
25
- Only the multisig itself can call addOwner, removeOwner, replaceOwner, changeRequirement, changeExecutionDelay, changeUpgradeDelay, proposeUpgrade & upgrade functions. Thus, they can only be called by submitting the call through the multisig, approving & executing it.
26
-
27
- ## Security
28
-
29
- The code was fully audited for security by a third party professional security firm.
30
- The report is publicly available as the [security_audit.pdf](security_audit.pdf) file at the root of the repository.
31
-
32
- ## Build
33
-
34
- By default this will build all files in `assembly/contracts` directory.
35
-
36
- ```shell
37
- npm run build
38
- ```
39
-
40
- ## Deploy the multisig
41
-
42
- Prerequisites :
43
-
44
- - You must add a `.env` file at the root of the repository with the following keys set to valid values:
45
- - `PRIVATE_KEY="wallet_private_key"`
46
- - `RPC_URL="https://..."` (optional, defaults to buildnet)
47
-
48
- These keys will be the ones used by the deployment script to interact with the blockchain.
49
-
50
- Adapt `required`, `owners` & `upgradeDelay` to your liking (cf. important concepts) in `src/deploy.ts`.
51
-
52
- The following command will build contracts in `assembly/contracts` directory and execute the deployment script
53
- `src/deploy.ts`. This script deploys `Multisig.wasm` directly and automatically runs its constructor.
54
-
55
- ```shell
56
- npm run deploy
57
- ```
58
-
59
- ## Proposal lifecycle (important)
60
-
61
- Submitting a proposal does **not** count as an approval for the proposing owner. The proposer must call approve separately if they want their confirmation included toward the threshold.
62
-
63
- The approve flow only records confirmations. When the number of approvals reaches the threshold, the proposal is **not** executed automatically. Someone with the right to execute must call execute explicitly (and respect any `executionDelay` enforced on-chain after the threshold is met).
64
-
65
- These behaviors are intentional in the current design. Automatically approving on behalf of the submitter, or automatically executing once the threshold is reached, could be explored as future improvements but are not implemented today.
66
-
67
- ## Create an add-member proposal
68
-
69
- The repository also includes a helper script to submit a multisig proposal that adds a new owner.
70
-
71
- ```shell
72
- npm run propose:add-member -- <multisig-address> <new-member-address>
73
- ```
74
-
75
- The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
76
-
77
- ## Create a revoke-member proposal
78
-
79
- The repository also includes a helper script to submit a multisig proposal that removes an existing owner.
80
-
81
- ```shell
82
- npm run propose:revoke-member -- <multisig-address> <member-address>
83
- ```
84
-
85
- The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
86
-
87
- ## Create a replace-member proposal
88
-
89
- The repository also includes a helper script to submit a multisig proposal that replaces an existing owner with a new one.
90
-
91
- ```shell
92
- npm run propose:replace-member -- <multisig-address> <current-member-address> <new-member-address>
93
- ```
94
-
95
- The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
96
-
97
- ## Create a threshold proposal
98
-
99
- The repository also includes a helper script to submit a multisig proposal that updates the required approval threshold.
100
-
101
- ```shell
102
- npm run propose:threshold -- <multisig-address> <threshold>
103
- ```
104
-
105
- The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
106
-
107
- ## Create an execution-delay proposal
108
-
109
- The repository also includes a helper script to submit a multisig proposal that updates the execution delay.
110
-
111
- ```shell
112
- npm run propose:execution-delay -- <multisig-address> <execution-delay>
113
- ```
114
-
115
- The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
116
-
117
- ## Approve a proposal
118
-
119
- The repository also includes a helper script to approve an existing multisig proposal by id.
120
-
121
- ```shell
122
- npm run approve:proposal -- <multisig-address> <proposal-id>
123
- ```
124
-
125
- The script uses the same `.env` configuration as deployment and prints the approval operation id plus the final events emitted by the contract.
126
-
127
- ## Execute a proposal
128
-
129
- The repository also includes a helper script to execute an existing multisig proposal by id.
130
-
131
- ```shell
132
- npm run execute:proposal -- <multisig-address> <proposal-id>
133
- ```
134
-
135
- The script uses the same `.env` configuration as deployment and prints the execution operation id plus the final events emitted by the contract.
136
-
137
- ## List proposals
138
-
139
- The repository also includes a read-only helper script to retrieve all multisig proposals and their current statuses.
140
-
141
- ```shell
142
- npm run list:proposals -- <multisig-address>
143
- ```
144
-
145
- The script prints a JSON array with each proposal's id, target, method, value, approvals, timestamp, execution flag, and derived status.
146
-
147
- ## Get multisig parameters
148
-
149
- The repository also includes a read-only helper script to retrieve the multisig members, threshold, and execution delay directly from storage.
150
-
151
- ```shell
152
- npm run get:multisig-parameters -- <multisig-address>
153
- ```
154
-
155
- The script prints a JSON object containing the `members`, `threshold`, and `delay`.
156
-
157
- ## Unit tests
158
-
159
- The test framework documentation is available here: [as-pect docs](https://as-pect.gitbook.io/as-pect)
160
-
161
- ```shell
162
- npm run test
163
- ```
164
-
165
- ## Format code
166
-
167
- ```shell
168
- npm run fmt
169
- ```
1
+ # Massa Multisignature Wallet
2
+
3
+ The purpose of multisig wallets is to increase security by requiring multiple parties to agree on transactions before execution. Transactions can be executed only when confirmed by a predefined number of owners.
4
+
5
+ Features
6
+ Can hold Massa and all kinds of tokens
7
+ Integration with web3 wallets
8
+ Interacting with any contracts
9
+ @dev Most important concepts:
10
+ * Threshold/required: Number of required confirmations for a Multisig transaction.
11
+ * Owners: List of addresses that control the Multisig. They are the only ones that
12
+ can submit, approve, and execute transactions.
13
+ * UpgradeDelay: Delay necessary between an upgrade proposition and the actual upgrade
14
+ * executionDelay: Delay necessary between the time the threshold is met for a specific transaction and its execution.
15
+ * Id: Each transaction has a different ID to prevent replay attacks.
16
+ * Signature: A valid signature of an owner of the Multisig for a transaction hash.
17
+ * Owners can only be added/removed by the multisig (same for changing the threshold
18
+ and upgrading the contract)
19
+ * Change the owners, required,& upgradeDelay to your needs in src/deploy.ts
20
+
21
+ The executionDelay starts once the threshold is met, and is not reset when another wallet approves the tx. It can be reset if a wallet revokes approval and the approval count goes below the threshold.
22
+
23
+ Anyone can send coins to the multisig using the receiveCoins functions.
24
+ Only owners can call submit, approve, execute & revoke functions.
25
+ Only the multisig itself can call addOwner, removeOwner, replaceOwner, changeRequirement, changeExecutionDelay, changeUpgradeDelay, proposeUpgrade & upgrade functions. Thus, they can only be called by submitting the call through the multisig, approving & executing it.
26
+
27
+ ## Security
28
+
29
+ The code was fully audited for security by a third party professional security firm.
30
+ The report is publicly available as the [security_audit.pdf](security_audit.pdf) file at the root of the repository.
31
+
32
+ ## Build
33
+
34
+ By default this will build all files in `assembly/contracts` directory.
35
+
36
+ ```shell
37
+ npm run build
38
+ ```
39
+
40
+ ## Deploy the multisig
41
+
42
+ Prerequisites :
43
+
44
+ - You must add a `.env` file at the root of the repository with the following keys set to valid values:
45
+ - `PRIVATE_KEY="wallet_private_key"`
46
+ - `C_LAYER_RPC_URL="https://..."` (optional, defaults to buildnet)
47
+ - `CURRENCY_REGISTRY_ADDRESS="AS..."` (required for currency-registry helper scripts)
48
+
49
+ These keys will be the ones used by the deployment script to interact with the blockchain.
50
+
51
+ Adapt `required`, `owners` & `upgradeDelay` to your liking (cf. important concepts) in `src/deploy.ts`.
52
+
53
+ The following command will build contracts in `assembly/contracts` directory and execute the deployment script
54
+ `src/deploy.ts`. This script deploys `Multisig.wasm` directly and automatically runs its constructor.
55
+
56
+ ```shell
57
+ npm run deploy
58
+ ```
59
+
60
+ ## Generate a wallet
61
+
62
+ You can generate a new Massa wallet keypair for local usage with:
63
+
64
+ ```shell
65
+ npm run generate:wallet
66
+ ```
67
+
68
+ The script prints the wallet address and a `PRIVATE_KEY="..."` line you can copy into your `.env`.
69
+
70
+ ## Proposal lifecycle (important)
71
+
72
+ Submitting a proposal does **not** count as an approval for the proposing owner. The proposer must call approve separately if they want their confirmation included toward the threshold.
73
+
74
+ The approve flow only records confirmations. When the number of approvals reaches the threshold, the proposal is **not** executed automatically. Someone with the right to execute must call execute explicitly (and respect any `executionDelay` enforced on-chain after the threshold is met).
75
+
76
+ These behaviors are intentional in the current design. Automatically approving on behalf of the submitter, or automatically executing once the threshold is reached, could be explored as future improvements but are not implemented today.
77
+
78
+ ## Create an add-member proposal
79
+
80
+ The repository also includes a helper script to submit a multisig proposal that adds a new owner.
81
+
82
+ ```shell
83
+ npm run propose:add-member -- <multisig-address> <new-member-address>
84
+ ```
85
+
86
+ The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
87
+
88
+ ## Create a revoke-member proposal
89
+
90
+ The repository also includes a helper script to submit a multisig proposal that removes an existing owner.
91
+
92
+ ```shell
93
+ npm run propose:revoke-member -- <multisig-address> <member-address>
94
+ ```
95
+
96
+ The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
97
+
98
+ ## Create a replace-member proposal
99
+
100
+ The repository also includes a helper script to submit a multisig proposal that replaces an existing owner with a new one.
101
+
102
+ ```shell
103
+ npm run propose:replace-member -- <multisig-address> <current-member-address> <new-member-address>
104
+ ```
105
+
106
+ The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
107
+
108
+ ## Create a threshold proposal
109
+
110
+ The repository also includes a helper script to submit a multisig proposal that updates the required approval threshold.
111
+
112
+ ```shell
113
+ npm run propose:threshold -- <multisig-address> <threshold>
114
+ ```
115
+
116
+ The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
117
+
118
+ ## Create an execution-delay proposal
119
+
120
+ The repository also includes a helper script to submit a multisig proposal that updates the execution delay.
121
+
122
+ ```shell
123
+ npm run propose:execution-delay -- <multisig-address> <execution-delay>
124
+ ```
125
+
126
+ The script uses the same `.env` configuration as deployment and prints the submitted operation id plus the final events emitted by the contract.
127
+
128
+ ## Create a currency pause/unpause proposal (C-layer)
129
+
130
+ The repository also includes a helper script to submit a multisig proposal that updates `isPaused` for a currency in the C-layer currency-registry.
131
+
132
+ ```shell
133
+ npm run propose:currency-pause -- <multisig-address> <currency-ticker> <pause|unpause>
134
+ ```
135
+
136
+ The script reads the current currency from currency-registry, preserves all fields, toggles only `isPaused`, then submits a multisig `updateCurrency` proposal with the same coin value used by the currency-registry wrapper (`0.1 MAS`).
137
+
138
+ ## Add a currency to registry (C-layer)
139
+
140
+ The repository also includes a helper script to call `createCurrency` on the C-layer currency-registry.
141
+
142
+ ```shell
143
+ npm run add:currency-to-registry -- <ticker> <name> <decimals> <currency-multisig-address> [isPaused]
144
+ ```
145
+
146
+ Notes:
147
+ * This call requires a wallet with the `CURRENCY_MANAGER` role (typically the COS-managed key).
148
+ * The script uses `PRIVATE_KEY` from `.env` as the caller key.
149
+ * It submits with `0.1 MAS`, aligned with the `certonym-contracts` currency-registry wrapper.
150
+ * `isPaused` is optional (`false` by default). Accepted values: `true/false` or `1/0`.
151
+
152
+ ## Remove a currency from registry (C-layer)
153
+
154
+ The repository also includes a helper script to call `removeCurrency` on the C-layer currency-registry.
155
+
156
+ ```shell
157
+ npm run remove:currency-from-registry -- <currency-id>
158
+ ```
159
+
160
+ ## Create a mint proposal (P-layer)
161
+
162
+ The repository also includes a helper script to submit a P-layer multisig `mint` proposal via the Player API.
163
+
164
+ ```shell
165
+ npm run propose:mint -- <decc-no> <amount> <currency-ticker>
166
+ ```
167
+
168
+ For P-layer scripts, `<amount>` is a user amount using currency decimals
169
+ (for decimals=2, `10` means a raw amount of `1000`).
170
+
171
+ ## Create a transfer_from proposal (P-layer)
172
+
173
+ The repository also includes a helper script to submit a P-layer multisig `transfer_from` proposal via the Player API.
174
+
175
+ ```shell
176
+ npm run propose:transfer_from -- <multisig-decc-no> <sender-decc-no> <recipient-decc-no> <amount> <currency-ticker>
177
+ ```
178
+
179
+ ## Create a freeze_account proposal (P-layer)
180
+
181
+ The repository also includes a helper script to submit a P-layer multisig `freeze_account` proposal via the Player API.
182
+
183
+ ```shell
184
+ npm run propose:freeze_account -- <multisig-decc-no> <target-decc-no> <currency-ticker>
185
+ ```
186
+
187
+ ## Create an unfreeze_account proposal (P-layer)
188
+
189
+ The repository also includes a helper script to submit a P-layer multisig `unfreeze_account` proposal via the Player API.
190
+
191
+ ```shell
192
+ npm run propose:unfreeze_account -- <multisig-decc-no> <target-decc-no> <currency-ticker>
193
+ ```
194
+
195
+ ## List proposals (P-layer)
196
+
197
+ The repository also includes a read-only helper script to retrieve non-executed P-layer multisig proposals for a currency.
198
+
199
+ ```shell
200
+ npm run list:p-layer-proposals -- <multisig-decc-no> <currency-ticker>
201
+ ```
202
+
203
+ The script prints a JSON array with proposal ids, proposal type data, approval count, status, and period metadata.
204
+
205
+ ## Approve a proposal (P-layer)
206
+
207
+ The repository also includes a helper script to approve an existing P-layer multisig proposal by id.
208
+
209
+ ```shell
210
+ npm run approve:p-layer-proposal -- <multisig-decc-no> <currency-ticker> <proposal-id>
211
+ ```
212
+
213
+ ## Get available currency info (P-layer)
214
+
215
+ ```shell
216
+ npm run get:available-currency-info
217
+ ```
218
+
219
+ This script prints currencies in the form `TICKER: Name. Decimals: X. ID: Y. Paused: Z`.
220
+
221
+ ## Get currency multisig info (P-layer)
222
+
223
+ ```shell
224
+ npm run get:currency-multisig-info -- <currency-ticker>
225
+ ```
226
+
227
+ The script submits the approval via the Player API and prints the resulting operation id.
228
+
229
+ These scripts use:
230
+ - `PRIVATE_KEY` from `.env` for signing,
231
+ - `P_LAYER_GRPC_URL` from `.env` for gRPC endpoint,
232
+ - proposal kind encoding from `p-layer-runtime/api/example-js`.
233
+
234
+ ## Approve a proposal
235
+
236
+ The repository also includes a helper script to approve an existing multisig proposal by id.
237
+
238
+ ```shell
239
+ npm run approve:proposal -- <multisig-address> <proposal-id>
240
+ ```
241
+
242
+ The script uses the same `.env` configuration as deployment and prints the approval operation id plus the final events emitted by the contract.
243
+
244
+ ## Execute a proposal
245
+
246
+ The repository also includes a helper script to execute an existing multisig proposal by id.
247
+
248
+ ```shell
249
+ npm run execute:proposal -- <multisig-address> <proposal-id>
250
+ ```
251
+
252
+ The script uses the same `.env` configuration as deployment and prints the execution operation id plus the final events emitted by the contract.
253
+
254
+ ## List proposals
255
+
256
+ The repository also includes a read-only helper script to retrieve all multisig proposals and their current statuses.
257
+
258
+ ```shell
259
+ npm run list:proposals -- <multisig-address>
260
+ ```
261
+
262
+ The script prints a JSON array with each proposal's id, target, method, value, approvals, timestamp, execution flag, and derived status.
263
+
264
+ ## Get multisig parameters
265
+
266
+ The repository also includes a read-only helper script to retrieve the multisig members, threshold, and execution delay directly from storage.
267
+
268
+ ```shell
269
+ npm run get:multisig-parameters -- <multisig-address>
270
+ ```
271
+
272
+ The script prints a JSON object containing the `members`, `threshold`, and `delay`.
273
+
274
+ ## Unit tests
275
+
276
+ The test framework documentation is available here: [as-pect docs](https://as-pect.gitbook.io/as-pect)
277
+
278
+ ```shell
279
+ npm run test
280
+ ```
281
+
282
+ ## Format code
283
+
284
+ ```shell
285
+ npm run fmt
286
+ ```
package/package.json CHANGED
@@ -1,20 +1,32 @@
1
1
  {
2
2
  "name": "@massalabs/multisig-contract",
3
- "version": "0.1.1-dev.20260420091552",
3
+ "version": "0.1.1-dev.20260506131730",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "asp --summary",
7
7
  "build": "npx massa-as-compile",
8
8
  "deploy": "tsx src/deploy.ts",
9
+ "generate:wallet": "tsx src/generate-wallet.ts",
10
+ "add:currency-to-registry": "tsx src/add-currency-to-registry.ts",
11
+ "remove:currency-from-registry": "tsx src/remove-currency-from-registry.ts",
9
12
  "approve:proposal": "tsx src/approve-proposal.ts",
10
13
  "execute:proposal": "tsx src/execute-proposal.ts",
11
14
  "get:multisig-parameters": "tsx src/get-multisig-parameters.ts",
12
15
  "list:proposals": "tsx src/list-proposals.ts",
16
+ "list:p-layer-proposals": "tsx src/list-p-layer-proposals.ts",
17
+ "get:available-currency-info": "tsx src/get-available-currency-info.ts",
18
+ "get:currency-multisig-info": "tsx src/get-currency-multisig-info.ts",
13
19
  "propose:add-member": "tsx src/propose-add-member.ts",
14
20
  "propose:replace-member": "tsx src/propose-replace-member.ts",
15
21
  "propose:revoke-member": "tsx src/propose-revoke-member.ts",
16
22
  "propose:threshold": "tsx src/propose-threshold.ts",
17
23
  "propose:execution-delay": "tsx src/propose-execution-delay.ts",
24
+ "propose:currency-pause": "tsx src/propose-currency-pause.ts",
25
+ "propose:mint": "tsx src/propose-mint.ts",
26
+ "propose:transfer_from": "tsx src/propose-transfer-from.ts",
27
+ "propose:freeze_account": "tsx src/propose-freeze-account.ts",
28
+ "propose:unfreeze_account": "tsx src/propose-unfreeze-account.ts",
29
+ "approve:p-layer-proposal": "tsx src/approve-p-layer-proposal.ts",
18
30
  "prettier": "prettier assembly//**/*.ts --check",
19
31
  "prettier:fix": "prettier assembly//**/*.ts --write",
20
32
  "lint": "eslint .",