Upgradable Contract Deployment Issue

I want to ask that we've deployed an up-gradable contract yesterday on polygon by hardhat plugin and it was deployed in one single transaction and now today we're deploying the same up-gradable contract now from same hardhat it's deploying in 3 transactions can you tell me why it's taking 2 extra transactions?

contract address deployed in one single transaction:
Contract Address 0x6a4581fffdeac8246b2dc3662f1035b6f5e8e618 | PolygonScan

Hi, welcome! :wave:

I think for the pattern of TransparentUpgradeableProxy, it will deploy three contracts:

  • contract implementation
  • proxy admin
  • proxy

When you want to deploy a new contracts, you can reuse implementation and proxy admin, but for the proxy, it should be a new one.

If you check the contract address that I'd shared in the post it's deployed in one transaction

This one is the TransparentUpgradeableProxy, so this mean you have provided the address of implementation and proxy admin, and you can also find these parameters on the polygonscan:

so the implementation contract address is: 0xe09b260364c305342209ab3bc288767add0e9f8d
proxy admin contract address is: 9689554c09f6e80bcc256a05d79036376a5f7487

As for how did you write your script, I am not sure.

The reason it was just one transactoin is that the other two contracts had been deployed previously, and they were reused. For example the implementation contract (the one that @skyge identified above) was deployed over a month ago.

The implementation is reused when the code is the same.

The proxy admin is always reused if it was deployed previously.