Contract 0x30582eeE34719fe22b1B6c3b607636A3ab94522E

Txn Hash Method
Block
From
To
Value
0x849992bf3564076feb04cf4cf1b4adfc4cf1cf99c94befb4648203ad357c2da6New Account150998922023-09-25 7:44:1212 hrs 47 mins ago0xd5255ac600d440f445607babeb2be5fa320ce9a6 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635171.50000005
0x0e95152aaf358883a8210b4a639aad30cc0acad41c9600588e1bc3a4afc02c84New Account148488872023-09-19 12:17:226 days 8 hrs ago0xed6a920c8c4dc8ab09fc90c972de0b506f93db1f IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.000037191990.11
0xcb738bc2de7b3d2e9c2d943c5c8312c75cbfeeb0bbf13a889af590f3c491ca1cNew Account146899032023-09-15 19:57:5410 days 33 mins ago0xee3c0b0d3338ae53be5f41b058265469059165f1 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0xd713cd4aab55d82c4ae39c579b6474a36cbc0f103951e2cbe7164825b7a3fb31New Account146404292023-09-14 16:28:4611 days 4 hrs ago0x76c568e643074553857ba1fb9b17f1ae5c7b0f34 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0x387d3ad7fd5c46caea49aab38b6eb35c466ad65855fa8c5eeb54b54ac67a4d93New Account145538512023-09-12 16:22:5013 days 4 hrs ago0x001d02127d7d798dcfc8a42f267d163d54c00198 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0xc500034b16599c6a2727871701e7cf5aa634d4a930b42b0a6091edb22aa4da6bNew Account142182502023-09-04 21:56:0820 days 22 hrs ago0x703d760c1f11c2c429e0cd1f7230d05d81891d87 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0000321009160.10000005
0xee732859fe87709e1f02814d80f42a4601984ae91b9a72c95f4bcddc1f7d0ad9New Account141384242023-09-03 1:35:1622 days 18 hrs ago0x9076af168ed01c917a7c3cf58b3ac063d5f913d4 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0000338109160.10000005
0x2753fec619bff80b3250f8186b92c198c769a1f33dc57c86cc7b8b6da18312cdNew Account140640882023-09-01 8:17:2424 days 12 hrs ago0x1a2d045380ee3bff01a244882cefdb805ade7267 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0xac328cd2afeca10371787e02cc8fd7f91a40aaea787c3ce8299d485433ca4ba7New Account139729022023-08-30 5:37:5226 days 14 hrs ago0x730669592fa07a0d932d23c3cbeecbcade07e38d IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0x90f24549938490e0da0c8c02f1e7fdf1b6dd57195c782fa6561534efae1eb0edNew Account139570812023-08-29 20:50:3026 days 23 hrs ago0x703d760c1f11c2c429e0cd1f7230d05d81891d87 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0000338109160.10000005
0x51c0c73f452bd831513d00575854c1b2090c1f754e9a8e1bef4b6b4d393fc101New Account138966942023-08-28 11:17:3628 days 9 hrs ago0xa505c99a1ddb782a6b8e4b97b70f7d402e1e0c17 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0xaccb6ad61c1720f0949395ed5745246d54838fd841eba15bb8982ea6631e465fNew Account138021532023-08-26 6:46:1430 days 13 hrs ago0x03e0175564c4b3e0ea5de56cfc41ece395833a52 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635161.50000005
0x8d7d24f17d86c2322b94c3178979c7d8ee437161908ba13c35f64c0281bbf4beNew Account133815232023-08-16 13:05:1440 days 7 hrs ago0x0c4ea5f0219fbc4decf9536463524953cd75f0cb IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071635181.50000005
0xdd937ad495824d9469315700bf7037fa5fd3728a04b7c47ac284b216c65b732fNew Account131361922023-08-10 20:47:3245 days 23 hrs ago0x0789091de9d7c34bc0621083ca268ed350a0f8d5 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071638021.50000005
0x7886c89c2d2fe170289c1ccc71fa65c7386edefff77582c45825e152e379e42aNew Account130400232023-08-08 15:21:5448 days 5 hrs ago0x3723ac5e62eb80fa8a175cf7a6b1d7edcad09b3f IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005668741591.50000005
0x8de632eefae6b184e1c875a59c63b3fa76d4a4adfceb310dbf46900b47f61a49New Account130056432023-08-07 20:15:5449 days 15 mins ago0x704b2f05b531a664767d32b8c4f0e7f16c1361d8 IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0005071651821.50000005
0x7e10ad653390ac5709a1eedd9ceaf05121200e84e84f52e180ca4e3fb1a99e9aNew Account128617352023-08-04 12:18:5852 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0x241752d7022d762ff45e6d08b72d3a17af26cc1ef032ceac3bb92f83ac0b7ce6New Account128617322023-08-04 12:18:5252 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0x2a62e6ba09d3ca58fe8573e46e6ac214a1729e1c7e711a64baa55aded2622f9cNew Account128617302023-08-04 12:18:4852 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0x843e491aa7f6fe97ad045b237d609cdd0f4cb075f7f692627353c60dedb08a65New Account128617272023-08-04 12:18:4252 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0x83c16440d52d1cf7458448b8e1b06c77b17fbb56527142e3a7bcbbe2e4167341New Account128617252023-08-04 12:18:3852 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0xdefd5f2fc37b562fb222e70dff29a9028c133db5cc048c2da7ce83c82b317874New Account128617242023-08-04 12:18:3652 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0xf18819b4fb96389a34b2abac9849297158e0cfb2e4d3ed33522263523d4a97c2New Account128617222023-08-04 12:18:3252 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0xa87d70a708aba2d142ccd3a083bcd3cd7ded18ead5eb4e0ff141f181c43c473bNew Account128617192023-08-04 12:18:2652 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
0xaad18c810745f1de31f3f503c2c444404f6dd1e9bee9a21adcbf0ecdd1b7d6c0New Account128617152023-08-04 12:18:1852 days 8 hrs ago0x484dcb2690eb56dc60261f89ae59c114e9724aaa IN 0x30582eee34719fe22b1b6c3b607636a3ab94522e0 ETH0.0004815135161.50000005
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x849992bf3564076feb04cf4cf1b4adfc4cf1cf99c94befb4648203ad357c2da6150998922023-09-25 7:44:1212 hrs 47 mins ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x0e95152aaf358883a8210b4a639aad30cc0acad41c9600588e1bc3a4afc02c84148488872023-09-19 12:17:226 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xcb738bc2de7b3d2e9c2d943c5c8312c75cbfeeb0bbf13a889af590f3c491ca1c146899032023-09-15 19:57:5410 days 33 mins ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xaebab0dcc2f9070c85ac95cf35298dd8c695111f6a6d09c009bb2dbfb5b82f55146831292023-09-15 16:12:0610 days 4 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x2b39edf78c8878cb34cafc297a293c0b1d050aecb26b9687e4057b4898187dbb146821422023-09-15 15:39:1210 days 4 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xd713cd4aab55d82c4ae39c579b6474a36cbc0f103951e2cbe7164825b7a3fb31146404292023-09-14 16:28:4611 days 4 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x387d3ad7fd5c46caea49aab38b6eb35c466ad65855fa8c5eeb54b54ac67a4d93145538512023-09-12 16:22:5013 days 4 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xc500034b16599c6a2727871701e7cf5aa634d4a930b42b0a6091edb22aa4da6b142182502023-09-04 21:56:0820 days 22 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xee732859fe87709e1f02814d80f42a4601984ae91b9a72c95f4bcddc1f7d0ad9141384242023-09-03 1:35:1622 days 18 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x2753fec619bff80b3250f8186b92c198c769a1f33dc57c86cc7b8b6da18312cd140640882023-09-01 8:17:2424 days 12 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xac328cd2afeca10371787e02cc8fd7f91a40aaea787c3ce8299d485433ca4ba7139729022023-08-30 5:37:5226 days 14 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x90f24549938490e0da0c8c02f1e7fdf1b6dd57195c782fa6561534efae1eb0ed139570812023-08-29 20:50:3026 days 23 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x51c0c73f452bd831513d00575854c1b2090c1f754e9a8e1bef4b6b4d393fc101138966942023-08-28 11:17:3628 days 9 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xaccb6ad61c1720f0949395ed5745246d54838fd841eba15bb8982ea6631e465f138021532023-08-26 6:46:1430 days 13 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x8d7d24f17d86c2322b94c3178979c7d8ee437161908ba13c35f64c0281bbf4be133815232023-08-16 13:05:1440 days 7 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xdd937ad495824d9469315700bf7037fa5fd3728a04b7c47ac284b216c65b732f131361922023-08-10 20:47:3245 days 23 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x7886c89c2d2fe170289c1ccc71fa65c7386edefff77582c45825e152e379e42a130400232023-08-08 15:21:5448 days 5 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x8de632eefae6b184e1c875a59c63b3fa76d4a4adfceb310dbf46900b47f61a49130056432023-08-07 20:15:5449 days 15 mins ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x7e10ad653390ac5709a1eedd9ceaf05121200e84e84f52e180ca4e3fb1a99e9a128617352023-08-04 12:18:5852 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x241752d7022d762ff45e6d08b72d3a17af26cc1ef032ceac3bb92f83ac0b7ce6128617322023-08-04 12:18:5252 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x2a62e6ba09d3ca58fe8573e46e6ac214a1729e1c7e711a64baa55aded2622f9c128617302023-08-04 12:18:4852 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x843e491aa7f6fe97ad045b237d609cdd0f4cb075f7f692627353c60dedb08a65128617272023-08-04 12:18:4252 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0x83c16440d52d1cf7458448b8e1b06c77b17fbb56527142e3a7bcbbe2e4167341128617252023-08-04 12:18:3852 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xdefd5f2fc37b562fb222e70dff29a9028c133db5cc048c2da7ce83c82b317874128617242023-08-04 12:18:3652 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
0xf18819b4fb96389a34b2abac9849297158e0cfb2e4d3ed33522263523d4a97c2128617222023-08-04 12:18:3252 days 8 hrs ago 0x30582eee34719fe22b1b6c3b607636a3ab94522e  Contract Creation0 ETH
[ Download CSV Export 
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:
Factory

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 5 : Owned.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Simple single owner authorization mixin.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)
abstract contract Owned {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

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

    /*//////////////////////////////////////////////////////////////
                            OWNERSHIP STORAGE
    //////////////////////////////////////////////////////////////*/

    address public owner;

    modifier onlyOwner() virtual {
        require(msg.sender == owner, "UNAUTHORIZED");

        _;
    }

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(address _owner) {
        owner = _owner;

        emit OwnershipTransferred(address(0), _owner);
    }

    /*//////////////////////////////////////////////////////////////
                             OWNERSHIP LOGIC
    //////////////////////////////////////////////////////////////*/

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

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

File 2 of 5 : AccountProxy.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;

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

/// @title Kwenta Account Proxy
/// @author OpenZeppelin, JaredBorders ([email protected])
/// @dev This contract implements a proxy that gets the
/// implementation address for each call from the {Beacon}
/// (which in this system is the contract: {Factory.sol}).
/// The beacon address is stored in the storage slot
/// `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
/// conflict with the storage layout of the implementation behind this proxy.
contract AccountProxy is IAccountProxy {
    /*//////////////////////////////////////////////////////////////
                           STORAGE MANAGEMENT
    //////////////////////////////////////////////////////////////*/

    bytes32 internal constant _BEACON_STORAGE_SLOT =
        bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1);

    /// @dev struct to store beacon address
    struct AddressSlot {
        address value;
    }

    /// @dev returns the storage slot where the beacon address is stored
    function _getAddressSlot(bytes32 slot)
        internal
        pure
        returns (AddressSlot storage r)
    {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            r.slot := slot
        }
    }

    /*//////////////////////////////////////////////////////////////
                              CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    /// @notice constructor for proxy
    /// @param _beaconAddress: address of beacon (i.e. factory address)
    /// @dev {Factory.sol} will store the implementation address,
    /// thus acting as the beacon
    constructor(address _beaconAddress) {
        _getAddressSlot(_BEACON_STORAGE_SLOT).value = _beaconAddress;
    }

    /*//////////////////////////////////////////////////////////////
                              BEACON LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @return beacon address (i.e. the factory address)
    function _beacon() internal view returns (address beacon) {
        beacon = _getAddressSlot(_BEACON_STORAGE_SLOT).value;
        if (beacon == address(0)) revert BeaconNotSet();
    }

    /*//////////////////////////////////////////////////////////////
                          IMPLEMENTATION LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @return implementation address (i.e. the account logic address)
    function _implementation() internal returns (address implementation) {
        (bool success, bytes memory data) =
            _beacon().call(abi.encodeWithSignature("implementation()"));
        if (!success) revert BeaconCallFailed();
        implementation = abi.decode(data, (address));
        if (implementation == address(0)) revert ImplementationNotSet();
    }

    /*//////////////////////////////////////////////////////////////
                            FORWARDING LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.
    /// Will run if no other function in the contract matches the call data.
    fallback() external payable {
        _fallback();
    }

    /// @dev Fallback function that delegates calls to the address returned by `_implementation()`.
    /// Will run if call data is empty.
    receive() external payable {
        _fallback();
    }

    /// @notice Delegates the current call to the address returned by `_implementation()`.
    /// @dev This function does not return to its internal call site,
    /// it will return directly to the external caller.
    function _fallback() internal {
        _delegate(_implementation());
    }

    /// @notice delegates the current call to `implementation`.
    /// @dev This function does not return to its internal call site,
    /// it will return directly to the external caller.
    function _delegate(address implementation) internal virtual {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result :=
                delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())
            switch result
            // delegatecall returns 0 on error.
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }
}

