Workshop: Cheap contract deployment through Clones - Saturday 27 February 2021

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

:calendar: Saturday 27th February
:clock12: Noon PT/3pm ET/8pm UTC

Workshop includes:
:page_facing_up: Typical use cases: Uniswap pairs & Argent wallets
:factory: Walkthrough building a contract factory using the Clones library
:fuelpump: Gas cost comparisons
:vs: Create vs Create2, when to use each one
:up: Comparison with other proxies

Register :point_down:

Really interesting. I joined.

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?

Thanks

1 Like

Hi @vittominacori,

We look forward to seeing you at the workshop.

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:

We would need to include an initialize function.