90 lines
2.3 KiB
Solidity
90 lines
2.3 KiB
Solidity
|
// SPDX-License-Identifier: Mozilla Public License 2.0
|
||
|
pragma solidity ^0.8.17;
|
||
|
|
||
|
import "./BaseModular.sol";
|
||
|
import "./BaseERC721.sol";
|
||
|
|
||
|
contract ModularERC721 is
|
||
|
BaseModular,
|
||
|
BaseERC721
|
||
|
{
|
||
|
constructor(
|
||
|
string memory name,
|
||
|
string memory symbol,
|
||
|
string memory baseTokenURI
|
||
|
) BaseERC721(name, symbol, baseTokenURI) {
|
||
|
_setupRole(ADMIN_ROLE, _msgSender());
|
||
|
_setupRole(MINTER_ROLE, _msgSender());
|
||
|
_setupRole(PAUSER_ROLE, _msgSender());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev Creates a new token for `to`. Its token ID will be automatically
|
||
|
* assigned (and available on the emitted {IERC721-Transfer} event), and the token
|
||
|
* URI autogenerated based on the base URI passed at construction.
|
||
|
*
|
||
|
* See {ERC721-_mint}.
|
||
|
*
|
||
|
* Requirements:
|
||
|
*
|
||
|
* - the caller must have the `MINTER_ROLE`.
|
||
|
*/
|
||
|
function mintTo(address to) public virtual {
|
||
|
require(hasRole(MINTER_ROLE, _msgSender()), "ModularERC721: must have minter role");
|
||
|
_mintTo(to);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev Pauses all token transfers.
|
||
|
*
|
||
|
* See {ERC721Pausable} and {Pausable-_pause}.
|
||
|
*
|
||
|
* Requirements:
|
||
|
*
|
||
|
* - the caller must have the `PAUSER_ROLE`.
|
||
|
*/
|
||
|
function pause() public virtual {
|
||
|
require(hasRole(PAUSER_ROLE, _msgSender()), "ModularERC721: must have pauser role");
|
||
|
_pause();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev Unpauses all token transfers.
|
||
|
*
|
||
|
* See {ERC721Pausable} and {Pausable-_unpause}.
|
||
|
*
|
||
|
* Requirements:
|
||
|
*
|
||
|
* - the caller must have the `PAUSER_ROLE`.
|
||
|
*/
|
||
|
function unpause() public virtual {
|
||
|
require(hasRole(PAUSER_ROLE, _msgSender()), "ModularERC721: must have pauser role");
|
||
|
_unpause();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev See {IERC165-supportsInterface}.
|
||
|
*/
|
||
|
function supportsInterface(bytes4 interfaceId)
|
||
|
public
|
||
|
view
|
||
|
virtual
|
||
|
override(AccessControlEnumerable, BaseERC721)
|
||
|
returns (bool)
|
||
|
{
|
||
|
return super.supportsInterface(interfaceId);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev Burns `tokenId`.
|
||
|
*
|
||
|
* Requirements:
|
||
|
*
|
||
|
* - The caller must have the BURNER_ROLE role.
|
||
|
*/
|
||
|
function burnToken(uint256 tokenId) public {
|
||
|
require(hasRole(MINTER_ROLE, _msgSender()), "ModularERC721: must have burner role");
|
||
|
_burn(tokenId);
|
||
|
}
|
||
|
}
|