- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
25 lines
904 B
Solidity
25 lines
904 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.11;
|
|
|
|
import "@openzeppelin/contracts/utils/Create2.sol";
|
|
import { Create2Probe } from "./Create2Probe.sol";
|
|
|
|
/// @dev Thin factory so CREATE2 runs inside contract code (same pattern as production deployers).
|
|
contract Create2Factory {
|
|
event ProbeDeployed(address indexed probe, bytes32 salt);
|
|
|
|
function probeInitCodeHash() external pure returns (bytes32) {
|
|
return keccak256(type(Create2Probe).creationCode);
|
|
}
|
|
|
|
function predictProbe(bytes32 salt) external view returns (address) {
|
|
return Create2.computeAddress(salt, keccak256(type(Create2Probe).creationCode), address(this));
|
|
}
|
|
|
|
function deployProbe(bytes32 salt) external returns (address addr) {
|
|
bytes memory bytecode = type(Create2Probe).creationCode;
|
|
addr = Create2.deploy(0, salt, bytecode);
|
|
emit ProbeDeployed(addr, salt);
|
|
}
|
|
}
|