Skip to content

Commit 5161a4d

Browse files
committed
Document ERC1155 event differences (#4666)
(cherry picked from commit 793d92a3331538d126033cbacb1ee5b8a7d95adc)
1 parent 932fddf commit 5161a4d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ In this logic of removing hidden SLOADs, the `_isApprovedOrOwner` function was r
180180

181181
The `_exists` function was removed. Calls to this function can be replaced by `_ownerOf(tokenId) != address(0)`.
182182

183+
#### More about ERC1155
184+
185+
Batch transfers will now emit `TransferSingle` if the batch consists of a single token, while in previous versions the `TransferBatch` event would be used for all transfers initiated through `safeBatchTransferFrom`. Both behaviors are compliant with the ERC-1155 specification.
186+
183187
#### ERC165Storage
184188

185189
Users that were registering EIP-165 interfaces with `_registerInterface` from `ERC165Storage` should instead do so so by overriding the `supportsInterface` function as seen below:

contracts/token/ERC1155/IERC1155.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,12 @@ interface IERC1155 is IERC165 {
104104
/**
105105
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
106106
*
107-
*
108107
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
109108
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
110109
* Ensure to follow the checks-effects-interactions pattern and consider employing
111110
* reentrancy guards when interacting with untrusted contracts.
112111
*
113-
* Emits a {TransferBatch} event.
112+
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
114113
*
115114
* Requirements:
116115
*

0 commit comments

Comments
 (0)