Reproduce a CREATE2 deployment address

When a factory predicts one address and a test expects another, compare the factory address, salt and exact initialization bytes before debugging the deployment.

Use a known zero-input vector

Compute Keccak-256 of the initialization code, concatenate the four fields below as raw bytes and hash again. Keep the low 20 bytes of the outer hash. With a zero factory address, zero salt and the single init-code byte 00, the expected address is 0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38.

0xff || factory[20] || salt[32] || keccak256(init_code)[32]

The factory is the account executing CREATE2. A wallet that calls the factory is not substituted into the formula. Encode the salt as exactly 32 bytes even when its numeric value is zero.

Check constructor arguments and collisions

Constructor arguments form part of the init code and change the resulting address. Matching the prediction only identifies the candidate destination. Creation can still fail, for example when an account with code or a nonzero nonce already occupies it. eips.ethereum.org EIP-1014