@@ -97,7 +97,7 @@ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IER
9797
9898 /// @inheritdoc IERC1155
9999 function safeTransferFrom (address from , address to , uint256 id , uint256 value , bytes memory data ) public virtual {
100- _checkAuthorized (from);
100+ _checkAuthorized (_msgSender (), from);
101101 _safeTransferFrom (from, to, id, value, data);
102102 }
103103
@@ -109,15 +109,14 @@ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IER
109109 uint256 [] memory values ,
110110 bytes memory data
111111 ) public virtual {
112- _checkAuthorized (from);
112+ _checkAuthorized (_msgSender (), from);
113113 _safeBatchTransferFrom (from, to, ids, values, data);
114114 }
115115
116- /// @dev Checks if the caller is authorized to transfer tokens from the given address. Reverts with {ERC1155MissingApprovalForAll} if not.
117- function _checkAuthorized (address from ) internal view virtual {
118- address sender = _msgSender ();
119- if (from != sender && ! isApprovedForAll (from, sender)) {
120- revert ERC1155MissingApprovalForAll (sender, from);
116+ /// @dev Checks if `operator` is authorized to transfer tokens owned by `owner`. Reverts with {ERC1155MissingApprovalForAll} if not.
117+ function _checkAuthorized (address operator , address owner ) internal view virtual {
118+ if (owner != operator && ! isApprovedForAll (owner, operator)) {
119+ revert ERC1155MissingApprovalForAll (operator, owner);
121120 }
122121 }
123122
0 commit comments