hardhat-tenderly icon indicating copy to clipboard operation
hardhat-tenderly copied to clipboard

Conflict with Hardhat/Openzepplin Upgrades Beacon Proxy

Open zeryx opened this issue 3 years ago • 1 comments

There is a conflict with the @openzepplin/hardhat-upgrades library that requires using the nativeContractFactory object when deploying a beacon proxy if the tenderly automagic setup() is used.

Expected Behavior:

const { ethers, upgrades } = require("hardhat");
const code = await ethers.getContractProxy("someContract");
const beacon = await deployBeacon(code);
const beaconProxy = await upgrades.deployBeaconProxy(beacon.address, code, [...])

console.log("my beacon proxy has been deployed with tenderly!")

Instead this is the required modification for this to work:

const { ethers, upgrades } = require("hardhat");
const code = await ethers.getContractProxy("someContract");
const beacon = await deployBeacon(code);
const code_native = code.nativeContractFactory;
const beaconProxy = await upgrades.deployBeaconProxy(beacon.address, code_native , [...])

console.log("my beacon proxy has been deployed with tenderly!")

Would love to get that supported 🙏 BeaconProxies are amazing and something we utilize everywhere.

zeryx avatar Sep 06 '22 22:09 zeryx

Hey @zeryx,

The problem here is that hardhat-tenderly is overriding the ethers library used by the hardhat-upgrades library. So deployBeacon returns our TdlyContractFactory instead of the ethers.ContractFactory.

And the workaround is as you have described. We'll see to provide a proper solution for this so our users don't have to use these workarounds. 😢

Btw, we have implemented automatic verification of the proxy contracts that are deployed using the hardhat-upgrades library. So you can check that out!

Thanks for reporting this!

dule-git avatar Oct 24 '24 13:10 dule-git