S Price: $0.505077 (-0.43%)

Contract

0x37e1a18cAa065dAAb575cd2C737008DC5A02f4ec

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Contract Own...5147552024-12-17 11:31:2880 days ago1734435088IN
0x37e1a18c...C5A02f4ec
0 S0.0032576100
Deploy5146592024-12-17 11:27:0580 days ago1734434825IN
0x37e1a18c...C5A02f4ec
0 S0.550078100

Latest 1 internal transaction

Parent Transaction Hash Block From To
5146592024-12-17 11:27:0580 days ago1734434825
0x37e1a18c...C5A02f4ec
 Contract Creation0 S
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Create2Factory

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 1 : Create2Factory.sol
// 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)
        )))));
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "none"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"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"}]

60a060405234801561001057600080fd5b503360805260805161057f61003d6000396000818160850152818161011f01526102b2015261057f6000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806381176c20146100515780638da5cb5b146100805780639c4ae2d0146100a7578063a58ae24c146100ba575b600080fd5b61006461005f366004610406565b6100cf565b6040516001600160a01b03909116815260200160405180910390f35b6100647f000000000000000000000000000000000000000000000000000000000000000081565b6100646100b5366004610406565b610112565b6100cd6100c83660046104d7565b6102a7565b005b600060ff60f81b308385805190602001206040516020016100f3949392919061050a565b60408051601f1981840301815291905280516020909101209392505050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101825760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064015b60405180910390fd5b600060ff60f81b308486805190602001206040516020016101a6949392919061050a565b60408051601f19818403018152919052805160209091012091508190506001600160a01b0381163b156102145760405162461bcd60e51b81526020600482015260166024820152754164647265737320616c726561647920696e2075736560501b6044820152606401610179565b828451602086016000f591506001600160a01b03821661026a5760405162461bcd60e51b815260206004820152601160248201527011195c1b1bde5b595b9d0819985a5b1959607a1b6044820152606401610179565b60405183906001600160a01b038416907f836641082a104c21a747f2896a189cda6d34502edf7de2f98afc4460d0720bfa90600090a35092915050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103105760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610179565b6040516001600160a01b0382811660248301526000919084169060440160408051601f198184030181529181526020820180516001600160e01b03166313af403560e01b179052516103629190610543565b6000604051808303816000865af19150503d806000811461039f576040519150601f19603f3d011682016040523d82523d6000602084013e6103a4565b606091505b50509050806103eb5760405162461bcd60e51b815260206004820152601360248201527213dddb995c8818da185b99d94819985a5b1959606a1b6044820152606401610179565b505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561041957600080fd5b823567ffffffffffffffff8082111561043157600080fd5b818501915085601f83011261044557600080fd5b813581811115610457576104576103f0565b604051601f8201601f19908116603f0116810190838211818310171561047f5761047f6103f0565b8160405282815288602084870101111561049857600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b80356001600160a01b03811681146104d257600080fd5b919050565b600080604083850312156104ea57600080fd5b6104f3836104bb565b9150610501602084016104bb565b90509250929050565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825160005b81811015610564576020818601810151858301520161054a565b50600092019182525091905056fea164736f6c6343000813000a

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806381176c20146100515780638da5cb5b146100805780639c4ae2d0146100a7578063a58ae24c146100ba575b600080fd5b61006461005f366004610406565b6100cf565b6040516001600160a01b03909116815260200160405180910390f35b6100647f000000000000000000000000f62c8c51ffcd894f728b18a24c5adf6cfe3c83f181565b6100646100b5366004610406565b610112565b6100cd6100c83660046104d7565b6102a7565b005b600060ff60f81b308385805190602001206040516020016100f3949392919061050a565b60408051601f1981840301815291905280516020909101209392505050565b6000336001600160a01b037f000000000000000000000000f62c8c51ffcd894f728b18a24c5adf6cfe3c83f116146101825760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064015b60405180910390fd5b600060ff60f81b308486805190602001206040516020016101a6949392919061050a565b60408051601f19818403018152919052805160209091012091508190506001600160a01b0381163b156102145760405162461bcd60e51b81526020600482015260166024820152754164647265737320616c726561647920696e2075736560501b6044820152606401610179565b828451602086016000f591506001600160a01b03821661026a5760405162461bcd60e51b815260206004820152601160248201527011195c1b1bde5b595b9d0819985a5b1959607a1b6044820152606401610179565b60405183906001600160a01b038416907f836641082a104c21a747f2896a189cda6d34502edf7de2f98afc4460d0720bfa90600090a35092915050565b336001600160a01b037f000000000000000000000000f62c8c51ffcd894f728b18a24c5adf6cfe3c83f116146103105760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606401610179565b6040516001600160a01b0382811660248301526000919084169060440160408051601f198184030181529181526020820180516001600160e01b03166313af403560e01b179052516103629190610543565b6000604051808303816000865af19150503d806000811461039f576040519150601f19603f3d011682016040523d82523d6000602084013e6103a4565b606091505b50509050806103eb5760405162461bcd60e51b815260206004820152601360248201527213dddb995c8818da185b99d94819985a5b1959606a1b6044820152606401610179565b505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561041957600080fd5b823567ffffffffffffffff8082111561043157600080fd5b818501915085601f83011261044557600080fd5b813581811115610457576104576103f0565b604051601f8201601f19908116603f0116810190838211818310171561047f5761047f6103f0565b8160405282815288602084870101111561049857600080fd5b826020860160208301376000602093820184015298969091013596505050505050565b80356001600160a01b03811681146104d257600080fd5b919050565b600080604083850312156104ea57600080fd5b6104f3836104bb565b9150610501602084016104bb565b90509250929050565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b6000825160005b81811015610564576020818601810151858301520161054a565b50600092019182525091905056fea164736f6c6343000813000a

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.