File 3 of 5 : Factory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;

import {AccountProxy} from "./AccountProxy.sol";
import {IFactory} from "./interfaces/IFactory.sol";
import {Owned} from "@solmate/auth/Owned.sol";

/// @title Kwenta Account Factory
/// @author JaredBorders ([email protected])
/// @notice factory for creating smart margin accounts
/// @dev the factory acts as a beacon for the proxy {AccountProxy.sol} contract(s)
contract Factory is IFactory, Owned {
    /*//////////////////////////////////////////////////////////////
                                 STATE
    //////////////////////////////////////////////////////////////*/

    /// @inheritdoc IFactory
    bool public canUpgrade = true;

    /// @inheritdoc IFactory
    address public implementation;

    /// @inheritdoc IFactory
    mapping(address accounts => bool exist) public accounts;

    /// @notice mapping of owner to accounts owned by owner
    mapping(address owner => address[] accounts) internal ownerAccounts;

    /*//////////////////////////////////////////////////////////////
                              CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    /// @notice constructor for factory that sets owner
    /// @param _owner: owner of factory
    constructor(address _owner) Owned(_owner) {}

    /*//////////////////////////////////////////////////////////////
                                 VIEWS
    //////////////////////////////////////////////////////////////*/

    /// @inheritdoc IFactory
    function getAccountOwner(address _account)
        public
        view
        override
        returns (address)
    {
        // ensure account is registered
        if (!accounts[_account]) revert AccountDoesNotExist();

        // fetch owner from account
        (bool success, bytes memory data) =
            _account.staticcall(abi.encodeWithSignature("owner()"));
        assert(success); // should never fail (account is a contract)

        return abi.decode(data, (address));
    }

    /// @inheritdoc IFactory
    function getAccountsOwnedBy(address _owner)
        external
        view
        override
        returns (address[] memory)
    {
        return ownerAccounts[_owner];
    }

    /*//////////////////////////////////////////////////////////////
                               OWNERSHIP
    //////////////////////////////////////////////////////////////*/

    /// @inheritdoc IFactory
    function updateAccountOwnership(address _newOwner, address _oldOwner)
        external
        override
    {
        // ensure account is registered by factory
        if (!accounts[msg.sender]) revert AccountDoesNotExist();

        // store length of ownerAccounts array in memory
        uint256 length = ownerAccounts[_oldOwner].length;

        for (uint256 i = 0; i < length;) {
            if (ownerAccounts[_oldOwner][i] == msg.sender) {
                // remove account from ownerAccounts mapping for old owner
                ownerAccounts[_oldOwner][i] =
                    ownerAccounts[_oldOwner][length - 1];
                ownerAccounts[_oldOwner].pop();

                // add account to ownerAccounts mapping for new owner
                ownerAccounts[_newOwner].push(msg.sender);

                return;
            }

            unchecked {
                ++i;
            }
        }
    }

    /*//////////////////////////////////////////////////////////////
                           ACCOUNT DEPLOYMENT
    //////////////////////////////////////////////////////////////*/

    /// @inheritdoc IFactory
    function newAccount()
        external
        override
        returns (address payable accountAddress)
    {
        // create account and set beacon to this address (i.e. factory address)
        accountAddress = payable(address(new AccountProxy(address(this))));

        // add account to accounts mapping
        accounts[accountAddress] = true;

        // add account to ownerAccounts mapping
        ownerAccounts[msg.sender].push(accountAddress);

        // set owner of account to caller
        (bool success, bytes memory data) = accountAddress.call(
            abi.encodeWithSignature("setInitialOwnership(address)", msg.sender)
        );
        if (!success) revert FailedToSetAcountOwner(data);

        // determine version for the following event
        (success, data) =
            accountAddress.call(abi.encodeWithSignature("VERSION()"));
        if (!success) revert AccountFailedToFetchVersion(data);

        emit NewAccount({
            creator: msg.sender,
            account: accountAddress,
            version: abi.decode(data, (bytes32))
        });
    }

    /*//////////////////////////////////////////////////////////////
                             UPGRADABILITY
    //////////////////////////////////////////////////////////////*/

    /// @inheritdoc IFactory
    function upgradeAccountImplementation(address _implementation)
        external
        override
        onlyOwner
    {
        if (!canUpgrade) revert CannotUpgrade();
        implementation = _implementation;
        emit AccountImplementationUpgraded({implementation: _implementation});
    }

    /// @inheritdoc IFactory
    function removeUpgradability() external override onlyOwner {
        canUpgrade = false;
    }
}

