Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x04D1046c4646456fcD6D5551355d39976facb8b3
Balance 0 ETH
Nonce 7
Code Size 3486 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3486 bytes
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063bf7e214f1161005b578063bf7e214f146100f8578063ef5de7e31461010b578063f2fde38b1461011e578063f74907a21461013157600080fd5b806369d773041461008d5780637a9e5e4b146100a25780638da5cb5b146100b5578063bf40fac1146100e5575b600080fd5b6100a061009b36600461092f565b610152565b005b6100a06100b03660046109b9565b610288565b6000546100c8906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100c86100f3366004610a1f565b610372565b6001546100c8906001600160a01b031681565b6100c8610119366004610a77565b610392565b6100a061012c3660046109b9565b610461565b61014461013f366004610a1f565b6104de565b6040519081526020016100dc565b610168336000356001600160e01b031916610511565b61018d5760405162461bcd60e51b815260040161018490610b86565b60405180910390fd5b8060005b818110156102825761026f8484838181106101ae576101ae610bac565b90506020028101906101c09190610bc2565b6101ce906020810190610be2565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925087915085905081811061021757610217610bac565b90506020028101906102299190610bc2565b6040013586868581811061023f5761023f610bac565b90506020028101906102519190610bc2565b61025f9060208101906109b9565b6001600160a01b031691906105bb565b508061027a81610c29565b915050610191565b50505050565b6000546001600160a01b031633148061031d575060015460405163b700961360e01b81526001600160a01b039091169063b7009613906102dc90339030906001600160e01b03196000351690600401610c50565b602060405180830381865afa1580156102f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031d9190610c7d565b61032657600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b60008061037f84846104de565b905061038a8161065a565b949350505050565b60006103aa336000356001600160e01b031916610511565b6103c65760405162461bcd60e51b815260040161018490610b86565b8451602086012083156103fa578585856040516020016103e893929190610ccf565b60405160208183030381529060405295505b600061040689896104de565b9050600061041582898761066c565b90507fd928a3951eedba2f72a5eb8c15b591ead63c282f21b2f5e93506fb88cae27fec8a8a838660405161044c9493929190610d18565b60405180910390a19998505050505050505050565b610477336000356001600160e01b031916610511565b6104935760405162461bcd60e51b815260040161018490610b86565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600082826040516020016104f3929190610d48565b60405160208183030381529060405280519060200120905092915050565b6001546000906001600160a01b0316801580159061059b575060405163b700961360e01b81526001600160a01b0382169063b70096139061055a90879030908890600401610c50565b602060405180830381865afa158015610577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059b9190610c7d565b8061038a57506000546001600160a01b0385811691161491505092915050565b6060814710156105e05760405163cd78605960e01b8152306004820152602401610184565b600080856001600160a01b031684866040516105fc9190610d5c565b60006040518083038185875af1925050503d8060008114610639576040519150601f19603f3d011682016040523d82523d6000602084013e61063e565b606091505b509150915061064e8683836107c2565b925050505b9392505050565b6000610666823061081e565b92915050565b6000806040518060400160405280601081526020016f67363d3d37363d34f03d5260086018f360801b81525090506000858251602084016000f590506001600160a01b0381166106f25760405162461bcd60e51b81526020600482015260116024820152701111541313d65351539517d19052531151607a1b6044820152606401610184565b6106fb8661065a565b92506000816001600160a01b031685876040516107189190610d5c565b60006040518083038185875af1925050503d8060008114610755576040519150601f19603f3d011682016040523d82523d6000602084013e61075a565b606091505b5050905080801561077457506001600160a01b0384163b15155b6107b85760405162461bcd60e51b815260206004820152601560248201527412539255125053125690551253d397d19052531151605a1b6044820152606401610184565b5050509392505050565b6060826107d7576107d282610903565b610653565b81511580156107ee57506001600160a01b0384163b155b1561081757604051639996b31560e01b81526001600160a01b0385166004820152602401610184565b5080610653565b604080518082018252601081526f67363d3d37363d34f03d5260086018f360801b60209182015290516001600160f81b0319918101919091526bffffffffffffffffffffffff19606083901b166021820152603581018390527f21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f605582015260009081906108c3906075015b6040516020818303038152906040528051906020012090565b6040516135a560f21b60208201526bffffffffffffffffffffffff19606083901b166022820152600160f81b603682015290915061038a906037016108aa565b8051156109135780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6000806020838503121561094257600080fd5b823567ffffffffffffffff8082111561095a57600080fd5b818501915085601f83011261096e57600080fd5b81358181111561097d57600080fd5b8660208260051b850101111561099257600080fd5b60209290920196919550909350505050565b6001600160a01b038116811461092c57600080fd5b6000602082840312156109cb57600080fd5b8135610653816109a4565b60008083601f8401126109e857600080fd5b50813567ffffffffffffffff811115610a0057600080fd5b602083019150836020828501011115610a1857600080fd5b9250929050565b60008060208385031215610a3257600080fd5b823567ffffffffffffffff811115610a4957600080fd5b610a55858286016109d6565b90969095509350505050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060808789031215610a9057600080fd5b863567ffffffffffffffff80821115610aa857600080fd5b610ab48a838b016109d6565b90985096506020890135915080821115610acd57600080fd5b818901915089601f830112610ae157600080fd5b813581811115610af357610af3610a61565b604051601f8201601f19908116603f01168101908382118183101715610b1b57610b1b610a61565b816040528281528c6020848701011115610b3457600080fd5b826020860160208301376000602084830101528098505050506040890135915080821115610b6157600080fd5b50610b6e89828a016109d6565b979a9699509497949695606090950135949350505050565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60008235605e19833603018112610bd857600080fd5b9190910192915050565b6000808335601e19843603018112610bf957600080fd5b83018035915067ffffffffffffffff821115610c1457600080fd5b602001915036819003821315610a1857600080fd5b600060018201610c4957634e487b7160e01b600052601160045260246000fd5b5060010190565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215610c8f57600080fd5b8151801515811461065357600080fd5b6000815160005b81811015610cc05760208185018101518683015201610ca6565b50600093019283525090919050565b6000610cdb8286610c9f565b838582376000930192835250909392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b606081526000610d2c606083018688610cef565b6001600160a01b03949094166020830152506040015292915050565b60208152600061038a602083018486610cef565b60006106538284610c9f56fea2646970667358221220c9520bd839421db6c3ed510c93ca806f9ecb9b754fd76593055e7ef4590f9ed064736f6c63430008150033

