hello, does anyone have experience with deploying contracts with same addresses across networks using CREATE3 (regardless of the nonce)?
I am trying get this to work but it keeps producing different addresses even though the deployer address, the salt and the code is the same...I do not understand where the difference comes from
Mar 9, 2022, 4:34 PM
How does your deployer contract look like?
Oh and I am assuming deployer contract have same address on all chain...
Mar 9, 2022, 5:47 PM
my deployer contract looks like this. And no, it does not have the same address on each network. I deploy this contract first and then call the deploy method which deploys the actual contract that should have same addresses. What am I missing?
Mar 9, 2022, 7:14 PM
Wait a sec, what's create3?
Mar 9, 2022, 7:42 PM
https://github.com/0xsequence/create3
Mar 9, 2022, 7:44 PM
Aah so basically create2, but contract add fixed even if bytecode is changed
Mar 9, 2022, 7:54 PM
yes....very cool and handy in principle but I just cant get it to produce same addresses even though the code is the same, the salt is the same and the deployer wallet is the same
Mar 9, 2022, 7:55 PM
But still, its using create2, which means msg.sender is one of the factor in address determination
Ah its not the deployer wallet, msg.sender is the input to create2
Which means, the deployer contract
Mar 9, 2022, 7:57 PM
msg.sender is the person calling the contract
Mar 9, 2022, 7:58 PM
Your point being?
Mar 9, 2022, 7:58 PM
do you have any explanation or suggestion what I could try to achieve same addresses?
I would expect that if I run the same script from the same wallet with the same codebase in rinkeby and mumbai, then I would end up with different addresses for the deployer contract and same addresses for the target contract (CrossChainBridgeRouter).....but I dont :/
I would expect that if I run the same script from the same wallet with the same codebase in rinkeby and mumbai, then I would end up with different addresses for the deployer contract and same addresses for the target contract (CrossChainBridgeRouter).....but I dont :/
Mar 9, 2022, 7:59 PM
Get a zero wallet, deploy deployer contract with same nonce on all networks
Mar 9, 2022, 8:01 PM
Well, if I do that then I can also deploy the target contract with that fresh wallet...what's the difference? :)
my goal is to get this to work....there must be something I am missing....but I dont know what else to try
/rules
Mar 9, 2022, 8:02 PM
You can use the deployer then again and again
Mar 9, 2022, 8:04 PM
I think you are right. And at the same time I feel there must be more to it.
If it's possible to call create3 with address(this) from the deployer contract, why can I not call that very same function (e.g. with a script) directly from my wallet and achieve the same result (not the same address, but just the fact that I can deploy to the same address if I use the same salt)
If it's possible to call create3 with address(this) from the deployer contract, why can I not call that very same function (e.g. with a script) directly from my wallet and achieve the same result (not the same address, but just the fact that I can deploy to the same address if I use the same salt)
Mar 9, 2022, 8:13 PM
Because normal contract deployment doesn't use create2
Oz have something which allows that as it seems
https://docs.openzeppelin.com/cli/2.8/deploying-with-create2
Mar 9, 2022, 8:17 PM
standard create2 depends on the bytecode you deploy. That's why CREATE3 is so charming....cause it produces same results for different bytecodes as long as the salt is the same. I kinda thought I could use this without having to have a fresh wallet....but maybe it doesnt work like that
Mar 9, 2022, 8:28 PM
https://github.com/0xsequence/create3/issues/6
same issue?
or is you?
or is you?
Mar 9, 2022, 8:36 PM
that's me ;)
Mar 9, 2022, 8:43 PM
okok
anyone that has tested it?
Mar 9, 2022, 8:53 PM
who forces you to set the same constructor?
You have to match the storage layout, yes. So you wouldnt be able to remove the immutable variable. But the content of your constructor can change, I am pretty sure.
Again, who (do you think) forces you to use same constructor?
You have to match the storage layout, yes. So you wouldnt be able to remove the immutable variable. But the content of your constructor can change, I am pretty sure.
Again, who (do you think) forces you to use same constructor?
i think you can just use an empty constructor. Just remove the line where it assignes the variable
Mar 9, 2022, 9:29 PM