0

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.

1 Answer 1

0

I have found a solution to my predicament. Here is an example of CryptoBears (MIT license), which has the OpenZeppelin code for NFTs at the top of the contract, allowing me to use Remix, and compile and deploy my contract. :)

https://etherscan.io/address/0xE020adb9e242702F1284440CF80dF635E9a458c3#code

2
  • 1
    Good to know that. Thanks for your sharing the solution. Best regards. Oct 31, 2023 at 17:52
  • @AriSetiawan No problem! :)
    – Adjam
    Feb 16 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.