Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x706c9F2dd328E2C01483eCF705D2D9708F4aB727
Balance 0 ETH
Nonce 61
Code Size 1494 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

1494 bytes
0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063481286e6146100675780635eb5d20714610096578063715018a6146100a95780638da5cb5b146100b3578063cdcb760a146100c4578063f2fde38b146100d7575b600080fd5b61007a610075366004610406565b6100ea565b6040516001600160a01b03909116815260200160405180910390f35b61007a6100a43660046104e7565b6100fd565b6100b1610179565b005b6000546001600160a01b031661007a565b61007a6100d236600461053e565b61018d565b6100b16100e5366004610585565b6101a3565b60006100f68383610221565b9392505050565b600061010761022e565b61011360008584610288565b60405163f2fde38b60e01b81526001600160a01b0385811660048301529192509082169063f2fde38b90602401600060405180830381600087803b15801561015a57600080fd5b505af115801561016e573d6000803e3d6000fd5b505050509392505050565b61018161022e565b61018b600061038c565b565b600061019761022e565b6100f660008484610288565b6101ab61022e565b6001600160a01b0381166102155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61021e8161038c565b50565b60006100f68383306103dc565b6000546001600160a01b0316331461018b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161020c565b6000834710156102da5760405162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015260640161020c565b815160000361032b5760405162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015260640161020c565b8282516020840186f590506001600160a01b0381166100f65760405162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015260640161020c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6000806040838503121561041957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461043f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261046b57600080fd5b813567ffffffffffffffff8082111561048657610486610444565b604051601f8301601f19908116603f011681019082821181831017156104ae576104ae610444565b816040528381528660208588010111156104c757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156104fc57600080fd5b8335925061050c60208501610428565b9150604084013567ffffffffffffffff81111561052857600080fd5b6105348682870161045a565b9150509250925092565b6000806040838503121561055157600080fd5b82359150602083013567ffffffffffffffff81111561056f57600080fd5b61057b8582860161045a565b9150509250929050565b60006020828403121561059757600080fd5b6100f68261042856fea2646970667358221220c02de9d9e1ff0b3ce81f770faee9704c7fd6bc783cfffc7c05c850d094ed8ee964736f6c63430008100033

Verified Source Code Full Match

Compiler: v0.8.16+commit.07a7930e EVM: london Optimization: Yes (200 runs)
PWNDeployer.sol 66 lines
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;

import "openzeppelin-contracts/contracts/access/Ownable.sol";
import "openzeppelin-contracts/contracts/utils/Create2.sol";


/**
 * @title PWN Deployer
 * @notice Contract that deploys other PWN protocol contracst with `CREATE2` opcode, to have same addresses on different chains.
 */
contract PWNDeployer is Ownable {

    string internal constant VERSION = "1.0";

    /*----------------------------------------------------------*|
    |*  # CONSTRUCTOR                                           *|
    |*----------------------------------------------------------*/

    constructor() Ownable() {

    }


    /*----------------------------------------------------------*|
    |*  # DEPLOY FUNCTIONS                                      *|
    |*----------------------------------------------------------*/

    /**
     * @notice Deploy new contract with salt.
     * @dev Set of salts is defined in {PWNContractDeployerSalt.sol}.
     *      Only deployer owner can call this function.
     * @param salt Salt used in `CREATE2` call.
     * @param bytecode Contracts create code encoded with constructor params.
     * @return Newly deployed contract address.
     */
    function deploy(bytes32 salt, bytes memory bytecode) external onlyOwner returns (address) {
        return Create2.deploy(0, salt, bytecode);
    }

    /**
     * @notice Deploy new contract with salt and transfer its ownership to the `owner`.
     * @dev Set of salts is defined in {PWNContractDeployerSalt.sol}.
     *      Only deployer owner can call this function.
     *      The newly deployed contract is expected to be `Ownable` to execute the `transferOwnership` function.
     * @param salt Salt used in `CREATE2` call.
     * @param owner Address to which the contract ownership is transferred after deployment.
     * @param bytecode Contracts create code encoded with constructor params.
     * @return deployedContract Newly deployed contract address.
     */
    function deployAndTransferOwnership(bytes32 salt, address owner, bytes memory bytecode) external onlyOwner returns (address deployedContract) {
        deployedContract = Create2.deploy(0, salt, bytecode);
        Ownable(deployedContract).transferOwnership(owner);
    }

    /**
     * @notice Compute address of a contract that would be deployed with given salt.
     * @param salt Salt used in `CREATE2` call.
     * @param bytecodeHash Hash of a contracts create code encoded with constructor params.
     * @return Computed contract address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) external view returns (address) {
        return Create2.computeAddress(salt, bytecodeHash);
    }

}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Create2.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Create2.sol)

pragma solidity ^0.8.0;

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(
        uint256 amount,
        bytes32 salt,
        bytes memory bytecode
    ) internal returns (address addr) {
        require(address(this).balance >= amount, "Create2: insufficient balance");
        require(bytecode.length != 0, "Create2: bytecode length is zero");
        /// @solidity memory-safe-assembly
        assembly {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(addr != address(0), "Create2: Failed on deploy");
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
     * `bytecodeHash` or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
        return computeAddress(salt, bytecodeHash, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(
        bytes32 salt,
        bytes32 bytecodeHash,
        address deployer
    ) internal pure returns (address addr) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40) // Get free memory pointer

            // |                   | ↓ ptr ...  ↓ ptr + 0x0B (start) ...  ↓ ptr + 0x20 ...  ↓ ptr + 0x40 ...   |
            // |-------------------|---------------------------------------------------------------------------|
            // | bytecodeHash      |                                                        CCCCCCCCCCCCC...CC |
            // | salt              |                                      BBBBBBBBBBBBB...BB                   |
            // | deployer          | 000000...0000AAAAAAAAAAAAAAAAAAA...AA                                     |
            // | 0xFF              |            FF                                                             |
            // |-------------------|---------------------------------------------------------------------------|
            // | memory            | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |
            // | keccak(start, 85) |            ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |

            mstore(add(ptr, 0x40), bytecodeHash)
            mstore(add(ptr, 0x20), salt)
            mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
            let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
            mstore8(start, 0xff)
            addr := keccak256(start, 85)
        }
    }
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

Read Contract

computeAddress 0x481286e6 → address
owner 0x8da5cb5b → address

Write Contract 4 functions

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

deploy 0xcdcb760a
bytes32 salt
bytes bytecode
returns: address
deployAndTransferOwnership 0x5eb5d207
bytes32 salt
address owner
bytes bytecode
returns: address
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address