@openzeppelin/compact-contracts 0.4.0-alpha.5 → 0.4.0-alpha.6
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 +1 -1
- package/access/AccessControl.compact +1 -1
- package/access/Ownable.compact +1 -1
- package/access/ShieldedAccessControl.compact +1 -1
- package/access/ZOwnablePK.compact +13 -4
- package/crypto/EcdhMask.compact +1 -1
- package/crypto/Ecdsa.compact +1 -1
- package/crypto/Eip712.compact +1 -1
- package/crypto/ElGamal.compact +1 -1
- package/multisig/ForwarderPrivate.compact +1 -1
- package/multisig/ForwarderShielded.compact +1 -1
- package/multisig/ForwarderUnshielded.compact +1 -1
- package/multisig/ProposalManager.compact +1 -1
- package/multisig/Secp256k1EcdsaMultisig.compact +275 -0
- package/multisig/ShieldedTreasury.compact +1 -1
- package/multisig/ShieldedTreasuryStateless.compact +1 -1
- package/multisig/Signer.compact +1 -1
- package/multisig/UnshieldedTreasury.compact +1 -1
- package/multisig/examples/ForwarderPrivateExample.compact +1 -1
- package/multisig/examples/ForwarderShieldedExample.compact +1 -1
- package/multisig/examples/ForwarderUnshieldedExample.compact +1 -1
- package/multisig/examples/NativeShieldedTokenIssuerExample.compact +4 -4
- package/multisig/examples/ShieldedMultiSigV2Example.compact +6 -8
- package/multisig/presets/NativeShieldedTokenIssuer.compact +84 -83
- package/multisig/presets/ShieldedMultiSigV2.compact +35 -43
- package/package.json +1 -1
- 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 +1 -1
- package/token/FungibleToken.compact +1 -1
- package/token/MultiToken.compact +1 -1
- package/token/NativeShieldedToken.compact +1 -1
- package/token/NativeShieldedTokenCore.compact +1 -1
- package/token/NativeShieldedTokenFamily.compact +1 -1
- package/token/NonFungibleToken.compact +1 -1
- package/token/examples/ZOwnableNativeShieldedTokenExample.compact +109 -0
- package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +1 -1
- package/token/extensions/NativeShieldedTokenDerivedNonce.compact +1 -1
- package/token/presets/ZOwnableNativeShieldedToken.compact +314 -0
- package/utils/EvmAbi.compact +1 -1
- package/utils/Utils.compact +1 -1
- package/multisig/EcdsaSignerManager.compact +0 -248
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ Overall progress [====================] 14/14
|
|
|
191
191
|
|
|
192
192
|
ZKIR v3: the library targets ZKIR v2, the compiler 0.34.0 default.
|
|
193
193
|
Pass `--feature-zkir-v3` only when the contract reaches a module that needs it:
|
|
194
|
-
the secp256k1-based `crypto/Ecdsa` and `multisig/
|
|
194
|
+
the secp256k1-based `crypto/Ecdsa` and `multisig/Secp256k1EcdsaMultisig`,
|
|
195
195
|
or the `keccak256`-based `crypto/Eip712`.
|
|
196
196
|
`multisig/presets/ShieldedMultiSigV2`, `multisig/presets/NativeShieldedTokenIssuer`
|
|
197
197
|
and the `multisig/examples/` contracts reach both.
|
package/access/Ownable.compact
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0-alpha.
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (access/ZOwnablePK.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -35,10 +35,17 @@ pragma language_version >= 0.26.0;
|
|
|
35
35
|
* providing unlinkability across ownership changes.
|
|
36
36
|
*
|
|
37
37
|
* @dev Security Considerations:
|
|
38
|
-
* -
|
|
39
|
-
*
|
|
38
|
+
* - `ownPublicKey()` is a witness: it returns the caller's Zswap coin public
|
|
39
|
+
* key, and nothing proves the caller holds the matching private key. See
|
|
40
|
+
* https://docs.midnight.network/compact/smart-contract-security#ownpublickey-is-a-witness-function.
|
|
41
|
+
* - The `secretNonce` is therefore the owner credential: the nonce and the
|
|
42
|
+
* owner's public key are enough to pass `assertOnlyOwner`. Generate it as
|
|
43
|
+
* 32 bytes from a CSPRNG and keep it private. Losing it prevents the owner
|
|
44
|
+
* from proving ownership or transferring it.
|
|
40
45
|
* - Ownership validation is entirely circuit-based using witness-provided values.
|
|
41
46
|
* - The `_instanceSalt` is immutable and used to differentiate deployments.
|
|
47
|
+
* Use a fresh random value per deployment; a reused salt links the same
|
|
48
|
+
* owner across deployments.
|
|
42
49
|
*
|
|
43
50
|
* @notice Best used for single-admin contracts with privacy requirements.
|
|
44
51
|
* It is not designed for multi-owner or role-based access control.
|
|
@@ -99,12 +106,13 @@ module ZOwnablePK {
|
|
|
99
106
|
* @warning The `ownerId` must be calculated prior to contract deployment using the SHA256 hashing algorithm.
|
|
100
107
|
* Using any other algorithm will result in a permanent loss of contract access.
|
|
101
108
|
*
|
|
102
|
-
* @constraints k=
|
|
109
|
+
* @constraints k=13, rows=6765
|
|
103
110
|
*
|
|
104
111
|
* Requirements:
|
|
105
112
|
*
|
|
106
113
|
* - Contract is not initialized.
|
|
107
114
|
* - `ownerId` is not zero.
|
|
115
|
+
* - `instanceSalt` is not zero.
|
|
108
116
|
*
|
|
109
117
|
* @param {Bytes<32>} ownerId - The owner's unique identifier SHA256(pk, nonce).
|
|
110
118
|
* @param {Bytes<32>} instanceSalt - Contract salt to prevent duplicate commitments if
|
|
@@ -116,6 +124,7 @@ module ZOwnablePK {
|
|
|
116
124
|
_isInitialized = true;
|
|
117
125
|
|
|
118
126
|
assert(ownerId != default<Bytes<32>>, "ZOwnablePK: invalid id");
|
|
127
|
+
assert(instanceSalt != default<Bytes<32>>, "ZOwnablePK: invalid salt");
|
|
119
128
|
_instanceSalt = disclose(instanceSalt);
|
|
120
129
|
_transferOwnership(ownerId);
|
|
121
130
|
}
|
package/crypto/EcdhMask.compact
CHANGED
package/crypto/Ecdsa.compact
CHANGED
package/crypto/Eip712.compact
CHANGED
package/crypto/ElGamal.compact
CHANGED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (multisig/Secp256k1EcdsaMultisig.compact)
|
|
3
|
+
|
|
4
|
+
pragma language_version >= 0.26.0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @module Secp256k1EcdsaMultisig<#t>
|
|
8
|
+
* @description
|
|
9
|
+
* A `t`-of-`n` accountable multisignature over secp256k1 ECDSA: `n` signer
|
|
10
|
+
* commitments are registered at deploy, and a call passes when `t` distinct
|
|
11
|
+
* registered signers have signed the digest. The threshold `t` is the module
|
|
12
|
+
* generic, so it is also the approval count every gated call carries.
|
|
13
|
+
*
|
|
14
|
+
* @dev Notation:
|
|
15
|
+
* - `H(...)`: `persistentHash` (SHA-256), a `Bytes<32>` digest.
|
|
16
|
+
* - `cm = H(pkX, pkY, salt, "Secp256k1EcdsaMultisig:signer")`: a signer
|
|
17
|
+
* commitment, over the affine coordinates of the secp256k1 public key.
|
|
18
|
+
* - `n`: signers registered at `initialize`.
|
|
19
|
+
* - `t`: the threshold and the `assertApprovals` width.
|
|
20
|
+
*
|
|
21
|
+
* @dev Derivations:
|
|
22
|
+
* `H` hashes the `SignerCommitmentInput` struct in Compact's encoding, not a
|
|
23
|
+
* byte concatenation. Do not reimplement it: `calculateSignerId` is the
|
|
24
|
+
* exported pure circuit, and the consumer test suites pin its vectors. A
|
|
25
|
+
* wrong derivation registers commitments no key can satisfy.
|
|
26
|
+
*
|
|
27
|
+
* @dev Parameterization:
|
|
28
|
+
* `t` is fixed at import (`import "./Secp256k1EcdsaMultisig"<2> prefix
|
|
29
|
+
* Secp256k1EcdsaMultisig_;`) and `n` per `initialize<#n>` call. `Signer`
|
|
30
|
+
* enforces `n >= t` at `initialize`. No circuit takes a threshold argument.
|
|
31
|
+
* `t = 0` does not compile.
|
|
32
|
+
*
|
|
33
|
+
* @dev Compatibility:
|
|
34
|
+
* The wire format is the `Secp256k1EcdsaMultisig:signer` domain, the
|
|
35
|
+
* `SignerCommitmentInput` layout, and the salt. Changing any of them orphans
|
|
36
|
+
* every registered signer set. The digest is the consumer's and is not part
|
|
37
|
+
* of this module's format.
|
|
38
|
+
*
|
|
39
|
+
* @notice Privacy:
|
|
40
|
+
* - Public, per tx: the `t` commitments (`disclose(commitment)` in
|
|
41
|
+
* `Signer_assertSigner`), so WHICH signers approved.
|
|
42
|
+
* - Public, as state: `_signers`, `_signerCount`, `_threshold`,
|
|
43
|
+
* `_instanceSalt`. All exported.
|
|
44
|
+
* - Private: public keys and signatures, verified in-circuit and never
|
|
45
|
+
* disclosed; the digest, beyond what the consumer publishes.
|
|
46
|
+
* - Signer identity: keys sit behind `cm` with a public salt, so an observer
|
|
47
|
+
* holding a candidate key can test membership; one without cannot
|
|
48
|
+
* correlate a signer across deployments.
|
|
49
|
+
*
|
|
50
|
+
* @notice Security:
|
|
51
|
+
* - Order: `assertApprovals` runs `Signer_assertThresholdMet(t)` first, so an
|
|
52
|
+
* uninitialized registry fails before any signature work. Then pairwise
|
|
53
|
+
* distinct commitments, then per entry a registered commitment and a valid
|
|
54
|
+
* signature.
|
|
55
|
+
* - Low-s: verification goes through `Ecdsa_secp256k1EcdsaVerifyLowS`, so a
|
|
56
|
+
* high-s encoding is an invalid signature.
|
|
57
|
+
* - Distinct signers: all `t(t-1)/2` pairs are compared, so no key counts
|
|
58
|
+
* twice.
|
|
59
|
+
* - Bounds: `Signer` rejects `t > n` at `initialize`.
|
|
60
|
+
* - Once-only: `initialize` rejects a second call while signers are
|
|
61
|
+
* registered, and writes the `sealed` salt, so it is constructor-only.
|
|
62
|
+
* - Immutable to the deployed circuit set: no signer or threshold change is
|
|
63
|
+
* exported. Losing more than `n - t` keys freezes every gated circuit.
|
|
64
|
+
* - Digest binding is the consumer's: this module verifies signatures over
|
|
65
|
+
* whatever `msgHash` it is handed. Replay, domain and instance binding
|
|
66
|
+
* belong in the digest.
|
|
67
|
+
* - Atomicity: a failed assert rejects the whole tx before any state moves,
|
|
68
|
+
* and the sender pays no fee.
|
|
69
|
+
*
|
|
70
|
+
* @notice Concurrency:
|
|
71
|
+
* - Every read (`_threshold`, `_signers.member(cm)`, `_instanceSalt`) is
|
|
72
|
+
* state written only by `initialize`, so `assertApprovals` and the views
|
|
73
|
+
* commute with everything, including each other.
|
|
74
|
+
*
|
|
75
|
+
* @notice Scope:
|
|
76
|
+
* Registry and verification only: no digest construction, no nonce, no
|
|
77
|
+
* roles, no signer rotation. The consumer builds the digest and gates its
|
|
78
|
+
* circuits with `assertApprovals`.
|
|
79
|
+
*
|
|
80
|
+
* @notice Client-side duties:
|
|
81
|
+
* - Before deploy: pick a random `instanceSalt`, derive each `cm` with
|
|
82
|
+
* `calculateSignerId(pk, salt)`, pass them as `signerCommitments`.
|
|
83
|
+
* - Per call: collect exactly `t` low-s signatures from distinct signers over
|
|
84
|
+
* the consumer's digest, submit keys and signatures in matching `Vector<t>`
|
|
85
|
+
* positions.
|
|
86
|
+
*
|
|
87
|
+
* @dev Performance:
|
|
88
|
+
* - Cost is per entry: one ECDSA verify and one `H` for each of the `t`
|
|
89
|
+
* approvals, plus `t(t-1)/2` `Bytes<32>` compares.
|
|
90
|
+
* - `assertApprovals` (zkir-v3): `t = 1` is k=16, rows=40538; `t = 2` is
|
|
91
|
+
* k=17, rows=64908; `t = 3` is k=17, rows=94995.
|
|
92
|
+
*
|
|
93
|
+
* @dev Composition:
|
|
94
|
+
* - Import this module at exactly one width per contract. Two widths
|
|
95
|
+
* instantiate two `Secp256k1EcdsaMultisig` modules over one shared
|
|
96
|
+
* `Signer<Bytes<32>>` registry, so the second `initialize` trips the
|
|
97
|
+
* once-only guard and that width's `_instanceSalt` is never written.
|
|
98
|
+
* - Do not import `Signer` alongside this module. A direct import
|
|
99
|
+
* instantiates a separate registry that `assertApprovals` never reads.
|
|
100
|
+
*/
|
|
101
|
+
module Secp256k1EcdsaMultisig<#t> {
|
|
102
|
+
import CompactStandardLibrary;
|
|
103
|
+
import "../crypto/Ecdsa" prefix Ecdsa_;
|
|
104
|
+
import "./Signer"<Bytes<32>> prefix Signer_;
|
|
105
|
+
|
|
106
|
+
// Named import/re-export of the registry state only, so a consuming
|
|
107
|
+
// contract's ledger keys read as `_signers` rather than `Signer__signers`.
|
|
108
|
+
// The circuits stay behind the `Signer_` prefix.
|
|
109
|
+
import { _signers, _signerCount, _threshold } from "./Signer"<Bytes<32>>;
|
|
110
|
+
export { _signers, _signerCount, _threshold };
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @description Deployment-supplied salt for signer commitments. Set at
|
|
114
|
+
* initialization and never changed. The registered commitments must have been
|
|
115
|
+
* derived under this same salt.
|
|
116
|
+
*/
|
|
117
|
+
export sealed ledger _instanceSalt: Bytes<32>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @description Input to `persistentHash` for computing signer commitments.
|
|
121
|
+
*/
|
|
122
|
+
struct SignerCommitmentInput {
|
|
123
|
+
pkX: Bytes<32>,
|
|
124
|
+
pkY: Bytes<32>,
|
|
125
|
+
salt: Bytes<32>,
|
|
126
|
+
domain: Bytes<32>
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @description Stores the instance salt and registers the signer set at
|
|
131
|
+
* threshold `t`. Call from the consuming contract's constructor only.
|
|
132
|
+
* Writes the `sealed` salt, so it cannot be reached from an exported
|
|
133
|
+
* circuit. The set is final: signers must be known at deploy and no circuit
|
|
134
|
+
* adds, removes or replaces one afterwards.
|
|
135
|
+
*
|
|
136
|
+
* Requirements:
|
|
137
|
+
*
|
|
138
|
+
* - Can only be called once.
|
|
139
|
+
* - `instanceSalt` should be cryptographically random.
|
|
140
|
+
* - `signerCommitments` must not contain duplicates.
|
|
141
|
+
* - `n` must be at least `t`.
|
|
142
|
+
*
|
|
143
|
+
* @param {Bytes<32>} instanceSalt - Per-deployment salt for commitment derivation.
|
|
144
|
+
* @param {Vector<n, Bytes<32>>} signerCommitments - Hashed signer identities.
|
|
145
|
+
* @returns {[]} Empty tuple.
|
|
146
|
+
*/
|
|
147
|
+
export circuit initialize<#n>(
|
|
148
|
+
instanceSalt: Bytes<32>,
|
|
149
|
+
signerCommitments: Vector<n, Bytes<32>>
|
|
150
|
+
): [] {
|
|
151
|
+
assert(Signer_getSignerCount() == 0, "Secp256k1EcdsaMultisig: signers already registered");
|
|
152
|
+
_instanceSalt = disclose(instanceSalt);
|
|
153
|
+
|
|
154
|
+
for (const commitment of signerCommitments) {
|
|
155
|
+
Signer__addSigner(commitment);
|
|
156
|
+
}
|
|
157
|
+
Signer__changeThreshold(t);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @description Verifies `t` approvals over `msgHash`: distinct registered
|
|
162
|
+
* signers, each with a valid low-s signature.
|
|
163
|
+
*
|
|
164
|
+
* `pubkeys` and `signatures` are parallel: entry `i` of each belongs to the
|
|
165
|
+
* same signer.
|
|
166
|
+
*
|
|
167
|
+
* Requirements:
|
|
168
|
+
*
|
|
169
|
+
* - The module must be initialized.
|
|
170
|
+
* - No two entries may be the same signer.
|
|
171
|
+
* - Every public key must hash to a registered signer commitment.
|
|
172
|
+
* - Every signature must be valid over `msgHash` and use the low-s encoding.
|
|
173
|
+
*
|
|
174
|
+
* @param {Bytes<32>} msgHash - The digest the signers approved.
|
|
175
|
+
* @param {Vector<t, Secp256k1Point>} pubkeys - Public keys of approving signers.
|
|
176
|
+
* @param {Vector<t, Secp256k1EcdsaSignature>} signatures - Signatures over `msgHash`.
|
|
177
|
+
* @returns {[]} Empty tuple.
|
|
178
|
+
*/
|
|
179
|
+
export circuit assertApprovals(
|
|
180
|
+
msgHash: Bytes<32>,
|
|
181
|
+
pubkeys: Vector<t, Secp256k1Point>,
|
|
182
|
+
signatures: Vector<t, Secp256k1EcdsaSignature>
|
|
183
|
+
): [] {
|
|
184
|
+
Signer_assertThresholdMet(t);
|
|
185
|
+
|
|
186
|
+
const commitments = map(signerCommitment, pubkeys);
|
|
187
|
+
|
|
188
|
+
for (const i of 0..t) {
|
|
189
|
+
for (const j of 0..t) {
|
|
190
|
+
if (i < j) {
|
|
191
|
+
assert(commitments[i] != commitments[j], "Secp256k1EcdsaMultisig: duplicate signer");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
for (const i of 0..t) {
|
|
197
|
+
Signer_assertSigner(commitments[i]);
|
|
198
|
+
assert(
|
|
199
|
+
Ecdsa_secp256k1EcdsaVerifyLowS(msgHash, signatures[i], pubkeys[i]),
|
|
200
|
+
"Secp256k1EcdsaMultisig: invalid signature"
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @description `map` callback. Commits `pk` under the instance salt.
|
|
207
|
+
*
|
|
208
|
+
* @param {Secp256k1Point} pk - The signer's secp256k1 public key.
|
|
209
|
+
* @returns {Bytes<32>} The signer commitment.
|
|
210
|
+
*/
|
|
211
|
+
circuit signerCommitment(pk: Secp256k1Point): Bytes<32> {
|
|
212
|
+
return calculateSignerId(pk, _instanceSalt);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @description Computes a signer commitment from a secp256k1 public key,
|
|
217
|
+
* as `persistentHash(pkX, pkY, salt, "Secp256k1EcdsaMultisig:signer")`.
|
|
218
|
+
*
|
|
219
|
+
* Pure, so the deployer can derive constructor commitments off-chain the
|
|
220
|
+
* same way the circuits derive them in-circuit.
|
|
221
|
+
*
|
|
222
|
+
* Requirements:
|
|
223
|
+
*
|
|
224
|
+
* - `pk` must not be the secp256k1 identity point, which has no coordinates.
|
|
225
|
+
*
|
|
226
|
+
* @param {Secp256k1Point} pk - The secp256k1 public key.
|
|
227
|
+
* @param {Bytes<32>} salt - The instance salt.
|
|
228
|
+
* @returns {Bytes<32>} The signer commitment.
|
|
229
|
+
*/
|
|
230
|
+
export pure circuit calculateSignerId(
|
|
231
|
+
pk: Secp256k1Point,
|
|
232
|
+
salt: Bytes<32>
|
|
233
|
+
): Bytes<32> {
|
|
234
|
+
return persistentHash<SignerCommitmentInput>(SignerCommitmentInput {
|
|
235
|
+
pkX: secp256k1PointX(pk) as Bytes<32>,
|
|
236
|
+
pkY: secp256k1PointY(pk) as Bytes<32>,
|
|
237
|
+
salt: salt,
|
|
238
|
+
domain: pad(32, "Secp256k1EcdsaMultisig:signer")
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @description Returns the number of registered signers.
|
|
244
|
+
*
|
|
245
|
+
* @constraints k=6, rows=34 (zkir-v3)
|
|
246
|
+
*
|
|
247
|
+
* @returns {Uint<8>} The signer count.
|
|
248
|
+
*/
|
|
249
|
+
export circuit getSignerCount(): Uint<8> {
|
|
250
|
+
return Signer_getSignerCount();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @description Returns the approval threshold.
|
|
255
|
+
*
|
|
256
|
+
* @constraints k=6, rows=34 (zkir-v3)
|
|
257
|
+
*
|
|
258
|
+
* @returns {Uint<8>} The threshold.
|
|
259
|
+
*/
|
|
260
|
+
export circuit getThreshold(): Uint<8> {
|
|
261
|
+
return Signer_getThreshold();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @description Returns whether the given commitment is a registered signer.
|
|
266
|
+
*
|
|
267
|
+
* @constraints k=8, rows=129 (zkir-v3)
|
|
268
|
+
*
|
|
269
|
+
* @param {Bytes<32>} commitment - The signer commitment to check.
|
|
270
|
+
* @returns {Boolean} True if registered.
|
|
271
|
+
*/
|
|
272
|
+
export circuit isSigner(commitment: Bytes<32>): Boolean {
|
|
273
|
+
return Signer_isSigner(commitment);
|
|
274
|
+
}
|
|
275
|
+
}
|
package/multisig/Signer.compact
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0-alpha.
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (multisig/examples/ForwarderPrivateExample.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0-alpha.
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (multisig/examples/ForwarderShieldedExample.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0-alpha.
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (multisig/examples/ForwarderUnshieldedExample.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0-alpha.
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (multisig/examples/NativeShieldedTokenIssuerExample.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ pragma language_version >= 0.26.0;
|
|
|
19
19
|
|
|
20
20
|
import CompactStandardLibrary;
|
|
21
21
|
|
|
22
|
-
import "../presets/NativeShieldedTokenIssuer" prefix NativeShieldedTokenIssuer_;
|
|
22
|
+
import "../presets/NativeShieldedTokenIssuer"<2> prefix NativeShieldedTokenIssuer_;
|
|
23
23
|
|
|
24
24
|
export { ZswapCoinPublicKey, ContractAddress, Either, Maybe };
|
|
25
25
|
export { ShieldedCoinInfo, QualifiedShieldedCoinInfo };
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
_symbol,
|
|
40
40
|
_decimals,
|
|
41
41
|
_isInitialized,
|
|
42
|
-
} from "../presets/NativeShieldedTokenIssuer"
|
|
42
|
+
} from "../presets/NativeShieldedTokenIssuer"<2>;
|
|
43
43
|
export {
|
|
44
44
|
_counter,
|
|
45
45
|
_domainSeparator,
|
|
@@ -79,7 +79,7 @@ constructor(
|
|
|
79
79
|
decimals_: Uint<8>,
|
|
80
80
|
signerCommitments: Vector<3, Bytes<32>>,
|
|
81
81
|
) {
|
|
82
|
-
NativeShieldedTokenIssuer_initialize(
|
|
82
|
+
NativeShieldedTokenIssuer_initialize<3>(
|
|
83
83
|
instanceSalt,
|
|
84
84
|
tokenDomain,
|
|
85
85
|
name_,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0-alpha.
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0-alpha.6 (multisig/examples/ShieldedMultiSigV2Example.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -15,28 +15,26 @@ pragma language_version >= 0.26.0;
|
|
|
15
15
|
|
|
16
16
|
import CompactStandardLibrary;
|
|
17
17
|
|
|
18
|
-
import "../presets/ShieldedMultiSigV2" prefix ShieldedMultiSigV2_;
|
|
18
|
+
import "../presets/ShieldedMultiSigV2"<2> prefix ShieldedMultiSigV2_;
|
|
19
19
|
|
|
20
20
|
export { ShieldedCoinInfo, QualifiedShieldedCoinInfo, ShieldedSendResult };
|
|
21
21
|
|
|
22
22
|
// Surface the preset's domain separator unprefixed so `ledger()` readers see
|
|
23
23
|
// the key name the preset published.
|
|
24
|
-
import { _domainSeparator } from "../presets/ShieldedMultiSigV2"
|
|
24
|
+
import { _domainSeparator } from "../presets/ShieldedMultiSigV2"<2>;
|
|
25
25
|
export { _domainSeparator };
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @description Deploys the wallet with 3 signer commitments
|
|
28
|
+
* @description Deploys the wallet with 3 signer commitments.
|
|
29
29
|
*
|
|
30
30
|
* @param {Bytes<32>} instanceSalt - Random salt for commitment derivation.
|
|
31
31
|
* @param {Vector<3, Bytes<32>>} signerCommitments - Hashed signer identities.
|
|
32
|
-
* @param {Uint<8>} thresh - Approvals required. Must be 2.
|
|
33
32
|
*/
|
|
34
33
|
constructor(
|
|
35
34
|
instanceSalt: Bytes<32>,
|
|
36
|
-
signerCommitments: Vector<3, Bytes<32
|
|
37
|
-
thresh: Uint<8>,
|
|
35
|
+
signerCommitments: Vector<3, Bytes<32>>
|
|
38
36
|
) {
|
|
39
|
-
ShieldedMultiSigV2_initialize(instanceSalt, signerCommitments
|
|
37
|
+
ShieldedMultiSigV2_initialize<3>(instanceSalt, signerCommitments);
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
export circuit deposit(coin: ShieldedCoinInfo): [] {
|