-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathERC721Common.sol
54 lines (45 loc) · 1.55 KB
/
ERC721Common.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title ERC721Common
* ERC721Common - ERC721 contract with basic functionality and AccessControl
*/
abstract contract ERC721Common is ERC721, AccessControl {
using SafeMath for uint256;
constructor(
string memory _name,
string memory _symbol
) ERC721(_name, _symbol) {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
/**
* @dev Returns the base uri used for all the tokens
*/
function baseTokenURI() virtual public pure returns (string memory);
/**
* @dev Returns the tokenURI for the tokenId, which is just baseTokenURI + tokenId
* @param _tokenId the tokenId
*/
function tokenURI(uint256 _tokenId) override public pure returns (string memory) {
return string(abi.encodePacked(baseTokenURI(), Strings.toString(_tokenId)));
}
/**
* @dev verifies if the interfaceId passed in is supported
* Must be implemented here due to Solidity limitations
* @param interfaceId interface being supported
*/
function supportsInterface(bytes4 interfaceId)
public
virtual
view
override(ERC721, AccessControl)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}