Skip to content
Verified contractPartialUNLICENSED

CloneFactory

Address0x485b9a41e8bf06e57bb64c6ba7cb04f9d53d2d76
Balance

0 ETH

 

Transactions

295,016

 

Compiler

solc 0.5.16

 

Same code

Only this contract

 

Details

Compiler
solc 0.5.16+commit.9c3226ce
Language
solidity
Optimization
Yes, 1,000 runs
EVM version
istanbul
License
UNLICENSED
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
9,873,037
Creation transaction
0xd7add14938…46a0ac35ee

src/CloneFactory.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.5.16;

/// @notice Minimal interface for the authorized sweeper contract.
interface ISweeper {
    /// @dev Original function name unrecovered; mined to match selector 0x801ead1d.
    function isAuthorized_2564522126(address account) external view returns (bool);
}

/// @title CloneFactory
/// @notice Deterministic EIP-1167 minimal proxy factory using CREATE2, gated by an authorized sweeper.
contract CloneFactory {
    /// @dev Emitted as topic0 on clone deployment (original event signature unrecovered).
    bytes32 private constant CLONE_CREATED_TOPIC = 0xb79ffe54c65423cd3cde3e50c2411f246cfd6f2dcbf760480ce3041b9a53817e;

    /// @notice Address of the sweeper contract queried for caller authorization.
    ISweeper public constant sweeper = ISweeper(0x5f65f7b609678448494De4C87521CdF6cEf1e932);

    /// @notice Implementation contract targeted by deployed EIP-1167 minimal proxies.
    /// @dev Original function name unrecovered; mined to match selector 0xa6ebf6aa.
    address public constant cloneTarget_3380594671 = 0x39778bc77Bd7a9456655b19FD4c5D0bF2071104E;

    /// @dev Anonymous event used to emit the exact unrecovered topic0 with non-indexed `(clone, salt)` data.
    event CloneCreated(bytes32 indexed topic, address clone, bytes32 salt) anonymous;

    /// @notice Deploys an EIP-1167 minimal proxy clone pointing to `cloneTarget_3380594671` via CREATE2.
    /// @dev Original function name unrecovered; mined to match selector 0x38bcdfc0.
    /// @param salt CREATE2 salt used to derive the deterministic clone address.
    function deployClone_3438190844(bytes32 salt) external {
        require(sweeper.isAuthorized_2564522126(msg.sender), "unauthorized");
        address clone = createClone(cloneTarget_3380594671, salt);
        require(clone != address(0), "create2");
        emit CloneCreated(CLONE_CREATED_TOPIC, clone, salt);
    }

    /// @notice Deploys an EIP-1167 minimal proxy pointing to `target` using CREATE2.
    function createClone(address target, bytes32 salt) internal returns (address result) {
        bytes20 targetBytes = bytes20(target);
        assembly {
            let clone := mload(0x40)
            mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(clone, 0x14), targetBytes)
            mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            result := create2(0, clone, 0x37, salt)
        }
    }
}
Compiler settingsShow
{
  "metadata": {
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 1000,
    "enabled": true
  },
  "evmVersion": "istanbul",
  "remappings": [
    "forge-std/=lib/forge-std/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.