@openzeppelin/compact-contracts 0.4.0-alpha.1 → 0.4.0-alpha.3

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 +44 -3
  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 +557 -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 +337 -79
  32. package/token/FungibleToken.compact +35 -21
  33. package/token/MultiToken.compact +15 -15
  34. package/token/NativeShieldedToken.compact +65 -16
  35. package/token/NativeShieldedTokenCore.compact +57 -15
  36. package/token/NativeShieldedTokenFamily.compact +66 -16
  37. package/token/NonFungibleToken.compact +83 -34
  38. package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +11 -6
  39. package/token/extensions/NativeShieldedTokenDerivedNonce.compact +2 -2
  40. package/token/extensions/NativeShieldedTokenFamilyPublicSupply.compact +7 -7
  41. package/token/extensions/NativeShieldedTokenPublicSupply.compact +7 -7
  42. package/token/extensions/NativeShieldedTokenPublicSupplyCore.compact +5 -5
  43. package/utils/EvmAbi.compact +134 -0
  44. package/utils/Utils.compact +11 -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 (token/NonFungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.3 (token/NonFungibleToken.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -58,7 +58,7 @@ pragma language_version >= 0.26.0;
58
58
  * or in ledger writes. Canonicalization zeroes out the inactive branch of the Either,
59
59
  * ensuring that two values with the same active branch always resolve to the same map key
60
60
  * regardless of what data the inactive branch carries. Write paths are canonicalized in
61
- * `_update` (for `_owners` and `_balances`), `_approve` (for `_tokenApprovals`), and
61
+ * `_update` (for `_owners` and `_balances`), `_unsafeApprove` (for `_tokenApprovals`), and
62
62
  * `_setApprovalForAll` (for `_operatorApprovals`). Read paths are canonicalized in
63
63
  * `balanceOf`, `isApprovedForAll`, and `_isAuthorized`.
64
64
  *
@@ -85,8 +85,13 @@ module NonFungibleToken {
85
85
  import CompactStandardLibrary;
86
86
  import "../utils/Utils" prefix Utils_;
87
87
 
88
- /// Public state
88
+ /**
89
+ * @description The token's human-readable name, set once at construction.
90
+ */
89
91
  export sealed ledger _name: Opaque<"string">;
92
+ /**
93
+ * @description The token's ticker symbol, set once at construction.
94
+ */
90
95
  export sealed ledger _symbol: Opaque<"string">;
91
96
 
92
97
  /**
@@ -160,7 +165,7 @@ module NonFungibleToken {
160
165
  * This MUST be called in the implementing contract's constructor.
161
166
  * Failure to do so can lead to an irreparable contract.
162
167
  *
163
- * @circuitInfo k=6, rows=52
168
+ * @constraints k=6, rows=52
164
169
  *
165
170
  * Requirements:
166
171
  *
@@ -206,7 +211,7 @@ module NonFungibleToken {
206
211
  /**
207
212
  * @description Returns the number of tokens in `owner`'s account.
208
213
  *
209
- * @circuitInfo k=10, rows=673
214
+ * @constraints k=10, rows=671
210
215
  *
211
216
  * Requirements:
212
217
  *
@@ -229,7 +234,7 @@ module NonFungibleToken {
229
234
  /**
230
235
  * @description Returns the owner of the `tokenId` token.
231
236
  *
232
- * @circuitInfo k=9, rows=333
237
+ * @constraints k=9, rows=331
233
238
  *
234
239
  * Requirements:
235
240
  *
@@ -247,7 +252,7 @@ module NonFungibleToken {
247
252
  /**
248
253
  * @description Returns the token name.
249
254
  *
250
- * @circuitInfo k=6, rows=28
255
+ * @constraints k=6, rows=26
251
256
  *
252
257
  * Requirements:
253
258
  *
@@ -263,7 +268,7 @@ module NonFungibleToken {
263
268
  /**
264
269
  * @description Returns the symbol of the token.
265
270
  *
266
- * @circuitInfo k=6, rows=28
271
+ * @constraints k=6, rows=26
267
272
  *
268
273
  * Requirements:
269
274
  *
@@ -280,7 +285,7 @@ module NonFungibleToken {
280
285
  * @description Returns the token URI for the given `tokenId`. Returns the empty
281
286
  * string if a tokenURI does not exist.
282
287
  *
283
- * @circuitInfo k=9, rows=326
288
+ * @constraints k=9, rows=324
284
289
  *
285
290
  * Requirements:
286
291
  *
@@ -309,7 +314,7 @@ module NonFungibleToken {
309
314
  /**
310
315
  * @description Sets the URI as `tokenURI` for the given `tokenId`.
311
316
  *
312
- * @circuitInfo k=9, rows=289
317
+ * @constraints k=9, rows=287
313
318
  *
314
319
  * Requirements:
315
320
  *
@@ -338,7 +343,7 @@ module NonFungibleToken {
338
343
  * In the case of an external (non-contract) caller, the caller's identity is derived from the `wit_NonFungibleTokenSK`
339
344
  * witness as `persistentHash(secretKey)`.
340
345
  *
341
- * @circuitInfo k=13, rows=3468
346
+ * @constraints k=13, rows=3406
342
347
  *
343
348
  * Requirements:
344
349
  *
@@ -359,7 +364,7 @@ module NonFungibleToken {
359
364
  /**
360
365
  * @description Returns the account approved for `tokenId` token.
361
366
  *
362
- * @circuitInfo k=9, rows=422
367
+ * @constraints k=9, rows=420
363
368
  *
364
369
  * Requirements:
365
370
  *
@@ -383,7 +388,7 @@ module NonFungibleToken {
383
388
  * In the case of an external (non-contract) caller, the caller's identity is derived from the `wit_NonFungibleTokenSK`
384
389
  * witness as `persistentHash(secretKey)`.
385
390
  *
386
- * @circuitInfo k=13, rows=2936
391
+ * @constraints k=13, rows=2938
387
392
  *
388
393
  * Requirements:
389
394
  *
@@ -406,7 +411,7 @@ module NonFungibleToken {
406
411
  /**
407
412
  * @description Returns if the `operator` is allowed to manage all of the assets of `owner`.
408
413
  *
409
- * @circuitInfo k=11, rows=1343
414
+ * @constraints k=11, rows=1341
410
415
  *
411
416
  * Requirements:
412
417
  *
@@ -439,7 +444,7 @@ module NonFungibleToken {
439
444
  * In the case of an external (non-contract) caller, the caller's identity is derived from the `wit_NonFungibleTokenSK`
440
445
  * witness as `persistentHash(secretKey)`.
441
446
  *
442
- * @circuitInfo k=13, rows=4800
447
+ * @constraints k=13, rows=4702
443
448
  *
444
449
  * Requirements:
445
450
  *
@@ -477,7 +482,7 @@ module NonFungibleToken {
477
482
  * are not currently supported. Tokens sent to a contract address may become irretrievable.
478
483
  * Once contract-to-contract calls are supported, this circuit may be deprecated.
479
484
  *
480
- * @circuitInfo k=13, rows=4797
485
+ * @constraints k=13, rows=4699
481
486
  *
482
487
  * Requirements:
483
488
  *
@@ -499,11 +504,14 @@ module NonFungibleToken {
499
504
  ): [] {
500
505
  assertInitialized();
501
506
  assert(!Utils_isTargetZero(to), "NonFungibleToken: invalid receiver");
502
- // Setting an "auth" argument enables the `_isAuthorized` check which verifies that the token exists
503
- // (fromAddress != 0). Therefore, it is not needed to verify that the return value is not 0 here.
504
507
  const auth = left<Bytes<32>, ContractAddress>(_computeAccountId());
505
508
  const previousOwner = _update(to, tokenId, auth);
506
509
 
510
+ // The `_isAuthorized` check inside `_update` already implies the token exists, but that
511
+ // holds only while approvals are never recorded for unminted tokens. Assert it directly
512
+ // so a misused `_unsafeApprove` cannot turn this circuit into an unauthorized mint.
513
+ assert(!Utils_isTargetZero(previousOwner), "NonFungibleToken: nonexistent token");
514
+
507
515
  const canonFrom = Utils_canonicalize<Bytes<32>, ContractAddress>(fromAddress);
508
516
  assert(previousOwner == canonFrom, "NonFungibleToken: incorrect owner");
509
517
  }
@@ -511,7 +519,7 @@ module NonFungibleToken {
511
519
  /**
512
520
  * @description Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist.
513
521
  *
514
- * @circuitInfo k=9, rows=308
522
+ * @constraints k=9, rows=306
515
523
  *
516
524
  * Requirements:
517
525
  *
@@ -532,7 +540,7 @@ module NonFungibleToken {
532
540
  /**
533
541
  * @description Returns the approved address for `tokenId`. Returns the zero value if `tokenId` is not minted.
534
542
  *
535
- * @circuitInfo k=9, rows=308
543
+ * @constraints k=9, rows=306
536
544
  *
537
545
  * Requirements:
538
546
  *
@@ -553,7 +561,7 @@ module NonFungibleToken {
553
561
  * @description Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
554
562
  * particular (ignoring whether it is owned by `owner`).
555
563
  *
556
- * @circuitInfo k=11, rows=1798
564
+ * @constraints k=11, rows=1796
557
565
  *
558
566
  * Requirements:
559
567
  *
@@ -585,7 +593,7 @@ module NonFungibleToken {
585
593
  /**
586
594
  * @description Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
587
595
  *
588
- * @circuitInfo k=11, rows=1804
596
+ * @constraints k=11, rows=1802
589
597
  *
590
598
  * Requirements:
591
599
  *
@@ -643,8 +651,8 @@ module NonFungibleToken {
643
651
 
644
652
  // Execute the update
645
653
  if (!Utils_isTargetZero(disclose(fromAddress))) {
646
- // Clear approval. No need to re-authorize
647
- _approve(Utils_zeroAccount(), tokenId, Utils_zeroAccount());
654
+ // Clear approval. No need to re-authorize or re-read the owner
655
+ _unsafeApprove(Utils_zeroAccount(), tokenId, Utils_zeroAccount(), false);
648
656
  const canonFrom = Utils_canonicalize<Bytes<32>, ContractAddress>(fromAddress);
649
657
  const newBalance = _balances.lookup(disclose(canonFrom)) - 1 as Uint<128>;
650
658
  _balances.insert(disclose(canonFrom), disclose(newBalance));
@@ -666,7 +674,7 @@ module NonFungibleToken {
666
674
  /**
667
675
  * @description Mints `tokenId` and transfers it to `to`.
668
676
  *
669
- * @circuitInfo k=11, rows=1473
677
+ * @constraints k=11, rows=1388
670
678
  *
671
679
  * Requirements:
672
680
  *
@@ -690,7 +698,7 @@ module NonFungibleToken {
690
698
  /**
691
699
  * @description Mints `tokenId` and transfers it to `to`. It does NOT check if the recipient is a ContractAddress.
692
700
  *
693
- * @circuitInfo k=11, rows=1470
701
+ * @constraints k=11, rows=1385
694
702
  *
695
703
  * Requirements:
696
704
  *
@@ -723,7 +731,7 @@ module NonFungibleToken {
723
731
  * The approval is cleared when the token is burned.
724
732
  * This circuit does not check if the sender is authorized to operate on the token.
725
733
  *
726
- * @circuitInfo k=10, rows=509
734
+ * @constraints k=10, rows=507
727
735
  *
728
736
  * Requirements:
729
737
  *
@@ -748,7 +756,7 @@ module NonFungibleToken {
748
756
  * interactions are supported in Compact. This restriction prevents assets from being inadvertently
749
757
  * locked in contracts that cannot currently handle token receipt.
750
758
  *
751
- * @circuitInfo k=12, rows=2067
759
+ * @constraints k=11, rows=1982
752
760
  *
753
761
  * Requirements:
754
762
  *
@@ -779,7 +787,7 @@ module NonFungibleToken {
779
787
  * As opposed to {_unsafeTransferFrom}, this imposes no restrictions on the caller's identity.
780
788
  * It does NOT check if the recipient is a ContractAddress.
781
789
  *
782
- * @circuitInfo k=12, rows=2064
790
+ * @constraints k=11, rows=1979
783
791
  *
784
792
  * Requirements:
785
793
  *
@@ -815,11 +823,12 @@ module NonFungibleToken {
815
823
  /**
816
824
  * @description Approve `to` to operate on `tokenId`.
817
825
  *
818
- * @circuitInfo k=11, rows=1810
826
+ * @constraints k=11, rows=1755
819
827
  *
820
828
  * Requirements:
821
829
  *
822
830
  * - The contract is initialized.
831
+ * - `tokenId` must exist.
823
832
  * - If `auth` is non 0, then this function will check that `auth` is either the owner of the token,
824
833
  * or approved to operate on the token (by the owner).
825
834
  *
@@ -833,6 +842,43 @@ module NonFungibleToken {
833
842
  tokenId: Uint<128>,
834
843
  auth: Either<Bytes<32>, ContractAddress>
835
844
  ): [] {
845
+ _unsafeApprove(to, tokenId, auth, true);
846
+ }
847
+
848
+ /**
849
+ * @description Approve `to` to operate on `tokenId`, requiring the token to exist
850
+ * only when `isExistenceRequired` is true.
851
+ *
852
+ * @constraints k=11, rows=1868
853
+ *
854
+ * @warning Passing false skips the check that `tokenId` was minted. Both
855
+ * `_unsafeTransferFrom` and `_update` read that invariant back, so a planted approval
856
+ * can mint a token nobody authorized or outlive a later mint. Pass false only where
857
+ * the owner has already been read, as `_update` does.
858
+ *
859
+ * @dev Counterpart to Solidity's `_approve(to, tokenId, auth, bool emitEvent)`, where
860
+ * the flag also suppresses the `Approval` event. Compact has no events, so it carries
861
+ * the existence check alone.
862
+ *
863
+ * Requirements:
864
+ *
865
+ * - The contract is initialized.
866
+ * - `tokenId` must exist, unless `isExistenceRequired` is false and `auth` is zero.
867
+ * - If `auth` is non 0, then this function will check that `auth` is either the owner of the token,
868
+ * or approved to operate on the token (by the owner).
869
+ *
870
+ * @param {Either<Bytes<32>, ContractAddress>} to - The target account to approve
871
+ * @param {Uint<128>} tokenId - The token to approve
872
+ * @param {Either<Bytes<32>, ContractAddress>} auth - An account authorized to operate on all tokens held by the owner of the token
873
+ * @param {Boolean} isExistenceRequired - Whether `tokenId` must exist
874
+ * @return {[]} - Empty tuple.
875
+ */
876
+ export circuit _unsafeApprove(
877
+ to: Either<Bytes<32>, ContractAddress>,
878
+ tokenId: Uint<128>,
879
+ auth: Either<Bytes<32>, ContractAddress>,
880
+ isExistenceRequired: Boolean
881
+ ): [] {
836
882
  assertInitialized();
837
883
  // Canonicalize + normalize `to`
838
884
  const canonTo = Utils_canonicalize<Bytes<32>, ContractAddress>(to);
@@ -841,11 +887,14 @@ module NonFungibleToken {
841
887
  // Canonicalize auth
842
888
  const canonAuth = Utils_canonicalize<Bytes<32>, ContractAddress>(auth);
843
889
 
844
- if (!Utils_isTargetZero(disclose(canonAuth))) {
890
+ // Avoid reading the owner unless necessary
891
+ if (disclose(isExistenceRequired) || !Utils_isTargetZero(disclose(canonAuth))) {
845
892
  const owner = _requireOwned(tokenId);
846
893
 
847
894
  // We do not use _isAuthorized because single-token approvals should not be able to call approve
848
- assert((owner == disclose(canonAuth) || isApprovedForAll(owner, canonAuth)),
895
+ assert((Utils_isTargetZero(disclose(canonAuth)) ||
896
+ owner == disclose(canonAuth) ||
897
+ isApprovedForAll(owner, canonAuth)),
849
898
  "NonFungibleToken: invalid approver"
850
899
  );
851
900
  }
@@ -856,7 +905,7 @@ module NonFungibleToken {
856
905
  /**
857
906
  * @description Approve `operator` to operate on all of `owner` tokens.
858
907
  *
859
- * @circuitInfo k=11, rows=1261
908
+ * @constraints k=11, rows=1280
860
909
  *
861
910
  * Requirements:
862
911
  *
@@ -895,7 +944,7 @@ module NonFungibleToken {
895
944
  * @description Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
896
945
  * Returns the owner.
897
946
  *
898
- * @circuitInfo k=9, rows=331
947
+ * @constraints k=9, rows=329
899
948
  *
900
949
  * Requirements:
901
950
  *
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/extensions/ConfidentialFungibleTokenPublicSupply.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.3 (token/extensions/ConfidentialFungibleTokenPublicSupply.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -33,15 +33,20 @@ pragma language_version >= 0.26.0;
33
33
  module ConfidentialFungibleTokenPublicSupply {
34
34
  import CompactStandardLibrary;
35
35
 
36
- // The public circulating supply. Mint and burn disclose their amounts
37
- // through the delta on this value.
36
+ /**
37
+ * @description Total tokens in circulation, tracked in the clear even though
38
+ * balances are encrypted. Raised by `_addSupply` and lowered by `_subSupply`,
39
+ * each rejecting over/underflow.
40
+ *
41
+ * @warning Mint and burn disclose their amounts through the delta on this value
42
+ */
38
43
  export ledger _totalSupply: Uint<128>;
39
44
 
40
45
  /**
41
46
  * @description Increases `totalSupply` by `value`. Call alongside the token
42
47
  * module's `_mint`. The added amount is disclosed via the supply delta.
43
48
  *
44
- * @circuitInfo k=9, rows=401
49
+ * @constraints k=9, rows=399
45
50
  *
46
51
  * Requirements:
47
52
  *
@@ -62,7 +67,7 @@ module ConfidentialFungibleTokenPublicSupply {
62
67
  * module's `_burn` or `_burnFrom`. The removed amount is disclosed via the
63
68
  * supply delta.
64
69
  *
65
- * @circuitInfo k=9, rows=256
70
+ * @constraints k=9, rows=254
66
71
  *
67
72
  * Requirements:
68
73
  *
@@ -80,7 +85,7 @@ module ConfidentialFungibleTokenPublicSupply {
80
85
  /**
81
86
  * @description Returns the public total token supply.
82
87
  *
83
- * @circuitInfo k=6, rows=26
88
+ * @constraints k=6, rows=24
84
89
  *
85
90
  * @return {Uint<128>} - The total supply.
86
91
  */
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.4.0-alpha.1 (token/extensions/NativeShieldedTokenDerivedNonce.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.3 (token/extensions/NativeShieldedTokenDerivedNonce.compact)
3
3
 
4
4
  pragma language_version >= 0.26.0;
5
5
 
@@ -59,7 +59,7 @@ module NativeShieldedTokenDerivedNonce {
59
59
  * @notice The derivation input is public ledger state, so mints using this
60
60
  * nonce are recipient-public; see the module notes.
61
61
  *
62
- * @circuitInfo k=9, rows=451
62
+ * @constraints k=9, rows=447
63
63
  *
64
64
  * @return {Bytes<32>} - The next derived coin nonce.
65
65
  */
@@ -20,7 +20,7 @@ pragma language_version >= 0.26.0;
20
20
  *
21
21
  * export circuit mint(
22
22
  * domain: Bytes<32>,
23
- * recipient: Either<ZswapCoinPublicKey, ContractAddress>,
23
+ * recipient: ZswapCoinPublicKey,
24
24
  * amount: Uint<64>,
25
25
  * nonce: Bytes<32>
26
26
  * ): ShieldedCoinInfo {
@@ -33,7 +33,7 @@ pragma language_version >= 0.26.0;
33
33
  * domain: Bytes<32>,
34
34
  * coin: ShieldedCoinInfo,
35
35
  * amount: Uint<128>,
36
- * refundTo: Either<ZswapCoinPublicKey, ContractAddress>
36
+ * refundTo: ZswapCoinPublicKey
37
37
  * ): Maybe<ShieldedCoinInfo> {
38
38
  * const refund = Family__burn(domain, coin, amount, refundTo);
39
39
  * Supply__addBurned(domain, amount);
@@ -76,7 +76,7 @@ module NativeShieldedTokenFamilyPublicSupply {
76
76
  * @description Adds `amount` to the exact minted total for `domain`. Call
77
77
  * once per successful `NativeShieldedTokenFamily._mint`.
78
78
  *
79
- * @circuitInfo k=10, rows=653
79
+ * @constraints k=10, rows=645
80
80
  *
81
81
  * @param {Bytes<32>} domain - 32-byte token discriminator.
82
82
  * @param {Uint<64>} amount - The minted amount.
@@ -93,7 +93,7 @@ module NativeShieldedTokenFamilyPublicSupply {
93
93
  * @dev Enforces per-domain `burned <= minted`; an unpaired, duplicate, or
94
94
  * wrong-domain burn reverts.
95
95
  *
96
- * @circuitInfo k=10, rows=755
96
+ * @constraints k=10, rows=747
97
97
  *
98
98
  * @param {Bytes<32>} domain - 32-byte token discriminator.
99
99
  * @param {Uint<128>} amount - The burned amount.
@@ -106,7 +106,7 @@ module NativeShieldedTokenFamilyPublicSupply {
106
106
  /**
107
107
  * @description Returns the exact amount ever minted for `domain`.
108
108
  *
109
- * @circuitInfo k=9, rows=344
109
+ * @constraints k=9, rows=342
110
110
  *
111
111
  * @param {Bytes<32>} domain - 32-byte token discriminator.
112
112
  * @return {Uint<128>} - The total amount minted.
@@ -120,7 +120,7 @@ module NativeShieldedTokenFamilyPublicSupply {
120
120
  * @notice This is a lower bound: coins sent directly to the burn address
121
121
  * without going through the contract are not counted.
122
122
  *
123
- * @circuitInfo k=9, rows=341
123
+ * @constraints k=9, rows=339
124
124
  *
125
125
  * @param {Bytes<32>} domain - 32-byte token discriminator.
126
126
  * @return {Uint<128>} - The total amount burned through the contract.
@@ -134,7 +134,7 @@ module NativeShieldedTokenFamilyPublicSupply {
134
134
  * @notice This is an UPPER BOUND on circulating supply, not an exact value:
135
135
  * burns that bypass the contract are invisible. See the module notes.
136
136
  *
137
- * @circuitInfo k=9, rows=439
137
+ * @constraints k=9, rows=437
138
138
  *
139
139
  * @param {Bytes<32>} domain - 32-byte token discriminator.
140
140
  * @return {Uint<128>} - The upper bound on tokens in existence.
@@ -18,7 +18,7 @@ pragma language_version >= 0.26.0;
18
18
  * pieces, calling the accounting block alongside the matching token op:
19
19
  *
20
20
  * export circuit mint(
21
- * recipient: Either<ZswapCoinPublicKey, ContractAddress>,
21
+ * recipient: ZswapCoinPublicKey,
22
22
  * amount: Uint<64>,
23
23
  * nonce: Bytes<32>
24
24
  * ): ShieldedCoinInfo {
@@ -30,7 +30,7 @@ pragma language_version >= 0.26.0;
30
30
  * export circuit burn(
31
31
  * coin: ShieldedCoinInfo,
32
32
  * amount: Uint<128>,
33
- * refundTo: Either<ZswapCoinPublicKey, ContractAddress>
33
+ * refundTo: ZswapCoinPublicKey
34
34
  * ): Maybe<ShieldedCoinInfo> {
35
35
  * const refund = Token__burn(coin, amount, refundTo);
36
36
  * Supply__addBurned(amount);
@@ -80,7 +80,7 @@ module NativeShieldedTokenPublicSupply {
80
80
  * @description Adds `amount` to the exact minted total. Call once per
81
81
  * successful `NativeShieldedToken._mint`.
82
82
  *
83
- * @circuitInfo k=9, rows=375
83
+ * @constraints k=9, rows=373
84
84
  *
85
85
  * @param {Uint<64>} amount - The minted amount.
86
86
  * @return {[]} - Empty tuple.
@@ -94,7 +94,7 @@ module NativeShieldedTokenPublicSupply {
94
94
  * per successful `NativeShieldedToken._burn` / `_burnFromSelf`.
95
95
  * @dev Enforces `burned <= minted`; an unpaired or duplicate burn reverts.
96
96
  *
97
- * @circuitInfo k=9, rows=477
97
+ * @constraints k=9, rows=475
98
98
  *
99
99
  * @param {Uint<128>} amount - The burned amount.
100
100
  * @return {[]} - Empty tuple.
@@ -106,7 +106,7 @@ module NativeShieldedTokenPublicSupply {
106
106
  /**
107
107
  * @description Returns the exact amount ever minted.
108
108
  *
109
- * @circuitInfo k=7, rows=65
109
+ * @constraints k=7, rows=63
110
110
  *
111
111
  * @return {Uint<128>} - The total amount minted.
112
112
  */
@@ -119,7 +119,7 @@ module NativeShieldedTokenPublicSupply {
119
119
  * @notice This is a lower bound: coins sent directly to the burn address
120
120
  * without going through the contract are not counted.
121
121
  *
122
- * @circuitInfo k=7, rows=62
122
+ * @constraints k=7, rows=60
123
123
  *
124
124
  * @return {Uint<128>} - The total amount burned through the contract.
125
125
  */
@@ -132,7 +132,7 @@ module NativeShieldedTokenPublicSupply {
132
132
  * @notice This is an UPPER BOUND on circulating supply, not an exact value:
133
133
  * burns that bypass the contract are invisible. See the module notes.
134
134
  *
135
- * @circuitInfo k=9, rows=160
135
+ * @constraints k=9, rows=158
136
136
  *
137
137
  * @return {Uint<128>} - The upper bound on tokens in existence.
138
138
  */
@@ -71,7 +71,7 @@ module NativeShieldedTokenPublicSupplyCore {
71
71
  * once per successful token `_mint`.
72
72
  * @dev Checks for overflow in order to output a readable error message.
73
73
  *
74
- * @circuitInfo k=10, rows=653
74
+ * @constraints k=10, rows=645
75
75
  *
76
76
  * @param {Bytes<32>} domain - 32-byte token discriminator.
77
77
  * @param {Uint<64>} amount - The minted amount.
@@ -91,7 +91,7 @@ module NativeShieldedTokenPublicSupplyCore {
91
91
  * The guard also keeps the add and the `totalSupply` subtraction within
92
92
  * bounds, so no separate overflow/underflow check is needed.
93
93
  *
94
- * @circuitInfo k=10, rows=755
94
+ * @constraints k=10, rows=747
95
95
  *
96
96
  * @param {Bytes<32>} domain - 32-byte token discriminator.
97
97
  * @param {Uint<128>} amount - The burned amount.
@@ -111,7 +111,7 @@ module NativeShieldedTokenPublicSupplyCore {
111
111
  /**
112
112
  * @description Returns the exact amount ever minted for `domain`.
113
113
  *
114
- * @circuitInfo k=9, rows=344
114
+ * @constraints k=9, rows=342
115
115
  *
116
116
  * @param {Bytes<32>} domain - 32-byte token discriminator.
117
117
  * @return {Uint<128>} - The total amount minted.
@@ -128,7 +128,7 @@ module NativeShieldedTokenPublicSupplyCore {
128
128
  * @notice This is a lower bound: coins sent directly to the burn address
129
129
  * without going through the contract are not counted.
130
130
  *
131
- * @circuitInfo k=9, rows=341
131
+ * @constraints k=9, rows=339
132
132
  *
133
133
  * @param {Bytes<32>} domain - 32-byte token discriminator.
134
134
  * @return {Uint<128>} - The total amount burned through the contract.
@@ -150,7 +150,7 @@ module NativeShieldedTokenPublicSupplyCore {
150
150
  * fires in normal operation. It is kept so the getter is a total function that
151
151
  * reads cleanly (returning 0) rather than reverting on an out-of-bound state.
152
152
  *
153
- * @circuitInfo k=9, rows=439
153
+ * @constraints k=9, rows=437
154
154
  *
155
155
  * @param {Bytes<32>} domain - 32-byte token discriminator.
156
156
  * @return {Uint<128>} - The upper bound on tokens in existence.