|
@@ -1,12 +1,11 @@
|
|
// SPDX-License-Identifier: MIT
|
|
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)
|
|
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)
|
|
|
|
|
|
-pragma solidity ^0.8.0;
|
|
|
|
|
|
+pragma solidity ^0.8.1;
|
|
|
|
|
|
import "./IERC1155.sol";
|
|
import "./IERC1155.sol";
|
|
import "./IERC1155Receiver.sol";
|
|
import "./IERC1155Receiver.sol";
|
|
import "./extensions/IERC1155MetadataURI.sol";
|
|
import "./extensions/IERC1155MetadataURI.sol";
|
|
-import "../../utils/Address.sol";
|
|
|
|
import "../../utils/Context.sol";
|
|
import "../../utils/Context.sol";
|
|
import "../../utils/introspection/ERC165.sol";
|
|
import "../../utils/introspection/ERC165.sol";
|
|
|
|
|
|
@@ -18,8 +17,6 @@ import "../../utils/introspection/ERC165.sol";
|
|
* _Available since v3.1._
|
|
* _Available since v3.1._
|
|
*/
|
|
*/
|
|
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
|
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
|
- using Address for address;
|
|
|
|
-
|
|
|
|
// Mapping from token ID to account balances
|
|
// Mapping from token ID to account balances
|
|
mapping(uint256 => mapping(address => uint256)) private _balances;
|
|
mapping(uint256 => mapping(address => uint256)) private _balances;
|
|
|
|
|
|
@@ -344,7 +341,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
|
uint256 amount,
|
|
uint256 amount,
|
|
bytes memory data
|
|
bytes memory data
|
|
) private {
|
|
) private {
|
|
- if (to.isContract()) {
|
|
|
|
|
|
+ if (to.code.length > 0) {
|
|
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
|
|
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
|
|
if (response != IERC1155Receiver.onERC1155Received.selector) {
|
|
if (response != IERC1155Receiver.onERC1155Received.selector) {
|
|
revert("ERC1155: ERC1155Receiver rejected tokens");
|
|
revert("ERC1155: ERC1155Receiver rejected tokens");
|
|
@@ -365,7 +362,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
|
|
uint256[] memory amounts,
|
|
uint256[] memory amounts,
|
|
bytes memory data
|
|
bytes memory data
|
|
) private {
|
|
) private {
|
|
- if (to.isContract()) {
|
|
|
|
|
|
+ if (to.code.length > 0) {
|
|
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
|
|
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
|
|
bytes4 response
|
|
bytes4 response
|
|
) {
|
|
) {
|