Transparent Proxy - Proxy and Admin not deployed

Hello,

I deployed two contracts with the same results and I need some help if it's possible to recover at least one of these contracts as it appears it's not completed initialized.
The steps I did were to deploy the upgradeable contract to mainnet with a low gas fee, send a second transaction with higher fees then cancel the first transaction so the second one with higher fees could be completed.
The result is that the mainnet.json file will point to the first transaction proxy, which is dead since it was canceled.
The question is, are there any chances to fix one on the deployed contracts so we don't have to pay the high gas fees for the third time?

:1234: Code to reproduce

Mainnet.json with a snippet of proxy and two contracts (proxy points to the canceled transaction):

`  "manifestVersion": "3.2",
  "proxies": [],
  "impls": {
    "eda3a9598019f3a192085d1091e742dae6c9ff276e8508bed84cc3004c3ac847": {
      "address": "0x36382f97A998CEA8194ffADED3d7E51C257E745b",
      "txHash": "0x7cfbb4590122b1fabbd3b4f507496bc3f715d793972797d9e9fc6bd510602479",
      "layout": {
        "storage": [
          {
            "contract": "Initializable",
            "label": "_initialized",
.
.
.
 },
    "3ead3124807e426e513a7b0d80dfb5eb96995d8f824f253b1ba825ba3bedc3a7": {
      "address": "0xa47FdD697cbc04428dd3583A5CD16cc88b19B7b5",
      "txHash": "0xb7803b423f1affa426179cc326590d2cede4be8eae8d99e0b11b4305b6abd64b",
      "layout": {
        "storage": [
          {
            "contract": "Initializable",
            "label": "_initialized",
.
.
.
   },
    "45bed5eb153651e422858def5e5bc7a418113a9d3e89565b57791b0f16a89a21": {
      "address": "0x2026644f276BC1D2BDD08af91228194C52957151",
      "txHash": "0xc8691db33e6a3e1a0b2ebab228c0995627fb8ed469e126197ab6735d7fca5d0e",
      "layout": {
        "storage": [
          {
            "contract": "Initializable",
            "label": "_initialized",

Deployment script:

const { ethers, upgrades } = require("hardhat");

async function main() {

    const [deployer] = await ethers.getSigners();
    console.log("Deploying contracts with the account:", deployer.address);
    console.log("Account balance:", (await deployer.getBalance()).toString());

    const Metaframe = await ethers.getContractFactory("Metaframe");
    console.log("Starting deployment...");
    const metaframe = await upgrades.deployProxy(Metaframe,{ initializer: 'initialize' });
    console.log("Started waiting for confirmation...");
    await metaframe.deployed();
    console.log("Metaframe deployed to:", metaframe.address);
}

main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error);
        process.exit(1);
    });

:computer: Environment

Hardhat version 2.6.8
"@openzeppelin/contracts-upgradeable": "^4.3.2",

I could find and understand after reading more about the proxy deployments is that these are the stages:

  1. Deploy the implementation contract (our Box contract)
  2. Deploy the ProxyAdmin contract (the admin for our proxy).
  3. Deploy the proxy contract and run any initializer function.

As per the mainnet json above, I could see that steps 2 and 3 never ran, thus the json file is missing the admin and proxy information.

As an example this is what I have when I deployed to test network. Part that is missing in maiinet.json

  "admin": {
    "address": "0xB351E7492a5Ed29b2F1089b6b88e0151394049dd",
    "txHash": "0xf18c9206db3a311dd98e6db37fff39fd080c216d20dc70e2e6bc801dedfa36a6",
    "deployTransaction": {
      "hash": "0xf18c9206db3a311dd98e6db37fff39fd080c216d20dc70e2e6bc801dedfa36a6",
.
.
.
 "proxies": [
    {
      "address": "0x157d470f078b0Bd3BF02b214839F1320848F223e",
      "txHash": "0x06f7aab3f36970603288806385c1364dfde7010e0749b5364372388011b99ff3",
      "kind": "transparent"

Hello @rickcuri

First, there is no contract on mainnet at address 0x36382f97A998CEA8194ffADED3d7E51C257E745b, so I suggest you remove the corresponding entry from the manifest.

No if you decide to run your script multiple times, it should pick up the implementation (and proxy admin) being already deployed an skip step 1 (and 2). This is however only happening if the contract metadata is not modified.

The script should thus NOT redeploy the implementation, unless you change some of it, change the compiler settings, or even change where the source code is on your machine (this affects the metadata produced by the solc compiler :confused:).

You should test against a testnet (ganache, rinkeby, goerli, ...)

Thank you for your response @Amxx .
I removed the line and retried the deployment.
I had to do it twice thou since it timed out first but while the admin was being created then after it was completed I deployed again to have the proxyadmin created.
Again thank you for your time and this great project!