DeployFactory
Minimalistic deploy factory, based on Openzeppelin's library
Functions
deploy
Deploys a contract using CREATE2. The address where the contract
will be deployed can be known in advance via computeAddress.
The bytecode for a contract can be obtained from Solidity with
type(contractName).creationCode.
Requirements:
bytecodemust not be empty.saltmust have not been used forbytecodealready.- the factory must have a balance of at least
amount.
function deploy(bytes32 salt, bytes memory bytecode) external returns (address addr);
computeAddress
Returns the address where a contract will be stored if deployed via deploy. Any change in the
bytecodeHash or salt will result in a new destination address.
function computeAddress(bytes32 salt, bytes32 bytecodeHash) external view returns (address);
computeAddress
Returns the address where a contract will be stored if deployed via deploy from a contract located at
deployer. If deployer is this contract's address, returns the same value as computeAddress.
function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr);