@openzeppelin/compact-contracts 0.4.0-alpha.1 → 0.4.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.
Files changed (46) hide show
  1. package/README.md +9 -5
  2. package/access/AccessControl.compact +13 -13
  3. package/access/Ownable.compact +15 -9
  4. package/access/ShieldedAccessControl.compact +25 -1
  5. package/access/ZOwnablePK.compact +8 -8
  6. package/crypto/EcdhMask.compact +1 -1
  7. package/crypto/Ecdsa.compact +4 -4
  8. package/crypto/Eip712.compact +168 -0
  9. package/crypto/ElGamal.compact +1 -1
  10. package/multisig/EcdsaSignerManager.compact +32 -15
  11. package/multisig/ForwarderPrivate.compact +11 -5
  12. package/multisig/ForwarderShielded.compact +2 -2
  13. package/multisig/ForwarderUnshielded.compact +2 -2
  14. package/multisig/ProposalManager.compact +194 -22
  15. package/multisig/ShieldedTreasury.compact +28 -1
  16. package/multisig/ShieldedTreasuryStateless.compact +1 -1
  17. package/multisig/Signer.compact +27 -79
  18. package/multisig/UnshieldedTreasury.compact +9 -1
  19. package/multisig/{presets/forwarder/ForwarderPrivate.compact → examples/ForwarderPrivateExample.compact} +3 -3
  20. package/multisig/{presets/forwarder/ForwarderShielded.compact → examples/ForwarderShieldedExample.compact} +3 -3
  21. package/multisig/{presets/forwarder/ForwarderUnshielded.compact → examples/ForwarderUnshieldedExample.compact} +3 -3
  22. package/multisig/examples/NativeShieldedTokenIssuerExample.compact +143 -0
  23. package/multisig/examples/ShieldedMultiSigV2Example.compact +77 -0
  24. package/multisig/presets/NativeShieldedTokenIssuer.compact +542 -0
  25. package/multisig/presets/ShieldedMultiSigV2.compact +251 -188
  26. package/package.json +15 -11
  27. package/security/Allowlist.compact +5 -5
  28. package/security/Blocklist.compact +5 -5
  29. package/security/Initializable.compact +8 -4
  30. package/security/Pausable.compact +10 -6
  31. package/token/ConfidentialFungibleToken.compact +80 -21
  32. package/token/FungibleToken.compact +35 -21
  33. package/token/MultiToken.compact +15 -15
  34. package/token/NativeShieldedToken.compact +9 -9
  35. package/token/NativeShieldedTokenCore.compact +19 -9
  36. package/token/NativeShieldedTokenFamily.compact +9 -9
  37. package/token/NonFungibleToken.compact +32 -27
  38. package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +11 -6
  39. package/token/extensions/NativeShieldedTokenDerivedNonce.compact +2 -2
  40. package/token/extensions/NativeShieldedTokenFamilyPublicSupply.compact +5 -5
  41. package/token/extensions/NativeShieldedTokenPublicSupply.compact +5 -5
  42. package/token/extensions/NativeShieldedTokenPublicSupplyCore.compact +5 -5
  43. package/utils/EvmAbi.compact +134 -0
  44. package/utils/Utils.compact +1 -1
  45. package/multisig/presets/ShieldedMultiSig.compact +0 -227
  46. package/multisig/presets/ShieldedMultiSigV3.compact +0 -311
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (security/Pausable.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (security/Pausable.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -12,12 +12,16 @@ pragma language_version >= 0.26.0;
12
12
  module Pausable {
13
13
  import CompactStandardLibrary;
14
14
 
15
+ /**
16
+ * @description Whether the contract is paused. Consuming contracts gate
17
+ * state-changing circuits on it via `assertPaused` / `assertNotPaused`.
18
+ */
15
19
  export ledger _isPaused: Boolean;
16
20
 
17
21
  /**
18
22
  * @description Returns true if the contract is paused, and false otherwise.
19
23
  *
20
- * @circuitInfo k=10, rows=32
24
+ * @constraints k=6, rows=24
21
25
  *
22
26
  * @return {Boolean} True if paused.
23
27
  */
@@ -28,7 +32,7 @@ module Pausable {
28
32
  /**
29
33
  * @description Makes a circuit only callable when the contract is paused.
30
34
  *
31
- * @circuitInfo k=10, rows=31
35
+ * @constraints k=6, rows=25
32
36
  *
33
37
  * Requirements:
34
38
  *
@@ -43,7 +47,7 @@ module Pausable {
43
47
  /**
44
48
  * @description Makes a circuit only callable when the contract is not paused.
45
49
  *
46
- * @circuitInfo k=10, rows=35
50
+ * @constraints k=6, rows=28
47
51
  *
48
52
  * Requirements:
49
53
  *
@@ -58,7 +62,7 @@ module Pausable {
58
62
  /**
59
63
  * @description Triggers a stopped state.
60
64
  *
61
- * @circuitInfo k=10, rows=38
65
+ * @constraints k=6, rows=28
62
66
  *
63
67
  * Requirements:
64
68
  *
@@ -74,7 +78,7 @@ module Pausable {
74
78
  /**
75
79
  * @description Lifts the pause on the contract.
76
80
  *
77
- * @circuitInfo k=10, rows=34
81
+ * @constraints k=6, rows=25
78
82
  *
79
83
  * Requirements:
80
84
  *
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/ConfidentialFungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/ConfidentialFungibleToken.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -258,22 +258,81 @@ module ConfidentialFungibleToken {
258
258
  // Ledger state
259
259
  // ---------------------------------------------------------------------------
260
260
 
261
- // Dual-balance grief fix. `_balances` is the SPENDABLE (confirmed) balance that
262
- // debits draw from; `_pending` is the incoming pool that credits land in. Only
263
- // the owner moves pending -> spendable, via `sweep()`. So a third party spamming
264
- // dust credits cannot churn a victim's spendable ciphertext and invalidate the
265
- // victim's in-flight spend proofs (a liveness grief). A wallet's total balance
266
- // is `balanceOf` (spendable) + `pendingOf` (pending).
261
+ /**
262
+ * @description Spendable (confirmed) balances, encrypted under each account's
263
+ * ElGamal key. Debits draw from here. Paired with `_pending`: only the owner
264
+ * moves pending into spendable, via `sweep()`, so a third party spamming dust
265
+ * credits cannot churn a victim's spendable ciphertext and invalidate their
266
+ * in-flight spend proofs. A wallet's total is `balanceOf` + `pendingOf`.
267
+ * @type {Bytes<32>} accountId - The account identifier.
268
+ * @type {ElGamal_Ciphertext} balance - The encrypted spendable balance.
269
+ * @type {Map<accountId, balance>}
270
+ * @type {Map<Bytes<32>, ElGamal_Ciphertext>} _balances
271
+ */
267
272
  export ledger _balances: Map<Bytes<32>, ElGamal_Ciphertext>;
273
+
274
+ /**
275
+ * @description Incoming (unconfirmed) balances, encrypted under each account's
276
+ * ElGamal key. Credits land here rather than in `_balances`; the owner moves
277
+ * them across with `sweep()`.
278
+ * @type {Bytes<32>} accountId - The account identifier.
279
+ * @type {ElGamal_Ciphertext} pending - The encrypted pending balance.
280
+ * @type {Map<accountId, pending>}
281
+ * @type {Map<Bytes<32>, ElGamal_Ciphertext>} _pending
282
+ */
268
283
  export ledger _pending: Map<Bytes<32>, ElGamal_Ciphertext>;
284
+
285
+ /**
286
+ * @description Registered ElGamal encryption keys, one per account.
287
+ * Registration is one-shot: a second registration for the same account is
288
+ * rejected.
289
+ * @type {Bytes<32>} accountId - The account identifier.
290
+ * @type {JubjubPoint} encryptionKey - The account's ElGamal public key.
291
+ * @type {Map<accountId, encryptionKey>}
292
+ * @type {Map<Bytes<32>, JubjubPoint>} _encryptionKeys
293
+ */
269
294
  export ledger _encryptionKeys: Map<Bytes<32>, JubjubPoint>;
295
+
296
+ /**
297
+ * @description Per-account memo inbox. A credit pushes a masked memo the
298
+ * recipient decrypts off-chain; `pushFront` means newest first.
299
+ * @type {Bytes<32>} accountId - The recipient's identifier.
300
+ * @type {List<EcdhMask_Ciphertext>} memos - The recipient's memos.
301
+ * @type {Map<accountId, memos>}
302
+ * @type {Map<Bytes<32>, List<EcdhMask_Ciphertext>>} _memos
303
+ */
270
304
  export ledger _memos: Map<Bytes<32>, List<EcdhMask_Ciphertext>>;
305
+
306
+ /**
307
+ * @description Escrowed allowances, keyed by owner then spender. Membership is
308
+ * checked independently of the entry, so an allowance that was never escrowed
309
+ * is unspendable.
310
+ * @type {Bytes<32>} owner - The account that escrowed the allowance.
311
+ * @type {Bytes<32>} spender - The account allowed to spend it.
312
+ * @type {EscrowEntry} entry - The escrowed allowance.
313
+ * @type {Map<owner, Map<spender, entry>>}
314
+ * @type {Map<Bytes<32>, Map<Bytes<32>, EscrowEntry>>} _escrow
315
+ */
271
316
  export ledger _escrow: Map<Bytes<32>, Map<Bytes<32>, EscrowEntry>>;
272
317
 
318
+ /**
319
+ * @description Whether `initialize` has run. Guards against re-initialization
320
+ * and against use before initialization.
321
+ */
273
322
  export ledger _isInitialized: Boolean;
274
323
 
324
+ /**
325
+ * @description The token's human-readable name, set once at construction.
326
+ */
275
327
  export sealed ledger _name: Opaque<"string">;
328
+ /**
329
+ * @description The token's ticker symbol, set once at construction.
330
+ */
276
331
  export sealed ledger _symbol: Opaque<"string">;
332
+ /**
333
+ * @description The number of decimals used to display balances, set once at
334
+ * construction. Purely presentational; no circuit scales by it.
335
+ */
277
336
  export sealed ledger _decimals: Uint<8>;
278
337
 
279
338
 
@@ -390,7 +449,7 @@ module ConfidentialFungibleToken {
390
449
  * ciphertext if the account is unregistered. The amount is encrypted; only the
391
450
  * account (or an authorized viewer) can decrypt it.
392
451
  *
393
- * @circuitInfo k=10, rows=989
452
+ * @constraints k=10, rows=984
394
453
  *
395
454
  * Requirements:
396
455
  *
@@ -416,7 +475,7 @@ module ConfidentialFungibleToken {
416
475
  * balance is `balanceOf`; a wallet's total is the sum of the two. See the
417
476
  * dual-balance note on the ledger declarations.
418
477
  *
419
- * @circuitInfo k=10, rows=986
478
+ * @constraints k=10, rows=981
420
479
  *
421
480
  * Requirements:
422
481
  *
@@ -447,7 +506,7 @@ module ConfidentialFungibleToken {
447
506
  * getter grants nothing, the spend path (`transferFrom`/`burnFrom`) gates on
448
507
  * `_escrow` membership independently, so a non-existent allowance is unspendable.
449
508
  *
450
- * @circuitInfo k=10, rows=938
509
+ * @constraints k=10, rows=936
451
510
  *
452
511
  * @param {Bytes<32>} owner - The account that granted the allowance.
453
512
  * @param {Bytes<32>} spender - The approved spender.
@@ -473,7 +532,7 @@ module ConfidentialFungibleToken {
473
532
  /**
474
533
  * @description Returns whether `account` has registered an encryption key.
475
534
  *
476
- * @circuitInfo k=9, rows=305
535
+ * @constraints k=9, rows=303
477
536
  *
478
537
  * @param {Bytes<32>} account - The account to query.
479
538
  * @return {Boolean} - True if `account` is registered.
@@ -491,7 +550,7 @@ module ConfidentialFungibleToken {
491
550
  * `wit_ConfidentialTokenEK` and initializes their balance to an encryption of
492
551
  * zero. Registration is a prerequisite for sending or receiving.
493
552
  *
494
- * @circuitInfo k=13, rows=6203
553
+ * @constraints k=13, rows=6157
495
554
  *
496
555
  * @notice Returns the caller's `accountId`. A composing contract can gate on
497
556
  * the returned value (e.g. assert it is KYC-approved) to restrict who may
@@ -693,7 +752,7 @@ module ConfidentialFungibleToken {
693
752
  * `extensions/ConfidentialFungibleTokenPublicSupply`) if the deployment tracks
694
753
  * `totalSupply`.
695
754
  *
696
- * @circuitInfo k=15, rows=27142
755
+ * @constraints k=15, rows=26925
697
756
  *
698
757
  * Requirements:
699
758
  *
@@ -716,7 +775,7 @@ module ConfidentialFungibleToken {
716
775
  * `extensions/ConfidentialFungibleTokenPublicSupply`) if the deployment tracks
717
776
  * `totalSupply`.
718
777
  *
719
- * @circuitInfo k=14, rows=14673
778
+ * @constraints k=14, rows=12860
720
779
  *
721
780
  * Requirements:
722
781
  *
@@ -740,7 +799,7 @@ module ConfidentialFungibleToken {
740
799
  * credits `to`, and pushes an encrypted memo to `to`. The amount is hidden;
741
800
  * the (sender, recipient) pair is public.
742
801
  *
743
- * @circuitInfo k=16, rows=41617
802
+ * @constraints k=16, rows=39561
744
803
  *
745
804
  * @notice Returns the caller's (sender's) `accountId` for caller-side gating.
746
805
  * The sender is derived from the same authentication `_debit` performs, so the
@@ -778,7 +837,7 @@ module ConfidentialFungibleToken {
778
837
  * operations (`mint`/`burn`) live in a separate layer outside this conserving
779
838
  * surface, and only they may break conservation.
780
839
  *
781
- * @circuitInfo k=16, rows=41606
840
+ * @constraints k=16, rows=39550
782
841
  *
783
842
  * @notice Like `transfer`, the credit lands in the recipient's pending pool
784
843
  * (see the dual-balance note); the caller sweeps their own incoming value.
@@ -819,7 +878,7 @@ module ConfidentialFungibleToken {
819
878
  * change, which is what would otherwise invalidate the victim's in-flight spend
820
879
  * proofs (a liveness grief).
821
880
  *
822
- * @circuitInfo k=13, rows=2879
881
+ * @constraints k=13, rows=2860
823
882
  *
824
883
  * @notice Purely homomorphic: adds the two ciphertexts (same key) and resets
825
884
  * pending to Enc(0). No plaintext is needed; the wallet already learned the
@@ -852,7 +911,7 @@ module ConfidentialFungibleToken {
852
911
  * refunds any prior escrow, so allowances replace rather than stack. The cap
853
912
  * is not public.
854
913
  *
855
- * @circuitInfo k=16, rows=43067
914
+ * @constraints k=16, rows=40913
856
915
  *
857
916
  * @notice Returns the caller's (approver's) `accountId` for caller-side gating.
858
917
  *
@@ -936,7 +995,7 @@ module ConfidentialFungibleToken {
936
995
  * caller via `approve`) and credits it to `to`, reducing both escrow copies by
937
996
  * `value`. The amount is hidden.
938
997
  *
939
- * @circuitInfo k=16, rows=63207
998
+ * @constraints k=16, rows=59844
940
999
  *
941
1000
  * @notice Returns the caller's (spender's) `accountId` for caller-side gating.
942
1001
  *
@@ -976,7 +1035,7 @@ module ConfidentialFungibleToken {
976
1035
  * @description Clears the caller's memo list, letting a wallet that has folded
977
1036
  * its memos into its local balance cache prune on-chain memo storage.
978
1037
  *
979
- * @circuitInfo k=13, rows=2316
1038
+ * @constraints k=13, rows=2308
980
1039
  *
981
1040
  * @warning Clearing memos is destructive and can permanently lock funds. The
982
1041
  * on-chain balance ciphertext is not directly decryptable (discrete-log
@@ -1119,7 +1178,7 @@ module ConfidentialFungibleToken {
1119
1178
  * recipient credit. The building block for a composing contract's
1120
1179
  * `burnFrom`; it performs no supply accounting (see `_burn`).
1121
1180
  *
1122
- * @circuitInfo k=16, rows=36274
1181
+ * @constraints k=16, rows=33128
1123
1182
  *
1124
1183
  * Requirements:
1125
1184
  *
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/FungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/FungibleToken.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -93,10 +93,24 @@ module FungibleToken {
93
93
  export ledger _allowances: Map<Either<Bytes<32>, ContractAddress>,
94
94
  Map<Either<Bytes<32>, ContractAddress>, Uint<128>>>;
95
95
 
96
+ /**
97
+ * @description Total tokens in circulation. `_update` raises it on a mint and
98
+ * lowers it on a burn, rejecting an increase that would overflow `Uint<128>`.
99
+ */
96
100
  export ledger _totalSupply: Uint<128>;
97
101
 
102
+ /**
103
+ * @description The token's human-readable name, set once at construction.
104
+ */
98
105
  export sealed ledger _name: Opaque<"string">;
106
+ /**
107
+ * @description The token's ticker symbol, set once at construction.
108
+ */
99
109
  export sealed ledger _symbol: Opaque<"string">;
110
+ /**
111
+ * @description The number of decimals used to display balances, set once at
112
+ * construction. Purely presentational; no circuit scales by it.
113
+ */
100
114
  export sealed ledger _decimals: Uint<8>;
101
115
 
102
116
 
@@ -116,7 +130,7 @@ module FungibleToken {
116
130
  * @dev This MUST be called in the implementing contract's constructor. Failure to do so
117
131
  * can lead to an irreparable contract.
118
132
  *
119
- * @circuitInfo k=10, rows=71
133
+ * @constraints k=10, rows=71
120
134
  *
121
135
  * @param {Opaque<"string">} name_ - The name of the token.
122
136
  * @param {Opaque<"string">} symbol_ - The symbol of the token.
@@ -164,7 +178,7 @@ module FungibleToken {
164
178
  /**
165
179
  * @description Returns the token name.
166
180
  *
167
- * @circuitInfo k=6, rows=28
181
+ * @constraints k=6, rows=26
168
182
  *
169
183
  * Requirements:
170
184
  *
@@ -180,7 +194,7 @@ module FungibleToken {
180
194
  /**
181
195
  * @description Returns the symbol of the token.
182
196
  *
183
- * @circuitInfo k=6, rows=28
197
+ * @constraints k=6, rows=26
184
198
  *
185
199
  * Requirements:
186
200
  *
@@ -196,7 +210,7 @@ module FungibleToken {
196
210
  /**
197
211
  * @description Returns the number of decimals used to get its user representation.
198
212
  *
199
- * @circuitInfo k=6, rows=28
213
+ * @constraints k=6, rows=26
200
214
  *
201
215
  * Requirements:
202
216
  *
@@ -212,7 +226,7 @@ module FungibleToken {
212
226
  /**
213
227
  * @description Returns the value of tokens in existence.
214
228
  *
215
- * @circuitInfo k=6, rows=28
229
+ * @constraints k=6, rows=26
216
230
  *
217
231
  * Requirements:
218
232
  *
@@ -228,7 +242,7 @@ module FungibleToken {
228
242
  /**
229
243
  * @description Returns the value of tokens owned by `account`.
230
244
  *
231
- * @circuitInfo k=10, rows=673
245
+ * @constraints k=10, rows=668
232
246
  *
233
247
  * @dev Manually checks if `account` is a key in the map and returns 0 if it is not.
234
248
  *
@@ -253,7 +267,7 @@ module FungibleToken {
253
267
  /**
254
268
  * @description Moves a `value` amount of tokens from the caller's account to `to`.
255
269
  *
256
- * @circuitInfo k=13, rows=3985
270
+ * @constraints k=13, rows=3743
257
271
  *
258
272
  * @notice Transfers to contract addresses are currently disallowed until contract-to-contract
259
273
  * interactions are supported in Compact. This restriction prevents assets from
@@ -284,7 +298,7 @@ module FungibleToken {
284
298
  /**
285
299
  * @description Unsafe variant of `transfer` which allows transfers to contract addresses.
286
300
  *
287
- * @circuitInfo k=13, rows=3982
301
+ * @constraints k=13, rows=3740
288
302
  *
289
303
  * @warning Transfers to contract addresses are considered unsafe because contract-to-contract
290
304
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
@@ -314,7 +328,7 @@ module FungibleToken {
314
328
  * @description Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner`
315
329
  * through `transferFrom`. This value changes when `approve` or `transferFrom` are called.
316
330
  *
317
- * @circuitInfo k=11, rows=1346
331
+ * @constraints k=11, rows=1350
318
332
  *
319
333
  * @dev Manually checks if `owner` and `spender` are keys in the map and returns 0 if they are not.
320
334
  *
@@ -344,7 +358,7 @@ module FungibleToken {
344
358
  /**
345
359
  * @description Sets a `value` amount of tokens as allowance of `spender` over the caller's tokens.
346
360
  *
347
- * @circuitInfo k=13, rows=3072
361
+ * @constraints k=13, rows=3066
348
362
  *
349
363
  * Requirements:
350
364
  *
@@ -369,7 +383,7 @@ module FungibleToken {
369
383
  * @description Moves `value` tokens from `fromAddress` to `to` using the allowance mechanism.
370
384
  * `value` is the deducted from the caller's allowance.
371
385
  *
372
- * @circuitInfo k=13, rows=4960
386
+ * @constraints k=13, rows=4906
373
387
  *
374
388
  * @notice Transfers to contract addresses are currently disallowed until contract-to-contract
375
389
  * interactions are supported in Compact. This restriction prevents assets from
@@ -403,7 +417,7 @@ module FungibleToken {
403
417
  /**
404
418
  * @description Unsafe variant of `transferFrom` which allows transfers to contract addresses.
405
419
  *
406
- * @circuitInfo k=13, rows=4957
420
+ * @constraints k=13, rows=4903
407
421
  *
408
422
  * @warning Transfers to contract addresses are considered unsafe because contract-to-contract
409
423
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
@@ -440,7 +454,7 @@ module FungibleToken {
440
454
  * This circuit is equivalent to {transfer}, and can be used to
441
455
  * e.g. implement automatic token fees, slashing mechanisms, etc.
442
456
  *
443
- * @circuitInfo k=12, rows=2345
457
+ * @constraints k=12, rows=2125
444
458
  *
445
459
  * @notice Transfers to contract addresses are currently disallowed until contract-to-contract
446
460
  * interactions are supported in Compact. This restriction prevents assets from
@@ -473,7 +487,7 @@ module FungibleToken {
473
487
  /**
474
488
  * @description Unsafe variant of `transferFrom` which allows transfers to contract addresses.
475
489
  *
476
- * @circuitInfo k=12, rows=2342
490
+ * @constraints k=12, rows=2122
477
491
  *
478
492
  * @warning Transfers to contract addresses are considered unsafe because contract-to-contract
479
493
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
@@ -507,7 +521,7 @@ module FungibleToken {
507
521
  * (or `to`) is the zero address.
508
522
  * @dev Checks for a mint overflow in order to output a more readable error message.
509
523
  *
510
- * @circuitInfo k=11, rows=1305
524
+ * @constraints k=11, rows=1305
511
525
  *
512
526
  * Requirements:
513
527
  *
@@ -551,7 +565,7 @@ module FungibleToken {
551
565
  * @description Creates a `value` amount of tokens and assigns them to `account`,
552
566
  * by transferring it from the zero address. Relies on the `update` mechanism.
553
567
  *
554
- * @circuitInfo k=11, rows=1437
568
+ * @constraints k=11, rows=1328
555
569
  *
556
570
  * @notice Transfers to contract addresses are currently disallowed until contract-to-contract
557
571
  * interactions are supported in Compact. This restriction prevents assets from
@@ -577,7 +591,7 @@ module FungibleToken {
577
591
  /**
578
592
  * @description Unsafe variant of `_mint` which allows transfers to contract addresses.
579
593
  *
580
- * @circuitInfo k=11, rows=1434
594
+ * @constraints k=11, rows=1325
581
595
  *
582
596
  * @warning Transfers to contract addresses are considered unsafe because contract-to-contract
583
597
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
@@ -605,7 +619,7 @@ module FungibleToken {
605
619
  * @description Destroys a `value` amount of tokens from `account`, lowering the total supply.
606
620
  * Relies on the `_update` mechanism.
607
621
  *
608
- * @circuitInfo k=11, rows=1377
622
+ * @constraints k=11, rows=1268
609
623
  *
610
624
  * Requirements:
611
625
  *
@@ -628,7 +642,7 @@ module FungibleToken {
628
642
  * This circuit is equivalent to `approve`, and can be used to
629
643
  * e.g. set automatic allowances for certain subsystems, etc.
630
644
  *
631
- * @circuitInfo k=11, rows=1406
645
+ * @constraints k=11, rows=1407
632
646
  *
633
647
  * Requirements:
634
648
  *
@@ -667,7 +681,7 @@ module FungibleToken {
667
681
  * @description Updates `owner`'s allowance for `spender` based on spent `value`.
668
682
  * Does not update the allowance value in case of infinite allowance.
669
683
  *
670
- * @circuitInfo k=11, rows=1729
684
+ * @constraints k=11, rows=1935
671
685
  *
672
686
  * Requirements:
673
687
  *
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/MultiToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/MultiToken.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -176,7 +176,7 @@ module MultiToken {
176
176
  /**
177
177
  * @description Initializes the contract by setting the base URI for all tokens.
178
178
  *
179
- * @circuitInfo k=6, rows=33
179
+ * @constraints k=6, rows=31
180
180
  *
181
181
  * Requirements:
182
182
  *
@@ -224,7 +224,7 @@ module MultiToken {
224
224
  * Clients calling this function must replace the `\{id\}` substring with the
225
225
  * actual token type ID.
226
226
  *
227
- * @circuitInfo k=8, rows=176
227
+ * @constraints k=8, rows=176
228
228
  *
229
229
  * Requirements:
230
230
  *
@@ -241,7 +241,7 @@ module MultiToken {
241
241
  /**
242
242
  * @description Returns the amount of `id` tokens owned by `account`.
243
243
  *
244
- * @circuitInfo k=10, rows=875
244
+ * @constraints k=10, rows=867
245
245
  *
246
246
  * Requirements:
247
247
  *
@@ -270,7 +270,7 @@ module MultiToken {
270
270
  * In the case of an external (non-contract) caller, the caller's identity is derived from the `wit_MultiTokenSK`
271
271
  * witness as `persistentHash(secretKey)`.
272
272
  *
273
- * @circuitInfo k=13, rows=2944
273
+ * @constraints k=13, rows=2938
274
274
  *
275
275
  * Requirements:
276
276
  *
@@ -295,7 +295,7 @@ module MultiToken {
295
295
  /**
296
296
  * @description Queries if `operator` is an authorized operator for `account`.
297
297
  *
298
- * @circuitInfo k=11, rows=1343
298
+ * @constraints k=11, rows=1347
299
299
  *
300
300
  * Requirements:
301
301
  *
@@ -332,7 +332,7 @@ module MultiToken {
332
332
  * interactions are supported in Compact. This restriction prevents assets from
333
333
  * being inadvertently locked in contracts that cannot currently handle token receipt.
334
334
  *
335
- * @circuitInfo k=13, rows=4926
335
+ * @constraints k=13, rows=4833
336
336
  *
337
337
  * Requirements:
338
338
  *
@@ -369,7 +369,7 @@ module MultiToken {
369
369
  * interactions are supported in Compact. This restriction prevents assets from
370
370
  * being inadvertently locked in contracts that cannot currently handle token receipt.
371
371
  *
372
- * @circuitInfo k=12, rows=2450
372
+ * @constraints k=12, rows=2381
373
373
  *
374
374
  * Requirements:
375
375
  *
@@ -462,7 +462,7 @@ module MultiToken {
462
462
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
463
463
  * Once contract-to-contract calls are supported, this circuit may be deprecated.
464
464
  *
465
- * @circuitInfo k=13, rows=4925
465
+ * @constraints k=13, rows=4832
466
466
  *
467
467
  * Requirements:
468
468
  *
@@ -504,7 +504,7 @@ module MultiToken {
504
504
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
505
505
  * Once contract-to-contract calls are supported, this circuit may be deprecated.
506
506
  *
507
- * @circuitInfo k=12, rows=2449
507
+ * @constraints k=12, rows=2380
508
508
  *
509
509
  * Requirements:
510
510
  *
@@ -546,7 +546,7 @@ module MultiToken {
546
546
  * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
547
547
  * for token type ID 0x4cce0.
548
548
  *
549
- * @circuitInfo k=6, rows=28
549
+ * @constraints k=6, rows=26
550
550
  *
551
551
  * Requirements:
552
552
  *
@@ -567,7 +567,7 @@ module MultiToken {
567
567
  * interactions are supported in Compact. This restriction prevents assets from
568
568
  * being inadvertently locked in contracts that cannot currently handle token receipt.
569
569
  *
570
- * @circuitInfo k=11, rows=1531
570
+ * @constraints k=11, rows=1449
571
571
  *
572
572
  * Requirements:
573
573
  *
@@ -596,7 +596,7 @@ module MultiToken {
596
596
  * calls are not currently supported. Tokens sent to a contract address may become irretrievable.
597
597
  * Once contract-to-contract calls are supported, this circuit may be deprecated.
598
598
  *
599
- * @circuitInfo k=11, rows=1530
599
+ * @constraints k=11, rows=1448
600
600
  *
601
601
  * Requirements:
602
602
  *
@@ -621,7 +621,7 @@ module MultiToken {
621
621
  /**
622
622
  * @description Destroys a `value` amount of tokens of type `id` from `fromAddress`.
623
623
  *
624
- * @circuitInfo k=11, rows=1222
624
+ * @constraints k=11, rows=1275
625
625
  *
626
626
  * Requirements:
627
627
  *
@@ -649,7 +649,7 @@ module MultiToken {
649
649
  * @notice This circuit does not check for access permissions but can be useful as a building block
650
650
  * for more complex contract logic.
651
651
  *
652
- * @circuitInfo k=11, rows=1279
652
+ * @constraints k=11, rows=1280
653
653
  *
654
654
  * Requirements:
655
655
  *
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/NativeShieldedToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/NativeShieldedToken.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -106,7 +106,7 @@ module NativeShieldedToken {
106
106
  /**
107
107
  * @description Returns whether the contract has been initialized.
108
108
  *
109
- * @circuitInfo k=6, rows=26
109
+ * @constraints k=6, rows=24
110
110
  *
111
111
  * @return {Boolean} - True once `initialize` has run.
112
112
  */
@@ -117,7 +117,7 @@ module NativeShieldedToken {
117
117
  /**
118
118
  * @description Returns the token name.
119
119
  *
120
- * @circuitInfo k=6, rows=28
120
+ * @constraints k=6, rows=26
121
121
  *
122
122
  * Requirements:
123
123
  *
@@ -132,7 +132,7 @@ module NativeShieldedToken {
132
132
  /**
133
133
  * @description Returns the symbol of the token.
134
134
  *
135
- * @circuitInfo k=6, rows=28
135
+ * @constraints k=6, rows=26
136
136
  *
137
137
  * Requirements:
138
138
  *
@@ -147,7 +147,7 @@ module NativeShieldedToken {
147
147
  /**
148
148
  * @description Returns the number of decimals used to get its user representation.
149
149
  *
150
- * @circuitInfo k=6, rows=28
150
+ * @constraints k=6, rows=26
151
151
  *
152
152
  * Requirements:
153
153
  *
@@ -163,7 +163,7 @@ module NativeShieldedToken {
163
163
  * @description Returns this token's coin color:
164
164
  * `tokenType(_domain, kernel.self())`, computed at call time.
165
165
  *
166
- * @circuitInfo k=13, rows=3971
166
+ * @constraints k=13, rows=3962
167
167
  *
168
168
  * Requirements:
169
169
  *
@@ -190,7 +190,7 @@ module NativeShieldedToken {
190
190
  * recipient; callers SHOULD deliver it out of band. Wallets cannot detect
191
191
  * contract-minted coins by scanning the chain.
192
192
  *
193
- * @circuitInfo k=14, rows=10843
193
+ * @constraints k=14, rows=10820
194
194
  *
195
195
  * Requirements:
196
196
  *
@@ -229,7 +229,7 @@ module NativeShieldedToken {
229
229
  * `refundTo`; callers SHOULD deliver it out of band. Wallets cannot detect
230
230
  * contract-sent coins by scanning the chain.
231
231
  *
232
- * @circuitInfo k=16, rows=47656
232
+ * @constraints k=16, rows=47477
233
233
  *
234
234
  * Requirements:
235
235
  *
@@ -263,7 +263,7 @@ module NativeShieldedToken {
263
263
  * ledger state: the change replaces `coin` as the contract's holding, and
264
264
  * its info is not otherwise recoverable.
265
265
  *
266
- * @circuitInfo k=15, rows=23307
266
+ * @constraints k=15, rows=23208
267
267
  *
268
268
  * Requirements:
269
269
  *