OpenZeppelin Upgrade Problem

Hey, I am getting this error when I want to upgrade my contract. The thing is that I didn't change any state variables. I just change some functions and their visibility/payable. Here is the script I used for upgrading:

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

async function main() {
  const NewVersion = await ethers.getContractFactory("MyContractV1");
  console.log("Upgrading...");
  await upgrades.upgradeProxy("MY PROXY ADDRESS IN HERE", NewVersion);
  console.log("Upgraded!")

}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

I solved the problem. I think the problem that was I deployed two different proxies. When I deleted the .openzeppelin directory then deploy version 1 and upgrade to version 2 there was no problem. Can anyone make an explanation for this issue? Am I missing something or is there bug on the plugin?

1 Like

Hm, can you share the source code for the contracts that caused this issue?