22// Compatible with OpenZeppelin Contracts ^5.0.0
33pragma solidity ^ 0.8.20 ;
44
5+ import { AccessControlEnumerable } from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol " ;
56import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol " ;
6- import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol " ;
77import { ERC1155 } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol " ;
88
9+ import { IERC1155Common } from "./interfaces/IERC1155Common.sol " ;
910import { ERC1155Burnable } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol " ;
1011import { ERC1155Pausable } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol " ;
1112import { ERC1155Supply } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol " ;
1213import { Strings } from "@openzeppelin/contracts/utils/Strings.sol " ;
13- import { IERC1155Common } from "./interfaces/IERC1155Common.sol " ;
1414
1515contract ERC1155Common is
1616 ERC1155 ,
@@ -44,7 +44,9 @@ contract ERC1155Common is
4444 * Requirements:
4545 * - the caller must have the `URI_SETTER_ROLE`.
4646 */
47- function setURI (string memory newURI ) external onlyRole (URI_SETTER_ROLE) {
47+ function setURI (
48+ string memory newURI
49+ ) external onlyRole (URI_SETTER_ROLE) {
4850 _setURI (newURI);
4951 }
5052
@@ -72,11 +74,12 @@ contract ERC1155Common is
7274 }
7375
7476 /// @inheritdoc IERC1155Common
75- function mintBatch (address to , uint256 [] calldata ids , uint256 [] calldata amounts , bytes calldata data )
76- public
77- virtual
78- onlyRole (MINTER_ROLE)
79- {
77+ function mintBatch (
78+ address to ,
79+ uint256 [] calldata ids ,
80+ uint256 [] calldata amounts ,
81+ bytes calldata data
82+ ) public virtual onlyRole (MINTER_ROLE) {
8083 _mintBatch (to, ids, amounts, data);
8184 }
8285
@@ -85,11 +88,12 @@ contract ERC1155Common is
8588 * Requirements:
8689 * - the caller must have the `MINTER_ROLE`.
8790 */
88- function bulkMint (uint256 id , address [] calldata tos , uint256 [] calldata amounts , bytes [] calldata datas )
89- public
90- virtual
91- onlyRole (MINTER_ROLE)
92- {
91+ function bulkMint (
92+ uint256 id ,
93+ address [] calldata tos ,
94+ uint256 [] calldata amounts ,
95+ bytes [] calldata datas
96+ ) public virtual onlyRole (MINTER_ROLE) {
9397 uint256 length = tos.length ;
9498 require (length != 0 && length == amounts.length && length == datas.length , "ERC1155: invalid array lengths " );
9599
@@ -101,7 +105,9 @@ contract ERC1155Common is
101105 /**
102106 * @dev See {ERC1155-uri}.
103107 */
104- function uri (uint256 tokenId ) public view virtual override returns (string memory ) {
108+ function uri (
109+ uint256 tokenId
110+ ) public view virtual override returns (string memory ) {
105111 string memory uri_ = super .uri (tokenId);
106112 return string .concat (uri_, tokenId.toString ());
107113 }
@@ -119,27 +125,21 @@ contract ERC1155Common is
119125 /**
120126 * @dev See {ERC165-supportsInterface}.
121127 */
122- function supportsInterface (bytes4 interfaceId )
123- public
124- view
125- virtual
126- override (IERC165 , ERC1155 , AccessControlEnumerable)
127- returns (bool )
128- {
128+ function supportsInterface (
129+ bytes4 interfaceId
130+ ) public view virtual override (IERC165 , ERC1155 , AccessControlEnumerable) returns (bool ) {
129131 return interfaceId == type (IERC1155Common ).interfaceId || super .supportsInterface (interfaceId);
130132 }
131133
132134 /**
133- * @dev See {ERC1155-_beforeTokenTransfer }.
135+ * @dev See {ERC1155-_update }.
134136 */
135- function _beforeTokenTransfer (
136- address operator ,
137+ function _update (
137138 address from ,
138139 address to ,
139140 uint256 [] memory ids ,
140- uint256 [] memory amounts ,
141- bytes memory data
142- ) internal virtual override (ERC1155 , ERC1155Pausable , ERC1155Supply ) {
143- super ._beforeTokenTransfer (operator, from, to, ids, amounts, data);
141+ uint256 [] memory values
142+ ) internal virtual override (ERC1155 , ERC1155Supply , ERC1155Pausable ) {
143+ super ._update (from, to, ids, values);
144144 }
145145}
0 commit comments