Is it possible to deploy a "Clone" with args?

I notice that using clones to deploy is way cheaper than using "new" keyword. My use case is the following. I would like to deploy the following proxy:

ERC1967Proxy proxy = new ERC1967Proxy{
            salt: uniqueName, 
            value: msg.value

Is it possible to achieve the previous by using Clones?

My guess is that I will need to deploy first the proxy to use its address as "implementation" parameter for the Clone() function but my main concern is to pass value, args and methods within the deployment.

I can pass the salt with CloneDeterministic but Im dubious on the rest. Would love any guidance!

A clone works like an upgradable proxy, but is not upgradable. It's a method to save gas on deployment when you have to deploy multiple contracts of the same type.

You can use the function clone from the library ClonesUpgradeable to deploy clones

Thank you for the reply @helio.rosa . This is exactly my point. Would it be possible to deploy previously an ERC1967 proxy with a certain implementation and then try to clone it like this:

address ProxyAd = ClonesUpgradeable.clone(ProxyTemplate);    
    address payable ProxyAddress = payable (ProxyAd);
    ERC1967Proxy Proxy = ERC1967Proxy(ProxyAddress);

What are the implications?

Extra gas costs. A clone is essentially a non-upgradable proxy. don't see the point of using both. Just point the newly deployed proxy/clone to the already deployed implementation

The proxies deployed by the Clones library (EIP-1167 minimal proxies) do not support arguments.

Here is a project that has implemented something similar:

1 Like