-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnftToken.sol
36 lines (26 loc) · 1.13 KB
/
nftToken.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol";
contract NFTMetadata {
mapping (uint256 => string) text;
}
contract newNFT is NFTokenMetadata, Ownable, NFTMetadata{
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() {
nftName = "Block Games Heart";
nftSymbol = "BHN";
}
function mint(address _to, string memory name, string memory description, string memory url) external returns (uint256){
_tokenIds.increment();
uint256 _tokenId = _tokenIds.current();
text[_tokenId] = string(abi.encodePacked("{name : ", name, ",image : ", url, ",description:",description," }"));
super._mint(_to, _tokenId);
return _tokenId;
}
function getMetadata(uint256 id) external view returns (string memory) {
return text[id];
}
}