Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x0969F8752A32B4F1f9D07b751C7bACbf6d9ae733
Balance 0 ETH
Nonce 126
Code Size 2707 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2707 bytes
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b1461014b578063be3397e914610123578063bf7e214f1461015e578063ccf1454a14610171578063f2fde38b1461018457600080fd5b806306fdde03146100a357806317355ca4146100e55780633ce98582146101105780635ad63cab146101235780637a9e5e4b14610136575b600080fd5b6100cf6040518060400160405280600d81526020016c21b7b937102232b83637bcb2b960991b81525081565b6040516100dc9190610756565b60405180910390f35b6100f86100f3366004610769565b610197565b6040516001600160a01b0390911681526020016100dc565b6100f861011e366004610825565b6101a8565b6100f86101313660046108ad565b61021e565b610149610144366004610929565b610263565b005b6000546100f8906001600160a01b031681565b6001546100f8906001600160a01b031681565b6100f861017f366004610946565b61034d565b610149610192366004610929565b610382565b60006101a2826103ff565b92915050565b60006101c0336000356001600160e01b0319166104b2565b6101e55760405162461bcd60e51b81526004016101dc9061097b565b60405180910390fd5b600083836040516020016101fa9291906109a1565b6040516020818303038152906040529050610215858261055c565b95945050505050565b6000610236336000356001600160e01b0319166104b2565b6102525760405162461bcd60e51b81526004016101dc9061097b565b61025c838361055c565b9392505050565b6000546001600160a01b03163314806102f8575060015460405163b700961360e01b81526001600160a01b039091169063b7009613906102b790339030906001600160e01b031960003516906004016109d0565b602060405180830381865afa1580156102d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f891906109fd565b61030157600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b600080826040516020016103619190610a1f565b60405160208183030381529060405280519060200120905061025c816103ff565b610398336000356001600160e01b0319166104b2565b6103b45760405162461bcd60e51b81526004016101dc9061097b565b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b604080516001600160f81b031960208083019190915230606090811b6bffffffffffffffffffffffff19908116602185015260358401959095527f21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f605580850191909152845180850390910181526075840185528051908301206135a560f21b6095850152901b9093166097820152600160f81b60ab8201528151608c81830301815260ac909101909152805191012090565b6001546000906001600160a01b0316801580159061053c575060405163b700961360e01b81526001600160a01b0382169063b7009613906104fb908790309088906004016109d0565b602060405180830381865afa158015610518573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053c91906109fd565b8061055457506000546001600160a01b038581169116145b949350505050565b600080836040516020016105709190610a1f565b60405160208183030381529060405280519060200120905061059281846105de565b9150816001600160a01b03167ff69d55da19b60d2a59ccf297aa416a80611050db35f7e5dfb9319a99d7c594ab85836040516105cf929190610a3b565b60405180910390a25092915050565b600061025c8383600060408051808201909152601081526f67363d3d37363d34f03d5260086018f360801b602082015260009061061a856103ff565b9150813b1561063c5760405163cd43efa160e01b815260040160405180910390fd5b6000858251602084016000f590506001600160a01b0381166106715760405163bbd2fe8760e01b815260040160405180910390fd5b6000816001600160a01b0316858760405161068c9190610a1f565b60006040518083038185875af1925050503d80600081146106c9576040519150601f19603f3d011682016040523d82523d6000602084013e6106ce565b606091505b505090508015806106de5750833b155b156106fc576040516353de54b960e01b815260040160405180910390fd5b5050509392505050565b60005b83811015610721578181015183820152602001610709565b50506000910152565b60008151808452610742816020860160208601610706565b601f01601f19169290920160200192915050565b60208152600061025c602083018461072a565b60006020828403121561077b57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126107a957600080fd5b813567ffffffffffffffff808211156107c4576107c4610782565b604051601f8301601f19908116603f011681019082821181831017156107ec576107ec610782565b8160405283815286602085880101111561080557600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561083a57600080fd5b833567ffffffffffffffff8082111561085257600080fd5b61085e87838801610798565b9450602086013591508082111561087457600080fd5b61088087838801610798565b9350604086013591508082111561089657600080fd5b506108a386828701610798565b9150509250925092565b600080604083850312156108c057600080fd5b823567ffffffffffffffff808211156108d857600080fd5b6108e486838701610798565b935060208501359150808211156108fa57600080fd5b5061090785828601610798565b9150509250929050565b6001600160a01b038116811461092657600080fd5b50565b60006020828403121561093b57600080fd5b813561025c81610911565b60006020828403121561095857600080fd5b813567ffffffffffffffff81111561096f57600080fd5b61055484828501610798565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b600083516109b3818460208801610706565b8351908301906109c7818360208801610706565b01949350505050565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215610a0f57600080fd5b8151801515811461025c57600080fd5b60008251610a31818460208701610706565b9190910192915050565b604081526000610a4e604083018561072a565b9050826020830152939250505056fea2646970667358221220be6fb0c9b4926e1487581e7d8950807521dc747c4199dbaeef126666cda7907364736f6c63430008190033

