wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.19k stars 292 forks source link

Support `create3` deployment #208

Open marcelomorgado opened 2 years ago

marcelomorgado commented 2 years ago

Unlike create2 the create3 allows deterministic addresses by using only msg.sender + salt that is useful when want to have the same address among chains even if the contracts' codes aren't equal.

Refs: https://github.com/0xsequence/create3

wighawag commented 2 years ago

Good idea, would need to have a create3 factory a la : https://github.com/Arachnid/deterministic-deployment-proxy and then we you could even use it for determinsitic deployment already via : https://github.com/wighawag/hardhat-deploy#4-deterministicdeployment-ability-to-specify-a-deployment-factory

outdoteth commented 2 years ago

+1 this would be great!

patidarmanoj10 commented 2 years ago

+1

bergben commented 1 year ago

hey @wighawag you mentioned using a create3 factory should even already be possible through the deterministic deployment options. This factory could e.g. be used: https://github.com/ZeframLou/create3-factory/blob/main/src/CREATE3Factory.sol#L14

But I think with current available options it is not possible to use it. As far as I understand, there would need to be changes to existing code to call the deploy() method on this CREATE3 Factory instead of building the deployTransaction like this: https://github.com/wighawag/hardhat-deploy/blob/192d6119c7e594c4e4c5e96eeb41de1fdaa71afc/src/helpers.ts#L586?

Edit: Workaround for this for now is to interact with the CREATE3 factory yourself and then use deployments.save() to manually log deployment data

wighawag commented 1 year ago

thanks @bergben for this, I see zefram's factory require the use of a function call It will indeed require extra wiring (it just need the deploy's bytes4 prefixed), or the look for an alternative factory

sherpya commented 1 year ago

what's the status of this issue? unfortunately many chains do not support shanghai so the address cannot be the same