forked from arpan-mondal/De-Fi-Sportify-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlbum.sol
28 lines (21 loc) · 962 Bytes
/
Album.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
contract NFT is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
address public owner;
constructor() ERC721("NonFungiMusic", "NFM") {
owner = msg.sender;
}
function createToken(string memory tokenURI) public returns (uint) {
require(msg.sender == owner, "Only owner is allowed to createTokens");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
}