@openzeppelin/compact-contracts 0.3.0-alpha → 0.3.0-alpha.2
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 +7 -7
- package/access/AccessControl.compact +1 -1
- package/access/Ownable.compact +1 -1
- package/access/ShieldedAccessControl.compact +1 -1
- package/access/ZOwnablePK.compact +1 -1
- package/crypto/EcdhMask.compact +177 -0
- package/crypto/ElGamal.compact +1 -1
- package/multisig/ForwarderPrivate.compact +16 -12
- package/multisig/ForwarderShielded.compact +2 -2
- package/multisig/ForwarderUnshielded.compact +2 -2
- package/multisig/ProposalManager.compact +35 -1
- package/multisig/ShieldedTreasury.compact +46 -13
- package/multisig/ShieldedTreasuryStateless.compact +56 -23
- package/multisig/Signer.compact +45 -41
- package/multisig/UnshieldedTreasury.compact +44 -17
- package/multisig/presets/ShieldedMultiSig.compact +10 -19
- package/multisig/presets/ShieldedMultiSigV2.compact +2 -2
- package/multisig/presets/ShieldedMultiSigV3.compact +2 -2
- package/multisig/presets/forwarder/ForwarderPrivate.compact +1 -1
- package/multisig/presets/forwarder/ForwarderShielded.compact +1 -1
- package/multisig/presets/forwarder/ForwarderUnshielded.compact +1 -1
- package/package.json +32 -20
- package/security/Allowlist.compact +1 -1
- package/security/Blocklist.compact +1 -1
- package/security/Initializable.compact +1 -1
- package/security/Pausable.compact +1 -1
- package/token/ConfidentialFungibleToken.compact +1208 -0
- package/token/FungibleToken.compact +1 -1
- package/token/MultiToken.compact +1 -1
- package/token/NativeShieldedToken.compact +2 -2
- package/token/NativeShieldedTokenCore.compact +1 -1
- package/token/NativeShieldedTokenFamily.compact +2 -2
- package/token/NonFungibleToken.compact +1 -1
- package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +90 -0
- package/token/extensions/NativeShieldedTokenDerivedNonce.compact +70 -0
- package/token/extensions/NativeShieldedTokenFamilyPublicSupply.compact +145 -0
- package/token/extensions/NativeShieldedTokenPublicSupply.compact +142 -0
- package/token/extensions/NativeShieldedTokenPublicSupplyCore.compact +163 -0
- package/utils/Utils.compact +1 -1
- package/multisig/SignerManager.compact +0 -205
package/multisig/Signer.compact
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/Signer.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/Signer.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
|
@@ -42,6 +42,25 @@ pragma language_version >= 0.23.0;
|
|
|
42
42
|
* call `initialize` in the contract's constructor. Contracts MUST NOT
|
|
43
43
|
* call `initialize` outside of the constructor context because
|
|
44
44
|
* this could corrupt the signer set and threshold configuration.
|
|
45
|
+
*
|
|
46
|
+
* `_isInitialized` records only whether `initialize` has run; it gates
|
|
47
|
+
* re-entry into `initialize` and nothing else. No other circuit consults it,
|
|
48
|
+
* so a contract that configures signers through its own flow
|
|
49
|
+
* (`_addSigner` / `_setThreshold`) is fully functional without ever calling
|
|
50
|
+
* `initialize`. Provided it gates those circuits behind its own
|
|
51
|
+
* authorization policy. Leaving them ungated lets the first caller register
|
|
52
|
+
* their own signer set and take control of the contract.
|
|
53
|
+
*
|
|
54
|
+
* @notice Not asserting initialization on the guard and view circuits is a
|
|
55
|
+
* deliberate divergence from the other modules in this library, which do.
|
|
56
|
+
* Those modules gate a zero-valued identity (an owner, a role holder); this
|
|
57
|
+
* one gates an empty collection, which rejects by absence. Safety here comes
|
|
58
|
+
* from the state rather than from a flag: an empty registry makes `isSigner`
|
|
59
|
+
* false for every input, so `assertSigner` rejects every caller, and a zero
|
|
60
|
+
* `_threshold` makes `assertThresholdMet` reject before it compares any
|
|
61
|
+
* approval count regardless of how the threshold came to be zero. Contracts
|
|
62
|
+
* needing a "configured" signal beyond that should track one at the contract
|
|
63
|
+
* layer.
|
|
45
64
|
*/
|
|
46
65
|
module Signer<T> {
|
|
47
66
|
import CompactStandardLibrary;
|
|
@@ -66,8 +85,6 @@ module Signer<T> {
|
|
|
66
85
|
* and an initial set of signers.
|
|
67
86
|
* If used, it should only be called in the contract's constructor.
|
|
68
87
|
*
|
|
69
|
-
* @circuitInfo k=11, rows=1815
|
|
70
|
-
*
|
|
71
88
|
* Requirements:
|
|
72
89
|
*
|
|
73
90
|
* - If used, can only be called once (in the constructor).
|
|
@@ -98,37 +115,43 @@ module Signer<T> {
|
|
|
98
115
|
/**
|
|
99
116
|
* @description Asserts that the given caller is an active signer.
|
|
100
117
|
*
|
|
101
|
-
* @circuitInfo k=10, rows=585
|
|
102
|
-
*
|
|
103
118
|
* Requirements:
|
|
104
119
|
*
|
|
105
|
-
* - Contract must be initialized.
|
|
106
120
|
* - `caller` must be a member of the signers registry.
|
|
107
121
|
*
|
|
108
122
|
* @param {T} caller - The identity to validate.
|
|
109
123
|
* @returns {[]} Empty tuple.
|
|
110
124
|
*/
|
|
111
125
|
export circuit assertSigner(caller: T): [] {
|
|
112
|
-
assertInitialized();
|
|
113
126
|
assert(isSigner(caller), "Signer: not a signer");
|
|
114
127
|
}
|
|
115
128
|
|
|
116
129
|
/**
|
|
117
130
|
* @description Asserts that the given approval count meets the threshold.
|
|
118
131
|
*
|
|
132
|
+
* @notice `approvalCount` is supplied by the consuming contract and is
|
|
133
|
+
* compared against the threshold only. This circuit never consults the signer
|
|
134
|
+
* registry. Ensuring the count reflects distinct, currently-registered signers
|
|
135
|
+
* is the consuming contract's responsibility, and a contract whose approval
|
|
136
|
+
* accounting is not itself gated by `assertSigner` gets no protection here.
|
|
137
|
+
*
|
|
138
|
+
* The count is deliberately left unbounded by `_signerCount`: approvals
|
|
139
|
+
* collected before a signer was removed must still count toward a threshold
|
|
140
|
+
* the remaining signers satisfy, and bounding the count would reject those.
|
|
141
|
+
* See the stale-signer-set guidance in the module header.
|
|
142
|
+
*
|
|
119
143
|
* @circuitInfo k=9, rows=54
|
|
120
144
|
*
|
|
121
145
|
* Requirements:
|
|
122
146
|
*
|
|
123
|
-
* -
|
|
124
|
-
*
|
|
147
|
+
* - Ledger threshold must be set (not be zero). An unconfigured module has a
|
|
148
|
+
* zero threshold, so this rejects before any approval count is compared.
|
|
125
149
|
* - `approvalCount` must be >= threshold.
|
|
126
150
|
*
|
|
127
151
|
* @param {Uint<8>} approvalCount - The current number of approvals.
|
|
128
152
|
* @returns {[]} Empty tuple.
|
|
129
153
|
*/
|
|
130
154
|
export circuit assertThresholdMet(approvalCount: Uint<8>): [] {
|
|
131
|
-
assertInitialized();
|
|
132
155
|
assert(_threshold != 0, "Signer: threshold not set");
|
|
133
156
|
assert(approvalCount >= _threshold, "Signer: threshold not met");
|
|
134
157
|
}
|
|
@@ -136,42 +159,32 @@ module Signer<T> {
|
|
|
136
159
|
// ─── View ──────────────────────────────────────────────────────────
|
|
137
160
|
|
|
138
161
|
/**
|
|
139
|
-
* @description Returns the current signer count.
|
|
162
|
+
* @description Returns the current signer count. Returns zero when no
|
|
163
|
+
* signers have been registered.
|
|
140
164
|
*
|
|
141
165
|
* @circuitInfo k=6, rows=26
|
|
142
166
|
*
|
|
143
|
-
* Requirements:
|
|
144
|
-
*
|
|
145
|
-
* - Contract must be initialized.
|
|
146
|
-
*
|
|
147
167
|
* @returns {Uint<8>} The number of active signers.
|
|
148
168
|
*/
|
|
149
169
|
export circuit getSignerCount(): Uint<8> {
|
|
150
|
-
assertInitialized();
|
|
151
170
|
return _signerCount;
|
|
152
171
|
}
|
|
153
172
|
|
|
154
173
|
/**
|
|
155
|
-
* @description Returns the approval threshold.
|
|
174
|
+
* @description Returns the approval threshold. Returns zero when the
|
|
175
|
+
* threshold has not been set.
|
|
156
176
|
*
|
|
157
177
|
* @circuitInfo k=6, rows=26
|
|
158
178
|
*
|
|
159
|
-
* Requirements:
|
|
160
|
-
*
|
|
161
|
-
* - Contract must be initialized.
|
|
162
|
-
*
|
|
163
179
|
* @returns {Uint<8>} The threshold.
|
|
164
180
|
*/
|
|
165
181
|
export circuit getThreshold(): Uint<8> {
|
|
166
|
-
assertInitialized();
|
|
167
182
|
return _threshold;
|
|
168
183
|
}
|
|
169
184
|
|
|
170
185
|
/**
|
|
171
186
|
* @description Returns whether the given account is an active signer.
|
|
172
187
|
*
|
|
173
|
-
* @circuitInfo k=10, rows=605
|
|
174
|
-
*
|
|
175
188
|
* @param {T} account - The account to check.
|
|
176
189
|
* @returns {Boolean} True if the account is an active signer.
|
|
177
190
|
*/
|
|
@@ -188,8 +201,6 @@ module Signer<T> {
|
|
|
188
201
|
* The consuming contract must gate this behind its own
|
|
189
202
|
* authorization policy.
|
|
190
203
|
*
|
|
191
|
-
* @circuitInfo k=10, rows=598
|
|
192
|
-
*
|
|
193
204
|
* Requirements:
|
|
194
205
|
*
|
|
195
206
|
* - `signer` must not already be an active signer.
|
|
@@ -214,8 +225,6 @@ module Signer<T> {
|
|
|
214
225
|
* The consuming contract must gate this behind its own
|
|
215
226
|
* authorization policy.
|
|
216
227
|
*
|
|
217
|
-
* @circuitInfo k=10, rows=612
|
|
218
|
-
*
|
|
219
228
|
* Requirements:
|
|
220
229
|
*
|
|
221
230
|
* - `signer` must be an active signer.
|
|
@@ -263,6 +272,14 @@ module Signer<T> {
|
|
|
263
272
|
* @warning This is intended for use during contract construction
|
|
264
273
|
* or custom setup flows where signers may not yet be registered.
|
|
265
274
|
*
|
|
275
|
+
* Leaving `newThreshold` above the signer count is permitted and expected
|
|
276
|
+
* mid-setup, and is not self-enforcing: `assertThresholdMet` compares
|
|
277
|
+
* `approvalCount` against the threshold alone, so a caller supplying a matching
|
|
278
|
+
* count satisfies it even against an empty registry. Contracts must not gate
|
|
279
|
+
* operations on `assertThresholdMet` while setup is incomplete. Lower the
|
|
280
|
+
* threshold with `_setThreshold`; `_changeThreshold` cannot lower one while the
|
|
281
|
+
* signer count is zero, because that would require a zero threshold.
|
|
282
|
+
*
|
|
266
283
|
* @notice Access control is NOT enforced here.
|
|
267
284
|
* The consuming contract must gate this behind its own
|
|
268
285
|
* authorization policy. Use `_changeThreshold` for
|
|
@@ -284,19 +301,6 @@ module Signer<T> {
|
|
|
284
301
|
|
|
285
302
|
// ─── Init guards ─────────────────────────────────────────────────────────
|
|
286
303
|
|
|
287
|
-
/**
|
|
288
|
-
* @description Asserts that the contract has been initialized, throwing an error if not.
|
|
289
|
-
*
|
|
290
|
-
* Requirements:
|
|
291
|
-
*
|
|
292
|
-
* - Contract must be initialized.
|
|
293
|
-
*
|
|
294
|
-
* @return {[]} - Empty tuple.
|
|
295
|
-
*/
|
|
296
|
-
circuit assertInitialized(): [] {
|
|
297
|
-
assert(_isInitialized, "Signer: contract not initialized");
|
|
298
|
-
}
|
|
299
|
-
|
|
300
304
|
/**
|
|
301
305
|
* @description Asserts that the contract has not been initialized, throwing an error if it has.
|
|
302
306
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/UnshieldedTreasury.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/UnshieldedTreasury.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
|
@@ -8,10 +8,24 @@ pragma language_version >= 0.23.0;
|
|
|
8
8
|
* @description Manages unshielded (transparent) token deposits and
|
|
9
9
|
* transfers for multisig governance contracts.
|
|
10
10
|
*
|
|
11
|
-
* Balances are tracked per token color in
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Balances are tracked per token color in `_balances`, this module's own
|
|
12
|
+
* accounting and the authority for its overflow and sufficiency guards. The
|
|
13
|
+
* protocol balance remains authoritative for what the contract actually holds,
|
|
14
|
+
* and the ledger independently enforces conservation — a contract cannot send
|
|
15
|
+
* funds it does not have.
|
|
16
|
+
*
|
|
17
|
+
* @notice The guards deliberately do NOT consult `unshieldedBalance` or its
|
|
18
|
+
* comparison circuits. That balance is fixed to the value provided at the start
|
|
19
|
+
* of execution, so it cannot observe a credit or debit made earlier in the same
|
|
20
|
+
* transaction: guarding on it rejects a legitimate receive-then-spend and misses
|
|
21
|
+
* an intra-transaction overspend. Guarding on `_balances` (the same value the
|
|
22
|
+
* arithmetic mutates) is correct in both cases, and keeps the named asserts
|
|
23
|
+
* reachable for the conditions they describe.
|
|
24
|
+
*
|
|
25
|
+
* @notice Consumers must route every unshielded credit and debit through
|
|
26
|
+
* `_deposit` / `_send`. A flow that calls `receiveUnshielded` or
|
|
27
|
+
* `sendUnshielded` directly leaves `_balances` out of step with the protocol
|
|
28
|
+
* balance, and `getTokenBalance` will misreport.
|
|
15
29
|
*
|
|
16
30
|
* Underscore-prefixed circuits (_deposit, _send) have no access control
|
|
17
31
|
* enforcement. The consuming contract must gate these behind its own
|
|
@@ -35,7 +49,9 @@ module UnshieldedTreasury {
|
|
|
35
49
|
*
|
|
36
50
|
* Zero-value deposits are permitted. While currently a no-op
|
|
37
51
|
* economically, they may serve as signaling mechanisms when events
|
|
38
|
-
* are supported.
|
|
52
|
+
* are supported. On a color the treasury has not held, a zero-value
|
|
53
|
+
* operation creates a zero-valued `_balances` entry, which
|
|
54
|
+
* `getTokenBalance` reports the same as absence.
|
|
39
55
|
*
|
|
40
56
|
* @notice Access control is NOT enforced here.
|
|
41
57
|
* The consuming contract must gate this behind its own
|
|
@@ -51,21 +67,35 @@ module UnshieldedTreasury {
|
|
|
51
67
|
* @returns {[]} Empty tuple.
|
|
52
68
|
*/
|
|
53
69
|
export circuit _deposit(color: Bytes<32>, amount: Uint<128>): [] {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
// `Utils_UINT128_MAX() - amount` stays in-circuit. Passing it to a protocol
|
|
71
|
+
// balance comparison would hand that built-in an operand near 2^128, which
|
|
72
|
+
// fails at runtime with "failed to decode for built-in type u64" despite the
|
|
73
|
+
// circuit's declared `Uint<128>` parameter.
|
|
74
|
+
const bal = getTokenBalance(color);
|
|
75
|
+
assert(bal <= Utils_UINT128_MAX() - amount, "UnshieldedTreasury: overflow");
|
|
58
76
|
|
|
59
77
|
receiveUnshielded(disclose(color), disclose(amount));
|
|
60
78
|
|
|
61
|
-
const bal = getTokenBalance(color);
|
|
62
79
|
_balances.insert(disclose(color), disclose(bal + amount as Uint<128>));
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
// ─── Send ───────────────────────────────────────────────────────
|
|
66
83
|
|
|
67
84
|
/**
|
|
68
|
-
* @description Sends unshielded tokens from the treasury.
|
|
85
|
+
* @description Sends unshielded tokens from the treasury. Zero-amount sends
|
|
86
|
+
* are permitted and are value-preserving no-ops.
|
|
87
|
+
*
|
|
88
|
+
* @warning Recipients are not validated. An unspendable recipient (such as a
|
|
89
|
+
* zero address) is accepted and permanently removes the funds from the
|
|
90
|
+
* contract. This is not a sanctioned burn — no unshielded equivalent of
|
|
91
|
+
* `shieldedBurnAddress` is exposed to contracts — so treat recipient
|
|
92
|
+
* validation as the consuming contract's responsibility.
|
|
93
|
+
*
|
|
94
|
+
* @warning Sending to this contract's own address zeroes the tracked balance
|
|
95
|
+
* while the funds stay held and spendable at the protocol level, after which
|
|
96
|
+
* `_send` will refuse to touch them. Recovery is only possible outside this
|
|
97
|
+
* module: a consumer may reconcile the exported `_balances`, or spend the
|
|
98
|
+
* funds through its own `sendUnshielded` call.
|
|
69
99
|
*
|
|
70
100
|
* @notice Access control is NOT enforced here.
|
|
71
101
|
* The consuming contract must gate this behind its own
|
|
@@ -86,12 +116,9 @@ module UnshieldedTreasury {
|
|
|
86
116
|
color: Bytes<32>,
|
|
87
117
|
amount: Uint<128>
|
|
88
118
|
): [] {
|
|
89
|
-
assert(
|
|
90
|
-
unshieldedBalanceGte(disclose(color), disclose(amount)),
|
|
91
|
-
"UnshieldedTreasury: insufficient balance"
|
|
92
|
-
);
|
|
93
|
-
|
|
94
119
|
const bal = getTokenBalance(color);
|
|
120
|
+
assert(bal >= amount, "UnshieldedTreasury: insufficient balance");
|
|
121
|
+
|
|
95
122
|
_balances.insert(disclose(color), disclose(bal - amount as Uint<128>));
|
|
96
123
|
sendUnshielded(disclose(color), disclose(amount), disclose(recipient));
|
|
97
124
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/presets/ShieldedMultiSig.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/presets/ShieldedMultiSig.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @module ShieldedMultiSig
|
|
8
|
-
* @description A shielded multisig preset composing `
|
|
8
|
+
* @description A shielded multisig preset composing `Signer`,
|
|
9
9
|
* `ProposalManager`, and `ShieldedTreasury`. Signers approve proposals that
|
|
10
10
|
* transfer shielded tokens out of the treasury once the configured threshold
|
|
11
11
|
* is met.
|
|
@@ -29,7 +29,7 @@ import CompactStandardLibrary;
|
|
|
29
29
|
|
|
30
30
|
import "../ProposalManager" prefix Proposal_;
|
|
31
31
|
import "../ShieldedTreasury" prefix Treasury_;
|
|
32
|
-
import "../
|
|
32
|
+
import "../Signer"<Either<ZswapCoinPublicKey, ContractAddress>> prefix Signer_;
|
|
33
33
|
|
|
34
34
|
// ─── State ───────────────────────────────────────────────────────────────
|
|
35
35
|
|
|
@@ -187,17 +187,12 @@ export circuit getProposal(id: Uint<64>): Proposal_Proposal {
|
|
|
187
187
|
return Proposal_getProposal(id);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export circuit getProposalColor(id: Uint<64>): Bytes<32> {
|
|
199
|
-
return Proposal_getProposalColor(id);
|
|
200
|
-
}
|
|
190
|
+
// NOTE: the per-field proposal getters (getProposalRecipient / getProposalAmount
|
|
191
|
+
// / getProposalColor) and getReceivedMinusSent were dropped to bring the deploy
|
|
192
|
+
// transaction under the block-weight limit (the full 19-circuit deploy is
|
|
193
|
+
// rejected with "Transaction would exhaust the block limits"). They are all
|
|
194
|
+
// redundant: read the proposal fields via `getProposal(id).to / .amount / .color`,
|
|
195
|
+
// and the net balance via `getReceivedTotal(color) - getSentTotal(color)`.
|
|
201
196
|
|
|
202
197
|
export circuit getProposalStatus(id: Uint<64>): Proposal_ProposalStatus {
|
|
203
198
|
return Proposal_getProposalStatus(id);
|
|
@@ -217,11 +212,7 @@ export circuit getSentTotal(color: Bytes<32>): Uint<128> {
|
|
|
217
212
|
return Treasury_getSentTotal(color);
|
|
218
213
|
}
|
|
219
214
|
|
|
220
|
-
|
|
221
|
-
return Treasury_getReceivedMinusSent(color);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// ISignerManager
|
|
215
|
+
// ISigner
|
|
225
216
|
|
|
226
217
|
export circuit getSignerCount(): Uint<8> {
|
|
227
218
|
return Signer_getSignerCount();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/presets/ShieldedMultiSigV2.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/presets/ShieldedMultiSigV2.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
|
@@ -24,7 +24,7 @@ import CompactStandardLibrary;
|
|
|
24
24
|
|
|
25
25
|
import "../ProposalManager" prefix Proposal_;
|
|
26
26
|
import "../ShieldedTreasuryStateless" prefix Treasury_;
|
|
27
|
-
import "../
|
|
27
|
+
import "../Signer"<Bytes<32>> prefix Signer_;
|
|
28
28
|
|
|
29
29
|
// ─── Types ──────────────────────────────────────────────────────
|
|
30
30
|
|
|
@@ -20,7 +20,7 @@ pragma language_version >= 0.23.0;
|
|
|
20
20
|
*
|
|
21
21
|
* - `mint` creates a new UTXO via `mintShieldedToken`, addressed to the
|
|
22
22
|
* contract. No external coin input; supply is produced on-chain.
|
|
23
|
-
* - `burn` consumes a UTXO via `sendShielded` to `
|
|
23
|
+
* - `burn` consumes a UTXO via `sendShielded` to `shieldedBurnAddress()`. Only
|
|
24
24
|
* coins of this contract's token type can be burned. Change is handled
|
|
25
25
|
* automatically by the transaction layer.
|
|
26
26
|
*
|
|
@@ -194,7 +194,7 @@ export circuit mint(
|
|
|
194
194
|
* @description Burns a shielded coin of this contract's token type,
|
|
195
195
|
* authorized by threshold signatures.
|
|
196
196
|
*
|
|
197
|
-
* Sends the specified amount of the supplied coin to `
|
|
197
|
+
* Sends the specified amount of the supplied coin to `shieldedBurnAddress()` via
|
|
198
198
|
* `sendShielded`. The nullifier is submitted on-chain, permanently marking
|
|
199
199
|
* the UTXO as spent.
|
|
200
200
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/presets/forwarder/ForwarderPrivate.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/presets/forwarder/ForwarderPrivate.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/presets/forwarder/ForwarderShielded.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/presets/forwarder/ForwarderShielded.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.3.0-alpha (multisig/presets/forwarder/ForwarderUnshielded.compact)
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.3.0-alpha.2 (multisig/presets/forwarder/ForwarderUnshielded.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.23.0;
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openzeppelin/compact-contracts",
|
|
3
|
-
"version": "0.3.0-alpha",
|
|
3
|
+
"version": "0.3.0-alpha.2",
|
|
4
4
|
"description": "OpenZeppelin Compact contract library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openzeppelin",
|
|
@@ -21,23 +21,24 @@
|
|
|
21
21
|
"homepage": "https://docs.openzeppelin.com/contracts-compact/",
|
|
22
22
|
"type": "module",
|
|
23
23
|
"imports": {
|
|
24
|
-
"#test-utils
|
|
24
|
+
"#test-utils/*": "./test-utils/*"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
27
|
+
"compile": "compact-compiler --exclude '*/archive/*'",
|
|
28
|
+
"compile:access": "compact-compiler --dir access",
|
|
29
|
+
"compile:archive": "compact-compiler --dir archive",
|
|
30
|
+
"compile:crypto": "compact-compiler --dir crypto",
|
|
31
|
+
"compile:multisig": "compact-compiler --dir multisig",
|
|
32
|
+
"compile:security": "compact-compiler --dir security",
|
|
33
|
+
"compile:token": "compact-compiler --dir token",
|
|
34
|
+
"compile:utils": "compact-compiler --dir utils",
|
|
35
|
+
"compile:integration": "SKIP_ZK=true compact-compiler --src test/integration/_mocks",
|
|
35
36
|
"build": "compact-builder --hierarchical --out dist --clean-dist --exclude '*/archive/*' --exclude 'Mock*' --exclude '*.mock.compact' --copy package.json --copy ../README.md && find dist -type d -empty -delete",
|
|
36
|
-
"test": "
|
|
37
|
-
"test:coverage": "
|
|
38
|
-
"test:
|
|
39
|
-
"
|
|
40
|
-
"test:
|
|
37
|
+
"test": "vitest run --project unit",
|
|
38
|
+
"test:coverage": "vitest run --project unit --coverage",
|
|
39
|
+
"test:integration": "vitest run --project integration",
|
|
40
|
+
"test:harness": "vitest run --project harness",
|
|
41
|
+
"test:harness:live": "MIDNIGHT_BACKEND=live vitest run --project harness-live",
|
|
41
42
|
"types": "tsc -p tsconfig.json --noEmit",
|
|
42
43
|
"clean": "git clean -fXd"
|
|
43
44
|
},
|
|
@@ -48,13 +49,24 @@
|
|
|
48
49
|
"@openzeppelin/compact-cli": "^0.0.2"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
+
"@midnight-ntwrk/compact-js": "2.5.1",
|
|
53
|
+
"@midnight-ntwrk/compact-runtime": "0.16.0",
|
|
54
|
+
"@midnight-ntwrk/ledger-v8": "8.1.0",
|
|
55
|
+
"@midnight-ntwrk/midnight-js-contracts": "4.1.1",
|
|
56
|
+
"@midnight-ntwrk/midnight-js-http-client-proof-provider": "4.1.1",
|
|
57
|
+
"@midnight-ntwrk/midnight-js-indexer-public-data-provider": "4.1.1",
|
|
58
|
+
"@midnight-ntwrk/midnight-js-network-id": "4.1.1",
|
|
59
|
+
"@midnight-ntwrk/midnight-js-node-zk-config-provider": "4.1.1",
|
|
60
|
+
"@midnight-ntwrk/midnight-js-protocol": "4.1.1",
|
|
61
|
+
"@midnight-ntwrk/midnight-js-types": "4.1.1",
|
|
62
|
+
"@midnight-ntwrk/testkit-js": "4.1.1",
|
|
63
|
+
"@openzeppelin/compact-simulator": "^0.3.1",
|
|
52
64
|
"@tsconfig/node24": "^24.0.4",
|
|
53
|
-
"@types/node": "
|
|
54
|
-
"@vitest/coverage-v8": "^4.1.
|
|
55
|
-
"fast-check": "^4.
|
|
65
|
+
"@types/node": "26.1.2",
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
67
|
+
"fast-check": "^4.9.0",
|
|
56
68
|
"ts-node": "^10.9.2",
|
|
57
69
|
"typescript": "^6.0.3",
|
|
58
|
-
"vitest": "^4.1.
|
|
70
|
+
"vitest": "^4.1.10"
|
|
59
71
|
}
|
|
60
72
|
}
|