Verified Source Code Full Match

Compiler: v0.8.25+commit.b61c2a91 EVM: paris Optimization: Yes (200 runs)
Create3.sol 120 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.17;

/**
  @title A library for deploying contracts EIP-3171 style.
  @author Agustin Aguilar <[email protected]>
*/
library Create3 {
    error ErrorCreatingProxy();
    error ErrorCreatingContract();
    error TargetAlreadyExists();

    /**
    @notice The bytecode for a contract that proxies the creation of another contract
    @dev If this code is deployed using CREATE2 it can be used to decouple `creationCode` from the child contract address

  0x67363d3d37363d34f03d5260086018f3:
      0x00  0x67  0x67XXXXXXXXXXXXXXXX  PUSH8 bytecode  0x363d3d37363d34f0
      0x01  0x3d  0x3d                  RETURNDATASIZE  0 0x363d3d37363d34f0
      0x02  0x52  0x52                  MSTORE
      0x03  0x60  0x6008                PUSH1 08        8
      0x04  0x60  0x6018                PUSH1 18        24 8
      0x05  0xf3  0xf3                  RETURN

  0x363d3d37363d34f0:
      0x00  0x36  0x36                  CALLDATASIZE    cds
      0x01  0x3d  0x3d                  RETURNDATASIZE  0 cds
      0x02  0x3d  0x3d                  RETURNDATASIZE  0 0 cds
      0x03  0x37  0x37                  CALLDATACOPY
      0x04  0x36  0x36                  CALLDATASIZE    cds
      0x05  0x3d  0x3d                  RETURNDATASIZE  0 cds
      0x06  0x34  0x34                  CALLVALUE       val 0 cds
      0x07  0xf0  0xf0                  CREATE          addr
  */

    bytes internal constant PROXY_CHILD_BYTECODE =
        hex"67_36_3d_3d_37_36_3d_34_f0_3d_52_60_08_60_18_f3";

    //                        KECCAK256_PROXY_CHILD_BYTECODE = keccak256(PROXY_CHILD_BYTECODE);
    bytes32 internal constant KECCAK256_PROXY_CHILD_BYTECODE =
        0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f;

    /**
    @notice Returns the size of the code on a given address
    @param _addr Address that may or may not contain code
    @return size of the code on the given `_addr`
  */
    function codeSize(address _addr) internal view returns (uint256 size) {
        assembly {
            size := extcodesize(_addr)
        }
    }

    /**
    @notice Creates a new contract with given `_creationCode` and `_salt`
    @param _salt Salt of the contract creation, resulting address will be derivated from this value only
    @param _creationCode Creation code (constructor) of the contract to be deployed, this value doesn't affect the resulting address
    @return addr of the deployed contract, reverts on error
  */
    function create3(bytes32 _salt, bytes memory _creationCode) internal returns (address addr) {
        return create3(_salt, _creationCode, 0);
    }

    /**
    @notice Creates a new contract with given `_creationCode` and `_salt`
    @param _salt Salt of the contract creation, resulting address will be derivated from this value only
    @param _creationCode Creation code (constructor) of the contract to be deployed, this value doesn't affect the resulting address
    @param _value In WEI of ETH to be forwarded to child contract
    @return addr of the deployed contract, reverts on error
  */
    function create3(
        bytes32 _salt,
        bytes memory _creationCode,
        uint256 _value
    ) internal returns (address addr) {
        // Creation code
        bytes memory creationCode = PROXY_CHILD_BYTECODE;

        // Get target final address
        addr = addressOf(_salt);
        if (codeSize(addr) != 0) revert TargetAlreadyExists();

        // Create CREATE2 proxy
        address proxy;
        assembly {
            proxy := create2(0, add(creationCode, 32), mload(creationCode), _salt)
        }
        if (proxy == address(0)) revert ErrorCreatingProxy();

        // Call proxy with final init code
        (bool success, ) = proxy.call{value: _value}(_creationCode);
        if (!success || codeSize(addr) == 0) revert ErrorCreatingContract();
    }

    /**
    @notice Computes the resulting address of a contract deployed using address(this) and the given `_salt`
    @param _salt Salt of the contract creation, resulting address will be derivated from this value only
    @return addr of the deployed contract, reverts on error

    @dev The address creation formula is: keccak256(rlp([keccak256(0xff ++ address(this) ++ _salt ++ keccak256(childBytecode))[12:], 0x01]))
  */
    function addressOf(bytes32 _salt) internal view returns (address) {
        address proxy = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(
                            hex"ff",
                            address(this),
                            _salt,
                            KECCAK256_PROXY_CHILD_BYTECODE
                        )
                    )
                )
            )
        );

        return address(uint160(uint256(keccak256(abi.encodePacked(hex"d6_94", proxy, hex"01")))));
    }
}
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);
}
CornDeployer.sol 86 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.17;

