InvalidDeployment Error: No contract at address 0x... (Removed from manifest)

Hi guys,

I have been trying to deploy two upgradeable contracts to mumbai network but I am getting this error (with debug):

It is weird because about a week ago the deployment was successful with the same code. I believe there is some problem with the Admin Proxy address, it is not assigned correctly, but this is just thought.

The problem persists if I change the account.

If I try to deploy these same contracts to rinkeby, it works.

hardhat.config.js:

require('@nomiclabs/hardhat-waffle');
require('@openzeppelin/hardhat-upgrades');
const fs = require('fs');
require('dotenv').config();
const privateKey = process.env.PRIVATE_KEY || '';
const infuraId = process.env.INFURA_API_KEY || '';

module.exports = {
  defaultNetwork: 'hardhat',
  networks: {
    hardhat: {
      chainId: 1337,
    },
    development: {
      url: 'http://127.0.0.1:8545',
      chainId: 1337, // Match any network id
    },

    mumbai: {
      // Infura
      url: `https://polygon-mumbai.infura.io/v3/${infuraId}`,
      accounts: [privateKey],
    },
    matic: {
      // Infura
      url: `https://polygon-mainnet.infura.io/v3/${infuraId}`,
      accounts: [privateKey],
    },
  },
  solidity: {
    version: '0.8.4',
    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
    },
  },
};

deployment script:

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

async function main() {
  const NFTMarket = await ethers.getContractFactory('NFTMarket');
  console.log('Deploying contracts to: ' + hardhat.network.name + ' network');
  const nftMarket = await upgrades.deployProxy(NFTMarket, []);
  await nftMarket.deployed();
  console.log('nftMarket deployed to:', nftMarket.address);

  const NFT = await ethers.getContractFactory('NFT');
  const nft = await upgrades.deployProxy(NFT, [nftMarket.address]);
  await nft.deployed();
  console.log('nft deployed to:', nft.address);

  let config = `
  export const network = "${hardhat.network.name}"
  export const nftmarketaddress = "${nftMarket.address}"
  export const nftaddress = "${nft.address}"
  `;

  let config_scripts = `
  const nftmarketaddress = "${nftMarket.address}" 
  module.exports = { nftmarketaddress }
  `;

  let data = JSON.stringify(config);
  fs.writeFileSync('config.js', JSON.parse(data));

  let data_scripts = JSON.stringify(config_scripts);
  fs.writeFileSync('config-scripts.js', JSON.parse(data_scripts));
}

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

I would really appreciate your help, since this problem is difficulting the progress of the project.

Request any other file if you think is needed!

Thank you in advance.

2 Likes

Hi @MGM. Looking into this.

It's weird, I can see the transaction included in your screenshot (0xc6ce4...) but the contract that it creates is at a different address.

We're going to try to reproduce this error on Mumbai testnet.

Hi @frangio. I am having exactly the same issue. DeployProxy works with ropsten network but gives me errors when I try to deploy to mumbai. Appreciate any help. Thank you.

async function main() {
  const NFTMarket = await ethers.getContractFactory("GalaxyMarket");
  const nftMarket = await NFTMarket.deploy();
  await nftMarket.deployed();
  console.log("GalaxyMarket deployed to:", nftMarket.address);
  
  const starNFT = await ethers.getContractFactory("StarNFT");
  // const nft = await NFT.deploy(nftMarket.address);
  const nft = await upgrades.deployProxy(starNFT, [nftMarket.address], { initializer: 'initializeStarNFT' });
  await nft.deployed();
  console.log("StarNFT deployed to:", nft.address);

  let config = `
  exports.nftmarketaddress = "${nftMarket.address}"
  exports.nftaddress = "${nft.address}"
  exports.networkName = "${network.name}"
  exports.networkURL = "${network.config.url}"
  `
  let data = JSON.stringify(config)
  fs.writeFileSync('config.js', JSON.parse(data))
}

@Oleksii_Fedosov @MGM As a workaround for now, if you are using Infura, can you try Alchemy (or vice versa) and see if it makes any difference?

1 Like

Thank you. Alchemy provider deploy & upgrade is working

1 Like

@ericglau @frangio Working great with Alchemy provider. Thank you for your time, really appreciate your help.

2 Likes

This is fixed in @openzeppelin/hardhat-upgrades@1.12.1 and later. It should work with Infura as well now.

1 Like

I occur the same problem when deploying the contract to Optimism in development, I already use the latest 1.12.1 plugin.

InvalidDeployment [Error]: No contract at address 0x8A791620dd6260079BF849Dc5567aDC3F2FdC318 (Removed from manifest)
    at resumeOrDeploy (/Users/smallyu/work/gogs/savefs-contracts/node_modules/@openzeppelin/upgrades-core/src/deployment.ts:43:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /Users/smallyu/work/gogs/savefs-contracts/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:34:23
    at async Manifest.lockedRun (/Users/smallyu/work/gogs/savefs-contracts/node_modules/@openzeppelin/upgrades-core/src/manifest.ts:118:14)
    at async fetchOrDeployGeneric (/Users/smallyu/work/gogs/savefs-contracts/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:26:24)
    at async deployImpl (/Users/smallyu/work/gogs/savefs-contracts/node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy-impl.ts:60:16)
    at async Proxy.deployProxy (/Users/smallyu/work/gogs/savefs-contracts/node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts:35:28)
    at async main (/Users/smallyu/work/gogs/savefs-contracts/scripts/deploy.ts:16:16)

@smallyunet Please create a new thread and provide the information listed here.