File 4 of 5 : IAccountProxy.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;

/// @title Kwenta Account Proxy Interface
/// @author JaredBorders ([email protected])
interface IAccountProxy {
    /*//////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/

    /// @dev thrown if beacon is not set to a valid address
    error BeaconNotSet();

    /// @dev thrown if implementation is not set to a valid address
    error ImplementationNotSet();

    /// @dev thrown if beacon call fails
    error BeaconCallFailed();
}

File 5 of 5 : IFactory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;

/// @title Kwenta Factory Interface
/// @author JaredBorders ([email protected])
interface IFactory {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    /// @notice emitted when new account is created
    /// @param creator: account creator (address that called newAccount())
    /// @param account: address of account that was created (will be address of proxy)
    event NewAccount(
        address indexed creator, address indexed account, bytes32 version
    );

    /// @notice emitted when implementation is upgraded
    /// @param implementation: address of new implementation
    event AccountImplementationUpgraded(address implementation);

    /*//////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/

    /// @notice thrown when factory cannot set account owner to the msg.sender
    /// @param data: data returned from failed low-level call
    error FailedToSetAcountOwner(bytes data);

    /// @notice thrown when Account creation fails due to no version being set
    /// @param data: data returned from failed low-level call
    error AccountFailedToFetchVersion(bytes data);

