@openzeppelin/compact-contracts 0.3.0-rc.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 +14 -4
  2. package/access/AccessControl.compact +14 -14
  3. package/access/Ownable.compact +16 -10
  4. package/access/ShieldedAccessControl.compact +26 -2
  5. package/access/ZOwnablePK.compact +9 -9
  6. package/crypto/EcdhMask.compact +5 -5
  7. package/crypto/Ecdsa.compact +111 -0
  8. package/crypto/Eip712.compact +168 -0
  9. package/crypto/ElGamal.compact +33 -107
  10. package/multisig/EcdsaSignerManager.compact +246 -0
  11. package/multisig/ForwarderPrivate.compact +12 -6
  12. package/multisig/ForwarderShielded.compact +3 -3
  13. package/multisig/ForwarderUnshielded.compact +3 -3
  14. package/multisig/ProposalManager.compact +195 -23
  15. package/multisig/ShieldedTreasury.compact +29 -2
  16. package/multisig/ShieldedTreasuryStateless.compact +2 -2
  17. package/multisig/Signer.compact +28 -80
  18. package/multisig/UnshieldedTreasury.compact +10 -2
  19. package/multisig/{presets/forwarder/ForwarderPrivate.compact → examples/ForwarderPrivateExample.compact} +4 -4
  20. package/multisig/{presets/forwarder/ForwarderShielded.compact → examples/ForwarderShieldedExample.compact} +4 -4
  21. package/multisig/{presets/forwarder/ForwarderUnshielded.compact → examples/ForwarderUnshieldedExample.compact} +4 -4
  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 +267 -259
  26. package/package.json +31 -25
  27. package/security/Allowlist.compact +6 -6
  28. package/security/Blocklist.compact +6 -6
  29. package/security/Initializable.compact +9 -5
  30. package/security/Pausable.compact +11 -7
  31. package/token/ConfidentialFungibleToken.compact +143 -270
  32. package/token/FungibleToken.compact +36 -22
  33. package/token/MultiToken.compact +16 -16
  34. package/token/NativeShieldedToken.compact +17 -66
  35. package/token/NativeShieldedTokenCore.compact +26 -48
  36. package/token/NativeShieldedTokenFamily.compact +17 -67
  37. package/token/NonFungibleToken.compact +40 -79
  38. package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +12 -7
  39. package/token/extensions/NativeShieldedTokenDerivedNonce.compact +3 -3
  40. package/token/extensions/NativeShieldedTokenFamilyPublicSupply.compact +8 -8
  41. package/token/extensions/NativeShieldedTokenPublicSupply.compact +8 -8
  42. package/token/extensions/NativeShieldedTokenPublicSupplyCore.compact +6 -6
  43. package/utils/EvmAbi.compact +134 -0
  44. package/utils/Utils.compact +2 -12
  45. package/multisig/presets/ShieldedMultiSig.compact +0 -227
  46. package/multisig/presets/ShieldedMultiSigV3.compact +0 -368
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-rc.1 (token/FungibleToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/FungibleToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module FungibleToken
@@ -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,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-rc.1 (token/MultiToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/MultiToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module MultiToken
@@ -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,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
- // OpenZeppelin Compact Contracts v0.3.0-rc.1 (token/NativeShieldedToken.compact)
2
+ // OpenZeppelin Compact Contracts v0.4.0-alpha.2 (token/NativeShieldedToken.compact)
3
3
 
4
- pragma language_version >= 0.23.0;
4
+ pragma language_version >= 0.26.0;
5
5
 
6
6
  /**
7
7
  * @module NativeShieldedToken
@@ -20,10 +20,6 @@ pragma language_version >= 0.23.0;
20
20
  * share one set of core state (a single init flag and one name/symbol/decimals).
21
21
  * Pick one flavor per contract.
22
22
  *
23
- * @notice Recipients must be coin public keys: contract-addressed recipients
24
- * are not supported at this layer. For a coin the contract holds itself, use
25
- * `_mintToSelf`, which mints to `kernel.self()` and claims it in the same call.
26
- *
27
23
  * @notice This module exposes composable building blocks for minting and
28
24
  * burning native shielded coins. It does NOT include access control: consuming
29
25
  * contracts compose that via the module/contract pattern (Ownable,
@@ -110,7 +106,7 @@ module NativeShieldedToken {
110
106
  /**
111
107
  * @description Returns whether the contract has been initialized.
112
108
  *
113
- * @circuitInfo k=6, rows=26
109
+ * @constraints k=6, rows=24
114
110
  *
115
111
  * @return {Boolean} - True once `initialize` has run.
116
112
  */
@@ -121,7 +117,7 @@ module NativeShieldedToken {
121
117
  /**
122
118
  * @description Returns the token name.
123
119
  *
124
- * @circuitInfo k=6, rows=28
120
+ * @constraints k=6, rows=26
125
121
  *
126
122
  * Requirements:
127
123
  *
@@ -136,7 +132,7 @@ module NativeShieldedToken {
136
132
  /**
137
133
  * @description Returns the symbol of the token.
138
134
  *
139
- * @circuitInfo k=6, rows=28
135
+ * @constraints k=6, rows=26
140
136
  *
141
137
  * Requirements:
142
138
  *
@@ -151,7 +147,7 @@ module NativeShieldedToken {
151
147
  /**
152
148
  * @description Returns the number of decimals used to get its user representation.
153
149
  *
154
- * @circuitInfo k=6, rows=28
150
+ * @constraints k=6, rows=26
155
151
  *
156
152
  * Requirements:
157
153
  *
@@ -167,7 +163,7 @@ module NativeShieldedToken {
167
163
  * @description Returns this token's coin color:
168
164
  * `tokenType(_domain, kernel.self())`, computed at call time.
169
165
  *
170
- * @circuitInfo k=13, rows=3971
166
+ * @constraints k=13, rows=3962
171
167
  *
172
168
  * Requirements:
173
169
  *
@@ -194,65 +190,25 @@ module NativeShieldedToken {
194
190
  * recipient; callers SHOULD deliver it out of band. Wallets cannot detect
195
191
  * contract-minted coins by scanning the chain.
196
192
  *
197
- * @circuitInfo k=14, rows=10473
193
+ * @constraints k=14, rows=10820
198
194
  *
199
195
  * Requirements:
200
196
  *
201
197
  * - Contract is initialized.
202
198
  * - `recipient` is not zero.
203
199
  *
204
- * @param {ZswapCoinPublicKey} recipient - The coin recipient.
200
+ * @param {Either<ZswapCoinPublicKey, ContractAddress>} recipient - The coin recipient.
205
201
  * @param {Uint<64>} amount - Quantity to mint. Capped at `Uint<64>` by the protocol.
206
202
  * @param {Bytes<32>} nonce - Caller-supplied nonce. Must be unique for this
207
203
  * contract's color.
208
204
  * @return {ShieldedCoinInfo} - The newly created coin's info (nonce, color, value).
209
205
  */
210
206
  export circuit _mint(
211
- recipient: ZswapCoinPublicKey,
212
- amount: Uint<64>,
213
- nonce: Bytes<32>
214
- ): ShieldedCoinInfo {
215
- return Core__mint(
216
- _domain,
217
- left<ZswapCoinPublicKey, ContractAddress>(recipient),
218
- amount,
219
- nonce
220
- );
221
- }
222
-
223
- /**
224
- * @description Mints `amount` to this contract itself, claiming the coin in
225
- * the same call. Forwards to `NativeShieldedTokenCore._mint` with
226
- * `right(kernel.self())`.
227
- *
228
- * @dev Nonce uniqueness is the caller's responsibility, as in `_mint`. Spend
229
- * the coin later with `_burnFromSelf`, once it carries an `mt_index`.
230
- *
231
- * @notice The consumer SHOULD persist the returned coin info in its own
232
- * ledger state: it is the contract's holding and is not otherwise
233
- * recoverable.
234
- *
235
- * @circuitInfo k=14, rows=16070
236
- *
237
- * Requirements:
238
- *
239
- * - Contract is initialized.
240
- *
241
- * @param {Uint<64>} amount - Quantity to mint. Capped at `Uint<64>` by the protocol.
242
- * @param {Bytes<32>} nonce - Caller-supplied nonce. Must be unique for this
243
- * contract's color.
244
- * @return {ShieldedCoinInfo} - The newly created coin's info (nonce, color, value).
245
- */
246
- export circuit _mintToSelf(
207
+ recipient: Either<ZswapCoinPublicKey, ContractAddress>,
247
208
  amount: Uint<64>,
248
209
  nonce: Bytes<32>
249
210
  ): ShieldedCoinInfo {
250
- return Core__mint(
251
- _domain,
252
- right<ZswapCoinPublicKey, ContractAddress>(kernel.self()),
253
- amount,
254
- nonce
255
- );
211
+ return Core__mint(_domain, recipient, amount, nonce);
256
212
  }
257
213
 
258
214
  /**
@@ -273,7 +229,7 @@ module NativeShieldedToken {
273
229
  * `refundTo`; callers SHOULD deliver it out of band. Wallets cannot detect
274
230
  * contract-sent coins by scanning the chain.
275
231
  *
276
- * @circuitInfo k=16, rows=41492
232
+ * @constraints k=16, rows=47477
277
233
  *
278
234
  * Requirements:
279
235
  *
@@ -285,22 +241,17 @@ module NativeShieldedToken {
285
241
  *
286
242
  * @param {ShieldedCoinInfo} coin - The coin to burn from.
287
243
  * @param {Uint<128>} amount - Value to destroy. Must be <= `coin.value`.
288
- * @param {ZswapCoinPublicKey} refundTo - Where to route the unspent
289
- * portion (`coin.value - amount`).
244
+ * @param {Either<ZswapCoinPublicKey, ContractAddress>} refundTo - Where to
245
+ * route the unspent portion (`coin.value - amount`).
290
246
  * @return {Maybe<ShieldedCoinInfo>} - The refund coin created for `refundTo`,
291
247
  * or `none` if the coin was burned in full.
292
248
  */
293
249
  export circuit _burn(
294
250
  coin: ShieldedCoinInfo,
295
251
  amount: Uint<128>,
296
- refundTo: ZswapCoinPublicKey
252
+ refundTo: Either<ZswapCoinPublicKey, ContractAddress>
297
253
  ): Maybe<ShieldedCoinInfo> {
298
- return Core__burn(
299
- _domain,
300
- coin,
301
- amount,
302
- left<ZswapCoinPublicKey, ContractAddress>(refundTo)
303
- );
254
+ return Core__burn(_domain, coin, amount, refundTo);
304
255
  }
305
256
 
306
257
  /**
@@ -312,7 +263,7 @@ module NativeShieldedToken {
312
263
  * ledger state: the change replaces `coin` as the contract's holding, and
313
264
  * its info is not otherwise recoverable.
314
265
  *
315
- * @circuitInfo k=15, rows=23307
266
+ * @constraints k=15, rows=23208
316
267
  *
317
268
  * Requirements:
318
269
  *