I cannot upgrade my contract. first I used forceImport to generate json file. I deployed two same contracts before. But when I generate them. it shows 'Error: The following deployment clashes with an existing one at'.
If I ignore it. when I use upgrades.upgradeproxy to upgrade. The implements contract stays in very old one.
I upgrade one of them succeeded. But the other one always remains in very old one.
Code to reproduce
import { ethers, upgrades } from 'hardhat';
async function main() {
const signers = await ethers.getSigners();
const addr = await signers[0].getAddress();
console.log(`deployer address: ${addr}`);
const contract = await ethers.getContractFactory('MyContract');
const deployedProxyAddress = myAddress //eth mainnet
await upgrades.forceImport(deployedProxyAddress, contract)// if I annotated this line after it generated. It still cannot work.
const sbt = await upgrades.upgradeProxy(deployedProxyAddress, contract);
console.log(await upgrades.erc1967.getImplementationAddress(sbt.address), " getImplementationAddress")
console.log(await upgrades.erc1967.getAdminAddress(sbt.address), " getAdminAddress")
}
main().catch(error => {
console.log(error);
process.exitCode = 1;
})