    /// @notice thrown when factory is not upgradable
    error CannotUpgrade();

    /// @notice thrown when account is unrecognized by factory
    error AccountDoesNotExist();

    /*//////////////////////////////////////////////////////////////
                                 VIEWS
    //////////////////////////////////////////////////////////////*/

    /// @return canUpgrade: bool to determine if system can be upgraded
    function canUpgrade() external view returns (bool);

    /// @return logic: account logic address
    function implementation() external view returns (address);

    /// @param _account: address of account
    /// @return whether or not account exists
    function accounts(address _account) external view returns (bool);

    /// @param _account: address of account
    /// @return owner of account
    function getAccountOwner(address _account)
        external
        view
        returns (address);

    /// @param _owner: address of owner
    /// @return array of accounts owned by _owner
    function getAccountsOwnedBy(address _owner)
        external
        view
        returns (address[] memory);

    /*//////////////////////////////////////////////////////////////
                               OWNERSHIP
    //////////////////////////////////////////////////////////////*/

    /// @notice update owner to account(s) mapping
    /// @dev does *NOT* check new owner != old owner
    /// @param _newOwner: new owner of account
    /// @param _oldOwner: old owner of account
    function updateAccountOwnership(address _newOwner, address _oldOwner)
        external;

    /*//////////////////////////////////////////////////////////////
                           ACCOUNT DEPLOYMENT
    //////////////////////////////////////////////////////////////*/

