The
ImmutableDeploymentFactory
can be used to deterministically deploy immutable smart contracts on any EVM-compatible chain to the same address using both create2
and create3
deployment functions.
Contracts deployed with this factory are immutable, and cannot be overwritten. Salts used for deployment can optionally include the caller's address to prevent front-running.
A blog post has been created reviewing this repo at: Deterministic EVM Deployments and the Immutable Deployment Factory
The following functions are available to based on hash and deployment method (create2/3)
findCreate[#]Address
- find contract deployment address based on saltsafeCreate[#]Address
- perform contract deployment based on salt
function safeCreate2(bytes32 salt, bytes calldata initializationCode) returns (address deploymentAddress);
function findCreate2Address(bytes32 salt, bytes calldata initCode) returns (address deploymentAddress);
function findCreate2AddressViaHash(bytes32 salt, bytes32 initCodeHash) returns (address deploymentAddress);
function safeCreate3(bytes32 salt, bytes calldata initializationCode) returns (address deploymentAddress);
function findCreate3Address(bytes32 salt) returns (address deploymentAddress);
Note:
create2
deployment addresses are influenced by the deploying contract's bytecode
When providing a salt during the deployment process, you have the **option** to prevent front-running of your deployment. This is accomplished by including the caller's address in the first 20 bytes of the salt. If you do not care to prevent front-running, the first 20 bytes of the salt must all be zeros.
The ImmutableDeploymentFactory
has been deployed to 0x0000086e1910D5977302116fC27934DC0254266C
on the following networks:
- Ethereum
- Optimism
- BSC
The ImmutableDeploymentFactory
was initially deployed using Nick's method for keyless contract deployments.
You can deploy a copy of the factory to any EVM compatible chain by:
- Funding the deployment address
0x0D6470aED3287d05dF6cE19Ba4fab50852a49b5e
with0.07
chain-currency (possibly with additional chain fees ex: L1 fees on Optimism) - Broadcast
signedTx
from keylessDeployment.json when gas is less than 100 gwei. You MUST fund the account prior to broadcasting the transaction.
Some web3 providers filter out Type-0 transactions (Ethereum legacy transactions), which are used here for omni-chain deployment. We had success using the Alchemy Sandbox to broadcast the deployment transactions.
This repo was created by Cameron White (Slvrfn) of Vitriol Labs, but would not have been possible without the contributions of:
Contributions are welcome, please review CONTRIBUTIONS for more details.
The files contained therein are licensed under The MIT License (MIT). See the LICENSE file for more details.
Please review the DISCLAIMER for more details.
- Eth: vitriollabs.eth or
0xFe9fe85c7E894917B5a42656548a9D143f96f12E
on any EVM chain. - Btc: bc1qwf9xndxfwhfuul93seaq603xkgr64cwkc4d4dd