Verified Source Code Full Match

Compiler: v0.8.21+commit.d9974bed EVM: london Optimization: Yes (200 runs)
Address.sol 159 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}
Auth.sol 64 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
abstract contract Auth {
    event OwnershipTransferred(address indexed user, address indexed newOwner);

    event AuthorityUpdated(address indexed user, Authority indexed newAuthority);

    address public owner;

    Authority public authority;

    constructor(address _owner, Authority _authority) {
        owner = _owner;
        authority = _authority;

        emit OwnershipTransferred(msg.sender, _owner);
        emit AuthorityUpdated(msg.sender, _authority);
    }

    modifier requiresAuth() virtual {
        require(isAuthorized(msg.sender, msg.sig), "UNAUTHORIZED");

        _;
    }

    function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {
        Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.

        // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be
        // aware that this makes protected functions uncallable even to the owner if the authority is out of order.
        return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
    }

    function setAuthority(Authority newAuthority) public virtual {
        // We check if the caller is the owner first because we want to ensure they can
        // always swap out the authority even if it's reverting or using up a lot of gas.
        require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));

        authority = newAuthority;

        emit AuthorityUpdated(msg.sender, newAuthority);
    }

    function transferOwnership(address newOwner) public virtual requiresAuth {
        owner = newOwner;

        emit OwnershipTransferred(msg.sender, newOwner);
    }
}

/// @notice A generic interface for a contract which provides authorization data to an Auth instance.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
interface Authority {
    function canCall(
        address user,
        address target,
        bytes4 functionSig
    ) external view returns (bool);
}
Bytes32AddressLib.sol 14 lines
// 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));
    }
}
CREATE3.sol 87 lines
// 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();
    }
}
Deployer.sol 81 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.21;

import {Auth, Authority} from "@solmate/auth/Auth.sol";
import {CREATE3} from "@solmate/utils/CREATE3.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

contract Deployer is Auth {
    using Address for address;

    /**
     * @notice Contains data needed to send a transaction.
     */
    struct Tx {
        address target;
        bytes data;
        uint256 value;
    }

    /**
     * @notice Emitted on `deployContract` calls.
     * @param name string name used to derive salt for deployment
     * @param contractAddress the newly deployed contract address
     * @param creationCodeHash keccak256 hash of the creation code
     *        - useful to determine creation code is the same across multiple chains
     */
    event ContractDeployed(string name, address contractAddress, bytes32 creationCodeHash);

    constructor(address _owner, Authority _auth) Auth(_owner, _auth) {}

    /**
     * @notice Deploy some contract to a deterministic address.
     * @param name string used to derive salt for deployment
     * @dev Should be of form:
     *      "ContractName Version 0.0"
     *      Where the numbers after version are VERSION . SUBVERSION
     * @param creationCode the contract creation code to deploy
     *        - can be obtained by calling type(contractName).creationCode
     * @param constructorArgs the contract constructor arguments if any
     *        - must be of form abi.encode(arg1, arg2, ...)
     * @param value non zero if constructor needs to be payable
     */
    function deployContract(
        string calldata name,
        bytes memory creationCode,
        bytes calldata constructorArgs,
        uint256 value
    ) external requiresAuth returns (address) {
        bytes32 creationCodeHash = keccak256(creationCode);

        if (constructorArgs.length > 0) {
            // Append constructor args to end of creation code.
            creationCode = abi.encodePacked(creationCode, constructorArgs);
        }

        bytes32 salt = convertNameToBytes32(name);

        address contractAddress = CREATE3.deploy(salt, creationCode, value);

        emit ContractDeployed(name, contractAddress, creationCodeHash);

        return contractAddress;
    }

    function bundleTxs(Tx[] calldata txs) external requiresAuth {
        uint256 txsLength = txs.length;
        for (uint256 i; i < txsLength; i++) {
            txs[i].target.functionCallWithValue(txs[i].data, txs[i].value);
        }
    }

    function getAddress(string calldata name) external view returns (address) {
        bytes32 salt = convertNameToBytes32(name);

        return CREATE3.getDeployed(salt);
    }

    function convertNameToBytes32(string calldata name) public pure returns (bytes32) {
        return keccak256(abi.encode(name));
    }
}

Read Contract

authority 0xbf7e214f → address
convertNameToBytes32 0xf74907a2 → bytes32
getAddress 0xbf40fac1 → address
owner 0x8da5cb5b → address

Write Contract 4 functions

These functions modify contract state and require a wallet transaction to execute.

bundleTxs 0x43d37a14
tuple[] txs
deployContract 0xef5de7e3
string name
bytes creationCode
bytes constructorArgs
uint256 value
returns: address
setAuthority 0x7a9e5e4b
address newAuthority
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address