    /// @notice create unique account proxy for function caller
    /// @return accountAddress address of account created
    function newAccount() external returns (address payable accountAddress);

    /*//////////////////////////////////////////////////////////////
                             UPGRADABILITY
    //////////////////////////////////////////////////////////////*/

    /// @notice upgrade implementation of account which all account proxies currently point to
    /// @dev this *will* impact all existing accounts
    /// @dev future accounts will also point to this new implementation (until
    /// upgradeAccountImplementation() is called again with a newer implementation)
    /// @dev *DANGER* this function does not check the new implementation for validity,
    /// thus, a bad upgrade could result in severe consequences.
    /// @param _implementation: address of new implementation
    function upgradeAccountImplementation(address _implementation) external;

    /// @notice remove upgradability from factory
    /// @dev cannot be undone
    function removeUpgradability() external;
}

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@solmate/=lib/solmate/src/",
    "@synthetix/=src/interfaces/synthetix/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountDoesNotExist","type":"error"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"AccountFailedToFetchVersion","type":"error"},{"inputs":[],"name":"CannotUpgrade","type":"error"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"FailedToSetAcountOwner","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"implementation","type":"address"}],"name":"AccountImplementationUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"version","type":"bytes32"}],"name":"NewAccount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"accounts","type":"address"}],"name":"accounts","outputs":[{"internalType":"bool","name":"exist","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canUpgrade","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getAccountOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getAccountsOwnedBy","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"newAccount","outputs":[{"internalType":"address payable","name":"accountAddress","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeUpgradability","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"},{"internalType":"address","name":"_oldOwner","type":"address"}],"name":"updateAccountOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_implementation","type":"address"}],"name":"upgradeAccountImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526000805460ff60a01b1916600160a01b17905534801561002357600080fd5b5060405161144738038061144783398101604081905261004291610091565b600080546001600160a01b0319166001600160a01b03831690811782556040518392907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350506100c1565b6000602082840312156100a357600080fd5b81516001600160a01b03811681146100ba57600080fd5b9392505050565b611377806100d06000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638da5cb5b11610081578063bf335e621161005b578063bf335e62146101e0578063f2fde38b146101e8578063fc8613f9146101fb57600080fd5b80638da5cb5b1461017b5780639738968c1461019b578063b53bc1e3146101c057600080fd5b80634b06effe116100b25780634b06effe146101205780635c60da1b146101285780635e5c06e21461014857600080fd5b80632e9ca204146100ce578063442b172c146100e3575b600080fd5b6100e16100dc366004610cea565b61020e565b005b6100f66100f1366004610d23565b61048a565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100e16105d5565b6001546100f69073ffffffffffffffffffffffffffffffffffffffff1681565b61016b610156366004610d23565b60026020526000908152604090205460ff1681565b6040519015158152602001610117565b6000546100f69073ffffffffffffffffffffffffffffffffffffffff1681565b60005461016b9074010000000000000000000000000000000000000000900460ff1681565b6101d36101ce366004610d23565b610685565b6040516101179190610d47565b6100f6610715565b6100e16101f6366004610d23565b610a79565b6100e1610209366004610d23565b610b6a565b3360009081526002602052604090205460ff16610257576040517fe76ea87f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260036020526040812054905b818110156104845773ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604090208054339190839081106102c1576102c1610da1565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff160361047c5773ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020610318600184610dd0565b8154811061032857610328610da1565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff86811684526003909252604090922080549190921691908390811061037257610372610da1565b600091825260208083209190910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff94851617905591851681526003909152604090208054806103dc576103dc610e10565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116909155930190935573ffffffffffffffffffffffffffffffffffffffff96909616865260038252604086208054600181018255908752919095200180549094163317909355505050565b60010161027f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081205460ff166104e9576040517fe76ea87f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8da5cb5b000000000000000000000000000000000000000000000000000000001790529051600091829173ffffffffffffffffffffffffffffffffffffffff86169161056791610e63565b600060405180830381855afa9150503d80600081146105a2576040519150601f19603f3d011682016040523d82523d6000602084013e6105a7565b606091505b5091509150816105b9576105b9610e7f565b808060200190518101906105cd9190610eae565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461065b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602090815260409182902080548351818402810184019094528084526060939283018282801561070957602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116106de575b50505050509050919050565b60003060405161072490610cb8565b73ffffffffffffffffffffffffffffffffffffffff9091168152602001604051809103906000f08015801561075d573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600081815260026020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915533808552600384528285208054928301815585529284200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000168517905551602481019190915292935091829190604401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd6c7ef8b00000000000000000000000000000000000000000000000000000000179052516108869190610e63565b6000604051808303816000865af19150503d80600081146108c3576040519150601f19603f3d011682016040523d82523d6000602084013e6108c8565b606091505b50915091508161090657806040517f215529560000000000000000000000000000000000000000000000000000000081526004016106529190610ecb565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffa1ad7400000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff85169161097f91610e63565b6000604051808303816000865af19150503d80600081146109bc576040519150601f19603f3d011682016040523d82523d6000602084013e6109c1565b606091505b50909250905081610a0057806040517ff873e28c0000000000000000000000000000000000000000000000000000000081526004016106529190610ecb565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f6814d673ab3768002b6eeaf470ba6db3e2b3e4b0f346c0ee23ee9271c1445c3d83806020019051810190610a639190610f1c565b60405190815260200160405180910390a3505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610afa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610652565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60005473ffffffffffffffffffffffffffffffffffffffff163314610beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610652565b60005474010000000000000000000000000000000000000000900460ff16610c3f576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fdaa2b90d4f4e53aac69bc06e8ce6fc4a0d69c6582f74cd6e4547abcb972f7c6e9060200160405180910390a150565b61040c80610f3683390190565b73ffffffffffffffffffffffffffffffffffffffff81168114610ce757600080fd5b50565b60008060408385031215610cfd57600080fd5b8235610d0881610cc5565b91506020830135610d1881610cc5565b809150509250929050565b600060208284031215610d3557600080fd5b8135610d4081610cc5565b9392505050565b6020808252825182820181905260009190848201906040850190845b81811015610d9557835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101610d63565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610e0a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015610e5a578181015183820152602001610e42565b50506000910152565b60008251610e75818460208701610e3f565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600060208284031215610ec057600080fd5b8151610d4081610cc5565b6020815260008251806020840152610eea816040850160208701610e3f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600060208284031215610f2e57600080fd5b505191905056fe608060405234801561001057600080fd5b5060405161040c38038061040c83398101604081905261002f91610085565b8061006161005e60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d516100b5565b90565b80546001600160a01b0319166001600160a01b0392909216919091179055506100dc565b60006020828403121561009757600080fd5b81516001600160a01b03811681146100ae57600080fd5b9392505050565b818103818111156100d657634e487b7160e01b600052601160045260246000fd5b92915050565b610321806100eb6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b610198565b565b60008060006100366101bc565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f5c60da1b00000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff92909216916100b2919061023f565b6000604051808303816000865af19150503d80600081146100ef576040519150601f19603f3d011682016040523d82523d6000602084013e6100f4565b606091505b509150915081610130576040517f73a769bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80806020019051810190610144919061026e565b925073ffffffffffffffffffffffffffffffffffffffff8316610193576040517f40dde93500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505090565b3660008037600080366000845af43d6000803e8080156101b7573d6000f35b3d6000fd5b60006101ef6101ec60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d516102ab565b90565b5473ffffffffffffffffffffffffffffffffffffffff169050806101ec576040517fee755c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000825160005b818110156102605760208186018101518583015201610246565b506000920191825250919050565b60006020828403121561028057600080fd5b815173ffffffffffffffffffffffffffffffffffffffff811681146102a457600080fd5b9392505050565b818103818111156102e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea2646970667358221220a9fe180b118f059af22133ae7f06251ccb7ca886e7c85092c4cf14b7a43fce0064736f6c63430008120033a264697066735822122074c2971fbf6c0bf00f081ec7e4edef26fc5749dd447d3f7dd60a6d5335a62d5264736f6c63430008120033000000000000000000000000c625f59d51ecdff57fefe535c80d318ca42a0ec4

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

000000000000000000000000c625f59d51ecdff57fefe535c80d318ca42a0ec4

-----Decoded View---------------
Arg [0] : _owner (address): 0xc625F59d51ecDff57FEFE535C80d318CA42A0Ec4

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c625f59d51ecdff57fefe535c80d318ca42a0ec4


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading