Sync workspace: config, docs, scripts, CI, operator rules, and submodule pointers.
- 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
This commit is contained in:
24
thirdweb-core-2103-test/src/Create2Factory.sol
Normal file
24
thirdweb-core-2103-test/src/Create2Factory.sol
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user