Skip to content
Verified contractExactAGPL-3.0-only

BoostHubDeploymentFactory

Address0x018d5b5a684f5da8cb629fbb7fe8661b1c07f6d2
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.28

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.28+commit.7893614a
Language
solidity
Optimization
Yes, 200 runs
EVM version
prague
Via IR
yes
License
AGPL-3.0-only
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,424,005
Creation transaction
0x45483c4f94…109deea74e

contracts/BoostHubDeploymentFactory_v1.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.28;
import {CREATE3} from "solmate/src/utils/CREATE3.sol";

/// @notice Deploys the same address across chains independently of constructor arguments.
/// @dev Chain-independent salts permit different EOA deployers/nonces on each network.
///      The first caller can consume a salt; coordinate Ethereum/Fraxtal launches to avoid salt squatting.
contract BoostHubDeploymentFactory {
    function deploy(bytes32 salt, bytes calldata creationCode) external payable returns (address) {
        return CREATE3.deploy(salt, creationCode, msg.value);
    }

    function getDeployed(address /* deployer */, bytes32 salt) external view returns (address) {
        return CREATE3.getDeployed(salt);
    }
}

dependencies/solmate/src/utils/Bytes32AddressLib.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Library for converting between addresses and bytes32 values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Bytes32AddressLib.sol)
library Bytes32AddressLib {
    function fromLast20Bytes(bytes32 bytesValue) internal pure returns (address) {
        return address(uint160(uint256(bytesValue)));
    }

    function fillLast12Bytes(address addressValue) internal pure returns (bytes32) {
        return bytes32(bytes20(addressValue));
    }
}

dependencies/solmate/src/utils/CREATE3.sol

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {Bytes32AddressLib} from "./Bytes32AddressLib.sol";

/// @notice Deploy to deterministic addresses without an initcode factor.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/CREATE3.sol)
/// @author Modified from 0xSequence (https://github.com/0xSequence/create3/blob/master/contracts/Create3.sol)
library CREATE3 {
    using Bytes32AddressLib for bytes32;

    //--------------------------------------------------------------------------------//
    // Opcode     | Opcode + Arguments    | Description      | Stack View             //
    //--------------------------------------------------------------------------------//
    // 0x36       |  0x36                 | CALLDATASIZE     | size                   //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 size                 //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 0 size               //
    // 0x37       |  0x37                 | CALLDATACOPY     |                        //
    // 0x36       |  0x36                 | CALLDATASIZE     | size                   //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 size                 //
    // 0x34       |  0x34                 | CALLVALUE        | value 0 size           //
    // 0xf0       |  0xf0                 | CREATE           | newContract            //
    //--------------------------------------------------------------------------------//
    // Opcode     | Opcode + Arguments    | Description      | Stack View             //
    //--------------------------------------------------------------------------------//
    // 0x67       |  0x67XXXXXXXXXXXXXXXX | PUSH8 bytecode   | bytecode               //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 bytecode             //
    // 0x52       |  0x52                 | MSTORE           |                        //
    // 0x60       |  0x6008               | PUSH1 08         | 8                      //
    // 0x60       |  0x6018               | PUSH1 18         | 24 8                   //
    // 0xf3       |  0xf3                 | RETURN           |                        //
    //--------------------------------------------------------------------------------//
    bytes internal constant PROXY_BYTECODE = hex"67_36_3d_3d_37_36_3d_34_f0_3d_52_60_08_60_18_f3";

    bytes32 internal constant PROXY_BYTECODE_HASH = keccak256(PROXY_BYTECODE);

    function deploy(
        bytes32 salt,
        bytes memory creationCode,
        uint256 value
    ) internal returns (address deployed) {
        bytes memory proxyChildBytecode = PROXY_BYTECODE;

        address proxy;
        /// @solidity memory-safe-assembly
        assembly {
            // Deploy a new contract with our pre-made bytecode via CREATE2.
            // We start 32 bytes into the code to avoid copying the byte length.
            proxy := create2(0, add(proxyChildBytecode, 32), mload(proxyChildBytecode), salt)
        }
        require(proxy != address(0), "DEPLOYMENT_FAILED");

        deployed = getDeployed(salt);
        (bool success, ) = proxy.call{value: value}(creationCode);
        require(success && deployed.code.length != 0, "INITIALIZATION_FAILED");
    }

    function getDeployed(bytes32 salt) internal view returns (address) {
        return getDeployed(salt, address(this));
    }

    function getDeployed(bytes32 salt, address creator) internal pure returns (address) {
        address proxy = keccak256(
            abi.encodePacked(
                // Prefix:
                bytes1(0xFF),
                // Creator:
                creator,
                // Salt:
                salt,
                // Bytecode hash:
                PROXY_BYTECODE_HASH
            )
        ).fromLast20Bytes();

        return
            keccak256(
                abi.encodePacked(
                    // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01)
                    // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)
                    hex"d6_94",
                    proxy,
                    hex"01" // Nonce of the proxy contract (1)
                )
            ).fromLast20Bytes();
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "prague",
  "remappings": [
    "@openzeppelin-4/=dependencies/node_modules/@openzeppelin-4/",
    "@openzeppelin-4/contracts/=dependencies/node_modules/@openzeppelin-4/contracts/",
    "@openzeppelin-5/=dependencies/node_modules/@openzeppelin-5/",
    "@openzeppelin-5/contracts/=dependencies/node_modules/@openzeppelin-5/contracts/",
    "@openzeppelin/=dependencies/node_modules/@openzeppelin/",
    "@openzeppelin/contracts-upgradeable/=dependencies/node_modules/@openzeppelin/contracts-upgradeable/",
    "@openzeppelin/contracts/=dependencies/node_modules/@openzeppelin/contracts/",
    "@uniswap/=dependencies/node_modules/@uniswap/",
    "ds-test/=dependencies/node_modules/@uniswap/v4-core/lib/solmate/lib/ds-test/",
    "erc4626-tests/=dependencies/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=dependencies/node_modules/@uniswap/v4-core/lib/forge-std/",
    "openzeppelin-contracts/=dependencies/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/",
    "solmate/=dependencies/node_modules/@uniswap/v4-core/lib/solmate/",
    "solmate/src/=dependencies/solmate/src/",
    "dependencies/node_modules/@uniswap/v4-core/:forge-std/=dependencies/node_modules/@uniswap/v4-core/lib/forge-std/",
    "dependencies/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/:forge-std/=dependencies/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/",
    "dependencies/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=dependencies/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/",
    "dependencies/node_modules/@uniswap/v4-core/lib/solmate/:ds-test/=dependencies/node_modules/@uniswap/v4-core/lib/solmate/lib/ds-test/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.