Can not deploy contract with proxy on the Optimism

Thanks for the detailed example. It works no problem on the testnets, but I got an error about cannot estimate gas when I tried to deploy contracts on Optimism.

Wondering if there’s a way to manually setup the gas limit when deploying contracts using upgrades.deployProxy(), or is there anything else that can fix the issue.

1 Like

I think you can set gas limit in the config file, the key word is gas, and for more details, please check this documentation

Tried to setup the gas in the config but that doesn’t seem to work, and got the same cannot estimate gas error. Is there any way to set the gas limit when sending the transaction?

1 Like

Hello @maxweng, welcome to the forum! I’m not familiar with Optimism, but happy to give it a look if you could provide a repo reproducing it, if that’s something you can do.

Thanks for looking into it. Here’s a repo I created for you to reproduce the issue: https://github.com/maxweng/ovm-deploy.git

You can run yarn test --network optimism to see the errors, assuming you running the optimism node locally on 127.0.0.1:8545

1 Like

Hey @martriay , did you get a chance to look into it?

Hi @maxweng! I have exactly same issue. Did you manage to solve it?

1 Like

I added gasPrice : 0 parameter to the deployProxy() function, for example: await deployProxy(Common, , { deployer, gasPrice: 0 }); The next error that pops up after this is that the ProxyAdmin deployment fails as below. Might be gasPrice not propagating but looks different - issue with OZ and Optimism? TransparentUpgradableProxy.sol constructor assert line 34: assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin))- 1)? :

Deploying ‘ProxyAdmin’

transaction hash: …
Error: *** Deployment Failed ***

“ProxyAdmin” hit a require or revert statement somewhere in its constructor.