I’m having trouble with my ERC721 token collection on OpenSea testnet. After I transfer an NFT to another wallet, it doesn’t show up in the collected section even though the blockchain shows the correct owner.
Here’s my contract code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts@4.6.0/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts@4.6.0/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts@4.6.0/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts@4.6.0/utils/Counters.sol";
contract CRYPTOBEASTS is ERC721, ERC721Enumerable, ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenCounter;
uint256 TOTAL_LIMIT = 3000;
constructor() ERC721("CRYPTOBEASTS", "CBT") {}
function createToken(address recipient, string memory tokenURI) public {
uint256 newTokenId = _tokenCounter.current();
require(newTokenId <= TOTAL_LIMIT, "Maximum tokens already created!");
_tokenCounter.increment();
_safeMint(recipient, newTokenId);
_setTokenURI(newTokenId, tokenURI);
}
function _beforeTokenTransfer(address sender, address receiver, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(sender, receiver, tokenId);
}
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}
The contract works fine for minting and transferring tokens. I can use safeTransferFrom to move tokens between addresses. But when I check OpenSea after transferring a token, it doesn’t appear in the collected tab of the new owner’s account. The blockchain confirms the transfer happened correctly and shows the right owner, but OpenSea doesn’t display it. Has anyone else run into this problem with OpenSea testnet?