Deploy an upgradeable contract. An error occurred during deployment. How to continue deployment?

@openzeppelin/hardhat-upgrades
When deploying an upgradeable contract, there is a proxy contract and a logic contract. However, the logic contract is deployed, but the proxy logic contract fails to deploy. How can I continue the deployment instead of restarting the deployment? Restarting the deployment will cause the contract address to be inconsistent with other networks.

1 Like

Can you provide the relevant code and the error you got.

2 Likes

If the logic contract was deployed but the proxy failed using @openzeppelin/hardhat-upgrades, a developer can continue deployment by manually deploying the proxy using the already deployed logic contract. Use deployProxy with the unsafeAllow flag if needed, or manually deploy using TransparentUpgradeableProxy by specifying the admin, initializer, and logic addresses. Use prepareUpgrade to ensure compatibility. Avoid redeploying the logic contract to maintain consistent addresses across networks. Developers should store deployment states in .json files to resume failed steps. Using hardhat-deploy or custom scripts helps developers handle and resume partial deployments efficiently.