chiru-labs / ERC721A

https://ERC721A.org
MIT License
2.51k stars 842 forks source link

Unable to Import Deployed Goreli Contract Into OpenSea #411

Closed advra closed 2 years ago

advra commented 2 years ago

I made a contract based off erc721A 4.x. I deployed it to Goreli and minted fine. I wen to opensea to import the contract and when trying I ran into the notorious error "We couldn't find this contract. Please ensure that this is a valid ERC721 or ERC1155 contract deployed on Goerli and that you have already minted items on the contract".

image

So I deployed a lean contract based off 721A and arrived at the same error when trying to import it to opensea. Heres the deployed small contract address on Goreli Etherscan.

Anyone else ran into this issue lately?

advra commented 2 years ago

Looks like same issue with #354. Any new developments on this? Looks like somewhere in 721A v4.x the contract cannot import to opensea? Im using "erc721a": "^4.2.2",

Vectorized commented 2 years ago

@advra After a lil try and error, it seems that OpenSea checks if the tokenURI actually returns a non-empty string before considering the contract as valid.

Try this:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "erc721a/contracts/ERC721A.sol";
import "solady/src/utils/LibString.sol";

contract TryThis is ERC721A, Ownable {
    string private _tokenURI;

    constructor() ERC721A("Try", "THIS") {
        _tokenURI = "ipfs://QmQFkLSQysj94s5GvTHPyzTxrawwtjgiiYS2TBLgrvw8CW/{id}";
    }

    function mintMulti(uint256 quantity) public virtual onlyOwner {
        _mint(msg.sender, quantity);
    }

    function _startTokenId() internal view virtual override returns (uint256) {
        return 1;
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        return LibString.replace(_tokenURI, '{id}', _toString(tokenId));
    }

    function setTokenURI(string calldata value) external onlyOwner {
        _tokenURI = value;
    }
}

If all else fails, but you really wanna get it working on testnet, just contact OpenSea.

Tbh, I wouldn't worry too much. There are successful contracts on mainnet using v4.0+.

advra commented 2 years ago

So here's my original contract (https://goerli.etherscan.io/address/0xbeb9ab39d45672af96b634232141dfdf131cde84) which has a mapping id->uri. The uri is passed in mint()for each NFT. So it should have a valid URI since that us passed during mint.

advra commented 2 years ago

I've contacted opensea but it's been days with no response unfortunately.

Does anything in the second contract I linked have any implementation issues that opensea doesn't like?

Vectorized commented 2 years ago

Try Rinkeby Opensea.

advra commented 2 years ago

Wow that actually worked. Maybe opensea's checks on Goreli need to be updated on their end.

Thanks again @Vectorized. Closing this as its now resolved.