ERC721MetadataMintable.sol 761 B

1234567891011121314151617181920212223242526272829303132
  1. pragma solidity ^0.4.24;
  2. import "./ERC721Metadata.sol";
  3. import "../../access/roles/MinterRole.sol";
  4. /**
  5. * @title ERC721MetadataMintable
  6. * @dev ERC721 minting logic with metadata
  7. */
  8. contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole {
  9. /**
  10. * @dev Function to mint tokens
  11. * @param to The address that will receive the minted tokens.
  12. * @param tokenId The token id to mint.
  13. * @param tokenURI The token URI of the minted token.
  14. * @return A boolean that indicates if the operation was successful.
  15. */
  16. function mintWithTokenURI(
  17. address to,
  18. uint256 tokenId,
  19. string tokenURI
  20. )
  21. public
  22. onlyMinter
  23. returns (bool)
  24. {
  25. _mint(to, tokenId);
  26. _setTokenURI(tokenId, tokenURI);
  27. return true;
  28. }
  29. }