Contract 0x8234F990b149Ae59416dc260305E565e5DAfEb54 9

 

Contract Overview

Balance:
0 ETH

EtherValue:
$0.00

Token:
Txn Hash Method
Block
From
To
Value
0xb16a62d6668c1d8dbb4b01dbce00f6994fd9c7cf822eb0d16ef4592d16e7b231New Account1101540302023-09-28 13:13:5753 mins ago0xc6ce2877198a43f08e49752d90d8e1e896c87ed0 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000283653310.048731138
0x18203e22cd92816db1dfe4d3b2b96bd7a4467bea65b361fb0bb212a2a313647eNew Account1101515792023-09-28 11:52:152 hrs 15 mins ago0x3c3e1450cd9ea5cf4a19a963f463951cbed1c4a0 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000298888470.050563874
0x0f24467304649a3ea1effdeb9664f3a7d4e3d1b29ba6f8fe936ecf75aa3097b1New Account1101496932023-09-28 10:49:233 hrs 17 mins ago0x87ffcc300d97882431afbec59e389d5041a95b39 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000266935750.047551778
0x4d7c559a3e9fbe426d87704fc16f9d3e4a337235572f35a9dafb1a75d6d8497dNew Account1101481592023-09-28 9:58:154 hrs 9 mins ago0xde93954cc528ef541b261512284c844c8e0d3300 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000265712330.047612192
0x5abfa5dd2ab45c2ccf757e75cb9d1ecfbdccac55ef08c8a9ef05298738c4864dNew Account1101460852023-09-28 8:49:075 hrs 18 mins ago0xdffa6d9d97d5c599578d7d8a04b71bff587c884b IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000647729450.148521
0x88823e81a965791f6a2a5879b3c70fd3ba7accd0920d89a8fb1f15e32091826cNew Account1101453062023-09-28 8:23:095 hrs 44 mins ago0x710c8c280628deffd396f1235c8235b33607e9af IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000327624120.051627429
0xb1962f18b1294a3530ed07e6fb27781fcf3852295b0e20a8a16d6b6a248c4b5aNew Account1101450872023-09-28 8:15:515 hrs 51 mins ago0x2535c9063b2dbe3554ec2d0762f757be6fe0ff28 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.000062054140.149708133
0xc2176ae6c34306a94a6737ee45b02a39cedf6016f27ddf1f945a3746687d3705New Account1101435732023-09-28 7:25:236 hrs 41 mins ago0xf626e9a2fddbf55b0b1a87c56128a7ba6723a85a IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000300165680.049972664
0xbbe0a98bd63fb90f3717452f094e406ce38b526e2c5c1744e2474d5de6d2ec3cNew Account1101429382023-09-28 7:04:137 hrs 3 mins ago0x94e7a1898630213790558d042dc8e713a61fd399 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.000063566930.14936497
0x2aa21444e27eb89d38e56fafa7d0c0de39ca340d243401cbbf8f0fa3f4d0863eNew Account1101427922023-09-28 6:59:217 hrs 7 mins ago0x18d35c6df1c32fe1b6286f57c772f2be9efd9ff0 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000424932710.0955543
0x3f288ae8102f4d152c6eb52215f0eedb5f852df2e6da4225b902d512d8e67f26New Account1101422462023-09-28 6:41:097 hrs 26 mins ago0x0f45e860058f2b2f8c608c1db003348cc2e8cc8e IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000258597940.047033367
0x3d581e48d10f2a8420195eaf82e645b85557068fe3d1b9adee12a00c11011de6New Account1101294222023-09-27 23:33:4114 hrs 33 mins ago0x9cf64fa5e8eaad5250d94a97879a3eac598ee262 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000258360620.04763315
0x45b736bd3564c8cd0406eb40bbc8ba094daa90718837b55b03f783b349eb4abaNew Account1101225752023-09-27 19:45:2718 hrs 21 mins ago0x54f14a2aa105d57fe26f0c8754b02389f52c71b4 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.000064355960.1
0x8aa84a3c98b8d6599fd81111dc8b361568f1fd0f0f943fad137a0099b60e6c66New Account1101209542023-09-27 18:51:2519 hrs 15 mins ago0x11fa3cdf16eef4a180028a132b5968bf938c07a3 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000407349860.064516281
0x1e3643fd464961d24d53bd4d3657a86b47a088f31016f44876128ad0de09d029New Account1101207902023-09-27 18:45:5719 hrs 21 mins ago0x14042891e9b9c662a1fa3a263ce8ab3cbb408913 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000424149030.063830295
0x75e80edc3c949a2edf941b043330ed37de8aed78a64c437ccf48b2bd71372454New Account1101184812023-09-27 17:28:5920 hrs 38 mins ago0x4c930cf4129e201ec2597000fe307f97c9ed04e9 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000474571490.053681854
0x8ba2fee2eacfffc4ce33ab75f40eb0391c38eabcc6156ce45d850c74ab8b0a6cNew Account1101162882023-09-27 16:15:5321 hrs 51 mins ago0x98919fc9e7ba248eb32ef971a193ebec89c0e8bf IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000588089650.099517913
0xd600f4479e05537e500701b5d262be79c0322e462b3c52788211979bcc5a083fNew Account1101145792023-09-27 15:18:5522 hrs 48 mins ago0xbf872950b9f1d08a3e1902ef6ada83eecb847aed IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000484120890.0477746
0xddd668133e9bb524dd0a88f226c43447386c62d1e0556fa3554a5774324f2aaaNew Account1101144692023-09-27 15:15:1522 hrs 52 mins ago0x4b4de68ef03ae45c0d1026801da71258ddc6bcf6 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000554217410.057827985
0xfbe71f56816e4b4413afde5879c665586f94634cc6decf1f37203aefb8bf39f7New Account1101136062023-09-27 14:46:2923 hrs 20 mins ago0xefcb66b8ff69a15e5cd0141c28f34b8a67fb5a2a IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000420239610.0547481
0x84854c56ecca158ce7125f54709f55a7724f9f2d85ea6bc8beebadbdca30cb0aNew Account1101129642023-09-27 14:25:0523 hrs 42 mins ago0xf0e4e8979a5f10a2c5299db0ff496b8b5f107ffc IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000386158090.049952352
0xe38e7f422b33ed646e1ed5ead7ba673ef56382e2ad1d44b27bf914b7e19a3cf4New Account1101129042023-09-27 14:23:0523 hrs 44 mins ago0xb8ac6ef01a6191c8689ad756b4a41dcad7021390 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000452064790.0712059
0xf47925445a9bba883c16c1a68de72c53d72ec656378cda2963682cbbe3412d0fNew Account1101105612023-09-27 13:04:591 day 1 hr ago0x3059c5e38d9ed4b697ec38705ca06db24a33f777 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.00003800570.050860535
0x2d6c8d2357bc69e361695b784dbc271773ffebf70cd2c77163994e6aab4e65eeNew Account1101101792023-09-27 12:52:151 day 1 hr ago0x12e007d8031004ad8aa582b8cf5ec0daa7eee9f1 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000313511820.050268706
0xbc440ace9990ab24f87b674c767c5164f342ab91a35cbbb9cfd272dacfd7fc8aNew Account1101100282023-09-27 12:47:131 day 1 hr ago0x471fc71d72b71a2131c6e1fc5b39fc21d425e653 IN 0x8234f990b149ae59416dc260305e565e5dafeb540 ETH0.0000671017820.149317909
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xb16a62d6668c1d8dbb4b01dbce00f6994fd9c7cf822eb0d16ef4592d16e7b2311101540302023-09-28 13:13:5753 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x18203e22cd92816db1dfe4d3b2b96bd7a4467bea65b361fb0bb212a2a313647e1101515792023-09-28 11:52:152 hrs 15 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x0f24467304649a3ea1effdeb9664f3a7d4e3d1b29ba6f8fe936ecf75aa3097b11101496932023-09-28 10:49:233 hrs 17 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x4d7c559a3e9fbe426d87704fc16f9d3e4a337235572f35a9dafb1a75d6d8497d1101481592023-09-28 9:58:154 hrs 9 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x5abfa5dd2ab45c2ccf757e75cb9d1ecfbdccac55ef08c8a9ef05298738c4864d1101460852023-09-28 8:49:075 hrs 18 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x88823e81a965791f6a2a5879b3c70fd3ba7accd0920d89a8fb1f15e32091826c1101453062023-09-28 8:23:095 hrs 44 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xb1962f18b1294a3530ed07e6fb27781fcf3852295b0e20a8a16d6b6a248c4b5a1101450872023-09-28 8:15:515 hrs 51 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xc2176ae6c34306a94a6737ee45b02a39cedf6016f27ddf1f945a3746687d37051101435732023-09-28 7:25:236 hrs 41 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xbbe0a98bd63fb90f3717452f094e406ce38b526e2c5c1744e2474d5de6d2ec3c1101429382023-09-28 7:04:137 hrs 3 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x2aa21444e27eb89d38e56fafa7d0c0de39ca340d243401cbbf8f0fa3f4d0863e1101427922023-09-28 6:59:217 hrs 7 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x3f288ae8102f4d152c6eb52215f0eedb5f852df2e6da4225b902d512d8e67f261101422462023-09-28 6:41:097 hrs 26 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x3d581e48d10f2a8420195eaf82e645b85557068fe3d1b9adee12a00c11011de61101294222023-09-27 23:33:4114 hrs 33 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x45b736bd3564c8cd0406eb40bbc8ba094daa90718837b55b03f783b349eb4aba1101225752023-09-27 19:45:2718 hrs 21 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x8aa84a3c98b8d6599fd81111dc8b361568f1fd0f0f943fad137a0099b60e6c661101209542023-09-27 18:51:2519 hrs 15 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x1e3643fd464961d24d53bd4d3657a86b47a088f31016f44876128ad0de09d0291101207902023-09-27 18:45:5719 hrs 21 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x75e80edc3c949a2edf941b043330ed37de8aed78a64c437ccf48b2bd713724541101184812023-09-27 17:28:5920 hrs 38 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x8ba2fee2eacfffc4ce33ab75f40eb0391c38eabcc6156ce45d850c74ab8b0a6c1101162882023-09-27 16:15:5321 hrs 51 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xd600f4479e05537e500701b5d262be79c0322e462b3c52788211979bcc5a083f1101145792023-09-27 15:18:5522 hrs 48 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xddd668133e9bb524dd0a88f226c43447386c62d1e0556fa3554a5774324f2aaa1101144692023-09-27 15:15:1522 hrs 52 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xfbe71f56816e4b4413afde5879c665586f94634cc6decf1f37203aefb8bf39f71101136062023-09-27 14:46:2923 hrs 20 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x84854c56ecca158ce7125f54709f55a7724f9f2d85ea6bc8beebadbdca30cb0a1101129642023-09-27 14:25:0523 hrs 42 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xe38e7f422b33ed646e1ed5ead7ba673ef56382e2ad1d44b27bf914b7e19a3cf41101129042023-09-27 14:23:0523 hrs 44 mins ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xf47925445a9bba883c16c1a68de72c53d72ec656378cda2963682cbbe3412d0f1101105612023-09-27 13:04:591 day 1 hr ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0x2d6c8d2357bc69e361695b784dbc271773ffebf70cd2c77163994e6aab4e65ee1101101792023-09-27 12:52:151 day 1 hr ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
0xbc440ace9990ab24f87b674c767c5164f342ab91a35cbbb9cfd272dacfd7fc8a1101100282023-09-27 12:47:131 day 1 hr ago 0x8234f990b149ae59416dc260305e565e5dafeb54  Contract Creation0 ETH
[ Download CSV Export 
Loading

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 Security Audit

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"}]

60806040526000805460ff60a01b1916600160a01b17905534801561002357600080fd5b5060405161144738038061144783398101604081905261004291610091565b600080546001600160a01b0319166001600160a01b03831690811782556040518392907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350506100c1565b6000602082840312156100a357600080fd5b81516001600160a01b03811681146100ba57600080fd5b9392505050565b611377806100d06000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638da5cb5b11610081578063bf335e621161005b578063bf335e62146101e0578063f2fde38b146101e8578063fc8613f9146101fb57600080fd5b80638da5cb5b1461017b5780639738968c1461019b578063b53bc1e3146101c057600080fd5b80634b06effe116100b25780634b06effe146101205780635c60da1b146101285780635e5c06e21461014857600080fd5b80632e9ca204146100ce578063442b172c146100e3575b600080fd5b6100e16100dc366004610cea565b61020e565b005b6100f66100f1366004610d23565b61048a565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100e16105d5565b6001546100f69073ffffffffffffffffffffffffffffffffffffffff1681565b61016b610156366004610d23565b60026020526000908152604090205460ff1681565b6040519015158152602001610117565b6000546100f69073ffffffffffffffffffffffffffffffffffffffff1681565b60005461016b9074010000000000000000000000000000000000000000900460ff1681565b6101d36101ce366004610d23565b610685565b6040516101179190610d47565b6100f6610715565b6100e16101f6366004610d23565b610a79565b6100e1610209366004610d23565b610b6a565b3360009081526002602052604090205460ff16610257576040517fe76ea87f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260036020526040812054905b818110156104845773ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604090208054339190839081106102c1576102c1610da1565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff160361047c5773ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260409020610318600184610dd0565b8154811061032857610328610da1565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff86811684526003909252604090922080549190921691908390811061037257610372610da1565b600091825260208083209190910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff94851617905591851681526003909152604090208054806103dc576103dc610e10565b6000828152602080822083017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116909155930190935573ffffffffffffffffffffffffffffffffffffffff96909616865260038252604086208054600181018255908752919095200180549094163317909355505050565b60010161027f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081205460ff166104e9576040517fe76ea87f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8da5cb5b000000000000000000000000000000000000000000000000000000001790529051600091829173ffffffffffffffffffffffffffffffffffffffff86169161056791610e63565b600060405180830381855afa9150503d80600081146105a2576040519150601f19603f3d011682016040523d82523d6000602084013e6105a7565b606091505b5091509150816105b9576105b9610e7f565b808060200190518101906105cd9190610eae565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461065b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a4544000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602090815260409182902080548351818402810184019094528084526060939283018282801561070957602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116106de575b50505050509050919050565b60003060405161072490610cb8565b73ffffffffffffffffffffffffffffffffffffffff9091168152602001604051809103906000f08015801561075d573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600081815260026020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915533808552600384528285208054928301815585529284200180547fffffffffffffffffffffffff0000000000000000000000000000000000000000168517905551602481019190915292935091829190604401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd6c7ef8b00000000000000000000000000000000000000000000000000000000179052516108869190610e63565b6000604051808303816000865af19150503d80600081146108c3576040519150601f19603f3d011682016040523d82523d6000602084013e6108c8565b606091505b50915091508161090657806040517f215529560000000000000000000000000000000000000000000000000000000081526004016106529190610ecb565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffa1ad7400000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff85169161097f91610e63565b6000604051808303816000865af19150503d80600081146109bc576040519150601f19603f3d011682016040523d82523d6000602084013e6109c1565b606091505b50909250905081610a0057806040517ff873e28c0000000000000000000000000000000000000000000000000000000081526004016106529190610ecb565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f6814d673ab3768002b6eeaf470ba6db3e2b3e4b0f346c0ee23ee9271c1445c3d83806020019051810190610a639190610f1c565b60405190815260200160405180910390a3505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610afa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610652565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b60005473ffffffffffffffffffffffffffffffffffffffff163314610beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610652565b60005474010000000000000000000000000000000000000000900460ff16610c3f576040517f24c1d6d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fdaa2b90d4f4e53aac69bc06e8ce6fc4a0d69c6582f74cd6e4547abcb972f7c6e9060200160405180910390a150565b61040c80610f3683390190565b73ffffffffffffffffffffffffffffffffffffffff81168114610ce757600080fd5b50565b60008060408385031215610cfd57600080fd5b8235610d0881610cc5565b91506020830135610d1881610cc5565b809150509250929050565b600060208284031215610d3557600080fd5b8135610d4081610cc5565b9392505050565b6020808252825182820181905260009190848201906040850190845b81811015610d9557835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101610d63565b50909695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610e0a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015610e5a578181015183820152602001610e42565b50506000910152565b60008251610e75818460208701610e3f565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b600060208284031215610ec057600080fd5b8151610d4081610cc5565b6020815260008251806020840152610eea816040850160208701610e3f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600060208284031215610f2e57600080fd5b505191905056fe608060405234801561001057600080fd5b5060405161040c38038061040c83398101604081905261002f91610085565b8061006161005e60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d516100b5565b90565b80546001600160a01b0319166001600160a01b0392909216919091179055506100dc565b60006020828403121561009757600080fd5b81516001600160a01b03811681146100ae57600080fd5b9392505050565b818103818111156100d657634e487b7160e01b600052601160045260246000fd5b92915050565b610321806100eb6000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b610198565b565b60008060006100366101bc565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f5c60da1b00000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff92909216916100b2919061023f565b6000604051808303816000865af19150503d80600081146100ef576040519150601f19603f3d011682016040523d82523d6000602084013e6100f4565b606091505b509150915081610130576040517f73a769bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80806020019051810190610144919061026e565b925073ffffffffffffffffffffffffffffffffffffffff8316610193576040517f40dde93500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505090565b3660008037600080366000845af43d6000803e8080156101b7573d6000f35b3d6000fd5b60006101ef6101ec60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d516102ab565b90565b5473ffffffffffffffffffffffffffffffffffffffff169050806101ec576040517fee755c3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000825160005b818110156102605760208186018101518583015201610246565b506000920191825250919050565b60006020828403121561028057600080fd5b815173ffffffffffffffffffffffffffffffffffffffff811681146102a457600080fd5b9392505050565b818103818111156102e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea2646970667358221220a9fe180b118f059af22133ae7f06251ccb7ca886e7c85092c4cf14b7a43fce0064736f6c63430008120033a264697066735822122074c2971fbf6c0bf00f081ec7e4edef26fc5749dd447d3f7dd60a6d5335a62d5264736f6c6343000812003300000000000000000000000039cfca7b389529ac861cbb05add802e5b06e5101

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

00000000000000000000000039cfca7b389529ac861cbb05add802e5b06e5101

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

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000039cfca7b389529ac861cbb05add802e5b06e5101


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.