diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5723294..bb3566937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- ERC721ReceiverComponent documentation (#945) + ### Changed - Bump scarb to v2.6.3 (#946) +### Fixed + +- ERC721ReceiverComponent mixin embeddable implementation name (#945) + ## 0.10.0 (2024-03-07) ### Added diff --git a/docs/modules/ROOT/pages/api/erc1155.adoc b/docs/modules/ROOT/pages/api/erc1155.adoc index 3f47880a1..543141853 100644 --- a/docs/modules/ROOT/pages/api/erc1155.adoc +++ b/docs/modules/ROOT/pages/api/erc1155.adoc @@ -182,11 +182,7 @@ NOTE: {src5-component-required-note} [.sub-index#ERC1155Component-Embeddable-Impls-ERC1155MetadataURIImpl] .ERC1155MetadataURIImpl * xref:#ERC1155Component-uri[`++uri(self, token_id)++`] --- -[.contract-index#ERC1155Component-Embeddable-Impls-camelCase] -.Embeddable implementations (camelCase) --- [.sub-index#ERC1155Component-Embeddable-Impls-ER1155CamelImpl] .ER1155CamelImpl * xref:#ERC1155Component-balanceOf[`++balanceOf(self, account, tokenId)++`] @@ -316,8 +312,6 @@ on the token type ID substitution mechanism Clients calling this function must replace the `\{id\}` substring with the actual token type ID. -==== camelCase Support - [.contract-item] [[ERC1155Component-balanceOf]] ==== `[.contract-item-name]#++balanceOf++#++(self: @ContractState, account: ContractAddress, tokenId: u256) → u256++` [.item-kind]#external# @@ -559,11 +553,7 @@ NOTE: {src5-component-required-note} .ERC1155ReceiverImpl * xref:#ERC1155ReceiverComponent-on_erc1155_received[`++on_erc1155_received(self, operator, from, token_id, value, data)++`] * xref:#ERC1155ReceiverComponent-on_erc1155_batch_received[`++on_erc1155_batch_received(self, operator, from, token_ids, values, data)++`] --- -[.contract-index#ERC1155ReceiverComponent-Embeddable-Impls-camelCase] -.Embeddable implementations (camelCase) --- .ERC1155ReceiverCamelImpl * xref:#ERC1155ReceiverComponent-onERC1155Received[`++onERC1155Received(self, operator, from, tokenId, value, data)++`] * xref:#ERC1155ReceiverComponent-onERC1155BatchReceived[`++onERC1155BatchReceived(self, operator, from, tokenIds, values, data)++`] @@ -590,9 +580,6 @@ Returns the `IERC1155Receiver` interface ID. Returns the `IERC1155Receiver` interface ID. -==== camelCase Support - - [.contract-item] [[ERC1155ReceiverComponent-onERC1155Received]] ==== `[.contract-item-name]#++onERC1155Received++#++(operator: ContractAddress, from: ContractAddress, token_id: u256, value: u256, data Span) -> felt252++` [.item-kind]#external# diff --git a/docs/modules/ROOT/pages/api/erc721.adoc b/docs/modules/ROOT/pages/api/erc721.adoc index 88cb19d14..32046ba0c 100644 --- a/docs/modules/ROOT/pages/api/erc721.adoc +++ b/docs/modules/ROOT/pages/api/erc721.adoc @@ -589,6 +589,8 @@ See <>. See <>. +== Receiver + [.contract] [[IERC721Receiver]] === `++IERC721Receiver++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.10.0/src/token/erc721/interface.cairo#L70-L79[{github-icon},role=heading-link] @@ -620,6 +622,70 @@ Interface for contracts that support receiving `safe_transfer_from` transfers. Whenever an IERC721 `token_id` token is transferred to this non-account contract via <> by `operator` from `from`, this function is called. +[.contract] +[[ERC721ReceiverComponent]] +=== `++ERC721ReceiverComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.10.0/src/token/erc721/erc721_receiver.cairo[{github-icon},role=heading-link] + +[.hljs-theme-dark] +```javascript +use openzeppelin::token::erc721::ERC721ReceiverComponent; +``` + +ERC721Receiver component implementing <>. + +NOTE: {src5-component-required-note} + +[.contract-index#ERC721ReceiverComponent-Embeddable-Mixin-Impl] +.{mixin-impls} + +-- +.ERCReceiverMixinImpl +* xref:#ERC721ReceiverComponent-Embeddable-Impls-ERC721ReceiverImpl[`++ERC721ReceiverImpl++`] +* xref:#ERC721ReceiverComponent-Embeddable-Impls-ERC721ReceiverCamelImpl[`++ERC721ReceiverCamelImpl++`] +* xref:api/introspection.adoc#SRC5Component-Embeddable-Impls[`++SRC5Impl++`] +-- + +[.contract-index#ERC721ReceiverComponent-Embeddable-Impls] +.Embeddable Implementations +-- +[.sub-index#ERC721ReceiverComponent-Embeddable-Impls-ERC721ReceiverImpl] +.ERC721ReceiverImpl +* xref:#ERC721ReceiverComponent-on_erc721_received[`++on_erc721_received(self, operator, from, token_id, data)++`] + +[.sub-index#ERC721ReceiverComponent-Embeddable-Impls-ERC721ReceiverCamelImpl] +.ERC721ReceiverCamelImpl +* xref:#ERC721ReceiverComponent-onERC721Received[`++onERC721Received(self, operator, from, tokenId, data)++`] +-- + +[.contract-index] +.Internal Functions +-- +.InternalImpl +* xref:#ERC721ReceiverComponent-initializer[`++initializer(self)++`] +-- + +==== Embeddable functions + +[.contract-item] +[[ERC721ReceiverComponent-on_erc721_received]] +==== `[.contract-item-name]#++on_erc721_received++#++(self: @ContractState, operator: ContractAddress, from: ContractAddress, token_id: u256, data Span) -> felt252++` [.item-kind]#external# + +Returns the `IERC721Receiver` interface ID. + +[.contract-item] +[[ERC721ReceiverComponent-onERC721Received]] +==== `[.contract-item-name]#++onERC721Received++#++(self: @ContractState, operator: ContractAddress, from: ContractAddress, token_id: u256, data Span) -> felt252++` [.item-kind]#external# + +See <>. + +==== Internal functions + +[.contract-item] +[[ERC721ReceiverComponent-initializer]] +==== `[.contract-item-name]#++initializer++#++(ref self: ContractState)++` [.item-kind]#internal# + +Registers the `IERC721Receiver` interface ID as supported through introspection. + == Presets [.contract] diff --git a/src/token/erc721/erc721_receiver.cairo b/src/token/erc721/erc721_receiver.cairo index 37839a8e5..017e08410 100644 --- a/src/token/erc721/erc721_receiver.cairo +++ b/src/token/erc721/erc721_receiver.cairo @@ -78,7 +78,7 @@ mod ERC721ReceiverComponent { } } - #[embeddable_as(ERC721ReceiverAMixinmpl)] + #[embeddable_as(ERC721ReceiverMixinImpl)] impl ERC721ReceiverMixin< TContractState, +HasComponent,