Learn how to deploy contract clones (minimal proxies) with lower fees based on EIP 1167 in our upcoming workshop: Cheap contract deployment through Clones
Led by Hadrien Croubois - Smart Contract Engineer at OpenZeppelin
Saturday 27th February
Noon PT/3pm ET/8pm UTC
Workshop includes:
Typical use cases: Uniswap pairs & Argent wallets
Walkthrough building a contract factory using the Clones library
Gas cost comparisons
Create vs Create2, when to use each one
Comparison with other proxies
I wanted to ask if is there any way to clone contract and call constructor.
Iβve seen that it should be done by calling an initialization method after clone but it means that contract with constructor parameter canβt be cloned?
I mean, if we have two parameters like in the ERC20 contract, or we have a check on cap > 0 (in ERC20Capped), can we clone as they are or should we rewrite all of that contract to be initialized after creation?
Clones (minimal proxies) need to use initialize functions to initialize state. This is the same limitation as with upgradeable proxies. This means we can't clone a contract that doesn't have an initialization function as we don't have a way to initialize state.
See the following in the documentation on the constructor caveat: