When using Clones.sol to create new clones of a reference project, what is the most gas-efficient way to initialise the new contract?
I see that the deprecated deployMinimal method from ProxyFactory.sol used to allow a caller to pass _data into the method, which seemed to then create the "clone" in what appears to be a very gas efficient way.
I am now using the clone method from Clones.sol, which leaves me apparently with only the following sort of option:
address newOxCartAddress = Clones.clone(referenceOxCartAddress); // Create clone
IOxCart oxCart = IOxCart(newOxCartAddress); // Load the cloned contract
oxCart.initialize(address(this)); // Call the initialize function on clone
I can't help but feel as if this isn't ideal from a gas-consumption perspective, is there a better approach?
Hey, sorry for digging out this convo, but I'm struggling with the clone proxy. I can't choose the owner of the cloned contract and I tried all possibles solutions on google. Can you share your code for me to understand please ?
Thank you for the reply,
I have an other problem just before that:
"Expected identifier but got '='" on IStorage storage = Istorage(newStorage);
Do you have an idea of why ?