How does the proxy created by ProxyFactory work?

Hi all. Not sure if this deserves it’s own issue but it’s on the topic of minimal proxies (Issues initializing EIP-1167 minimal proxies deployed with factory contract). I’m understanding how the deployMinimal function works in the ProxyFactory contract to deploy proxies, but I don’t understand how the proxy that is created works since the examples I’ve seen do not have the implementation contract (the one you are making clones of) inheriting the Proxy contract which has the delegatecall functionality.

Looking at the example listed above, the Forwarder.sol contract, is not inheriting the OpenZeppelin Proxy contract. If the Forwarder contract had additional functions that the proxy owner could call, how do those calls get forwarded to the deployed implementation contract?

1 Like

Hi @kseniya,

The minimal proxy is a simple contract that just delegates all calls to a logic contract. A delegate call is similar to a regular call, except that all code is executed in the context of the caller, not of the callee. Meaning that the state is with the minimal proxy and there can be multiple minimal proxies all pointing to the one logic contract.

The logic contract doesn’t need any proxy functionality. The only thing it may need is an initialize function, and so can inherit from Initializable to use the initializer modifier to ensure that initialize is only called once.

I suggest reading (if you haven’t already): Deep dive into the Minimal Proxy contract

Feel free to ask all the questions that you need.