import "./Create3.sol";
import {Auth, Authority} from "solmate/auth/Auth.sol";

contract CornDeployer is Auth {
    string public constant name = "Corn Deployer";

    event ContractDeployed(address indexed contractAddress, string contractName, bytes32 salt);

    constructor() Auth(msg.sender, Authority(address(0))) {}

    /**
     * @notice Deploy a contract using salt in string format and arbitrary runtime code.
     *     @dev Intended use is: get the future Corn addresses, then deploy the appropriate contract to each address via this method, building the constructor using the mapped addresses
     *     @dev no enforcment of bytecode at address as we can't know the runtime code in this contract due to space constraints
     */
    function _deploy(string memory _saltString, bytes memory _creationCode)
        internal
        returns (address deployedAddress)
    {
        bytes32 _salt = keccak256(abi.encodePacked(_saltString));
        deployedAddress = Create3.create3(_salt, _creationCode);
        emit ContractDeployed(deployedAddress, _saltString, _salt);
    }

    /**
     * @notice Deploy a contract using salt in string format and arbitrary runtime code.
     *     @dev Intended use is: get the future Corn addresses, then deploy the appropriate contract to each address via this method, building the constructor using the mapped addresses
     *     @dev no enforcment of bytecode at address as we can't know the runtime code in this contract due to space constraints
     */
    function deploy(string memory _saltString, bytes memory _creationCode)
        public
        requiresAuth
        returns (address deployedAddress)
    {
        return _deploy(_saltString, _creationCode);
    }

    function deployWithCreationCodeAndConstructorArgs(
        string memory _saltString,
        bytes memory creationCode,
        bytes memory constructionArgs
    ) external requiresAuth returns (address) {
        bytes memory _data = abi.encodePacked(creationCode, constructionArgs);
        return _deploy(_saltString, _data);
    }

    function deployWithCreationCode(string memory _saltString, bytes memory creationCode)
        external
        requiresAuth
        returns (address)
    {
        return _deploy(_saltString, creationCode);
    }

    function addressOf(string memory _saltString) external view returns (address) {
        bytes32 _salt = keccak256(abi.encodePacked(_saltString));
        return Create3.addressOf(_salt);
    }

    function addressOfSalt(bytes32 _salt) external view returns (address) {
        return Create3.addressOf(_salt);
    }

    /**
     * @notice Create the creation code for a contract with the given runtime code.
     *     @dev credit: https://github.com/0xsequence/create3/blob/master/contracts/test_utils/Create3Imp.sol
     */
    function creationCodeFor(bytes memory _code) internal pure returns (bytes memory) {
        /*
      0x00    0x63         0x63XXXXXX  PUSH4 _code.length  size
      0x01    0x80         0x80        DUP1                size size
      0x02    0x60         0x600e      PUSH1 14            14 size size
      0x03    0x60         0x6000      PUSH1 00            0 14 size size
      0x04    0x39         0x39        CODECOPY            size
      0x05    0x60         0x6000      PUSH1 00            0 size
      0x06    0xf3         0xf3        RETURN
      <CODE>
        */

        return abi.encodePacked(hex"63", uint32(_code.length), hex"80600E6000396000F3", _code);
    }
}

Read Contract

addressOf 0xccf1454a → address
addressOfSalt 0x17355ca4 → address
authority 0xbf7e214f → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address

Write Contract 5 functions

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

deploy 0xbe3397e9
string _saltString
bytes _creationCode
returns: address
deployWithCreationCode 0x5ad63cab
string _saltString
bytes creationCode
returns: address
deployWithCreationCodeAndConstructorArgs 0x3ce98582
string _saltString
bytes creationCode
bytes constructionArgs
returns: address
setAuthority 0x7a9e5e4b
address newAuthority
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address