0

When I try to deploy this smart contract address Using Remix IDE with Injected Provider Metamask wallet (Polygon Mumbai testnet)

//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
import "./ERC721.sol";
contract ComicBookCollection {
    ERC721Template public nftTemp;
   struct Data {
        address owner;
        string uri;
        string name;
        string symbol;
        uint256 totalSupply;
        uint256 mintPrice;
    }
    struct CollectionsbyOwner {
        address[] nftcollections;
    }
    // owner to collection to collectiondata
    mapping(address => mapping(address => Data)) public CollectionRecords;
    // owner address to collection
    mapping(address => CollectionsbyOwner) CollectionOwner;

    modifier isOwner(address _nftCollection) {
        Data memory data = CollectionRecords[msg.sender][_nftCollection];
        require(data.owner == msg.sender, "You are not the owner");
        _;
    }
    function createCollection(
        string memory _name,
        string memory _uri,
        uint256 _totalSupply,
        uint256 _mintPrice,
        uint256 _startDate,
        uint256 _expirationDate
    ) public {
        nftTemp = new ERC721Template(_name, _uri, _totalSupply, _mintPrice, _startDate, _expirationDate);
        CollectionsbyOwner storage tempCollections =  CollectionOwner[msg.sender];
        tempCollections.nftcollections.push(address(nftTemp));
        transferOwner(msg.sender, address(nftTemp));
    }
    function getCollections(address _owner) public view returns(CollectionsbyOwner memory){
        return CollectionOwner[_owner];
    }
    function updatePrice(uint256 _newPrice, address _nftCollection)
        public
        isOwner(_nftCollection)
    {
        CollectionRecords[msg.sender][_nftCollection].mintPrice = _newPrice;
    }
    function updateUri(string memory _newUri, address _nftCollection)
        public
        isOwner(_nftCollection)
    {
        CollectionRecords[msg.sender][_nftCollection].uri = _newUri;
    }
    function transferOwner(address newOwner, address _nftCollection)
        internal
    {
        CollectionRecords[msg.sender][_nftCollection].owner = newOwner;
        ERC721Template(_nftCollection).transferOwnership(newOwner);
    }
}

I got this error enter image description here

1 Answer 1

0

This is because solidity 0.8.20 introduces the PUSH0(0x5f) opcode which is only supported on the ETH mainnet and not on any other chains. That's why other chains can't find the PUSH0(0x5f) opcode and throw this error.

Consider using 0.8.19 for other chains.

You can change the compiler version here in remix: enter image description here

This should solve your problem.

If you want to learn more about PUSH0 opcode you can check this small article which explains it pretty well. https://www.zaryabs.com/push0-opcode/

Your Answer

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

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