Skip to content
Merged
Show file tree
Hide file tree
Changes from 157 commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
fc77ac2
add erc1155 workspace
andrew-fleming Apr 15, 2025
5211853
start erc1155
andrew-fleming Apr 15, 2025
3e19fba
add logic to _setApprovalForAll
andrew-fleming Apr 15, 2025
2463e56
add setApprove tests
andrew-fleming Apr 15, 2025
a8212e3
add _safeTransferFrom tests
andrew-fleming Apr 15, 2025
505708f
add overflow check in _update
andrew-fleming Apr 15, 2025
78a267b
add _update and _setURI tests
andrew-fleming Apr 15, 2025
8cd89ee
add tests for _mint and _burn
andrew-fleming Apr 15, 2025
86a0ca7
add _setApprovalForAll tests
andrew-fleming Apr 15, 2025
ed90183
add template comment
andrew-fleming Apr 21, 2025
3dbac35
add circuit comments in contract
andrew-fleming Apr 22, 2025
bea3cb9
add balanceOfBatch
andrew-fleming Apr 24, 2025
6198271
add template comments
andrew-fleming Apr 24, 2025
43e0b37
add balanceOfBatch tests
andrew-fleming Apr 25, 2025
9f8d0b7
add assertion for ownerNoBal
andrew-fleming Apr 25, 2025
e22e689
fix comment
andrew-fleming Apr 25, 2025
996201f
improve test
andrew-fleming Apr 25, 2025
db67fa7
add generic data param to safe transfer
andrew-fleming Apr 25, 2025
f00717c
Add pausable (#22)
andrew-fleming Apr 26, 2025
a292657
remove data param
andrew-fleming Apr 28, 2025
b3fd9bc
remove safeBatchTransferFrom
andrew-fleming Apr 28, 2025
375425a
change Field to Uint
andrew-fleming Apr 28, 2025
2e7683b
change id back to field
andrew-fleming Apr 29, 2025
9a866c0
remove unused test vars
andrew-fleming Apr 29, 2025
1894d16
remove safe prefix from transferFrom
andrew-fleming Apr 29, 2025
969e3b0
Bump midnight-js, transition to biome, basic improvements (#35)
andrew-fleming Apr 29, 2025
2fd085b
fix fmt
andrew-fleming May 1, 2025
063d1be
fix lint
andrew-fleming May 1, 2025
354ad56
simplify jest config
andrew-fleming May 1, 2025
4c2a02a
fix comment
andrew-fleming May 1, 2025
4b8a089
use stdlib burn_address circuit for zero
andrew-fleming May 1, 2025
2fe9aef
change erc1155 to MultiToken
andrew-fleming May 1, 2025
c6b6c61
improve mod description
andrew-fleming May 1, 2025
aac410d
replace Field type with Uint<128> for ids
andrew-fleming May 1, 2025
635cef1
fix fmt
andrew-fleming May 1, 2025
8916680
Add PR and issue templates (#43)
andrew-fleming May 7, 2025
a4700ad
Add security doc (#42)
andrew-fleming May 7, 2025
bcf0914
chore: add code owners (#53)
0xisk May 9, 2025
1ca410e
Improve compact scripts (#41)
andrew-fleming May 14, 2025
ecb4c6e
fix fmt and lint, remove barrel files
andrew-fleming May 19, 2025
b16db49
Add license (#44)
andrew-fleming May 19, 2025
668554b
Support compact 0.23.0, migrate to vitest (#68)
andrew-fleming May 19, 2025
5f90d1f
Update .nvmrc (#73)
andrew-fleming May 20, 2025
3f232f8
remove jest, add vitest
andrew-fleming May 21, 2025
60043db
fix types
andrew-fleming May 21, 2025
a688b35
fix fmt
andrew-fleming May 21, 2025
26abc19
fix lint
andrew-fleming May 21, 2025
efafafa
bump lang version
andrew-fleming May 21, 2025
a1d8f38
Apply suggestions from code review
andrew-fleming May 21, 2025
8b9d3e3
bump types/node
andrew-fleming May 22, 2025
b4febfd
change initializer => initialize
andrew-fleming May 22, 2025
3f00b0a
chore(tests): adding more edge test cases for ERC1155 (#78)
0xisk May 22, 2025
a604eba
fix max uint128 transfer test
andrew-fleming May 22, 2025
544bbea
add initialized check in initialize
andrew-fleming May 23, 2025
11cb6c1
add todos
andrew-fleming May 23, 2025
85c3048
add missing feature list for erc1155 spec compatibility
andrew-fleming May 26, 2025
2366410
Merge branch 'main' into erc1155-unshielded
emnul Jun 5, 2025
67ca450
Add string types to multitoken
emnul Jun 5, 2025
6e5285c
Remove comment
emnul Jun 5, 2025
9a92430
Merge branch 'main' into erc1155-unshielded
andrew-fleming Jun 11, 2025
9512210
add init assertion to all circuits
andrew-fleming Jun 11, 2025
1fedde7
remove maybe from uri string
andrew-fleming Jun 11, 2025
c798d08
fix fmt/lint
andrew-fleming Jun 11, 2025
838c677
change _update to internal (not exported)
andrew-fleming Jun 11, 2025
460ffe6
test bad initialization
andrew-fleming Jun 12, 2025
5561196
fix bad init test
andrew-fleming Jun 12, 2025
f614ff3
remove unused vars
andrew-fleming Jun 12, 2025
70ad72e
fix fmt/lint
andrew-fleming Jun 12, 2025
9eb5f6c
fix comments
andrew-fleming Jun 12, 2025
dc15385
add _unsafeMint
andrew-fleming Jun 12, 2025
0553106
update utils module
andrew-fleming Jun 12, 2025
cfaf0f2
add _unsafeMint tests, improve _mint tests
andrew-fleming Jun 12, 2025
e5093f9
fix fmt/lint
andrew-fleming Jun 12, 2025
99f5197
add unsafe transfer variants
andrew-fleming Jun 13, 2025
5c67927
fix tests with zero key
andrew-fleming Jun 13, 2025
916a082
add test for _transferFrom to contract
andrew-fleming Jun 13, 2025
afef819
add unsafe circuits to mock and sim / add unsafe circuit tests
andrew-fleming Jun 14, 2025
53e629a
fix fmt/lint
andrew-fleming Jun 14, 2025
43896b2
improve unsafe transfer tests
andrew-fleming Jun 14, 2025
f1a4526
clean up tests
andrew-fleming Jun 14, 2025
552e025
improve utils, clean up tests
andrew-fleming Jun 14, 2025
7686c14
fix fmt/lint
andrew-fleming Jun 14, 2025
36a9186
parametrize caller in transferFrom tests
andrew-fleming Jun 14, 2025
2bc800c
improve tests
andrew-fleming Jun 14, 2025
0ff0a0f
fix comment
andrew-fleming Jun 14, 2025
691d397
improve code docs
andrew-fleming Jun 14, 2025
ba83067
fix comment
andrew-fleming Jun 15, 2025
48c39c7
add docstrings to multitoken sim
andrew-fleming Jun 15, 2025
59e855b
fix comment
andrew-fleming Jun 15, 2025
ab294dd
add additional failing circuits on bad init
andrew-fleming Jun 15, 2025
2af3595
improve balanceOf tests
andrew-fleming Jun 15, 2025
f020f6b
improve failing circuits test
andrew-fleming Jun 15, 2025
000f292
fix tests and fmt
andrew-fleming Jun 17, 2025
88e7450
fix package name
andrew-fleming Jun 17, 2025
c0b4100
fix comment description
andrew-fleming Jun 17, 2025
1717c03
improve doc comments
andrew-fleming Jun 17, 2025
1923a57
Rename multitoken -> multiToken
andrew-fleming Jun 17, 2025
9f9738a
fix formatting
andrew-fleming Jun 17, 2025
2192260
Apply suggestions from code review
andrew-fleming Jun 17, 2025
f781c83
Apply suggestions from code review
andrew-fleming Jun 17, 2025
7e22450
move unsafe circuits toward bottom of module
andrew-fleming Jun 18, 2025
f8dedb3
remove trailing space
andrew-fleming Jun 18, 2025
9af8ea3
add tests for 1000 batch
andrew-fleming Jun 18, 2025
0ff4714
add no pad test for balanceOfBatch
andrew-fleming Jun 18, 2025
78b5fbe
Apply suggestions from code review
andrew-fleming Jun 18, 2025
96e77a7
Merge branch 'erc1155-unshielded' of https://github.com/OpenZeppelin/…
andrew-fleming Jun 18, 2025
42d535d
fix return comment
andrew-fleming Jun 18, 2025
680ddf7
tidy up comments
andrew-fleming Jun 18, 2025
74e852e
remove balanceOfBatch
andrew-fleming Jun 18, 2025
90259a7
add balanceOfBatch to missing features list
andrew-fleming Jun 18, 2025
7f85b17
fix conflicts
andrew-fleming Jun 18, 2025
06ceb87
Remove old dir, add renamed dir
andrew-fleming Jun 18, 2025
ef94613
fix fmt
andrew-fleming Jun 18, 2025
fcaab82
tmp disable cache
andrew-fleming Jun 18, 2025
7fc6c9d
cancel tmp no-cache
andrew-fleming Jun 18, 2025
ba01b85
clear zk-params cache
andrew-fleming Jun 18, 2025
3553522
add debug
andrew-fleming Jun 18, 2025
50f799d
revert changes to CI
andrew-fleming Jun 18, 2025
aeee13b
bump cache keys
andrew-fleming Jun 18, 2025
84d1fbe
add clean cache key
andrew-fleming Jun 18, 2025
7dded55
remove cache before installing
andrew-fleming Jun 18, 2025
a9911c9
restore action
andrew-fleming Jun 18, 2025
0f8c7c2
restore test
andrew-fleming Jun 18, 2025
d111b91
revert contract dir name
andrew-fleming Jun 19, 2025
e76c64a
remove dir
andrew-fleming Jun 19, 2025
153245e
restore multiToken
andrew-fleming Jun 19, 2025
f55a99b
fix lock file
andrew-fleming Jun 19, 2025
ebba50c
change back to lower case again
andrew-fleming Jun 19, 2025
086765f
try new ci
andrew-fleming Jun 23, 2025
6f79282
fix conflicts
andrew-fleming Jun 23, 2025
0feb366
replace _transferFrom/_unsafeUncheckedTransferFrom => _transfer/_unsa…
andrew-fleming Jun 23, 2025
1e8624e
fix doc comments
andrew-fleming Jun 24, 2025
e278204
add multitoken pages to nav
andrew-fleming Jun 25, 2025
366fe3f
add initial template guide for multitoken (needs to be finished)
andrew-fleming Jun 25, 2025
38a914f
add multitoken API
andrew-fleming Jun 25, 2025
cf5bf32
small cleanup
andrew-fleming Jun 25, 2025
ced8009
Merge branch 'main' into multi-token-docs
andrew-fleming Jun 25, 2025
11ca23b
re-add new line
andrew-fleming Jun 26, 2025
9cf7605
finish missing features, add c2c section
andrew-fleming Jun 30, 2025
f88b941
update import name
andrew-fleming Jun 30, 2025
ba134ec
Merge branch 'main' into multi-token-docs
andrew-fleming Jun 30, 2025
85d7522
Merge branch 'main' into multi-token-docs
andrew-fleming Jul 9, 2025
b6619c6
Merge branch 'main' into multi-token-docs
andrew-fleming Jul 14, 2025
3e21c17
Merge branch 'multi-token-docs' of https://github.com/OpenZeppelin/co…
andrew-fleming Jul 14, 2025
5f2f228
fix conflicts
andrew-fleming Jul 16, 2025
cc505a3
improve usage example
andrew-fleming Jul 16, 2025
942f332
fix conflicts
andrew-fleming Jul 16, 2025
9879230
reorder mods in sidebar
andrew-fleming Jul 16, 2025
c9a8952
fix gh links
andrew-fleming Jul 16, 2025
fa7dfe8
fix param type
andrew-fleming Jul 16, 2025
cf9e603
remove note from _burn
andrew-fleming Jul 17, 2025
fdd0e5f
fix zswap pk type
andrew-fleming Jul 17, 2025
47cc972
Apply suggestions from code review
andrew-fleming Jul 18, 2025
82b7451
add _update (internal) to API
andrew-fleming Jul 18, 2025
0b26e7b
add _update to ToC
andrew-fleming Jul 18, 2025
d09377d
Apply suggestions from code review
andrew-fleming Jul 19, 2025
15438e9
move attr value output
andrew-fleming Jul 19, 2025
77c33c8
fix import example links, fix fmt
andrew-fleming Jul 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
page-sidebar-collapse-default: 'Ownable'
page-sidebar-collapse-default: 'FungibleToken,MultiToken,Ownable'
5 changes: 5 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
* xref:index.adoc[Overview]

* Learn

** xref:extensibility.adoc[Extensibility]

* Modules

** xref:ownable.adoc[Ownable]
*** xref:api/ownable.adoc[API Reference]

** xref:fungibleToken.adoc[FungibleToken]
*** xref:/api/fungibleToken.adoc[API Reference]

** xref:multitoken.adoc[MultiToken]
*** xref:api/multitoken.adoc[API Reference]
257 changes: 257 additions & 0 deletions docs/modules/ROOT/pages/api/multitoken.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
:github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
:multiToken-guide: xref:multitoken.adoc[MultiToken guide]
:erc1155-metadata: https://eips.ethereum.org/EIPS/eip-1155#metadata[ERC1155-Metadata]

= MultiToken

This module provides the full MultiToken module API.

TIP: For an overview of the module, read the {multiToken-guide}.

== Core

[.hljs-theme-dark]
```ts
import "./node_modules/@openzeppelin-compact/multi-token/MultiToken" prefix MultiToken_;
```

[.contract]
[[MultiToken]]
=== `++MultiToken++` link:https://github.com/OpenZeppelin/compact-contracts/blob/main/contracts/multiToken/src/MultiToken.compact[{github-icon},role=heading-link]

[.contract-index]
.Circuits
--

[.sub-index#MultiTokenModule]
* xref:#MultiTokenModule-initialize[`++initialize(uri_)++`]
* xref:#MultiTokenModule-uri[`++uri(id)++`]
* xref:#MultiTokenModule-balanceOf[`++balanceOf(account, id)++`]
* xref:#MultiTokenModule-setApprovalForAll[`++setApprovalForAll(operator, approved)++`]
* xref:#MultiTokenModule-isApprovedForAll[`++isApprovedForAll(account, operator)++`]
* xref:#MultiTokenModule-transferFrom[`++transferFrom(from, to, id, value)++`]
* xref:#MultiTokenModule-_transfer[`++_transfer(from, to, id, value)++`]
* xref:#MultiTokenModule-_update[`++_update(from, to, id, value)++`]
* xref:#MultiTokenModule-_unsafeTransferFrom[`++_unsafeTransferFrom(from, to, id, value)++`]
* xref:#MultiTokenModule-_unsafeTransfer[`++_unsafeTransfer(from, to, id, value)++`]
* xref:#MultiTokenModule-_setURI[`++_setURI(newURI)++`]
* xref:#MultiTokenModule-_mint[`++_mint(to, id, value)++`]
* xref:#MultiTokenModule-_unsafeMint[`++_unsafeMint(to, id, value)++`]
* xref:#MultiTokenModule-_burn[`++_burn(from, id, value)++`]
* xref:#MultiTokenModule-_setApprovalForAll[`++_setApprovalForAll(owner, operator, approved)++`]
--
Comment thread
emnul marked this conversation as resolved.

[.contract-item]
[[MultiTokenModule-initialize]]
==== `[.contract-item-name]#++initialize++#++(uri_: Opaque<"string">) → []++` [.item-kind]#circuit#

Initializes the contract by setting the base URI for all tokens.

This MUST be called in the implementing contract's constructor.
Failure to do so can lead to an irreparable contract.

Requirements:

- Contract is not initialized.

[.contract-item]
[[MultiTokenModule-uri]]
==== `[.contract-item-name]#++uri++#++(id: Uint<128>) → Opaque<"string">++` [.item-kind]#circuit#

This implementation returns the same URI for *all* token types.
It relies on the token type ID substitution mechanism defined in the EIP: {erc1155-metadata}.
Comment thread
andrew-fleming marked this conversation as resolved.
Clients calling this function must replace the `\{id\}` substring with the actual token type ID.

Requirements:

- Contract is initialized.

[.contract-item]
[[MultiTokenModule-balanceOf]]
==== `[.contract-item-name]#++balanceOf++#++(account: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>) → Uint<128>++` [.item-kind]#circuit#

Returns the amount of `id` tokens owned by `account`.

Requirements:

- Contract is initialized.



[.contract-item]
[[MultiTokenModule-setApprovalForAll]]
==== `[.contract-item-name]#++setApprovalForAll++#++(operator: Either<ZswapCoinPublicKey, ContractAddress>, approved: Boolean) → []++` [.item-kind]#circuit#

Enables or disables approval for `operator` to manage all of the caller's assets.

Requirements:

- Contract is initialized.
- `operator` is not the zero address.


[.contract-item]
[[MultiTokenModule-isApprovedForAll]]
==== `[.contract-item-name]#++balanceOf++#++(account: Either<ZswapCoinPublicKey, ContractAddress>, operator: Either<ZswapCoinPublicKey, ContractAddress>) → Boolean++` [.item-kind]#circuit#

Queries if `operator` is an authorized operator for `owner`.

Requirements:

- Contract is initialized.


[.contract-item]
[[MultiTokenModule-transferFrom]]
==== `[.contract-item-name]#++transferFrom++#++(from: Either<ZswapCoinPublicKey, ContractAddress>, to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>) → []++` [.item-kind]#circuit#

Transfers ownership of `value` amount of `id` tokens from `from` to `to`.
The caller must be `from` or approved to transfer on their behalf.

NOTE: Transfers to contract addresses are currently disallowed until contract-to-contract interactions are supported in Compact.
This restriction prevents assets from being inadvertently locked in contracts that cannot currently handle token receipt.

Requirements:

- Contract is initialized.
- `to` is not a ContractAddress.
- `to` is not the zero address.
- `from` is not the zero address.
- Caller must be `from` or approved via `setApprovalForAll`.
- `from` must have an `id` balance of at least `value`.

[.contract-item]
[[MultiTokenModule-_transfer]]
==== `[.contract-item-name]#++_transfer++#++(from: Either<ZswapCoinPublicKey, ContractAddress>, to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>)++` [.item-kind]#circuit#

Transfers ownership of `value` amount of `id` tokens from `from` to `to`.
Does not impose restrictions on the caller, making it suitable for composition in higher-level contract logic.

NOTE: Transfers to contract addresses are currently disallowed until contract-to-contract interactions are supported in Compact.
This restriction prevents assets from being inadvertently locked in contracts that cannot currently handle token receipt.

Requirements:

- Contract is initialized.
- `to` is not a ContractAddress.
- `to` is not the zero address.
- `from` is not the zero address.
- `from` must have an `id` balance of at least `value`.

[.contract-item]
[[MultiTokenModule-_update]]
==== `[.contract-item-name]#++_update++#++(from: Either<ZswapCoinPublicKey, ContractAddress>, to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>)++` [.item-kind]#internal#

Transfers a value amount of tokens of type id from from to to.
This circuit will mint (or burn) if `from` (or `to`) is the zero address.

Requirements:

- Contract is initialized.
- If `from` is not zero, the balance of `id` of `from` must be >= `value`.

[.contract-item]
[[MultiTokenModule-_unsafeTransferFrom]]
==== `[.contract-item-name]#++_unsafeTransferFrom++#++(from: Either<ZswapCoinPublicKey, ContractAddress>, to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>) → []++` [.item-kind]#circuit#

Unsafe variant of <<MultiTokenModule-transferFrom,transferFrom>> which allows transfers to contract addresses.
The caller must be `from` or approved to transfer on their behalf.

WARNING: Transfers to contract addresses are considered unsafe because contract-to-contract calls are not currently supported. Tokens sent to a contract address may become irretrievable.
Once contract-to-contract calls are supported, this circuit may be deprecated.

Requirements:

- Contract is initialized.
- `to` is not the zero address.
- `from` is not the zero address.
- Caller must be `from` or approved via `setApprovalForAll`.
- `from` must have an `id` balance of at least `value`.

[.contract-item]
[[MultiTokenModule-_unsafeTransfer]]
==== `[.contract-item-name]#++_unsafeTransfer++#++(from: Either<ZswapCoinPublicKey, ContractAddress>, to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>) → []++` [.item-kind]#circuit#

Unsafe variant of <<MultiTokenModule-_transfer,_transfer>> which allows transfers to contract addresses.
Does not impose restrictions on the caller, making it suitable as a low-level building block for advanced contract logic.

WARNING: Transfers to contract addresses are considered unsafe because contract-to-contract calls are not currently supported. Tokens sent to a contract address may become irretrievable.
Once contract-to-contract calls are supported, this circuit may be deprecated.

Requirements:

- Contract is initialized.
- `from` is not the zero address.
- `to` is not the zero address.
- `from` must have an `id` balance of at least `value`.

[.contract-item]
[[MultiTokenModule-_setURI]]
==== `[.contract-item-name]#++_setURI++#++(newURI: Opaque<"string">) → []++` [.item-kind]#circuit#

Sets a new URI for all token types, by relying on the token type ID substitution mechanism defined in the MultiToken standard.
See https://eips.ethereum.org/EIPS/eip-1155#metadata.

By this mechanism, any occurrence of the `\{id\}` substring
in either the URI or any of the values in the JSON file at said URI will be replaced by clients with the token type ID.

For example, the `https://token-cdn-domain/\{id\}.json` URI would be interpreted by clients as
`https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` for token type ID 0x4cce0.

Requirements:

- Contract is initialized.

[.contract-item]
[[MultiTokenModule-_mint]]
==== `[.contract-item-name]#++_mint++#++(to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>) → []++` [.item-kind]#circuit#

Creates a `value` amount of tokens of type `token_id`, and assigns them to `to`.

NOTE: Transfers to contract addresses are currently disallowed until contract-to-contract interactions are supported in Compact.
This restriction prevents assets from being inadvertently locked in contracts that cannot currently handle token receipt.

Requirements:

- Contract is initialized.
- `to` is not the zero address.
- `to` is not a ContractAddress

[.contract-item]
[[MultiTokenModule-_unsafeMint]]
==== `[.contract-item-name]#++_unsafeMint++#++(to: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>) → []++` [.item-kind]#circuit#

Unsafe variant of `_mint` which allows transfers to contract addresses.

WARNING: Transfers to contract addresses are considered unsafe because contract-to-contract calls are not currently supported.
Tokens sent to a contract address may become irretrievable.
Once contract-to-contract calls are supported, this circuit may be deprecated.

Requirements:

- Contract is initialized.
- `to` is not the zero address.

[.contract-item]
[[MultiTokenModule-_burn]]
==== `[.contract-item-name]#++_burn++#++(from: Either<ZswapCoinPublicKey, ContractAddress>, id: Uint<128>, value: Uint<128>) → []++` [.item-kind]#circuit#

Destroys a `value` amount of tokens of type `token_id` from `from`.

Requirements:

- Contract is initialized.
- `from` is not the zero address.
- `from` must have an `id` balance of at least `value`.

[.contract-item]
[[MultiTokenModule-_setApprovalForAll]]
==== `[.contract-item-name]#++_setApprovalForAll++#++(owner: Either<ZswapCoinPublicKey, ContractAddress>, operator: Either<ZswapCoinPublicKey, ContractAddress>, approved: Boolean) → []++` [.item-kind]#circuit#

Enables or disables approval for `operator` to manage all of the caller's assets.
This circuit does not check for access permissions but can be useful as a building block for more complex contract logic.

Requirements:

- Contract is initialized.
- `operator` is not the zero address.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/api/ownable.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "./node_modules/@openzeppelin-compact/ownable" prefix Ownable_;

[.contract]
[[Ownable]]
=== `++Ownable++` link:https://github.com/OpenZeppelin/midnight-contracts/blob/add-ownable/contracts/ownable/src/Ownable.compact[{github-icon},role=heading-link]
=== `++Ownable++` link:https://github.com/OpenZeppelin/compact-contracts/blob/main/contracts/ownable/src/Ownable.compact[{github-icon},role=heading-link]

[.contract-index]
.Circuits
Expand Down
Loading