Deploy a proxy programmatically


I'm writing a contract in which we wanna deploy a simple contract for which we wanna enable upgradable.

Like below

contract InstanceContract {


contract MasterContract {

    function newInstance() {
       InstanceContract instance = InstanceContract();
       ERC1967Proxy proxy = ERC1967Proxy(instance, someInitialData)
  • Is there any caveat we should take care?
  • My understanding is that ERC1967Proxy will auto set the caller as admin. Then the MasterContract will be the admin right?


This would be a proxy factory. See this thread for some examples/discussion on proxy factories.

1 Like