openzeppelin-foundry-upgrades icon indicating copy to clipboard operation
openzeppelin-foundry-upgrades copied to clipboard

Add support for deployement using create2 without the Defender requirement

Open Magicking opened this issue 1 year ago • 3 comments

It's currently impossible to deploy using create2 without the assistance of the Defender; it's a bummer as it seems this could be a low-hanging fruit to support this by passing the salt arg and calling create2 below if there is a salt.

image

About Create2 https://docs.openzeppelin.com/cli/2.8/deploying-with-create2

Magicking avatar Oct 23 '24 14:10 Magicking

Deploying with create2 requires a factory contract. It doesn't seem possible to just broadcast a create2 call directly from a script.

Using create2 with Defender is recommended because Defender keeps track of the factory addresses on each chain.

To support this request, we could consider one of the following:

  • Use the default deterministic deployer suggested by Foundry at the address described in https://book.getfoundry.sh/tutorials/create2-tutorial
  • Use CreateX at the address described in https://github.com/pcaversaccio/createx/tree/main?tab=readme-ov-file#createx-deployments

ericglau avatar Oct 23 '24 14:10 ericglau

@Magicking, Hey, I ran into the same issue. Here's a little PoC on how you can do it yourself while keeping all other functionality.

https://github.com/pimlicolabs/magic-spend/blob/main/src/MagicSpendFactory.sol#L16

pavlovdog avatar Nov 17 '24 07:11 pavlovdog

@pavlovdog i have the same issue! the repo you shared seems to be private. do you mind making it public or sharing the code snippet? Thanks!

hcheng826 avatar Jul 08 '25 09:07 hcheng826