@openzeppelin/compact-contracts 0.4.0-alpha.6 → 0.4.0
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/access/AccessControl.compact +1 -1
- package/access/Ownable.compact +1 -3
- package/access/ShieldedAccessControl.compact +44 -41
- package/access/ZOwnablePK.compact +1 -3
- package/crypto/EcdhMask.compact +11 -1
- package/crypto/Ecdsa.compact +1 -1
- package/crypto/Eip712.compact +1 -1
- package/crypto/ElGamal.compact +1 -1
- package/multisig/ForwarderPrivate.compact +17 -6
- package/multisig/ForwarderShielded.compact +1 -1
- package/multisig/ForwarderUnshielded.compact +1 -1
- package/multisig/ProposalManager.compact +65 -127
- package/multisig/RecipientTypes.compact +48 -0
- package/multisig/Secp256k1EcdsaMultisig.compact +1 -1
- package/multisig/ShieldedTreasury.compact +20 -8
- package/multisig/ShieldedTreasuryStateless.compact +11 -5
- package/multisig/Signer.compact +1 -1
- package/multisig/UnshieldedTreasury.compact +24 -11
- package/multisig/examples/ForwarderPrivateExample.compact +3 -2
- package/multisig/examples/ForwarderShieldedExample.compact +1 -1
- package/multisig/examples/ForwarderUnshieldedExample.compact +1 -1
- package/multisig/examples/NativeShieldedTokenIssuerExample.compact +1 -1
- package/multisig/examples/ShieldedMultiSigV2Example.compact +2 -2
- package/multisig/presets/NativeShieldedTokenIssuer.compact +5 -2
- package/multisig/presets/ShieldedMultiSigV2.compact +16 -10
- package/package.json +1 -1
- package/security/Allowlist.compact +1 -1
- package/security/Blocklist.compact +1 -1
- package/security/Initializable.compact +1 -3
- package/security/Pausable.compact +1 -1
- package/token/ConfidentialFungibleToken.compact +70 -22
- package/token/FungibleToken.compact +1 -3
- package/token/MultiToken.compact +1 -3
- package/token/NativeShieldedToken.compact +11 -3
- package/token/NativeShieldedTokenCore.compact +1 -1
- package/token/NativeShieldedTokenFamily.compact +1 -1
- package/token/NonFungibleToken.compact +1 -3
- package/token/examples/ZOwnableNativeShieldedTokenExample.compact +1 -1
- package/token/extensions/ConfidentialFungibleTokenPublicSupply.compact +1 -1
- package/token/extensions/NativeShieldedTokenDerivedNonce.compact +1 -1
- package/utils/EvmAbi.compact +1 -1
- package/utils/Utils.compact +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (multisig/presets/NativeShieldedTokenIssuer.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -183,7 +183,10 @@ pragma language_version >= 0.26.0;
|
|
|
183
183
|
* Mint and burn only. No send, transfer or execute circuit exists, so
|
|
184
184
|
* contract-held coins (from `mintToSelf` or `burnFromSelf` change) leave only
|
|
185
185
|
* through `burnFromSelf`, supplied by the operator as
|
|
186
|
-
* `QualifiedShieldedCoinInfo`.
|
|
186
|
+
* `QualifiedShieldedCoinInfo`. Moving such a coin anywhere else needs a
|
|
187
|
+
* custody module composed by the consumer that records the coin without
|
|
188
|
+
* claiming it a second time; `ShieldedTreasury._deposit` is not that module
|
|
189
|
+
* today (compact-contracts#1112). Coins minted to users are ordinary
|
|
187
190
|
* Zswap coins the contract neither tracks nor restricts; a holder redeems by
|
|
188
191
|
* paying the coin into a `burn` tx. No supply accounting.
|
|
189
192
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (multisig/presets/ShieldedMultiSigV2.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -25,6 +25,13 @@ pragma language_version >= 0.26.0;
|
|
|
25
25
|
* through ZswapOutput events from the indexer, constructs QualifiedShieldedCoinInfo
|
|
26
26
|
* off-chain, and provides it as a circuit parameter for spending.
|
|
27
27
|
*
|
|
28
|
+
* @notice Keeping coin data off the ledger hides balances from the public,
|
|
29
|
+
* not from a depositor. Whoever knows a deposited coin can find the `execute`
|
|
30
|
+
* that spends it, recover the amount sent, test candidate recipients against
|
|
31
|
+
* the sent coin's commitment, and derive the change coin, so every later
|
|
32
|
+
* spend descending from that change and the balance it carries are traceable
|
|
33
|
+
* by that depositor. See `ShieldedTreasuryStateless` for the derivation.
|
|
34
|
+
*
|
|
28
35
|
* @notice Requires ZKIR v3: `keccak256` is unavailable on the v2 backend.
|
|
29
36
|
*
|
|
30
37
|
* @notice Implementing contracts register the signer set from their
|
|
@@ -37,13 +44,11 @@ module ShieldedMultiSigV2<#t> {
|
|
|
37
44
|
import "../Secp256k1EcdsaMultisig"<t> prefix Secp256k1EcdsaMultisig_;
|
|
38
45
|
import "../../crypto/Eip712" prefix Eip712_;
|
|
39
46
|
import "../../utils/EvmAbi" prefix EvmAbi_;
|
|
40
|
-
import "../
|
|
47
|
+
import "../RecipientTypes";
|
|
41
48
|
import "../ShieldedTreasuryStateless" prefix Treasury_;
|
|
42
49
|
|
|
43
|
-
// Implementing contracts need
|
|
44
|
-
|
|
45
|
-
// unwritten copy of its state.
|
|
46
|
-
export { Proposal_Recipient };
|
|
50
|
+
// Implementing contracts need these for the re-exported `execute` signature.
|
|
51
|
+
export { Recipient, RecipientKind };
|
|
47
52
|
|
|
48
53
|
/**
|
|
49
54
|
* @description Monotonic operation counter. `execute` reads it as that
|
|
@@ -132,7 +137,8 @@ module ShieldedMultiSigV2<#t> {
|
|
|
132
137
|
*
|
|
133
138
|
* No access control which allows anyone to deposit. The coin is claimed at the
|
|
134
139
|
* protocol level through receiveShielded. No coin data is stored on the
|
|
135
|
-
* public ledger,
|
|
140
|
+
* public ledger, so no balance is readable from it; a depositor can still
|
|
141
|
+
* follow the coin they deposited (see the module notice).
|
|
136
142
|
*
|
|
137
143
|
* The operator discovers the coin's Merkle tree index by subscribing
|
|
138
144
|
* to ZswapOutput events via the indexer, filtering by contract address,
|
|
@@ -175,7 +181,7 @@ module ShieldedMultiSigV2<#t> {
|
|
|
175
181
|
* - `to.kind` must be `ShieldedUser`.
|
|
176
182
|
* - Coin value must be >= amount.
|
|
177
183
|
*
|
|
178
|
-
* @param {
|
|
184
|
+
* @param {Recipient} to - The recipient.
|
|
179
185
|
* @param {Uint<128>} amount - The amount to send.
|
|
180
186
|
* @param {QualifiedShieldedCoinInfo} coin - The coin to spend (from operator's pool).
|
|
181
187
|
* @param {Vector<t, Secp256k1Point>} pubkeys - Public keys of approving signers.
|
|
@@ -184,7 +190,7 @@ module ShieldedMultiSigV2<#t> {
|
|
|
184
190
|
* @returns {ShieldedSendResult} The send result including any change.
|
|
185
191
|
*/
|
|
186
192
|
export circuit execute(
|
|
187
|
-
to:
|
|
193
|
+
to: Recipient,
|
|
188
194
|
amount: Uint<128>,
|
|
189
195
|
coin: QualifiedShieldedCoinInfo,
|
|
190
196
|
pubkeys: Vector<t, Secp256k1Point>,
|
|
@@ -211,7 +217,7 @@ module ShieldedMultiSigV2<#t> {
|
|
|
211
217
|
Secp256k1EcdsaMultisig_assertApprovals(msgHash, pubkeys, signatures);
|
|
212
218
|
|
|
213
219
|
assert(
|
|
214
|
-
to.kind ==
|
|
220
|
+
to.kind == RecipientKind.ShieldedUser,
|
|
215
221
|
"ShieldedMultiSigV2: recipient must be a coin public key"
|
|
216
222
|
);
|
|
217
223
|
const recipient = left<ZswapCoinPublicKey, ContractAddress>(
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (security/Initializable.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -35,8 +35,6 @@ module Initializable {
|
|
|
35
35
|
/**
|
|
36
36
|
* @description Initializes the state thus ensuring the calling circuit can only be called once.
|
|
37
37
|
*
|
|
38
|
-
* @constraints k=6, rows=28
|
|
39
|
-
*
|
|
40
38
|
* Requirements:
|
|
41
39
|
*
|
|
42
40
|
* - Contract must not be initialized.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/ConfidentialFungibleToken.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -28,6 +28,16 @@ pragma language_version >= 0.26.0;
|
|
|
28
28
|
* (`extensions/ConfidentialFungibleTokenPublicSupply`) a composing contract pairs
|
|
29
29
|
* with them if it wants a tracked supply.
|
|
30
30
|
*
|
|
31
|
+
* @notice Allowances. `approve` funds the allowance at approve time: `value`
|
|
32
|
+
* moves out of the caller's spendable balance into the escrow, where it stays
|
|
33
|
+
* until spent or re-approved. Funding is required, not a choice: the spender
|
|
34
|
+
* holds no owner encryption key, so at spend time it can only prove against
|
|
35
|
+
* its own escrow copy, never that the owner's balance covers the allowance.
|
|
36
|
+
* An approve conserves the owner's holdings (spendable plus every outstanding
|
|
37
|
+
* escrow), so allowances across spenders can sum to the whole holding but
|
|
38
|
+
* never exceed it, and a re-approve replaces the prior one rather than
|
|
39
|
+
* stacking.
|
|
40
|
+
*
|
|
31
41
|
* @notice Single-receiver. Auditor support, freeze, and admin-style seize are
|
|
32
42
|
* deliberately left to companion modules or a future multi-receiver variant.
|
|
33
43
|
* The escrow-spend primitive here (`_spendEscrow`) enables user-consenting
|
|
@@ -35,6 +45,9 @@ pragma language_version >= 0.26.0;
|
|
|
35
45
|
* requires authority visibility into balances and is therefore out of scope
|
|
36
46
|
* for the single-receiver base.
|
|
37
47
|
*
|
|
48
|
+
* @dev Initialization. Every exported circuit except `initialize` asserts the
|
|
49
|
+
* contract is initialized.
|
|
50
|
+
*
|
|
38
51
|
* @dev Trust model for witnesses.
|
|
39
52
|
*
|
|
40
53
|
* Witness implementations live in the user's wallet (TypeScript frontend) and
|
|
@@ -390,7 +403,9 @@ module ConfidentialFungibleToken {
|
|
|
390
403
|
/**
|
|
391
404
|
* @description Escrowed allowances, keyed by owner then spender. Membership is
|
|
392
405
|
* checked independently of the entry, so an allowance that was never escrowed
|
|
393
|
-
* is unspendable.
|
|
406
|
+
* is unspendable. A spend also requires both owner and spender to be
|
|
407
|
+
* registered, so an entry written here for an unregistered account (for
|
|
408
|
+
* example by a composing contract) is unspendable as well.
|
|
394
409
|
* @type {Bytes<32>} owner - The account that escrowed the allowance.
|
|
395
410
|
* @type {Bytes<32>} spender - The account allowed to spend it.
|
|
396
411
|
* @type {EscrowEntry} entry - The escrowed allowance.
|
|
@@ -618,25 +633,37 @@ module ConfidentialFungibleToken {
|
|
|
618
633
|
|
|
619
634
|
/**
|
|
620
635
|
* @description Returns the escrow entry (the encrypted allowance) that `owner`
|
|
621
|
-
* granted `spender`. When no allowance exists, returns a
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
636
|
+
* granted `spender`. When no allowance exists, returns a placeholder entry
|
|
637
|
+
* rather than `default<EscrowEntry>`: the returned Jubjub points are on-curve,
|
|
638
|
+
* so the view is safe to prove (e.g. through a contract-to-contract call),
|
|
639
|
+
* whereas a zeroed default holds off-curve points. The cap is encrypted, not
|
|
640
|
+
* public.
|
|
641
|
+
*
|
|
642
|
+
* @notice The placeholder's `spenderCt` and `ownerCt` are genuine encryptions
|
|
643
|
+
* of 0. Its `ownerMemo` is not: it is a sentinel for an absent allowance,
|
|
644
|
+
* recognised by `ephemeralPk == identity`, which `EcdhMask_encrypt` never
|
|
645
|
+
* produces and `EcdhMask_decrypt` rejects. A wallet must test for the
|
|
646
|
+
* sentinel rather than decrypt and narrow it.
|
|
647
|
+
*
|
|
648
|
+
* @notice "No allowance" and "an allowance of 0" both read as encrypted-zero in
|
|
649
|
+
* the amount fields; the memo sentinel tells them apart, since `approve` stores
|
|
650
|
+
* a real memo even for 0. This getter grants nothing, the spend path
|
|
651
|
+
* (`transferFrom`/`burnFrom`) gates on `_escrow` membership independently, so a
|
|
652
|
+
* non-existent allowance is unspendable.
|
|
653
|
+
*
|
|
654
|
+
* @constraints k=10, rows=938
|
|
627
655
|
*
|
|
628
|
-
*
|
|
629
|
-
* a caller that must distinguish them reads `_escrow` membership off-chain. This
|
|
630
|
-
* getter grants nothing, the spend path (`transferFrom`/`burnFrom`) gates on
|
|
631
|
-
* `_escrow` membership independently, so a non-existent allowance is unspendable.
|
|
656
|
+
* Requirements:
|
|
632
657
|
*
|
|
633
|
-
*
|
|
658
|
+
* - Contract is initialized.
|
|
634
659
|
*
|
|
635
660
|
* @param {Bytes<32>} owner - The account that granted the allowance.
|
|
636
661
|
* @param {Bytes<32>} spender - The approved spender.
|
|
637
|
-
* @return {EscrowEntry} - The encrypted escrow entry (
|
|
662
|
+
* @return {EscrowEntry} - The encrypted escrow entry (a placeholder with the
|
|
663
|
+
* absent-allowance sentinel if none).
|
|
638
664
|
*/
|
|
639
665
|
export circuit allowance(owner: Bytes<32>, spender: Bytes<32>): EscrowEntry {
|
|
666
|
+
assertInitialized();
|
|
640
667
|
if (!_escrow.member(disclose(owner)) ||
|
|
641
668
|
!_escrow.lookup(disclose(owner)).member(disclose(spender))) {
|
|
642
669
|
const id = constructJubjubPoint(0 as Field, 1 as Field);
|
|
@@ -656,12 +683,17 @@ module ConfidentialFungibleToken {
|
|
|
656
683
|
/**
|
|
657
684
|
* @description Returns whether `account` has registered an encryption key.
|
|
658
685
|
*
|
|
659
|
-
* @constraints k=9, rows=
|
|
686
|
+
* @constraints k=9, rows=305
|
|
687
|
+
*
|
|
688
|
+
* Requirements:
|
|
689
|
+
*
|
|
690
|
+
* - Contract is initialized.
|
|
660
691
|
*
|
|
661
692
|
* @param {Bytes<32>} account - The account to query.
|
|
662
693
|
* @return {Boolean} - True if `account` is registered.
|
|
663
694
|
*/
|
|
664
695
|
export circuit isRegistered(account: Bytes<32>): Boolean {
|
|
696
|
+
assertInitialized();
|
|
665
697
|
return _encryptionKeys.member(disclose(account));
|
|
666
698
|
}
|
|
667
699
|
|
|
@@ -812,6 +844,12 @@ module ConfidentialFungibleToken {
|
|
|
812
844
|
* `sum(balances) == totalSupply` invariant. Pair it with a debit (as `transfer`
|
|
813
845
|
* does) or a supply increase (as a supply layer's `mint` does).
|
|
814
846
|
*
|
|
847
|
+
* Requirements:
|
|
848
|
+
*
|
|
849
|
+
* - Contract is initialized.
|
|
850
|
+
* - `value` is within `MAX_TRANSFER_VALUE()`.
|
|
851
|
+
* - `account` is non-zero and registered.
|
|
852
|
+
*
|
|
815
853
|
* @param account - The recipient account id.
|
|
816
854
|
* @param value - The amount to credit.
|
|
817
855
|
*/
|
|
@@ -928,7 +966,7 @@ module ConfidentialFungibleToken {
|
|
|
928
966
|
* credits `to`, and pushes an encrypted memo to `to`. The amount is hidden;
|
|
929
967
|
* the (sender, recipient) pair is public.
|
|
930
968
|
*
|
|
931
|
-
* @constraints k=16, rows=
|
|
969
|
+
* @constraints k=16, rows=41621
|
|
932
970
|
*
|
|
933
971
|
* @notice Returns the caller's (sender's) `accountId` for caller-side gating.
|
|
934
972
|
* The sender is derived from the same authentication `_debit` performs, so the
|
|
@@ -946,7 +984,6 @@ module ConfidentialFungibleToken {
|
|
|
946
984
|
* @return {Bytes<32>} - The caller's (sender's) accountId.
|
|
947
985
|
*/
|
|
948
986
|
export circuit transfer(to: Bytes<32>, value: Uint<128>): Bytes<32> {
|
|
949
|
-
assertInitialized();
|
|
950
987
|
// Derive the sender from the same authentication `_debit` uses, so the
|
|
951
988
|
// returned id is exactly the account whose funds moved.
|
|
952
989
|
const senderId = _debit(value);
|
|
@@ -966,7 +1003,7 @@ module ConfidentialFungibleToken {
|
|
|
966
1003
|
* operations (`mint`/`burn`) live in a separate layer outside this conserving
|
|
967
1004
|
* surface, and only they may break conservation.
|
|
968
1005
|
*
|
|
969
|
-
* @constraints k=16, rows=
|
|
1006
|
+
* @constraints k=16, rows=41610
|
|
970
1007
|
*
|
|
971
1008
|
* @notice Like `transfer`, the credit lands in the recipient's pending pool
|
|
972
1009
|
* (see the dual-balance note); the caller sweeps their own incoming value.
|
|
@@ -992,7 +1029,6 @@ module ConfidentialFungibleToken {
|
|
|
992
1029
|
* @return {Bytes<32>} - The caller's accountId (for caller-side gating).
|
|
993
1030
|
*/
|
|
994
1031
|
export circuit _move(to: Bytes<32>, value: Uint<128>): Bytes<32> {
|
|
995
|
-
assertInitialized();
|
|
996
1032
|
const senderId = _debit(value);
|
|
997
1033
|
_credit(to, value);
|
|
998
1034
|
return senderId;
|
|
@@ -1125,7 +1161,7 @@ module ConfidentialFungibleToken {
|
|
|
1125
1161
|
* caller via `approve`) and credits it to `to`, reducing both escrow copies by
|
|
1126
1162
|
* `value`. The amount is hidden.
|
|
1127
1163
|
*
|
|
1128
|
-
*
|
|
1164
|
+
* @constraints k=17, rows=68922
|
|
1129
1165
|
*
|
|
1130
1166
|
* @notice Returns the caller's (spender's) `accountId` for caller-side gating.
|
|
1131
1167
|
*
|
|
@@ -1135,6 +1171,7 @@ module ConfidentialFungibleToken {
|
|
|
1135
1171
|
* - `value` is within `MAX_TRANSFER_VALUE()`.
|
|
1136
1172
|
* - `to` is registered and is not the zero account.
|
|
1137
1173
|
* - An escrow from `fromAddress` to the caller exists with at least `value`.
|
|
1174
|
+
* - `fromAddress` and the caller are registered.
|
|
1138
1175
|
*
|
|
1139
1176
|
* @param {Bytes<32>} fromAddress - The owner whose escrow is drawn on.
|
|
1140
1177
|
* @param {Bytes<32>} to - The recipient account.
|
|
@@ -1146,7 +1183,6 @@ module ConfidentialFungibleToken {
|
|
|
1146
1183
|
to: Bytes<32>,
|
|
1147
1184
|
value: Uint<128>
|
|
1148
1185
|
): Bytes<32> {
|
|
1149
|
-
assertInitialized();
|
|
1150
1186
|
_assertValueInBound(value);
|
|
1151
1187
|
assert(to != default<Bytes<32>>,
|
|
1152
1188
|
"ConfidentialFungibleToken: invalid receiver");
|
|
@@ -1299,6 +1335,13 @@ module ConfidentialFungibleToken {
|
|
|
1299
1335
|
* not prove the post-refund balance on a later re-approve/revoke. See the
|
|
1300
1336
|
* `EscrowEntry` field doc.
|
|
1301
1337
|
*
|
|
1338
|
+
* Requirements:
|
|
1339
|
+
*
|
|
1340
|
+
* - Contract is initialized.
|
|
1341
|
+
* - `value` is within `MAX_TRANSFER_VALUE()`.
|
|
1342
|
+
* - An escrow from `fromAddress` to the caller exists with at least `value`.
|
|
1343
|
+
* - `fromAddress` and the caller are registered.
|
|
1344
|
+
*
|
|
1302
1345
|
* @param fromAddress - The owner whose escrow the caller (spender) draws on.
|
|
1303
1346
|
* @param value - The amount to consume from the allowance.
|
|
1304
1347
|
*/
|
|
@@ -1310,6 +1353,10 @@ module ConfidentialFungibleToken {
|
|
|
1310
1353
|
assert(_escrow.member(disclose(fromAddress)) &&
|
|
1311
1354
|
_escrow.lookup(disclose(fromAddress)).member(disclose(spenderId)),
|
|
1312
1355
|
"ConfidentialFungibleToken: no escrow");
|
|
1356
|
+
assert(_encryptionKeys.member(disclose(spenderId)),
|
|
1357
|
+
"ConfidentialFungibleToken: spender not registered");
|
|
1358
|
+
assert(_encryptionKeys.member(disclose(fromAddress)),
|
|
1359
|
+
"ConfidentialFungibleToken: owner not registered");
|
|
1313
1360
|
|
|
1314
1361
|
const entry = _escrow.lookup(disclose(fromAddress)).lookup(disclose(spenderId));
|
|
1315
1362
|
|
|
@@ -1374,13 +1421,14 @@ module ConfidentialFungibleToken {
|
|
|
1374
1421
|
* recipient credit. The building block for a composing contract's
|
|
1375
1422
|
* `burnFrom`; it performs no supply accounting (see `_burn`).
|
|
1376
1423
|
*
|
|
1377
|
-
*
|
|
1424
|
+
* @constraints k=16, rows=42205
|
|
1378
1425
|
*
|
|
1379
1426
|
* Requirements:
|
|
1380
1427
|
*
|
|
1381
1428
|
* - Contract is initialized.
|
|
1382
1429
|
* - `value` is within `MAX_TRANSFER_VALUE()`.
|
|
1383
1430
|
* - An escrow from `fromAddress` to the caller exists with at least `value`.
|
|
1431
|
+
* - `fromAddress` and the caller are registered.
|
|
1384
1432
|
*
|
|
1385
1433
|
* @param {Bytes<32>} fromAddress - The owner whose escrow is consumed.
|
|
1386
1434
|
* @param {Uint<128>} value - The amount to burn.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/FungibleToken.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -130,8 +130,6 @@ module FungibleToken {
|
|
|
130
130
|
* @dev This MUST be called in the implementing contract's constructor. Failure to do so
|
|
131
131
|
* can lead to an irreparable contract.
|
|
132
132
|
*
|
|
133
|
-
* @constraints k=10, rows=71
|
|
134
|
-
*
|
|
135
133
|
* @param {Opaque<"string">} name_ - The name of the token.
|
|
136
134
|
* @param {Opaque<"string">} symbol_ - The symbol of the token.
|
|
137
135
|
* @param {Uint<8>} decimals_ - The number of decimals used to get the user representation.
|
package/token/MultiToken.compact
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/MultiToken.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -176,8 +176,6 @@ module MultiToken {
|
|
|
176
176
|
/**
|
|
177
177
|
* @description Initializes the contract by setting the base URI for all tokens.
|
|
178
178
|
*
|
|
179
|
-
* @constraints k=6, rows=31
|
|
180
|
-
*
|
|
181
179
|
* Requirements:
|
|
182
180
|
*
|
|
183
181
|
* - Must be called in the contract's constructor.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/NativeShieldedToken.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -230,7 +230,13 @@ module NativeShieldedToken {
|
|
|
230
230
|
*
|
|
231
231
|
* @notice The consumer SHOULD persist the returned coin info in its own
|
|
232
232
|
* ledger state: it is the contract's holding and is not otherwise
|
|
233
|
-
* recoverable.
|
|
233
|
+
* recoverable. The coin is already claimed as a receive by the mint, so a
|
|
234
|
+
* custody module must record it without calling `receiveShielded` on it
|
|
235
|
+
* again (see the recipient-arm note in `NativeShieldedTokenCore`).
|
|
236
|
+
* `ShieldedTreasury._deposit` claims on the way in and is not that path;
|
|
237
|
+
* a record-only circuit is tracked in compact-contracts#1112. Until a
|
|
238
|
+
* custody module is composed, the only spend of a contract-held coin is
|
|
239
|
+
* `_burnFromSelf`.
|
|
234
240
|
*
|
|
235
241
|
* @constraints k=14, rows=10221
|
|
236
242
|
*
|
|
@@ -310,7 +316,9 @@ module NativeShieldedToken {
|
|
|
310
316
|
*
|
|
311
317
|
* @dev The consumer SHOULD persist the returned change coin info in its own
|
|
312
318
|
* ledger state: the change replaces `coin` as the contract's holding, and
|
|
313
|
-
* its info is not otherwise recoverable.
|
|
319
|
+
* its info is not otherwise recoverable. Like a `_mintToSelf` coin, the
|
|
320
|
+
* change is already claimed as a receive, so a custody module must record
|
|
321
|
+
* it without a second `receiveShielded`.
|
|
314
322
|
*
|
|
315
323
|
* @constraints k=15, rows=23208
|
|
316
324
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/NonFungibleToken.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
|
@@ -165,8 +165,6 @@ module NonFungibleToken {
|
|
|
165
165
|
* This MUST be called in the implementing contract's constructor.
|
|
166
166
|
* Failure to do so can lead to an irreparable contract.
|
|
167
167
|
*
|
|
168
|
-
* @constraints k=6, rows=52
|
|
169
|
-
*
|
|
170
168
|
* Requirements:
|
|
171
169
|
*
|
|
172
170
|
* - Contract is not initialized.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// OpenZeppelin Compact Contracts v0.4.0
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/examples/ZOwnableNativeShieldedTokenExample.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
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/extensions/ConfidentialFungibleTokenPublicSupply.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
|
|
2
|
+
// OpenZeppelin Compact Contracts v0.4.0 (token/extensions/NativeShieldedTokenDerivedNonce.compact)
|
|
3
3
|
|
|
4
4
|
pragma language_version >= 0.26.0;
|
|
5
5
|
|
package/utils/EvmAbi.compact
CHANGED
package/utils/Utils.compact
CHANGED