@@ -7,29 +7,34 @@ import "./ERC721ABC.sol";
77/// @custom:security-contact [email protected] 88contract M3ter is ERC721ABC , IM3ter {
99 bytes32 public constant REGISTRAR_ROLE = keccak256 ("REGISTRAR_ROLE " );
10- uint256 private _nextTokenId;
10+ bytes32 public constant MINTER_ROLE = keccak256 ("MINTER_ROLE " );
11+ uint256 public nextTokenId;
1112
12- mapping (uint256 => bytes32 ) public token_to_key ;
13- mapping (bytes32 => uint256 ) public key_to_token ;
13+ mapping (uint256 => bytes32 ) public keyByToken ;
14+ mapping (bytes32 => uint256 ) public tokenByKey ;
1415
1516 constructor () ERC721 ("M3ter " , "M3R " ) {
1617 _grantRole (DEFAULT_ADMIN_ROLE, msg .sender );
1718 _grantRole (REGISTRAR_ROLE, msg .sender );
19+ _grantRole (MINTER_ROLE, msg .sender );
1820 _grantRole (PAUSER_ROLE, msg .sender );
1921 }
2022
21- function safeMint (address to , string memory uri ) public whenNotPaused {
22- uint256 tokenId = _nextTokenId++ ;
23+ function safeMint (
24+ address to ,
25+ string memory uri
26+ ) external onlyRole (MINTER_ROLE) whenNotPaused {
27+ uint256 tokenId = nextTokenId++ ;
2328 _setTokenURI (tokenId, uri);
2429 _safeMint (to, tokenId);
2530 }
2631
27- function _register (
32+ function register (
2833 uint256 tokenId ,
2934 bytes32 publicKey
30- ) external onlyRole (REGISTRAR_ROLE) {
31- token_to_key [tokenId] = publicKey;
32- key_to_token [publicKey] = tokenId;
35+ ) external onlyRole (REGISTRAR_ROLE) whenNotPaused {
36+ keyByToken [tokenId] = publicKey;
37+ tokenByKey [publicKey] = tokenId;
3338 emit Register (tokenId, publicKey, msg .sender , block .timestamp );
3439 }
3540}
0 commit comments