Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Latest 2 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
4757588 | 16 days ago | 0 S | ||||
4740945 | 16 days ago | Contract Creation | 0 S |
Loading...
Loading
Contract Name:
Create2Factory
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; contract Create2Factory { // Contract owner address public immutable owner; // Event emitted when a new contract is deployed event ContractDeployed(address indexed deployedAddress, uint256 indexed salt); constructor() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner, "Not authorized"); _; } // Helper function to call setOwner on deployed contracts function setContractOwner(address deployedContract, address newOwner) external onlyOwner { (bool success, ) = deployedContract.call( abi.encodeWithSignature("setOwner(address)", newOwner) ); require(success, "Owner change failed"); } /** * @dev Deploys a contract using CREATE2 * @param bytecode The contract bytecode to deploy * @param salt Unique value for deterministic address generation * @return deployedAddress The address where the contract was deployed */ function deploy(bytes memory bytecode, uint256 salt) external onlyOwner returns (address deployedAddress) { // Compute the address where contract will be deployed bytes32 hash = keccak256( abi.encodePacked( bytes1(0xff), address(this), salt, keccak256(bytecode) ) ); deployedAddress = address(uint160(uint256(hash))); // Check if address is already in use require(deployedAddress.code.length == 0, "Address already in use"); // Deploy the contract assembly { deployedAddress := create2(0, add(bytecode, 0x20), mload(bytecode), salt) } // Verify deployment was successful require(deployedAddress != address(0), "Deployment failed"); emit ContractDeployed(deployedAddress, salt); } /** * @dev Computes the address where a contract will be deployed using CREATE2 * @param bytecode The contract bytecode * @param salt The salt value * @return The address where the contract would be deployed */ function computeAddress(bytes memory bytecode, uint256 salt) public view returns (address) { return address(uint160(uint256(keccak256(abi.encodePacked( bytes1(0xff), address(this), salt, keccak256(bytecode) ))))); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"deployedAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"salt","type":"uint256"}],"name":"ContractDeployed","type":"event"},{"inputs":[{"internalType":"bytes","name":"bytecode","type":"bytes"},{"internalType":"uint256","name":"salt","type":"uint256"}],"name":"computeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"bytecode","type":"bytes"},{"internalType":"uint256","name":"salt","type":"uint256"}],"name":"deploy","outputs":[{"internalType":"address","name":"deployedAddress","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"deployedContract","type":"address"},{"internalType":"address","name":"newOwner","type":"address"}],"name":"setContractOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b503360805260805161057f61003d6000396000818160850152818161011f01526102b2015261057f6000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806381176c20146100515780638da5cb5b146100805780639c4ae2d0146100a7578063a58ae24c146100ba575b600080fd5b61006461005f366004610406565b6100cf565b6040516001600160a01b03909116815260200160405180910390f35b6100647f000000000000000000000000000000000000000000000000000000000000000081565b6100646100b5366004610406565b610112565b6100cd6100c83660046104d7565b6102a7565b005b600060ff60f81b308385805190602001206040516020016100f3949392919061050a565b60408051601f1981840301815291905280516020909101209392505050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101825760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064015b60405180910390fd5b600060ff60f81b308486805190602001206040516020016101a6949392919061050a565b60408051601f19818403018152919052805160209091012091508190506001600160a01b0381163b156102145760405162461bcd60e51b81526020600482015260166024820152754164647265737320616c726561647920696e2075736560501b6044820152606401610179565b828451602086016000f591506001600160a01b03821661026a5760405162461bcd60e51b815260206004820152601160248201527011195c1b1bde5b595b9d0819985a5b1959607a1b6044820152606401610179565b60405183906001600160a01b038416907f836641082a104c21a747f2896a189cda6d34502edf7de2f98afc4460d0720bfa90600090a35092915050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103105760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610179565b6040516001600160a01b0382811660248301526000919084169060440160408051601f198184030181529181526020820180516001600160e01b03166313af403560e01b179052516103629190610543565b6000604051808303816000865af19150503d806000811461039f576040519150601f19603f3d011682016040523d82523d6000602084013e6103a4565b606091505b50509050806103eb5760405162461bcd60e51b815260206004820152601360248201527213dddb995c8818da185b99d94819985a5b1959606a1b6044820152606401610179565b505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561041957600080fd5b823567ffffffffffffffff8082111561043157600080fd5b818501915085601f83011261044557600080fd5b813581811115610457576104576103f0565b604051601f8201601f19908116603f0116810190838211818310171561047f5761047f6103f0565b8160405282815288602084870101111561049857600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b80356001600160a01b03811681146104d257600080fd5b919050565b600080604083850312156104ea57600080fd5b6104f3836104bb565b9150610501602084016104bb565b90509250929050565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825160005b81811015610564576020818601810151858301520161054a565b50600092019182525091905056fea164736f6c6343000813000a
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806381176c20146100515780638da5cb5b146100805780639c4ae2d0146100a7578063a58ae24c146100ba575b600080fd5b61006461005f366004610406565b6100cf565b6040516001600160a01b03909116815260200160405180910390f35b6100647f000000000000000000000000f62c8c51ffcd894f728b18a24c5adf6cfe3c83f181565b6100646100b5366004610406565b610112565b6100cd6100c83660046104d7565b6102a7565b005b600060ff60f81b308385805190602001206040516020016100f3949392919061050a565b60408051601f1981840301815291905280516020909101209392505050565b6000336001600160a01b037f000000000000000000000000f62c8c51ffcd894f728b18a24c5adf6cfe3c83f116146101825760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064015b60405180910390fd5b600060ff60f81b308486805190602001206040516020016101a6949392919061050a565b60408051601f19818403018152919052805160209091012091508190506001600160a01b0381163b156102145760405162461bcd60e51b81526020600482015260166024820152754164647265737320616c726561647920696e2075736560501b6044820152606401610179565b828451602086016000f591506001600160a01b03821661026a5760405162461bcd60e51b815260206004820152601160248201527011195c1b1bde5b595b9d0819985a5b1959607a1b6044820152606401610179565b60405183906001600160a01b038416907f836641082a104c21a747f2896a189cda6d34502edf7de2f98afc4460d0720bfa90600090a35092915050565b336001600160a01b037f000000000000000000000000f62c8c51ffcd894f728b18a24c5adf6cfe3c83f116146103105760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610179565b6040516001600160a01b0382811660248301526000919084169060440160408051601f198184030181529181526020820180516001600160e01b03166313af403560e01b179052516103629190610543565b6000604051808303816000865af19150503d806000811461039f576040519150601f19603f3d011682016040523d82523d6000602084013e6103a4565b606091505b50509050806103eb5760405162461bcd60e51b815260206004820152601360248201527213dddb995c8818da185b99d94819985a5b1959606a1b6044820152606401610179565b505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561041957600080fd5b823567ffffffffffffffff8082111561043157600080fd5b818501915085601f83011261044557600080fd5b813581811115610457576104576103f0565b604051601f8201601f19908116603f0116810190838211818310171561047f5761047f6103f0565b8160405282815288602084870101111561049857600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b80356001600160a01b03811681146104d257600080fd5b919050565b600080604083850312156104ea57600080fd5b6104f3836104bb565b9150610501602084016104bb565b90509250929050565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825160005b81811015610564576020818601810151858301520161054a565b50600092019182525091905056fea164736f6c6343000813000a
Deployed Bytecode Sourcemap
58:2522:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2263:315;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;1314:32:1;;;1296:51;;1284:2;1269:18;2263:315:0;;;;;;;110:30;;;;;1057:956;;;;;;:::i;:::-;;:::i;514:273::-;;;;;;:::i;:::-;;:::i;:::-;;2263:315;2372:7;2474:4;2467:12;;2501:4;2520;2548:8;2538:19;;;;;;2437:130;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;2437:130:0;;;;;;;;;2427:141;;2437:130;2427:141;;;;;2263:315;-1:-1:-1;;;2263:315:0:o;1057:956::-;1165:23;390:10;-1:-1:-1;;;;;404:5:0;390:19;;382:46;;;;-1:-1:-1;;;382:46:0;;2449:2:1;382:46:0;;;2431:21:1;2488:2;2468:18;;;2461:30;-1:-1:-1;;;2507:18:1;;;2500:44;2561:18;;382:46:0;;;;;;;;;1268:12:::1;1347:4;1340:12;;1378:4;1401;1433:8;1423:19;;;;;;1306:150;;;;;;;;;;;:::i;:::-;;::::0;;-1:-1:-1;;1306:150:0;;::::1;::::0;;;;;;1283:183;;1306:150:::1;1283:183:::0;;::::1;::::0;;-1:-1:-1;1283:183:0;;-1:-1:-1;;;;;;1607:27:0;::::1;;:32:::0;1599:67:::1;;;::::0;-1:-1:-1;;;1599:67:0;;2792:2:1;1599:67:0::1;::::0;::::1;2774:21:1::0;2831:2;2811:18;;;2804:30;-1:-1:-1;;;2850:18:1;;;2843:52;2912:18;;1599:67:0::1;2590:346:1::0;1599:67:0::1;1807:4;1796:8;1790:15;1783:4;1773:8;1769:19;1766:1;1758:54;1739:73:::0;-1:-1:-1;;;;;;1892:29:0;::::1;1884:59;;;::::0;-1:-1:-1;;;1884:59:0;;3143:2:1;1884:59:0::1;::::0;::::1;3125:21:1::0;3182:2;3162:18;;;3155:30;-1:-1:-1;;;3201:18:1;;;3194:47;3258:18;;1884:59:0::1;2941:341:1::0;1884:59:0::1;1967:39;::::0;2001:4;;-1:-1:-1;;;;;1967:39:0;::::1;::::0;::::1;::::0;;;::::1;1195:818;1057:956:::0;;;;:::o;514:273::-;390:10;-1:-1:-1;;;;;404:5:0;390:19;;382:46;;;;-1:-1:-1;;;382:46:0;;2449:2:1;382:46:0;;;2431:21:1;2488:2;2468:18;;;2461:30;-1:-1:-1;;;2507:18:1;;;2500:44;2561:18;;382:46:0;2247:338:1;382:46:0;667:54:::1;::::0;-1:-1:-1;;;;;1314:32:1;;;667:54:0::1;::::0;::::1;1296:51:1::0;614:12:0::1;::::0;632:21;;::::1;::::0;1269:18:1;;667:54:0::1;::::0;;-1:-1:-1;;667:54:0;;::::1;::::0;;;;;;::::1;::::0;::::1;::::0;;-1:-1:-1;;;;;667:54:0::1;-1:-1:-1::0;;;667:54:0::1;::::0;;632:99;::::1;::::0;667:54;632:99:::1;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;613:118;;;749:7;741:39;;;::::0;-1:-1:-1;;;741:39:0;;3906:2:1;741:39:0::1;::::0;::::1;3888:21:1::0;3945:2;3925:18;;;3918:30;-1:-1:-1;;;3964:18:1;;;3957:49;4023:18;;741:39:0::1;3704:343:1::0;741:39:0::1;603:184;514:273:::0;;:::o;14:127:1:-;75:10;70:3;66:20;63:1;56:31;106:4;103:1;96:15;130:4;127:1;120:15;146:999;223:6;231;284:2;272:9;263:7;259:23;255:32;252:52;;;300:1;297;290:12;252:52;340:9;327:23;369:18;410:2;402:6;399:14;396:34;;;426:1;423;416:12;396:34;464:6;453:9;449:22;439:32;;509:7;502:4;498:2;494:13;490:27;480:55;;531:1;528;521:12;480:55;567:2;554:16;589:2;585;582:10;579:36;;;595:18;;:::i;:::-;670:2;664:9;638:2;724:13;;-1:-1:-1;;720:22:1;;;744:2;716:31;712:40;700:53;;;768:18;;;788:22;;;765:46;762:72;;;814:18;;:::i;:::-;854:10;850:2;843:22;889:2;881:6;874:18;931:7;924:4;919:2;915;911:11;907:22;904:35;901:55;;;952:1;949;942:12;901:55;1012:2;1005:4;1001:2;997:13;990:4;982:6;978:17;965:50;1059:1;1052:4;1035:15;;;1031:26;;1024:37;1035:15;1118:20;;;;1105:34;;-1:-1:-1;;;;;;146:999:1:o;1358:173::-;1426:20;;-1:-1:-1;;;;;1475:31:1;;1465:42;;1455:70;;1521:1;1518;1511:12;1455:70;1358:173;;;:::o;1536:260::-;1604:6;1612;1665:2;1653:9;1644:7;1640:23;1636:32;1633:52;;;1681:1;1678;1671:12;1633:52;1704:29;1723:9;1704:29;:::i;:::-;1694:39;;1752:38;1786:2;1775:9;1771:18;1752:38;:::i;:::-;1742:48;;1536:260;;;;;:::o;1801:441::-;-1:-1:-1;;;;;;2024:26:1;;;;2012:39;;2088:2;2084:15;;;;-1:-1:-1;;2080:53:1;2076:1;2067:11;;2060:74;2159:2;2150:12;;2143:28;2196:2;2187:12;;2180:28;2233:2;2224:12;;1801:441::o;3287:412::-;3416:3;3454:6;3448:13;3479:1;3489:129;3503:6;3500:1;3497:13;3489:129;;;3601:4;3585:14;;;3581:25;;3575:32;3562:11;;;3555:53;3518:12;3489:129;;;-1:-1:-1;3673:1:1;3637:16;;3662:13;;;-1:-1:-1;3637:16:1;3287:412;-1:-1:-1;3287:412:1:o
Swarm Source
none
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.