I'm trying to make a basic imageless NFT for Binance Smart Chain using remix.ethereum.org (for NFT identity verification purposes) but I've encountered a problem. Basically solidity version 0.8.2 or higher is required to use openzeppelin,
Sadly also solidity 0.8.19 or lower is required to not throw an "opcode 0x5f not defined" error. (As in this stack overflow answer invalid opcode: opcode 0x5f not defined).
So is making an NFT with remix for BSC possible?
My smart contract code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
// Import OpenZeppelin ERC721 contracts
// this is the problem, these contracts require solidity 0.8.2 or higher
// But 0.8.2 or higher gives an error, only 0.8.19 or lower will deploy
// but it wont deploy without 0.8.2 or higher so it wont deploy
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract MyNFT_z is ERC721("MyNFT_z", "NFTZ") {
struct NFT {
address owner;
string name;
uint256 mintNumber;
}
mapping (address => NFT) public nfts;
function createNFT(string memory name, uint256 mintNumber, address my_to) public payable {
NFT storage nft = nfts[msg.sender];
require(nft.mintNumber == 0);
nft.name = name;
nft.mintNumber = mintNumber;
_mint(my_to, mintNumber);// new line
}
}
How can I solve this? Is making an NFT with remix currently not possible on Binance Smart Chain? Is it a flaw with my contract code? I am brand new to NFTs, and need to get an NFT working on Binance Smart Chain. Any solutions would be much appreciated.