Cloned factory pattern for ERC721 contracts

I have an upgradeable ERC721 contract for a marketplace and its working is such that every time a new collection is to be deployed a new contract is created for that collection. Now, I this process is quiet costly gas wise. So, I want to know that if we use the cloned factory pattern will this also be deploying those same multiple contracts for different collections? What would be the advantages or disadvantages of using this approach?

If you use a factory pattern based on clones, the factory deploys proxy layers (defined by the clone contract) that delegate calls to an implementation contract (your ERC721 contract). Storage variables will live in the proxy contract and functions live in the implementation contract (which is only ever deployed once). You can expect to save >80% on your gas costs (at least that is what I have observed in my experience) using a clone pattern and functionality wise, you should not be able to tell the difference between your current implementation and the clone pattern.

The disadvantage is that the basic clone pattern is not upgradable, so you might consider the beacon proxy pattern.

1 Like

For an example of contract that uses this approach:

1 Like