OpenZeppelin / openzeppelin-upgrades

Plugins for Hardhat and Foundry to deploy and manage upgradeable contracts on Ethereum.
MIT License
627 stars 268 forks source link

Not able to deploy upgradable smart contract with initializer argument #327

Closed 0xparashar closed 3 years ago

0xparashar commented 3 years ago

I have two upgradeable smart contracts, one is getting deployed successfully. The second contract requires address of first contract in initialize function. I am getting the following error:

"AdminUpgradeabilityProxy" -- The contract code couldn't be stored, please check your gas limit..

Here is deployment code:

 module.exports = async function (deployer) {

   const existing = await TestNFT.deployed();

   await deployProxy(TestOperator, [existing.address] , { deployer, initializer:'initialize' });

};
frangio commented 3 years ago

Hi @ankitiitb1069. Were you able to solve this?

0xparashar commented 3 years ago

Yes, I was calling _grantRole of AccessControlUpgradeable in initializer function, replacing it with _setupRole worked just fine