ERC721 Contracts Wizard: Adding Contract Level Metadata & Royalties?

Hi there,

Long-time lurker, first time poster.

I have been playing around with Contracts Wizard and this great tutorial for ERC721 contracts – these are amazing resources!

I can’t believe they are free.

I am trying to implement:

  1. Contract level metadata so "description", "image", external_link": etc show up on marketplaces, particularly OpenSea; and

  2. Royalty price and royalty payout address in the contract

I have done an extensive search of the forums and nothing has addressed this already, so hoping this thread will shed some light.

###

1) I have added the following lines in Remix:

string _contractURI = "https://MY-CONTRACTURI-METADATA.com"

function contractURI() public view returns (string memory) {

return _contractURI;

}

This actually successfully allows contract level metadata to shows up on OpenSea!

However, OpenSea doesn’t refresh from the JSON URI after the first time – it seems to be set once and cannot be changed.
Is this correct? OpenSea documentation and forums do not offer any advice.

Next, the code compiles and deploys correctly to testnets, but it doesn’t load the ABI interface for read and write contract like the example code given in Contracts Wizard etc.

If I remove that string and function and recompile and redeploy the contract to testnets (ie just like the example code given in Contracts Wizard etc), the ABI interface for read and write contract LOADS.

What am I doing incorrectly here?

2) I have added the following lines in Remix

import "@openzeppelin/contracts@4.5.0/token/ERC721/extensions/ERC721Royalty.sol";

import "@openzeppelin/contracts@4.5.0/interfaces/IERC2981.sol";

What function code do I need to also use to set royalty price and royalty payout address in the contract?

Is it as simple as adding the following to contractURI metadata above?:

"seller_fee_basis_points": 100

fee_recipient": "0x ADDRESS GOES HERE"

Thanks for any insights you can provide :pray::pray::pray: