I am using the OpenZeppelin Clones Library so that users of my dapp can create clones of my implementation contract. My dapp will be following the EIP-1167 standard.

For functionality, I will need to save the deployer address (of implementation contract). The way one would traditionally do this would be in the constructor, however clone contracts do not read the 'creation-code' and they only view 'runtime-code', so if I save deployer address using a constructor, the cloned contracts will not be able to access that saved variable (as far as I know).

The reason I want to save the deployer address is because I would like to be paid out a certain percentage of the balance of all the cloned contracts.

Can someone please tell me how I would go about saving the deployer address so that I can be paid out from the cloned contracts. I am also open to other means of going about this, so long as I am able to receive payments to my deployer address.

One idea I have is to store my deployer address (or any other personal address) as a variable in the implementation contract and divert all payments to that address. This would remove the need of having to set a deployer address in the constructor.

Would this be a good way to go about it or is there a more 'correct' method which I can use for this?

Any help would be greatly appreciated! Thanks in advance!

1 Answer 1


The most used method is having a initialize function in the implementation, where you can store "once and for all" your factory variable.

So for example, this is how the implementation may look:

contract Implementation {
    bool private initialized;

    address public deployer;   // aka the factory
    address public user;

    function initialize(address _user) public {
        require(!initialized, "Already initialized!");
        initialized = true;

        deployer = msg.sender;
        user = _user;


The initialize function must be called by the deployer (Factory) immediately after deploying the contract. Example:

interface IImplementation {
    function initialize(address) external;

contract Factory {
    address public implementation = 0x...;

    // an user calls this function to make a new contract (clone)
    function createNewContract() public {
        address newcontract = Clones.clone(implementation);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.