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

We've published a new release of the Hardhat Upgrades plugin that fixes this issue. It should work with Infura as well now.

1 Like