I have read almost all the docs available about proxying, but I still don't understand one thing, in the deployProxy
method, where does the factory of the proxy contract go? Because we have 2 contracts (Proxy + Implementation). But the method only asks for one: the implementation. So where is the Proxy contract definition go? You can't deploy without it because the Proxy will hold the state variables.
async function deployProxy(
Contract: ethers.ContractFactory,
args: unknown[] = [],
opts?: {
initializer?: string | false,
unsafeAllow?: ValidationError[],
constructorArgs?: unknown[],
initialOwner?: string,
timeout?: number,
pollingInterval?: number,
redeployImplementation?: 'always' | 'never' | 'onchange',
txOverrides?: ethers.Overrides,
kind?: 'uups' | 'transparent',
useDefenderDeploy?: boolean,
},
): Promise<ethers.Contract>
As you can see above, it only asks for 1 factory contract (the Implementation), but it should be asking for both, otherwise, how does it know which contract is going to delegate-call into implementation?
Contract: ethers.ContractFactory,
<--- this is the implementation, where do I put the factory for the Proxy ?
Naturally , I would expect deployProxy()
method to be defined like this:
async function deployProxy(
ProxyContract: ethers.ContractFactory,
ImplementationContract: ethers.ContractFactory,
args: unknown[] = [],
opts?: {
initializer?: string | false,
unsafeAllow?: ValidationError[],
constructorArgs?: unknown[],
initialOwner?: string,
timeout?: number,
pollingInterval?: number,
redeployImplementation?: 'always' | 'never' | 'onchange',
txOverrides?: ethers.Overrides,
kind?: 'uups' | 'transparent',
useDefenderDeploy?: boolean,
},
): Promise<ethers.Contract>
This would make a better sense, wouldn't it??
I am implementing the UUPS proxy type, already have my contracts, but don't understand how to deploy them with only one factory object. Can somebody enlighten me?