I was looking at Optionality's clone-factory, which is based off EIP-1167, and wondering whether it can be ported to use CREATE2.

One concern is that a third-party could, in theory, "front-run" the deployment tx and deploy another contract with the user's salt, initialise it with their own constructor arguments and so on.

How can we mitigate this?

I thought about hashing the tx.origin with the user-provided salt, and passing the resultant hash as the salt to CREATE2. This way, clients can deterministically compute the contract address off-chain, and the deployment tx is not front-runnable, because tx.origin cannot be impersonated.

Would that suffice?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.