Complete interrupted upgradable contract installation

I have an upgradable smart contract that I deploy on each chain with the same unused key pair in order to get the same deployment address on each chain.

The deployment is carried out using hardhat and the OZ library code

On Mumbai, due to the weird gas pricing, the first transaction took forever to be confirmed and timed out after the first contract was deployed. I have since verified the contract that was actually deployed.

Is there any way to complete the deployment of the other two contracts rather than starting over which would cause the contract address to be wrong?

You can see the contract at 0x1e8150050A7a4715aad42b905C08df76883f396F on

  • ETH
  • Goerli
  • Polygon

but looking at the deployer key on Mumbai you will see that only the business logic was deployed

:computer: Environment

Hardhat

You can use the different available functions for the Hardhat upgrades plugin to perform various steps of your deployment.

If the implementation was already deployed, and you just want to deploy a proxy, you can use the useDeployedImplementation option when calling deployProxy to ensure that it does not redeploy the implementation.

Are there any examples of using options in javascript?

I tried

        const reg = await upgrades.deployProxy(
            REG, 
            [],
            (
                useDeployedImplementation:true
            )
        );

by VS Code shows a warning
Type annotations can only be used in TypeScript files.ts(8010)

The options should be provided with {} instead of ()

const reg = await upgrades.deployProxy(
            REG, 
            [],
            {
                useDeployedImplementation:true
            }
        );

I tested this with my currently installed version

    "@openzeppelin/contracts": "^4.6.0",
    "@openzeppelin/contracts-upgradeable": "^4.6.0",
    "@openzeppelin/hardhat-upgrades": "^1.17.0",

and functions like deployImplementation and the useDeployedImplementation:true option do not exist.

(error on first, deploys regardless on the second)

Is it safe to update these in order to get the required functions ?

Update @openzeppelin/hardhat-upgrades and @openzeppelin/upgrades-core (which @openzeppelin/hardhat-upgrades depends on) to the latest versions. The latest versions can be viewed at https://github.com/OpenZeppelin/openzeppelin-upgrades/releases

1 Like

Works like a dream. Thanks.

1 Like