2

When does the function contractURI() take effect in a OpenSea NFT contract?

function contractURI() public view returns (string memory) {
    return "https://metadata-url.com/my-metadata";
}

Does it only take affect once the first time a NFT contract is loaded in Opensea? Or is it possible to make the ContractURI changeable to change the contract metadata after deployment? I tried to change it after deployment with

function setContractURI(string memory _contractURI) public onlyOwner {
    contractURI = string(
        abi.encodePacked(_contractURI, contractMetadataFilename)
    );
}

But in Opensea did not change anything after I set a new ContractURI

Thomas
  • 21
  • 3

1 Answers1

0

I found out what the problem was. It was a common problem not specific to the problem described above. But the solution to the common problem also solved the problem described above.

I used the ProxyRegistryAddress that was coded in 2_deploy_contracts.js in the opensea-creatures example (https://github.com/ProjectOpenSea/opensea-creatures). This was in January 2022. The address was 0xf57b2c51ded3a29e6891aba85459d600256cf317 f or Rinkeby

Now I tried to use a factory contract deployed in March 2022. I got the error

Couldn't get permission to approve these tokens for trading. Their contract might not be implemented correctly. Please contact the developer!

I again checked the ProxyRegistryAddress for Rinkeby in the 2_deploy_contract.js in the repository mentioned above. In them meantime it has changed to 0x1E525EEAF261cA41b809884CBDE9DD9E1619573A

I could not find any documentation in OpenSea where the current ProxyRegistryAddress for a given environment like Rinkeby is documented.

After this experience, I think it is a good idea to code a setter for the ProxyRegistryAddress to be able to change the address after the deployment of a contract.

With using the correct proxyRegistryAddress, a change of the contractURI of an already deployed contract will be reflected in OpenSea.

Pang
  • 9,564
  • 146
  • 81
  • 122
Thomas
  • 21
  • 3