ERC721Mintable.sol 809 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. pragma solidity ^0.4.24;
  2. import "./ERC721Full.sol";
  3. import "../../access/roles/MinterRole.sol";
  4. /**
  5. * @title ERC721Mintable
  6. * @dev ERC721 minting logic
  7. */
  8. contract ERC721Mintable is ERC721Full, 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. * @return A boolean that indicates if the operation was successful.
  14. */
  15. function mint(
  16. address to,
  17. uint256 tokenId
  18. )
  19. public
  20. onlyMinter
  21. returns (bool)
  22. {
  23. _mint(to, tokenId);
  24. return true;
  25. }
  26. function mintWithTokenURI(
  27. address to,
  28. uint256 tokenId,
  29. string tokenURI
  30. )
  31. public
  32. onlyMinter
  33. returns (bool)
  34. {
  35. mint(to, tokenId);
  36. _setTokenURI(tokenId, tokenURI);
  37. return true;
  38. }
  39. }