Contract 0xF7c5503E8b97dca47265c3e445eBd578b037dB3D 2

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xc62ed6f03502752517193b4e493b7be6fb34d9b8a4672a92642dce9fd29f4be90x60a06040253571312023-01-24 14:43:256 days 8 hrs ago0x52786c3b943d134b3698d71041dc27973f01ac80 IN  Create: OpFactory0 AVAX0.00883307525
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
OpFactory

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 3 : Clones.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol)

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create(0, 0x09, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create2(0, 0x09, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(add(ptr, 0x38), deployer)
            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
            mstore(add(ptr, 0x14), implementation)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
            mstore(add(ptr, 0x58), salt)
            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
            predicted := keccak256(add(ptr, 0x43), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 2 of 3 : IDefiOp.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

interface IDefiOp {
    function init(address owner_) external;

    function withdrawERC20(address token) external;

    function withdrawNative() external;
}

File 3 of 3 : OpFactory.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/proxy/Clones.sol";

import {IDefiOp} from "./interfaces/IDefiOp.sol";

contract OpFactory {
    address public immutable opImplementation;
    event OpCreated(address owner, address opContract);

    constructor(address opImplementation_) {
        opImplementation = opImplementation_;
    }

    function getOpFor(address wallet) external view returns (address op) {
        op = Clones.predictDeterministicAddress(
            opImplementation,
            keccak256(abi.encodePacked(wallet)),
            address(this)
        );
    }

    function createOp() external {
        createOpFor(msg.sender);
    }

    function createOpFor(address owner) public {
        address op = Clones.cloneDeterministic(
            opImplementation,
            keccak256(abi.encodePacked(owner))
        );
        IDefiOp(op).init(owner);

        emit OpCreated(owner, op);
    }
}

Settings
{
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"opImplementation_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"opContract","type":"address"}],"name":"OpCreated","type":"event"},{"inputs":[],"name":"createOp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"createOpFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getOpFor","outputs":[{"internalType":"address","name":"op","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"opImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b50604051610683380380610683833981810160405281019061003291906100cf565b8073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1681525050506100fc565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061009c82610071565b9050919050565b6100ac81610091565b81146100b757600080fd5b50565b6000815190506100c9816100a3565b92915050565b6000602082840312156100e5576100e461006c565b5b60006100f3848285016100ba565b91505092915050565b6080516105606101236000396000818160c70152818160fb01526101f701526105606000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063468512d914610051578063829a29e31461006f578063b81ef1db14610079578063c55f630814610095575b600080fd5b6100596100c5565b60405161006691906103a8565b60405180910390f35b6100776100e9565b005b610093600480360381019061008e91906103f4565b6100f4565b005b6100af60048036038101906100aa91906103f4565b6101f0565b6040516100bc91906103a8565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6100f2336100f4565b565b60006101467f00000000000000000000000000000000000000000000000000000000000000008360405160200161012b9190610469565b6040516020818303038152906040528051906020012061024a565b90508073ffffffffffffffffffffffffffffffffffffffff166319ab453c836040518263ffffffff1660e01b815260040161018191906103a8565b600060405180830381600087803b15801561019b57600080fd5b505af11580156101af573d6000803e3d6000fd5b505050507fcd48388cd7912bf899cd4e5db7ec55b9b5a32dd2951163f9d6e16d07fd49edda82826040516101e4929190610484565b60405180910390a15050565b60006102437f0000000000000000000000000000000000000000000000000000000000000000836040516020016102279190610469565b6040516020818303038152906040528051906020012030610306565b9050919050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008360601b60e81c176000526e5af43d82803e903d91602b57fd5bf38360781b1760205281603760096000f59050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610300576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102f79061050a565b60405180910390fd5b92915050565b60006040518260388201526f5af43d82803e903d91602b57fd5bf3ff6024820152846014820152733d602d80600a3d3981f3363d3d373d3d3d363d7381528360588201526037600c8201206078820152605560438201209150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061039282610367565b9050919050565b6103a281610387565b82525050565b60006020820190506103bd6000830184610399565b92915050565b600080fd5b6103d181610387565b81146103dc57600080fd5b50565b6000813590506103ee816103c8565b92915050565b60006020828403121561040a576104096103c3565b5b6000610418848285016103df565b91505092915050565b60008160601b9050919050565b600061043982610421565b9050919050565b600061044b8261042e565b9050919050565b61046361045e82610387565b610440565b82525050565b60006104758284610452565b60148201915081905092915050565b60006040820190506104996000830185610399565b6104a66020830184610399565b9392505050565b600082825260208201905092915050565b7f455243313136373a2063726561746532206661696c6564000000000000000000600082015250565b60006104f46017836104ad565b91506104ff826104be565b602082019050919050565b60006020820190508181036000830152610523816104e7565b905091905056fea2646970667358221220ab4d8fffd609767fd46ac50d603eb244d4ec64b432e5015d2345b221c41a40d464736f6c634300081100330000000000000000000000004869f0ca320f910de6f2a587506d4e93437597d5

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000004869f0ca320f910de6f2a587506d4e93437597d5

-----Decoded View---------------
Arg [0] : opImplementation_ (address): 0x4869f0ca320f910de6f2a587506d4e93437597d5

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004869f0ca320f910de6f2a587506d4e93437597d5


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.