Skip to content
Merged
Changes from 1 commit
Commits
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
14 changes: 7 additions & 7 deletions contracts/token/ERC1155/ERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IER
return _operatorApprovals[account][operator];
}

/// @inheritdoc IERC1155
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
function _checkAuthorized(address from) internal view {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
}

/// @inheritdoc IERC1155
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
_checkAuthorized(from);
_safeTransferFrom(from, to, id, value, data);
}

Expand All @@ -112,13 +116,9 @@ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IER
uint256[] memory values,
bytes memory data
) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_checkAuthorized(from);
_safeBatchTransferFrom(from, to, ids, values, data);
}

/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
* (or `to`) is the zero address.
Expand Down
Loading