// Address = keccak256(deployer, nonce)
new CreateContract(owner);
──────────────────────────────────────────────────────────────────
CREATE
──────────────────────────────────────────────────────────────────
Example:
Deployer: 0x4f98e7507c578e2341B5b874E9a7C910aA8Db3e1
Nonce: 234
──────────────────────────────────────────────────────
Result: 0xa729B8363b472E8A3f20eF4E6210Cdd70C0cF5aB
Characteristics:
✅ Simple, default behavior
❌ Address changes if nonce changes
❌ Can't predict address before deployment
❌ Different address on each chain (different nonces)
CREATE2 (Deterministic Deployment)
// Address = keccak256(0xff, factory, salt, initCodeHash)
// Used automatically by Foundry for libraries
─────────────────────────────────────────────────────────────────
CREATE2
─────────────────────────────────────────────────────────────────
Example:
Factory: 0x4f98e7507c578e2341B5b874E9a7C910aA8Db3e1 (Deterministic Deployer)
Salt: 0x0000...0000
InitCode: <bytecode of Library>
──────────────────────────────────────────────────────
Result: 0xEdA41181EAB196E739140876C5fF35e2DFde188a
Characteristics:
✅ Same address on ALL chains (if same salt + bytecode)
✅ Predictable before deployment
✅ Great for libraries, factories, cross-chain deploys
❌ Slightly more complex
❌ Requires a factory contract
Top comments (0)