I am trying to create an NFT creation site (ERC721) where any user could upload an NFT he wants he just needs to fill in details of "name","symbol" and "url". I'm having a problem I can't change the "name" and "symbol". After the first creation each user who uploads NFT is given the "name" and "symbol" of the first user filled in. I use the library of "openzeppelin"
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity >=0.6.0 <0.8.0;
import "../ERC721/ERC721.sol";
contract newNFT is ERC721 {
uint internal counterNFT;
constructor () public{
counterNFT = 1;
}
function mint(string memory uri,string memory name,string memory symbol) public {
name_symbol(name,symbol);
_safeMint(msg.sender, counterNFT);
_setTokenURI(counterNFT, uri);
counterNFT++;
}
}
** openzeppelin **
constructor () public {
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
function name_symbol(string memory nameNFT,string memory symbolNFT) internal virtual{
_name = nameNFT;
_symbol = symbolNFT;
}
I want to create a smart contract with which any user can easily upload NFT By "name" "symbol" and url he chooses. The problem is that the "name" and "symbol" do not change for me after the first user uploaded the NFT with his name and icon. Any user who comes after him and fills in the details will not change the "name" and "symbol" in "polygonscan" in the transaction.
For example the first user on a site that uploads NFT name = dragonBallZ symbol = Dragon url = wwwww.exmaple.co.il
In the first example everything will work well you can see in polygonscan the "name" and "symbol" that the user has selected.
Second user of the site: name = pokemon symbol = PK url = wwwww.exmaple.co.il
In the second example after a user has filled in details entering polygonscan only the name and icon will still be as in the first example they will not change that way any subsequent user will get the name and icon of the first example. And this is the problem I can not solve.
You are fully missunderstanding how name and symbol are supposed to work. They should identify the collection or the one NFT they will represent.
Say for example Bored Apes:
name="Bored Apes"
andsymbol = "BAYC"
. Then if I have the monkey smoking a cigar it's gonna be part of the metadata (the tokenURI) of that specific token ( for example Bored Ape #1344 withtokenURI="{smokes: true, smokeName: "cigar", hairColor:"black"}"
)So you shouldn't be chaning name and symbol for every mint.