HardHat Upgrades plugin: How to deploy and upgrade a UUPS proxy

The documentation for Hardhat Deploy and update of a UUPS proxy is somewhat lacking.

Can anyone from the dev team confirm that using the standard deployProxy/upgradeProxy functions with an additional <kind : "uups"> opt is the correct way to handle a UUPS proxy.

That is:

:1234: Code to reproduce

//deploy a uups proxy:
    const _proxy = await upgrades.deployProxy(OrigContractFactory, [initialize -params-here], { 
              initializer: "initialize",
              kind : "uups",

//upgrade a uups proxy:
    const _proxy = await upgrades.upgradeProxy(ORIG_PROXY_ADDRESS, NewContractFactory,  {
             kind : "uups"

:computer: Environment

The kind option is inferred if you do not specify it.
But since you know that you want to use a UUPS proxy, what you provided above looks correct.

great. thanks Eric.

BTW I assume the default inferred value is uups?

If the implementation has a function with signature upgradeTo(address) or upgradeToAndCall(address,bytes), then it is inferred as "uups", otherwise it is inferred as "transparent". This can be seen in the code here.

And when upgrading a proxy with upgradeProxy, the kind (whether manually specified or inferred) must match with what was previously recorded in the network file for that proxy.

Got you. Thanks Eric

1 Like