How to force deploy rather than upgrade?

I have a proxy contract I'e deployed. I'd like to create a new contract with a new address, but each time I try I just seem to get an upgrade. Is there some way to stop the hardhat plugin detecting that I have just changed a small part of my contract?

using code as below

  const instance = await upgrades.deployProxy(factory, [], {
    initializer: 'initialize',
    // @ts-ignore
    gasPrice,
  })

Hi, welcome to the community! :wave:

If you use the plugin @openzeppelin/hardhat-upgrades to deploy a proxy contract, I think you will get a new folder named .openzeppelin, it will contain a NETWORK.json, maybe georli.json or something else. All you deployed contracts are in this file, if you want to deploy a new implementation contract, you can clear the content in the filed impls, it is better to keep a backup.

1 Like

Fantastic, thanks so much for your help, I would have never found this!

I wonder how openzep keeps track of which impl. goes with which proxy though? The data only seems to keep records of the separate items, eg:

{
  "manifestVersion": "3.2",
  "proxies": [
    {
      "address": "0x459D17f3D42459F23a8Eb2F9ae7A609F1473E0B4",
      "txHash": "0x2e95f4a31ac262e13573b6a135dbca5971e0baa3838fe25bfae86f22bd3aab0e",
      "kind": "uups"
    },
    ...
  }
  "impls": {
    "751cdbf32cab5693b4106b13f97782207a8e61e1923d01aecd6131fd4feb1689": {
      "address": "0x6c9788D430375F51e8cFC612eee47527936E8099",
      "txHash": "0x62a12054ee46faa721656fe322b53f5daf03a21417eb239f7c4c00902e4a9fc7",
      "layout": {
        "storage": [
....
}

ie there is no link between the two, unless you traverse the TXs maybe.

FWIW I use a block like this to find out, so maybe there is more internal logic going on too

  const proxyAddress = envState.proxyAddress;
  const logicAddress = await upgrades.erc1967.getImplementationAddress(
    proxyAddress
  );
  const adminAddress = await upgrades.erc1967.getAdminAddress(proxyAddress);
1 Like