Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xF7C04d03eFDc876cc8CB59f0aD58290388EDd004
Balance 0 ETH
Nonce 31
Code Size 2248 bytes
Last Active
Indexed Transactions 1 (24,465,83724,465,837)
Gas Used (indexed) 97,909
External Etherscan · Sourcify

Contract Bytecode

2248 bytes
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100f55780639f9fb96814610106578063f2fde38b14610127578063f3fef3a31461013a578063fc0c546a1461014d57600080fd5b806331d4fd77146100985780634e71e0c8146100ad5780635b51bec0146100b557806366d003ac146100d0575b600080fd5b6100ab6100a63660046104a1565b610160565b005b6100ab6101e5565b604051640302e362e360dc1b81526020015b60405180910390f35b6002546001600160a01b03165b6040516001600160a01b0390911681526020016100c7565b6000546001600160a01b03166100dd565b610119610114366004610505565b610283565b6040516100c792919061051d565b6100ab610135366004610480565b61030f565b6100ab6101483660046104dc565b610357565b6003546100dd906001600160a01b031681565b336101736000546001600160a01b031690565b6001600160a01b03161461018657600080fd5b6001600160a01b03831661019957600080fd5b600280546001600160a01b0319166001600160a01b0385161790556101be828261038b565b5050600054600280546001600160a01b0319166001600160a01b0390921691909117905550565b6001546001600160a01b0316331415610281576001546001600160a01b03166102166000546001600160a01b031690565b6001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360018054600080546001600160a01b0383166001600160a01b031991821681179092559182169092556002805490911690911790555b565b60606000806040518060200161029890610457565b601f1982820381018352601f90910116604081815282516020808501919091206001600160f81b0319828501526bffffffffffffffffffffffff193060601b166021850152603584019890985260558084019890985281518084039098018852607590920190528551950194909420939492505050565b336103226000546001600160a01b031690565b6001600160a01b03161461033557600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b3361036a6000546001600160a01b031690565b6001600160a01b03161461037d57600080fd5b610387828261038b565b5050565b60008061039783610283565b600380546001600160a01b0319166001600160a01b038881169190911790915582519294509092508216319060009085906020860183f590506001600160a01b0381166103e357600080fd5b600380546001600160a01b03191690557fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb6104266002546001600160a01b031690565b604080516001600160a01b0392831681529186166020830152810184905260600160405180910390a1505050505050565b6103118061058283390190565b80356001600160a01b038116811461047b57600080fd5b919050565b600060208284031215610491578081fd5b61049a82610464565b9392505050565b6000806000606084860312156104b5578182fd5b6104be84610464565b92506104cc60208501610464565b9150604084013590509250925092565b600080604083850312156104ee578182fd5b6104f783610464565b946020939093013593505050565b600060208284031215610516578081fd5b5035919050565b6040815260008351806040840152815b8181101561054a576020818701810151606086840101520161052d565b8181111561055b5782606083860101525b506001600160a01b0393909316602083015250601f91909101601f19160160600191905056fe608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fea2646970667358221220820d083773baf3f84f3af74133087e936c58f2a05fdf46b525ba37dba6ae0e2d64736f6c63430008040033

Verified Source Code Partial Match

Compiler: v0.8.4+commit.c7e474f2 EVM: istanbul Optimization: Yes (200 runs)
Factory6.sol 208 lines
// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

/**
 * @dev Library of helper methods for interacting with ERC20 tokens that do not consistently return true/false
 */
library SafeERC20 {
    function safeTransfer(IERC20 _token, address _to, uint256 _value) internal {
        (bool success, bytes memory _data) = address(_token).call(abi.encodeWithSelector(_token.transfer.selector, _to, _value));
        require(success && (_data.length == 0 || abi.decode(_data, (bool))));
    }
}

contract Deposit {
    using SafeERC20 for IERC20;

    constructor() payable {
        Factory factory = Factory(msg.sender);
        address _recipient = factory.recipient();

        IERC20 _token = IERC20(factory.token());

        // Send all tokens from this contract to owner Factory
        if (address(_token) != address(0)) {
            IERC20(_token).safeTransfer(
                _recipient,
                IERC20(_token).balanceOf(address(this))
            );
        }

        selfdestruct(payable(_recipient)); // selfdestruct to receive gas refund and reset nonce to 0
    }
}

contract Factory {
    address private _owner = msg.sender;
    address private _pendingOwner;

    address private _recipient = _owner;

    address public token;

    event Withdrawn(address _recipient, address _depositAddress2, uint256 _depositEthBalance);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    modifier onlyOwner() {
        require(owner() == msg.sender);
        _;
    }

    modifier onlyPendingOwner() {
        if (_pendingOwner == msg.sender)
        _;
    }

    function owner() public view virtual returns (address) {
        return _owner;
    }

    function recipient() public view virtual returns (address) {
        return _recipient;
    }

    function getFactoryVersion() external pure returns (bytes5) {
        return '0.6.0';
    }

    function getDeposit(uint256 _salt) public view returns (bytes memory, address) {
        bytes memory _bytecode = type(Deposit).creationCode;

        bytes32 _hash = keccak256(
            abi.encodePacked(
                bytes1(0xff),
                address(this),
                _salt,
                keccak256(_bytecode)
            )
        );

        return (_bytecode, address(uint160(uint256(_hash))));
    }

    function _createDeposit(address _token, uint256 _salt) private {
        (bytes memory _bytecode, address _depositAddress2) = getDeposit(_salt);

        token = _token;
        uint256 _depositEthBalance = _depositAddress2.balance;
        
        address _createAddress2;

        assembly {
            _createAddress2 := create2(
                0, // 0 wei
                add(_bytecode, 32), // the bytecode itself starts at the second slot. The first slot contains array length
                mload(_bytecode), // size of init_code
                _salt // salt from function arguments
            )
        }

        require(_createAddress2 != address(0));

        token = address(0);

        emit Withdrawn(recipient(), _depositAddress2, _depositEthBalance);
    }

    function withdraw(address _token, uint256 _salt) external onlyOwner {
        _createDeposit(_token, _salt);
    }

    function withdrawToAnotherAddress(address _anotherAddress, address _token, uint256 _salt) external onlyOwner {
        require(_anotherAddress != address(0));

        _recipient = _anotherAddress;

        _createDeposit(_token, _salt);

        _recipient = owner();
    }

    function transferOwnership(address _newOwner) external onlyOwner {
        _pendingOwner = _newOwner;
    }

    function claimOwnership() external onlyPendingOwner {
        emit OwnershipTransferred(owner(), _pendingOwner);
       
        _owner = _pendingOwner;       
        _pendingOwner = address(0);

        _recipient = owner();
    }
}

Read Contract

getDeposit 0x9f9fb968 → bytes, address
getFactoryVersion 0x5b51bec0 → bytes5
owner 0x8da5cb5b → address
recipient 0x66d003ac → address
token 0xfc0c546a → address

Write Contract 4 functions

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

claimOwnership 0x4e71e0c8
No parameters
transferOwnership 0xf2fde38b
address _newOwner
withdraw 0xf3fef3a3
address _token
uint256 _salt
withdrawToAnotherAddress 0x31d4fd77
address _anotherAddress
address _token
uint256 _salt

Top Interactions

AddressTxnsSentReceived
0x5F9Acf4E...5151 1 1

Recent Transactions

CSV
|
Hash Method Block Age From/To Value Txn Fee Type
0xc6d198af...aec5d4 0xf3fef3a3 24,465,837 IN 0x5F9Acf4E...5151 0 ETH 0.000161902634 ETH EIP-1559