ETH Price: $2,523.98 (-0.01%)

Contract

0x787a700BE36966C316fC737dc21abE2BB904ED71
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x61012060201239642024-06-19 6:21:4773 days ago1718778107IN
 Create: ScrollerAccount
0 ETH0.008632782.67105713

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ScrollerAccount

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
File 1 of 47 : ScrollerAccount.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./AccountV3.sol"; // tokenbound base account contract
import "./interfaces/IL1GatewayRouter.sol";
import "./interfaces/IL2GasOracle.sol";

/**
 * @title Tokenbound ERC-6551 Account Implementation
 * @dev Implementation of an account contract with ERC-6551 compliance, capable of bridging Ether
 *      balances and handling gas reimbursements.
 */
contract ScrollerAccount is AccountV3 {
    /**
     * @dev Address of the Scroll NFT Admin Router.
     */
    address constant ADMIN = 0x2b8fF41DAf40028d71c06bD71Fb1Cbb04fFceF02;

    /**
     * @dev Scroll bridge core contracts used by Scroller.
     */
    address constant L1ROUTER = 0xF8B1378579659D8F7EE5f3C929c2f3E332E41Fd6;
    address constant L2ORACLE = 0x0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B;

    event PaidFees(address to, uint256 gasFee, uint256 serviceFee);
    event RefundedEther(address to, uint256 amount);

    constructor(
        address entryPoint_,
        address multicallForwarder,
        address erc6551Registry,
        address _guardian
    ) AccountV3(entryPoint_, multicallForwarder, erc6551Registry, _guardian) {}

    /**
     * @dev Bridges the Ether balance of the contract to another address, reimbursing gas costs.
     * @param _l1AdminGasLimit L1 gas Limit reimbursed to the Scroller Paymaster EOA.
     * @param _l1BridgeGasLimit L1 gas limit for the Scroll bridge core contracts.
     * @param _l2GasLimit L2 gas limit for the Scroll messaging contracts.
     * @param _feeWallet originating Admin wallet address to receive the L1 gas reimbursement.
     */
    function bridgeEthBalance(
        uint _l1AdminGasLimit,
        uint _l1BridgeGasLimit,
        uint _l2GasLimit,
        address payable _feeWallet
    ) external payable {
        require(msg.sender == ADMIN, "TBA: Not Scroll NFT Admin Contract!");

        // transfer L1 gas fee to Paymaster EOA
        uint l1AdminGasFee = _l1AdminGasLimit * tx.gasprice;
        (bool sent, ) = _feeWallet.call{value: l1AdminGasFee}("");
        require(sent, "TBA: Failed to transfer gas costs.");
        emit PaidFees(_feeWallet, l1AdminGasFee, l1AdminGasFee);

        // determine L2 fees and determine amount to send to L2
        uint l2GasPrice = IL2GasOracle(L2ORACLE).l2BaseFee();
        uint estimatedl2GasFee = _l2GasLimit * l2GasPrice;
        uint amountToReceive = address(this).balance - estimatedl2GasFee;

        // bridge ETH balance to Scroll via bridge core contracts
        IL1GatewayRouter(L1ROUTER).depositETH{value: address(this).balance}(
            owner(),
            amountToReceive,
            _l1BridgeGasLimit
        );

        // return surplus ETH to TBA Owner
        if (address(this).balance > 0) {
            uint repayment = address(this).balance;
            (bool sent2, ) = owner().call{value: repayment}("");
            require(sent2, "TBA: Failed to reimburse Owner.");
            emit RefundedEther(owner(), repayment);
        }
    }
}

File 2 of 47 : BaseAccount.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

/* solhint-disable avoid-low-level-calls */
/* solhint-disable no-empty-blocks */

import "../interfaces/IAccount.sol";
import "../interfaces/IEntryPoint.sol";
import "./Helpers.sol";

/**
 * Basic account implementation.
 * this contract provides the basic logic for implementing the IAccount interface  - validateUserOp
 * specific account implementation should inherit it and provide the account-specific logic
 */
abstract contract BaseAccount is IAccount {
    using UserOperationLib for UserOperation;

    //return value in case of signature failure, with no time-range.
    // equivalent to _packValidationData(true,0,0);
    uint256 constant internal SIG_VALIDATION_FAILED = 1;

    /**
     * Return the account nonce.
     * This method returns the next sequential nonce.
     * For a nonce of a specific key, use `entrypoint.getNonce(account, key)`
     */
    function getNonce() public view virtual returns (uint256) {
        return entryPoint().getNonce(address(this), 0);
    }

    /**
     * return the entryPoint used by this account.
     * subclass should return the current entryPoint used by this account.
     */
    function entryPoint() public view virtual returns (IEntryPoint);

    /**
     * Validate user's signature and nonce.
     * subclass doesn't need to override this method. Instead, it should override the specific internal validation methods.
     */
    function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
    external override virtual returns (uint256 validationData) {
        _requireFromEntryPoint();
        validationData = _validateSignature(userOp, userOpHash);
        _validateNonce(userOp.nonce);
        _payPrefund(missingAccountFunds);
    }

    /**
     * ensure the request comes from the known entrypoint.
     */
    function _requireFromEntryPoint() internal virtual view {
        require(msg.sender == address(entryPoint()), "account: not from EntryPoint");
    }

    /**
     * validate the signature is valid for this message.
     * @param userOp validate the userOp.signature field
     * @param userOpHash convenient field: the hash of the request, to check the signature against
     *          (also hashes the entrypoint and chain id)
     * @return validationData signature and time-range of this operation
     *      <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,
     *         otherwise, an address of an "authorizer" contract.
     *      <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite"
     *      <6-byte> validAfter - first timestamp this operation is valid
     *      If the account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.
     *      Note that the validation code cannot use block.timestamp (or block.number) directly.
     */
    function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)
    internal virtual returns (uint256 validationData);

    /**
     * Validate the nonce of the UserOperation.
     * This method may validate the nonce requirement of this account.
     * e.g.
     * To limit the nonce to use sequenced UserOps only (no "out of order" UserOps):
     *      `require(nonce < type(uint64).max)`
     * For a hypothetical account that *requires* the nonce to be out-of-order:
     *      `require(nonce & type(uint64).max == 0)`
     *
     * The actual nonce uniqueness is managed by the EntryPoint, and thus no other
     * action is needed by the account itself.
     *
     * @param nonce to validate
     *
     * solhint-disable-next-line no-empty-blocks
     */
    function _validateNonce(uint256 nonce) internal view virtual {
    }

    /**
     * sends to the entrypoint (msg.sender) the missing funds for this transaction.
     * subclass MAY override this method for better funds management
     * (e.g. send to the entryPoint more than the minimum required, so that in future transactions
     * it will not be required to send again)
     * @param missingAccountFunds the minimum value this method should send the entrypoint.
     *  this value MAY be zero, in case there is enough deposit, or the userOp has a paymaster.
     */
    function _payPrefund(uint256 missingAccountFunds) internal virtual {
        if (missingAccountFunds != 0) {
            (bool success,) = payable(msg.sender).call{value : missingAccountFunds, gas : type(uint256).max}("");
            (success);
            //ignore failure (its EntryPoint's job to verify, not account.)
        }
    }
}

File 3 of 47 : Helpers.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

/* solhint-disable no-inline-assembly */

/**
 * returned data from validateUserOp.
 * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`
 * @param aggregator - address(0) - the account validated the signature by itself.
 *              address(1) - the account failed to validate the signature.
 *              otherwise - this is an address of a signature aggregator that must be used to validate the signature.
 * @param validAfter - this UserOp is valid only after this timestamp.
 * @param validaUntil - this UserOp is valid only up to this timestamp.
 */
    struct ValidationData {
        address aggregator;
        uint48 validAfter;
        uint48 validUntil;
    }

//extract sigFailed, validAfter, validUntil.
// also convert zero validUntil to type(uint48).max
    function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {
        address aggregator = address(uint160(validationData));
        uint48 validUntil = uint48(validationData >> 160);
        if (validUntil == 0) {
            validUntil = type(uint48).max;
        }
        uint48 validAfter = uint48(validationData >> (48 + 160));
        return ValidationData(aggregator, validAfter, validUntil);
    }

// intersect account and paymaster ranges.
    function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {
        ValidationData memory accountValidationData = _parseValidationData(validationData);
        ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);
        address aggregator = accountValidationData.aggregator;
        if (aggregator == address(0)) {
            aggregator = pmValidationData.aggregator;
        }
        uint48 validAfter = accountValidationData.validAfter;
        uint48 validUntil = accountValidationData.validUntil;
        uint48 pmValidAfter = pmValidationData.validAfter;
        uint48 pmValidUntil = pmValidationData.validUntil;

        if (validAfter < pmValidAfter) validAfter = pmValidAfter;
        if (validUntil > pmValidUntil) validUntil = pmValidUntil;
        return ValidationData(aggregator, validAfter, validUntil);
    }

/**
 * helper to pack the return value for validateUserOp
 * @param data - the ValidationData to pack
 */
    function _packValidationData(ValidationData memory data) pure returns (uint256) {
        return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));
    }

/**
 * helper to pack the return value for validateUserOp, when not using an aggregator
 * @param sigFailed - true for signature failure, false for success
 * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)
 * @param validAfter first timestamp this UserOperation is valid
 */
    function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {
        return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));
    }

/**
 * keccak function over calldata.
 * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.
 */
    function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {
        assembly {
            let mem := mload(0x40)
            let len := data.length
            calldatacopy(mem, data.offset, len)
            ret := keccak256(mem, len)
        }
    }

File 4 of 47 : IAccount.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

import "./UserOperation.sol";

interface IAccount {

    /**
     * Validate user's signature and nonce
     * the entryPoint will make the call to the recipient only if this validation call returns successfully.
     * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).
     * This allows making a "simulation call" without a valid signature
     * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.
     *
     * @dev Must validate caller is the entryPoint.
     *      Must validate the signature and nonce
     * @param userOp the operation that is about to be executed.
     * @param userOpHash hash of the user's request data. can be used as the basis for signature.
     * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.
     *      This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.
     *      The excess is left as a deposit in the entrypoint, for future calls.
     *      can be withdrawn anytime using "entryPoint.withdrawTo()"
     *      In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.
     * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode
     *      <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,
     *         otherwise, an address of an "authorizer" contract.
     *      <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite"
     *      <6-byte> validAfter - first timestamp this operation is valid
     *      If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.
     *      Note that the validation code cannot use block.timestamp (or block.number) directly.
     */
    function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
    external returns (uint256 validationData);
}

File 5 of 47 : IAggregator.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

import "./UserOperation.sol";

/**
 * Aggregated Signatures validator.
 */
interface IAggregator {

    /**
     * validate aggregated signature.
     * revert if the aggregated signature does not match the given list of operations.
     */
    function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;

    /**
     * validate signature of a single userOp
     * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation
     * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.
     * @param userOp the userOperation received from the user.
     * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.
     *    (usually empty, unless account and aggregator support some kind of "multisig"
     */
    function validateUserOpSignature(UserOperation calldata userOp)
    external view returns (bytes memory sigForUserOp);

    /**
     * aggregate multiple signatures into a single value.
     * This method is called off-chain to calculate the signature to pass with handleOps()
     * bundler MAY use optimized custom code perform this aggregation
     * @param userOps array of UserOperations to collect the signatures from.
     * @return aggregatedSignature the aggregated signature
     */
    function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);
}

File 6 of 47 : IEntryPoint.sol
/**
 ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.
 ** Only one instance required on each chain.
 **/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

/* solhint-disable avoid-low-level-calls */
/* solhint-disable no-inline-assembly */
/* solhint-disable reason-string */

import "./UserOperation.sol";
import "./IStakeManager.sol";
import "./IAggregator.sol";
import "./INonceManager.sol";

interface IEntryPoint is IStakeManager, INonceManager {

    /***
     * An event emitted after each successful request
     * @param userOpHash - unique identifier for the request (hash its entire content, except signature).
     * @param sender - the account that generates this request.
     * @param paymaster - if non-null, the paymaster that pays for this request.
     * @param nonce - the nonce value from the request.
     * @param success - true if the sender transaction succeeded, false if reverted.
     * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.
     * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).
     */
    event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);

    /**
     * account "sender" was deployed.
     * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.
     * @param sender the account that is deployed
     * @param factory the factory used to deploy this account (in the initCode)
     * @param paymaster the paymaster used by this UserOp
     */
    event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);

    /**
     * An event emitted if the UserOperation "callData" reverted with non-zero length
     * @param userOpHash the request unique identifier.
     * @param sender the sender of this request
     * @param nonce the nonce used in the request
     * @param revertReason - the return bytes from the (reverted) call to "callData".
     */
    event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);

    /**
     * an event emitted by handleOps(), before starting the execution loop.
     * any event emitted before this event, is part of the validation.
     */
    event BeforeExecution();

    /**
     * signature aggregator used by the following UserOperationEvents within this bundle.
     */
    event SignatureAggregatorChanged(address indexed aggregator);

    /**
     * a custom revert error of handleOps, to identify the offending op.
     *  NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.
     *  @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)
     *  @param reason - revert reason
     *      The string starts with a unique code "AAmn", where "m" is "1" for factory, "2" for account and "3" for paymaster issues,
     *      so a failure can be attributed to the correct entity.
     *   Should be caught in off-chain handleOps simulation and not happen on-chain.
     *   Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.
     */
    error FailedOp(uint256 opIndex, string reason);

    /**
     * error case when a signature aggregator fails to verify the aggregated signature it had created.
     */
    error SignatureValidationFailed(address aggregator);

    /**
     * Successful result from simulateValidation.
     * @param returnInfo gas and time-range returned values
     * @param senderInfo stake information about the sender
     * @param factoryInfo stake information about the factory (if any)
     * @param paymasterInfo stake information about the paymaster (if any)
     */
    error ValidationResult(ReturnInfo returnInfo,
        StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);

    /**
     * Successful result from simulateValidation, if the account returns a signature aggregator
     * @param returnInfo gas and time-range returned values
     * @param senderInfo stake information about the sender
     * @param factoryInfo stake information about the factory (if any)
     * @param paymasterInfo stake information about the paymaster (if any)
     * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)
     *      bundler MUST use it to verify the signature, or reject the UserOperation
     */
    error ValidationResultWithAggregation(ReturnInfo returnInfo,
        StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,
        AggregatorStakeInfo aggregatorInfo);

    /**
     * return value of getSenderAddress
     */
    error SenderAddressResult(address sender);

    /**
     * return value of simulateHandleOp
     */
    error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);

    //UserOps handled, per aggregator
    struct UserOpsPerAggregator {
        UserOperation[] userOps;

        // aggregator address
        IAggregator aggregator;
        // aggregated signature
        bytes signature;
    }

    /**
     * Execute a batch of UserOperation.
     * no signature aggregator is used.
     * if any account requires an aggregator (that is, it returned an aggregator when
     * performing simulateValidation), then handleAggregatedOps() must be used instead.
     * @param ops the operations to execute
     * @param beneficiary the address to receive the fees
     */
    function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;

    /**
     * Execute a batch of UserOperation with Aggregators
     * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)
     * @param beneficiary the address to receive the fees
     */
    function handleAggregatedOps(
        UserOpsPerAggregator[] calldata opsPerAggregator,
        address payable beneficiary
    ) external;

    /**
     * generate a request Id - unique identifier for this request.
     * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.
     */
    function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);

    /**
     * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.
     * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.
     * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.
     * @param userOp the user operation to validate.
     */
    function simulateValidation(UserOperation calldata userOp) external;

    /**
     * gas and return values during simulation
     * @param preOpGas the gas used for validation (including preValidationGas)
     * @param prefund the required prefund for this operation
     * @param sigFailed validateUserOp's (or paymaster's) signature check failed
     * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)
     * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)
     * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)
     */
    struct ReturnInfo {
        uint256 preOpGas;
        uint256 prefund;
        bool sigFailed;
        uint48 validAfter;
        uint48 validUntil;
        bytes paymasterContext;
    }

    /**
     * returned aggregated signature info.
     * the aggregator returned by the account, and its current stake.
     */
    struct AggregatorStakeInfo {
        address aggregator;
        StakeInfo stakeInfo;
    }

    /**
     * Get counterfactual sender address.
     *  Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.
     * this method always revert, and returns the address in SenderAddressResult error
     * @param initCode the constructor code to be passed into the UserOperation.
     */
    function getSenderAddress(bytes memory initCode) external;


    /**
     * simulate full execution of a UserOperation (including both validation and target execution)
     * this method will always revert with "ExecutionResult".
     * it performs full validation of the UserOperation, but ignores signature error.
     * an optional target address is called after the userop succeeds, and its value is returned
     * (before the entire call is reverted)
     * Note that in order to collect the the success/failure of the target call, it must be executed
     * with trace enabled to track the emitted events.
     * @param op the UserOperation to simulate
     * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult
     *        are set to the return from that call.
     * @param targetCallData callData to pass to target address
     */
    function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;
}

File 7 of 47 : INonceManager.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

interface INonceManager {

    /**
     * Return the next nonce for this sender.
     * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)
     * But UserOp with different keys can come with arbitrary order.
     *
     * @param sender the account address
     * @param key the high 192 bit of the nonce
     * @return nonce a full nonce to pass for next UserOp with this sender.
     */
    function getNonce(address sender, uint192 key)
    external view returns (uint256 nonce);

    /**
     * Manually increment the nonce of the sender.
     * This method is exposed just for completeness..
     * Account does NOT need to call it, neither during validation, nor elsewhere,
     * as the EntryPoint will update the nonce regardless.
     * Possible use-case is call it with various keys to "initialize" their nonces to one, so that future
     * UserOperations will not pay extra for the first transaction with a given key.
     */
    function incrementNonce(uint192 key) external;
}

File 8 of 47 : IStakeManager.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.12;

/**
 * manage deposits and stakes.
 * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)
 * stake is value locked for at least "unstakeDelay" by the staked entity.
 */
interface IStakeManager {

    event Deposited(
        address indexed account,
        uint256 totalDeposit
    );

    event Withdrawn(
        address indexed account,
        address withdrawAddress,
        uint256 amount
    );

    /// Emitted when stake or unstake delay are modified
    event StakeLocked(
        address indexed account,
        uint256 totalStaked,
        uint256 unstakeDelaySec
    );

    /// Emitted once a stake is scheduled for withdrawal
    event StakeUnlocked(
        address indexed account,
        uint256 withdrawTime
    );

    event StakeWithdrawn(
        address indexed account,
        address withdrawAddress,
        uint256 amount
    );

    /**
     * @param deposit the entity's deposit
     * @param staked true if this entity is staked.
     * @param stake actual amount of ether staked for this entity.
     * @param unstakeDelaySec minimum delay to withdraw the stake.
     * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked
     * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)
     *    and the rest fit into a 2nd cell.
     *    112 bit allows for 10^15 eth
     *    48 bit for full timestamp
     *    32 bit allows 150 years for unstake delay
     */
    struct DepositInfo {
        uint112 deposit;
        bool staked;
        uint112 stake;
        uint32 unstakeDelaySec;
        uint48 withdrawTime;
    }

    //API struct used by getStakeInfo and simulateValidation
    struct StakeInfo {
        uint256 stake;
        uint256 unstakeDelaySec;
    }

    /// @return info - full deposit information of given account
    function getDepositInfo(address account) external view returns (DepositInfo memory info);

    /// @return the deposit (for gas payment) of the account
    function balanceOf(address account) external view returns (uint256);

    /**
     * add to the deposit of the given account
     */
    function depositTo(address account) external payable;

    /**
     * add to the account's stake - amount and delay
     * any pending unstake is first cancelled.
     * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.
     */
    function addStake(uint32 _unstakeDelaySec) external payable;

    /**
     * attempt to unlock the stake.
     * the value can be withdrawn (using withdrawStake) after the unstake delay.
     */
    function unlockStake() external;

    /**
     * withdraw from the (unlocked) stake.
     * must first call unlockStake and wait for the unstakeDelay to pass
     * @param withdrawAddress the address to send withdrawn value.
     */
    function withdrawStake(address payable withdrawAddress) external;

    /**
     * withdraw from the deposit.
     * @param withdrawAddress the address to send withdrawn value.
     * @param withdrawAmount the amount to withdraw.
     */
    function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;
}

File 9 of 47 : UserOperation.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;

/* solhint-disable no-inline-assembly */

import {calldataKeccak} from "../core/Helpers.sol";

/**
 * User Operation struct
 * @param sender the sender account of this request.
     * @param nonce unique value the sender uses to verify it is not a replay.
     * @param initCode if set, the account contract will be created by this constructor/
     * @param callData the method call to execute on this account.
     * @param callGasLimit the gas limit passed to the callData method call.
     * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.
     * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.
     * @param maxFeePerGas same as EIP-1559 gas parameter.
     * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.
     * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.
     * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.
     */
    struct UserOperation {

        address sender;
        uint256 nonce;
        bytes initCode;
        bytes callData;
        uint256 callGasLimit;
        uint256 verificationGasLimit;
        uint256 preVerificationGas;
        uint256 maxFeePerGas;
        uint256 maxPriorityFeePerGas;
        bytes paymasterAndData;
        bytes signature;
    }

/**
 * Utility functions helpful when working with UserOperation structs.
 */
library UserOperationLib {

    function getSender(UserOperation calldata userOp) internal pure returns (address) {
        address data;
        //read sender from userOp, which is first userOp member (saves 800 gas...)
        assembly {data := calldataload(userOp)}
        return address(uint160(data));
    }

    //relayer/block builder might submit the TX with higher priorityFee, but the user should not
    // pay above what he signed for.
    function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {
    unchecked {
        uint256 maxFeePerGas = userOp.maxFeePerGas;
        uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;
        if (maxFeePerGas == maxPriorityFeePerGas) {
            //legacy mode (for networks that don't support basefee opcode)
            return maxFeePerGas;
        }
        return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);
    }
    }

    function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {
        address sender = getSender(userOp);
        uint256 nonce = userOp.nonce;
        bytes32 hashInitCode = calldataKeccak(userOp.initCode);
        bytes32 hashCallData = calldataKeccak(userOp.callData);
        uint256 callGasLimit = userOp.callGasLimit;
        uint256 verificationGasLimit = userOp.verificationGasLimit;
        uint256 preVerificationGas = userOp.preVerificationGas;
        uint256 maxFeePerGas = userOp.maxFeePerGas;
        uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;
        bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);

        return abi.encode(
            sender, nonce,
            hashInitCode, hashCallData,
            callGasLimit, verificationGasLimit, preVerificationGas,
            maxFeePerGas, maxPriorityFeePerGas,
            hashPaymasterAndData
        );
    }

    function hash(UserOperation calldata userOp) internal pure returns (bytes32) {
        return keccak256(pack(userOp));
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }
}

File 10 of 47 : IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

File 11 of 47 : ERC2771Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Context variant with ERC2771 support.
 *
 * WARNING: Avoid using this pattern in contracts that rely in a specific calldata length as they'll
 * be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC2771
 * specification adding the address size in bytes (20) to the calldata size. An example of an unexpected
 * behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive`
 * function only accessible if `msg.data.length == 0`.
 *
 * WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption.
 * Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender}
 * recovery.
 */
abstract contract ERC2771Context is Context {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable _trustedForwarder;

    /**
     * @dev Initializes the contract with a trusted forwarder, which will be able to
     * invoke functions on this contract on behalf of other accounts.
     *
     * NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}.
     */
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address trustedForwarder_) {
        _trustedForwarder = trustedForwarder_;
    }

    /**
     * @dev Returns the address of the trusted forwarder.
     */
    function trustedForwarder() public view virtual returns (address) {
        return _trustedForwarder;
    }

    /**
     * @dev Indicates whether any particular address is the trusted forwarder.
     */
    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
        return forwarder == trustedForwarder();
    }

    /**
     * @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgSender() internal view virtual override returns (address) {
        uint256 calldataLength = msg.data.length;
        uint256 contextSuffixLength = _contextSuffixLength();
        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {
            return address(bytes20(msg.data[calldataLength - contextSuffixLength:]));
        } else {
            return super._msgSender();
        }
    }

    /**
     * @dev Override for `msg.data`. Defaults to the original `msg.data` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgData() internal view virtual override returns (bytes calldata) {
        uint256 calldataLength = msg.data.length;
        uint256 contextSuffixLength = _contextSuffixLength();
        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {
            return msg.data[:calldataLength - contextSuffixLength];
        } else {
            return super._msgData();
        }
    }

    /**
     * @dev ERC-2771 specifies the context as being a single address (20 bytes).
     */
    function _contextSuffixLength() internal view virtual override returns (uint256) {
        return 20;
    }
}

File 12 of 47 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Interface that must be implemented by smart contracts in order to receive
 * ERC-1155 token transfers.
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 13 of 47 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.20;

import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
import {IERC1155Receiver} from "../IERC1155Receiver.sol";

/**
 * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 */
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }

    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 14 of 47 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
     *   {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
     *   a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 15 of 47 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be
     * reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 16 of 47 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.20;

import {IERC721Receiver} from "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or
 * {IERC721-setApprovalForAll}.
 */
abstract contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 17 of 47 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 18 of 47 : Create2.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Create2.sol)

pragma solidity ^0.8.20;

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev Not enough balance for performing a CREATE2 deploy.
     */
    error Create2InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev There's no code to deploy.
     */
    error Create2EmptyBytecode();

    /**
     * @dev The deployment failed.
     */
    error Create2FailedDeployment();

    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {
        if (address(this).balance < amount) {
            revert Create2InsufficientBalance(address(this).balance, amount);
        }
        if (bytecode.length == 0) {
            revert Create2EmptyBytecode();
        }
        /// @solidity memory-safe-assembly
        assembly {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
        }
        if (addr == address(0)) {
            revert Create2FailedDeployment();
        }
    }

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

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

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

            mstore(add(ptr, 0x40), bytecodeHash)
            mstore(add(ptr, 0x20), salt)
            mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
            let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
            mstore8(start, 0xff)
            addr := keccak256(start, 85)
        }
    }
}

File 19 of 47 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError, bytes32) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

File 20 of 47 : SignatureChecker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.20;

import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Safe Wallet (previously Gnosis Safe).
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error, ) = ECDSA.tryRecover(hash, signature);
        return
            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
            isValidERC1271SignatureNow(signer, hash, signature);
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

File 21 of 47 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 22 of 47 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 23 of 47 : ERC4337Account.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

import {IEntryPoint} from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import {UserOperation} from "@account-abstraction/contracts/interfaces/UserOperation.sol";
import {BaseAccount as BaseERC4337Account} from "@account-abstraction/contracts/core/BaseAccount.sol";

import "../utils/Errors.sol";

/**
 * @title ERC-4337 Support
 * @dev Implements ERC-4337 account support
 */
abstract contract ERC4337Account is BaseERC4337Account {
    using ECDSA for bytes32;

    IEntryPoint immutable _entryPoint;

    constructor(address entryPoint_) {
        if (entryPoint_ == address(0)) revert InvalidEntryPoint();
        _entryPoint = IEntryPoint(entryPoint_);
    }

    /**
     * @dev See {BaseERC4337Account-entryPoint}
     */
    function entryPoint() public view override returns (IEntryPoint) {
        return _entryPoint;
    }

    /**
     * @dev See {BaseERC4337Account-_validateSignature}
     */
    function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)
        internal
        view
        virtual
        override
        returns (uint256)
    {
        if (_isValidSignature(_getUserOpSignatureHash(userOp, userOpHash), userOp.signature)) {
            return 0;
        }

        return 1;
    }

    /**
     * @dev Returns the user operation hash that should be signed by the account owner
     */
    function _getUserOpSignatureHash(UserOperation calldata userOp, bytes32 userOpHash)
        internal
        view
        virtual
        returns (bytes32)
    {
        bytes32 prefixedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", userOpHash));
        return prefixedHash;
    }

    function _isValidSignature(bytes32 hash, bytes calldata signature)
        internal
        view
        virtual
        returns (bool);
}

File 24 of 47 : ERC6551Account.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

import "erc6551/lib/ERC6551AccountLib.sol";
import "erc6551/interfaces/IERC6551Account.sol";

import "./Signatory.sol";

/**
 * @title ERC-6551 Account Support
 * @dev Implements the ERC-6551 Account interface
 */
abstract contract ERC6551Account is IERC6551Account, ERC165, Signatory {
    uint256 _state;

    receive() external payable virtual {}

    /**
     * @dev See: {IERC6551Account-isValidSigner}
     */
    function isValidSigner(address signer, bytes calldata data)
        external
        view
        returns (bytes4 magicValue)
    {
        if (_isValidSigner(signer, data)) {
            return IERC6551Account.isValidSigner.selector;
        }

        return bytes4(0);
    }

    /**
     * @dev See: {IERC6551Account-token}
     */
    function token()
        public
        view
        returns (uint256 chainId, address tokenContract, uint256 tokenId)
    {
        return ERC6551AccountLib.token();
    }

    /**
     * @dev See: {IERC6551Account-state}
     */
    function state() public view returns (uint256) {
        return _state;
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return
            interfaceId == type(IERC6551Account).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns true if a given signer is authorized to use this account
     */
    function _isValidSigner(address signer, bytes memory) internal view virtual returns (bool);
}

File 25 of 47 : BaseExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/utils/Context.sol";

import "./SandboxExecutor.sol";

/**
 * @title Base Executor
 * @dev Base configuration for all executors
 */
abstract contract BaseExecutor is Context, SandboxExecutor {
    function _beforeExecute() internal virtual {}

    function _isValidExecutor(address executor) internal view virtual returns (bool);
}

File 26 of 47 : BatchExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "../../utils/Errors.sol";

import "./BaseExecutor.sol";

/**
 * @title Batch Executor
 * @dev Allows multiple operations to be executed from this account in a single transaction
 */
abstract contract BatchExecutor is BaseExecutor {
    struct Operation {
        address to;
        uint256 value;
        bytes data;
        uint8 operation;
    }

    /**
     * @notice Executes a batch of operations if the caller is authorized
     * @param operations Operations to execute
     */
    function executeBatch(Operation[] calldata operations)
        external
        payable
        returns (bytes[] memory)
    {
        if (!_isValidExecutor(_msgSender())) revert NotAuthorized();

        _beforeExecute();

        uint256 length = operations.length;
        bytes[] memory results = new bytes[](length);

        for (uint256 i = 0; i < length; i++) {
            results[i] = LibExecutor._execute(
                operations[i].to, operations[i].value, operations[i].data, operations[i].operation
            );
        }

        return results;
    }
}

File 27 of 47 : ERC6551Executor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

import "erc6551/interfaces/IERC6551Executable.sol";
import "erc6551/interfaces/IERC6551Account.sol";
import "erc6551/lib/ERC6551AccountLib.sol";

import "../../utils/Errors.sol";
import "../../lib/LibExecutor.sol";
import "../../lib/LibSandbox.sol";
import "./SandboxExecutor.sol";
import "./BaseExecutor.sol";

/**
 * @title ERC-6551 Executor
 * @dev Basic executor which implements the IERC6551Executable execution interface
 */
abstract contract ERC6551Executor is IERC6551Executable, ERC165, BaseExecutor {
    /**
     * Executes a low-level operation from this account if the caller is a valid executor
     *
     * @param to Account to operate on
     * @param value Value to send with operation
     * @param data Encoded calldata of operation
     * @param operation Operation type (0=CALL, 1=DELEGATECALL, 2=CREATE, 3=CREATE2)
     */
    function execute(address to, uint256 value, bytes calldata data, uint8 operation)
        external
        payable
        virtual
        returns (bytes memory)
    {
        if (!_isValidExecutor(_msgSender())) revert NotAuthorized();

        _beforeExecute();

        return LibExecutor._execute(to, value, data, operation);
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC6551Executable).interfaceId
            || super.supportsInterface(interfaceId);
    }
}

File 28 of 47 : NestedAccountExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/metatx/ERC2771Context.sol";

import "erc6551/interfaces/IERC6551Executable.sol";
import "erc6551/interfaces/IERC6551Account.sol";
import "erc6551/lib/ERC6551AccountLib.sol";

import "../../utils/Errors.sol";
import "../../lib/LibExecutor.sol";
import "../../lib/LibSandbox.sol";
import "./SandboxExecutor.sol";
import "./BaseExecutor.sol";

import "../Lockable.sol";

/**
 * @title Nested Account Executor
 * @dev Allows the root owner of a nested token bound account to execute transactions directly
 * against the nested account, even if intermediate accounts have not been created.
 */
abstract contract NestedAccountExecutor is BaseExecutor {
    address immutable __self = address(this);
    address public immutable erc6551Registry;

    struct ERC6551AccountInfo {
        bytes32 salt;
        address tokenContract;
        uint256 tokenId;
    }

    constructor(address _erc6551Registry) {
        if (_erc6551Registry == address(0)) revert InvalidERC6551Registry();
        erc6551Registry = _erc6551Registry;
    }

    /**
     * Executes a low-level operation from this account if the caller is a valid signer on the
     * parent TBA specified in the proof
     *
     * @param to Account to operate on
     * @param value Value to send with operation
     * @param data Encoded calldata of operation
     * @param operation Operation type (0=CALL, 1=DELEGATECALL, 2=CREATE, 3=CREATE2)
     * @param proof An array of ERC-6551 account information specifying the ownership path from this
     * account to its parent
     */
    function executeNested(
        address to,
        uint256 value,
        bytes calldata data,
        uint8 operation,
        ERC6551AccountInfo[] calldata proof
    ) external payable returns (bytes memory) {
        uint256 length = proof.length;
        address current = _msgSender();

        ERC6551AccountInfo calldata accountInfo;
        for (uint256 i = 0; i < length; i++) {
            accountInfo = proof[i];
            address tokenContract = accountInfo.tokenContract;
            uint256 tokenId = accountInfo.tokenId;

            address next = ERC6551AccountLib.computeAddress(
                erc6551Registry, __self, accountInfo.salt, block.chainid, tokenContract, tokenId
            );

            if (tokenContract.code.length == 0) revert InvalidAccountProof();

            if (next.code.length > 0) {
                if (Lockable(next).isLocked()) revert AccountLocked();
            }

            try IERC721(tokenContract).ownerOf(tokenId) returns (address _owner) {
                if (_owner != current) revert InvalidAccountProof();
                current = next;
            } catch {
                revert InvalidAccountProof();
            }
        }

        if (!_isValidExecutor(current)) revert NotAuthorized();

        _beforeExecute();

        return LibExecutor._execute(to, value, data, operation);
    }
}

File 29 of 47 : SandboxExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/utils/Create2.sol";

import "../../interfaces/ISandboxExecutor.sol";
import "../../utils/Errors.sol";
import "../../lib/LibSandbox.sol";
import "../../lib/LibExecutor.sol";

/**
 * @title Sandbox Executor
 * @dev Allows the sandbox contract for an account to execute low-level operations
 */
abstract contract SandboxExecutor is ISandboxExecutor {
    /**
     * @dev Ensures that a given caller is the sandbox for this account
     */
    function _requireFromSandbox() internal view {
        if (msg.sender != LibSandbox.sandbox(address(this))) revert NotAuthorized();
    }

    /**
     * @dev Allows the sandbox contract to execute low-level calls from this account
     */
    function extcall(address to, uint256 value, bytes calldata data)
        external
        returns (bytes memory result)
    {
        _requireFromSandbox();
        return LibExecutor._call(to, value, data);
    }

    /**
     * @dev Allows the sandbox contract to create contracts on behalf of this account
     */
    function extcreate(uint256 value, bytes calldata bytecode) external returns (address) {
        _requireFromSandbox();

        return LibExecutor._create(value, bytecode);
    }

    /**
     * @dev Allows the sandbox contract to create deterministic contracts on behalf of this account
     */
    function extcreate2(uint256 value, bytes32 salt, bytes calldata bytecode)
        external
        returns (address)
    {
        _requireFromSandbox();
        return LibExecutor._create2(value, salt, bytecode);
    }

    /**
     * @dev Allows arbitrary storage reads on this account from external contracts
     */
    function extsload(bytes32 slot) external view returns (bytes32 value) {
        assembly {
            value := sload(slot)
        }
    }
}

File 30 of 47 : TokenboundExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/metatx/ERC2771Context.sol";

import "erc6551/interfaces/IERC6551Executable.sol";
import "erc6551/interfaces/IERC6551Account.sol";
import "erc6551/lib/ERC6551AccountLib.sol";

import "../../utils/Errors.sol";
import "../../lib/LibExecutor.sol";
import "../../lib/LibSandbox.sol";
import "./ERC6551Executor.sol";
import "./BatchExecutor.sol";
import "./NestedAccountExecutor.sol";

/**
 * @title Tokenbound Executor
 * @dev Enables basic ERC-6551 execution as well as batch, nested, and mult-account execution
 */
abstract contract TokenboundExecutor is
    ERC6551Executor,
    BatchExecutor,
    NestedAccountExecutor,
    ERC2771Context
{
    constructor(
        address multicallForwarder,
        address _erc6551Registry
    )
        ERC2771Context(multicallForwarder)
        NestedAccountExecutor(_erc6551Registry)
    {
        if (multicallForwarder == address(0))
            revert InvalidMulticallForwarder();
    }

    function _msgSender()
        internal
        view
        virtual
        override(Context, ERC2771Context)
        returns (address sender)
    {
        return super._msgSender();
    }

    function _msgData()
        internal
        view
        virtual
        override(Context, ERC2771Context)
        returns (bytes calldata)
    {
        return super._msgData();
    }

    /**
     * @dev ERC-2771 specifies the context as being a single address (20 bytes).
     */
    function _contextSuffixLength()
        internal
        view
        virtual
        override(Context, ERC2771Context)
        returns (uint256)
    {
        return 20;
    }
}

File 31 of 47 : Lockable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "erc6551/lib/ERC6551AccountLib.sol";

import "../utils/Errors.sol";

/**
 * @title Account Lock
 * @dev Allows the root owner of a token bound account to lock access to an account until a
 * certain timestamp
 */
abstract contract Lockable {
    /**
     * @notice The timestamp at which this account will be unlocked
     */
    uint256 public lockedUntil;

    event LockUpdated(uint256 lockedUntil);

    /**
     * @dev Locks the account until a certain timestamp
     *
     * @param _lockedUntil The time at which this account will no longer be locke
     */
    function lock(uint256 _lockedUntil) external virtual {
        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();
        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);

        if (_owner == address(0)) revert NotAuthorized();
        if (msg.sender != _owner) revert NotAuthorized();

        if (_lockedUntil > block.timestamp + 365 days) {
            revert ExceedsMaxLockTime();
        }

        _beforeLock();

        lockedUntil = _lockedUntil;

        emit LockUpdated(_lockedUntil);
    }

    /**
     * @dev Returns the current lock status of the account as a boolean
     */
    function isLocked() public view virtual returns (bool) {
        return lockedUntil > block.timestamp;
    }

    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)
        internal
        view
        virtual
        returns (address);

    function _beforeLock() internal virtual {}
}

File 32 of 47 : Overridable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "erc6551/lib/ERC6551AccountLib.sol";

import "../utils/Errors.sol";
import "../lib/LibSandbox.sol";

/**
 * @title Account Overrides
 * @dev Allows the root owner of a token bound account to override the implementation of a given
 * function selector on the account. Overrides are keyed by the root owner address, so will be
 * disabled upon transfer of the token which owns this account tree.
 */
abstract contract Overridable {
    /**
     * @dev mapping from owner => selector => implementation
     */
    mapping(address => mapping(bytes4 => address)) public overrides;

    event OverrideUpdated(address owner, bytes4 selector, address implementation);

    /**
     * @dev Sets the implementation address for a given array of function selectors. Can only be
     * called by the root owner of the account
     *
     * @param selectors Array of selectors to override
     * @param implementations Array of implementation address corresponding to selectors
     */
    function setOverrides(bytes4[] calldata selectors, address[] calldata implementations)
        external
        virtual
    {
        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();
        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);

        if (_owner == address(0)) revert NotAuthorized();
        if (msg.sender != _owner) revert NotAuthorized();

        _beforeSetOverrides();

        address sandbox = LibSandbox.sandbox(address(this));
        if (sandbox.code.length == 0) LibSandbox.deploy(address(this));

        uint256 length = selectors.length;

        if (implementations.length != length) revert InvalidInput();

        for (uint256 i = 0; i < length; i++) {
            overrides[_owner][selectors[i]] = implementations[i];
            emit OverrideUpdated(_owner, selectors[i], implementations[i]);
        }
    }

    /**
     * @dev Calls into the implementation address using sandbox if override is set for the current
     * function selector. If an implementation is defined, this funciton will either revert or
     * return with the return value of the implementation
     */
    function _handleOverride() internal virtual {
        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();
        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);

        address implementation = overrides[_owner][msg.sig];

        if (implementation != address(0)) {
            address sandbox = LibSandbox.sandbox(address(this));
            (bool success, bytes memory result) =
                sandbox.call(abi.encodePacked(implementation, msg.data, msg.sender));
            assembly {
                if iszero(success) { revert(add(result, 32), mload(result)) }
                return(add(result, 32), mload(result))
            }
        }
    }

    /**
     * @dev Static calls into the implementation addressif override is set for the current function
     * selector. If an implementation is defined, this funciton will either revert or return with
     * the return value of the implementation
     */
    function _handleOverrideStatic() internal view virtual {
        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();
        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);

        address implementation = overrides[_owner][msg.sig];

        if (implementation != address(0)) {
            (bool success, bytes memory result) = implementation.staticcall(msg.data);
            assembly {
                if iszero(success) { revert(add(result, 32), mload(result)) }
                return(add(result, 32), mload(result))
            }
        }
    }

    function _beforeSetOverrides() internal virtual {}

    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)
        internal
        view
        virtual
        returns (address);
}

File 33 of 47 : Permissioned.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "erc6551/lib/ERC6551AccountLib.sol";
import "../utils/Errors.sol";

/**
 * @title Account Permissions
 * @dev Allows the root owner of a token bound account to allow another account to execute
 * operations from this account. Permissions are keyed by the root owner address, so will be
 * disabled upon transfer of the token which owns this account tree.
 */
abstract contract Permissioned {
    /**
     * @dev mapping from owner => caller => has permissions
     */
    mapping(address => mapping(address => bool)) public permissions;

    event PermissionUpdated(address owner, address caller, bool hasPermission);

    /**
     * @dev Grants or revokes execution permissions for a given array of callers on this account.
     * Can only be called by the root owner of the account
     *
     * @param callers Array of callers to grant permissions to
     * @param _permissions Array of booleans, true if execution permissions should be granted,
     * false if permissions should be revoked
     */
    function setPermissions(address[] calldata callers, bool[] calldata _permissions)
        external
        virtual
    {
        (uint256 chainId, address tokenContract, uint256 tokenId) = ERC6551AccountLib.token();
        address _owner = _rootTokenOwner(chainId, tokenContract, tokenId);

        if (_owner == address(0)) revert NotAuthorized();
        if (msg.sender != _owner) revert NotAuthorized();

        _beforeSetPermissions();

        uint256 length = callers.length;

        if (_permissions.length != length) revert InvalidInput();

        for (uint256 i = 0; i < length; i++) {
            permissions[_owner][callers[i]] = _permissions[i];
            emit PermissionUpdated(_owner, callers[i], _permissions[i]);
        }
    }

    /**
     * @dev Returns true if caller has permissions to act on behalf of owner
     *
     * @param caller Address to query permissions for
     * @param owner Root owner address for which to query permissions
     */
    function hasPermission(address caller, address owner) internal view returns (bool) {
        return permissions[owner][caller];
    }

    function _beforeSetPermissions() internal virtual {}

    function _rootTokenOwner(uint256 chainId, address tokenContract, uint256 tokenId)
        internal
        view
        virtual
        returns (address);
}

File 34 of 47 : Signatory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/interfaces/IERC1271.sol";

/**
 * @title Signatory
 * @dev Implements ERC-1271 signature verification
 */
abstract contract Signatory is IERC1271 {
    /**
     * @dev See {IERC1721-isValidSignature}
     */
    function isValidSignature(bytes32 hash, bytes calldata signature)
        external
        view
        returns (bytes4 magicValue)
    {
        if (_isValidSignature(hash, signature)) {
            return IERC1271.isValidSignature.selector;
        }

        return bytes4(0);
    }

    function _isValidSignature(bytes32 hash, bytes calldata signature)
        internal
        view
        virtual
        returns (bool);
}

File 35 of 47 : AccountV3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";

import "erc6551/lib/ERC6551AccountLib.sol";

import "./abstract/Lockable.sol";
import "./abstract/Overridable.sol";
import "./abstract/Permissioned.sol";
import "./abstract/ERC6551Account.sol";
import "./abstract/ERC4337Account.sol";
import "./abstract/execution/TokenboundExecutor.sol";

import "./lib/OPAddressAliasHelper.sol";

import "./interfaces/IAccountGuardian.sol";

/**
 * @title Tokenbound ERC-6551 Account Implementation
 */
contract AccountV3 is
    ERC721Holder,
    ERC1155Holder,
    Lockable,
    Overridable,
    Permissioned,
    ERC6551Account,
    ERC4337Account,
    TokenboundExecutor
{
    IAccountGuardian immutable guardian;

    /**
     * @param entryPoint_ The ERC-4337 EntryPoint address
     * @param multicallForwarder The MulticallForwarder address
     * @param erc6551Registry The ERC-6551 Registry address
     * @param _guardian The AccountGuardian address
     */
    constructor(
        address entryPoint_,
        address multicallForwarder,
        address erc6551Registry,
        address _guardian
    )
        ERC4337Account(entryPoint_)
        TokenboundExecutor(multicallForwarder, erc6551Registry)
    {
        guardian = IAccountGuardian(_guardian);
    }

    /**
     * @notice Called whenever this account received Ether
     *
     * @dev Can be overriden via Overridable
     */
    receive() external payable override {
        _handleOverride();
    }

    /**
     * @notice Called whenever the calldata function selector does not match a defined function
     *
     * @dev Can be overriden via Overridable
     */
    fallback() external payable {
        _handleOverride();
    }

    /**
     * @notice Returns the owner of the token this account is bound to (if available)
     *
     * @dev Returns zero address if token is on a foreign chain or token contract does not exist
     *
     * @return address The address which owns the token this account is bound to
     */
    function owner() public view returns (address) {
        (
            uint256 chainId,
            address tokenContract,
            uint256 tokenId
        ) = ERC6551AccountLib.token();
        return _tokenOwner(chainId, tokenContract, tokenId);
    }

    /**
     * @notice Returns whether a given ERC165 interface ID is supported
     *
     * @dev Can be overriden via Overridable except for base interfaces.
     *
     * @param interfaceId The interface ID to query for
     * @return bool True if the interface is supported, false otherwise
     */
    function supportsInterface(
        bytes4 interfaceId
    )
        public
        view
        virtual
        override(ERC6551Account, ERC6551Executor, ERC1155Holder)
        returns (bool)
    {
        bool interfaceSupported = super.supportsInterface(interfaceId);

        if (interfaceSupported) return true;

        _handleOverrideStatic();

        return false;
    }

    /**
     * @dev called whenever an ERC-721 token is received. Can be overriden via Overridable. Reverts
     * if token being received is the token the account is bound to.
     */
    function onERC721Received(
        address,
        address,
        uint256 tokenId,
        bytes memory
    ) public virtual override returns (bytes4) {
        (
            uint256 chainId,
            address tokenContract,
            uint256 _tokenId
        ) = ERC6551AccountLib.token();

        if (
            msg.sender == tokenContract &&
            tokenId == _tokenId &&
            chainId == block.chainid
        ) {
            revert OwnershipCycle();
        }

        _handleOverride();

        return this.onERC721Received.selector;
    }

    /**
     * @dev called whenever an ERC-1155 token is received. Can be overriden via Overridable.
     */
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        _handleOverride();
        return this.onERC1155Received.selector;
    }

    /**
     * @dev called whenever a batch of ERC-1155 tokens are received. Can be overriden via Overridable.
     */
    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        _handleOverride();
        return this.onERC1155BatchReceived.selector;
    }

    /**
     * @notice Returns whether a given account is authorized to sign on behalf of this account
     *
     * @param signer The address to query authorization for
     * @return True if the signer is valid, false otherwise
     */
    function _isValidSigner(
        address signer,
        bytes memory
    ) internal view virtual override returns (bool) {
        (
            uint256 chainId,
            address tokenContract,
            uint256 tokenId
        ) = ERC6551AccountLib.token();

        // Single level accuont owner is valid signer
        address _owner = _tokenOwner(chainId, tokenContract, tokenId);
        if (signer == _owner) return true;

        // Root owner of accuont tree is valid signer
        address _rootOwner = _rootTokenOwner(
            _owner,
            chainId,
            tokenContract,
            tokenId
        );
        if (signer == _rootOwner) return true;

        // Accounts granted permission by root owner are valid signers
        return hasPermission(signer, _rootOwner);
    }

    /**
     * Determines if a given hash and signature are valid for this account
     * @param hash Hash of signed data
     * @param signature ECDSA signature or encoded contract signature (v=0)
     */
    function _isValidSignature(
        bytes32 hash,
        bytes calldata signature
    ) internal view override(ERC4337Account, Signatory) returns (bool) {
        uint8 v = uint8(signature[64]);
        address signer;
        signer = address(0);
        // Smart contract signature
        if (v == 0) {
            // Signer address encoded in r
            signer = address(uint160(uint256(bytes32(signature[:32]))));

            // Allow recursive signature verification
            if (!_isValidSigner(signer, "") && signer != address(this)) {
                return false;
            }

            // Signature offset encoded in s
            bytes calldata _signature = signature[uint256(
                bytes32(signature[32:64])
            ):];

            return
                SignatureChecker.isValidERC1271SignatureNow(
                    signer,
                    hash,
                    _signature
                );
        }

        ECDSA.RecoverError _error;
        signer = ECDSA.recover(hash, signature);

        if (_error != ECDSA.RecoverError.NoError) return false;

        return _isValidSigner(signer, "");
    }

    /**
     * @notice Returns whether a given account is authorized to execute transactions on behalf of
     * this account
     *
     * @param executor The address to query authorization for
     * @return True if the executor is authorized, false otherwise
     */
    function _isValidExecutor(
        address executor
    ) internal view virtual override returns (bool) {
        // Allow execution from ERC-4337 EntryPoint
        if (executor == address(entryPoint())) return true;

        (
            uint256 chainId,
            address tokenContract,
            uint256 tokenId
        ) = ERC6551AccountLib.token();

        // Allow cross chain execution
        if (chainId != block.chainid) {
            // Allow execution from L1 account on OPStack chains
            if (
                OPAddressAliasHelper.undoL1ToL2Alias(_msgSender()) ==
                address(this)
            ) {
                return true;
            }

            // Allow execution from trusted cross chain bridges
            if (guardian.isTrustedExecutor(executor)) return true;
        }

        // Allow execution from owner
        address _owner = _tokenOwner(chainId, tokenContract, tokenId);
        if (executor == _owner) return true;

        // Allow execution from root owner of account tree
        address _rootOwner = _rootTokenOwner(
            _owner,
            chainId,
            tokenContract,
            tokenId
        );
        if (executor == _rootOwner) return true;

        // Allow execution from permissioned account
        if (hasPermission(executor, _rootOwner)) return true;

        return false;
    }

    /**
     * @dev Updates account state based on previous state and msg.data
     */
    function _updateState() internal virtual {
        _state = uint256(keccak256(abi.encode(_state, _msgData())));
    }

    /**
     * @dev Called before executing an operation. Reverts if account is locked. Ensures state is
     * updated prior to execution.
     */
    function _beforeExecute() internal override {
        if (isLocked()) revert AccountLocked();
        _updateState();
    }

    /**
     * @dev Called before locking the account. Reverts if account is locked. Updates account state.
     */
    function _beforeLock() internal override {
        if (isLocked()) revert AccountLocked();
        _updateState();
    }

    /**
     * @dev Called before setting overrides on the account. Reverts if account is locked. Updates
     * account state.
     */
    function _beforeSetOverrides() internal override {
        if (isLocked()) revert AccountLocked();
        _updateState();
    }

    /**
     * @dev Called before setting permissions on the account. Reverts if account is locked. Updates
     * account state.
     */
    function _beforeSetPermissions() internal override {
        if (isLocked()) revert AccountLocked();
        _updateState();
    }

    /**
     * @dev Returns the root owner of an account. If account is not owned by a TBA, returns the
     * owner of the NFT bound to this account. If account is owned by a TBA, iterates up token
     * ownership tree and returns root owner.
     *
     * *Security Warning*: the return value of this function can only be trusted if it is also the
     * address of the sender (as the code of the NFT contract cannot be trusted). This function
     * should therefore only be used for authorization and never authentication.
     */
    function _rootTokenOwner(
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    )
        internal
        view
        virtual
        override(Overridable, Permissioned, Lockable)
        returns (address)
    {
        address _owner = _tokenOwner(chainId, tokenContract, tokenId);

        return _rootTokenOwner(_owner, chainId, tokenContract, tokenId);
    }

    /**
     * @dev Returns the root owner of an account given a known account owner address (saves an
     * additional external call).
     */
    function _rootTokenOwner(
        address owner_,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) internal view virtual returns (address) {
        address _owner = owner_;

        while (
            ERC6551AccountLib.isERC6551Account(_owner, __self, erc6551Registry)
        ) {
            (chainId, tokenContract, tokenId) = IERC6551Account(payable(_owner))
                .token();
            _owner = _tokenOwner(chainId, tokenContract, tokenId);
        }

        return _owner;
    }

    /**
     * @dev Returns the owner of the token which this account is bound to. Returns the zero address
     * if token does not exist on the current chain or if the token contract does not exist
     */
    function _tokenOwner(
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) internal view virtual returns (address) {
        if (chainId != block.chainid) return address(0);
        if (tokenContract.code.length == 0) return address(0);

        try IERC721(tokenContract).ownerOf(tokenId) returns (address _owner) {
            return _owner;
        } catch {
            return address(0);
        }
    }
}

File 36 of 47 : IAccountGuardian.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IAccountGuardian {
    function setTrustedImplementation(address implementation, bool trusted) external;

    function setTrustedExecutor(address executor, bool trusted) external;

    function defaultImplementation() external view returns (address);

    function isTrustedImplementation(address implementation) external view returns (bool);

    function isTrustedExecutor(address implementation) external view returns (bool);
}

File 37 of 47 : IL1GatewayRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

interface IL1GatewayRouter {
    function depositETH(
        address _to,
        uint256 _amount,
        uint256 _gasLimit
    ) external payable;

    function ethGateway() external view returns (address);
}

File 38 of 47 : IL2GasOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IL2GasOracle {
    function l2BaseFee() external view returns (uint256);
}

File 39 of 47 : ISandboxExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface ISandboxExecutor {
    function extcall(address to, uint256 value, bytes calldata data)
        external
        returns (bytes memory result);

    function extcreate(uint256 value, bytes calldata data) external returns (address);

    function extcreate2(uint256 value, bytes32 salt, bytes calldata bytecode)
        external
        returns (address);

    function extsload(bytes32 slot) external view returns (bytes32 value);
}

File 40 of 47 : LibExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "../utils/Errors.sol";
import "./LibSandbox.sol";

library LibExecutor {
    uint8 constant OP_CALL = 0;
    uint8 constant OP_DELEGATECALL = 1;
    uint8 constant OP_CREATE = 2;
    uint8 constant OP_CREATE2 = 3;

    function _execute(address to, uint256 value, bytes calldata data, uint8 operation)
        internal
        returns (bytes memory)
    {
        if (operation == OP_CALL) return _call(to, value, data);
        if (operation == OP_DELEGATECALL) {
            address sandbox = LibSandbox.sandbox(address(this));
            if (sandbox.code.length == 0) LibSandbox.deploy(address(this));
            return _call(sandbox, value, abi.encodePacked(to, data));
        }
        if (operation == OP_CREATE) return abi.encodePacked(_create(value, data));
        if (operation == OP_CREATE2) {
            bytes32 salt = bytes32(data[:32]);
            bytes calldata bytecode = data[32:];
            return abi.encodePacked(_create2(value, salt, bytecode));
        }

        revert InvalidOperation();
    }

    function _call(address to, uint256 value, bytes memory data)
        internal
        returns (bytes memory result)
    {
        bool success;
        (success, result) = to.call{value: value}(data);

        if (!success) {
            assembly {
                revert(add(result, 32), mload(result))
            }
        }
    }

    function _create(uint256 value, bytes memory data) internal returns (address created) {
        bytes memory bytecode = data;

        assembly {
            created := create(value, add(bytecode, 0x20), mload(bytecode))
        }

        if (created == address(0)) revert ContractCreationFailed();
    }

    function _create2(uint256 value, bytes32 salt, bytes calldata data)
        internal
        returns (address created)
    {
        bytes memory bytecode = data;

        assembly {
            created := create2(value, add(bytecode, 0x20), mload(bytecode), salt)
        }

        if (created == address(0)) revert ContractCreationFailed();
    }
}

File 41 of 47 : LibSandbox.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/utils/Create2.sol";

library LibSandbox {
    bytes public constant header = hex"604380600d600039806000f3fe73";
    bytes public constant footer =
        hex"3314601d573d3dfd5b363d3d373d3d6014360360143d5160601c5af43d6000803e80603e573d6000fd5b3d6000f3";

    function bytecode(address owner) internal pure returns (bytes memory) {
        return abi.encodePacked(header, owner, footer);
    }

    function sandbox(address owner) internal view returns (address) {
        return
            Create2.computeAddress(keccak256("org.tokenbound.sandbox"), keccak256(bytecode(owner)));
    }

    function deploy(address owner) internal {
        Create2.deploy(0, keccak256("org.tokenbound.sandbox"), bytecode(owner));
    }
}

File 42 of 47 : OPAddressAliasHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

// Source: https://github.com/ethereum-optimism/optimism/blob/96562692558e5c3851899488bcebe51fbe3b7f09/packages/contracts-bedrock/src/vendor/AddressAliasHelper.sol
library OPAddressAliasHelper {
    uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);

    /// @notice Utility function that converts the address in the L1 that submitted a tx to
    /// the inbox to the msg.sender viewed in the L2
    /// @param l1Address the address in the L1 that triggered the tx to L2
    /// @return l2Address L2 address as viewed in msg.sender
    function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
        unchecked {
            l2Address = address(uint160(l1Address) + offset);
        }
    }

    /// @notice Utility function that converts the msg.sender viewed in the L2 to the
    /// address in the L1 that submitted a tx to the inbox
    /// @param l2Address L2 address as viewed in msg.sender
    /// @return l1Address the address in the L1 that triggered the tx to L2
    function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {
        unchecked {
            l1Address = address(uint160(l2Address) - offset);
        }
    }
}

File 43 of 47 : Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

error InvalidOperation();
error ContractCreationFailed();
error NotAuthorized();
error InvalidInput();
error ExceedsMaxLockTime();
error AccountLocked();
error InvalidAccountProof();
error InvalidGuardian();
error InvalidImplementation();
error AlreadyInitialized();
error InvalidEntryPoint();
error InvalidMulticallForwarder();
error InvalidERC6551Registry();
error OwnershipCycle();

File 44 of 47 : IERC6551Account.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @dev the ERC-165 identifier for this interface is `0x6faff5f1`
interface IERC6551Account {
    /**
     * @dev Allows the account to receive Ether.
     *
     * Accounts MUST implement a `receive` function.
     *
     * Accounts MAY perform arbitrary logic to restrict conditions
     * under which Ether can be received.
     */
    receive() external payable;

    /**
     * @dev Returns the identifier of the non-fungible token which owns the account.
     *
     * The return value of this function MUST be constant - it MUST NOT change over time.
     *
     * @return chainId       The EIP-155 ID of the chain the token exists on
     * @return tokenContract The contract address of the token
     * @return tokenId       The ID of the token
     */
    function token()
        external
        view
        returns (uint256 chainId, address tokenContract, uint256 tokenId);

    /**
     * @dev Returns a value that SHOULD be modified each time the account changes state.
     *
     * @return The current account state
     */
    function state() external view returns (uint256);

    /**
     * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf
     * of the account.
     *
     * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid.
     *
     * By default, the holder of the non-fungible token the account is bound to MUST be considered
     * a valid signer.
     *
     * Accounts MAY implement additional authorization logic which invalidates the holder as a
     * signer or grants signing permissions to other non-holder accounts.
     *
     * @param  signer     The address to check signing authorization for
     * @param  context    Additional data used to determine whether the signer is valid
     * @return magicValue Magic value indicating whether the signer is valid
     */
    function isValidSigner(address signer, bytes calldata context)
        external
        view
        returns (bytes4 magicValue);
}

File 45 of 47 : IERC6551Executable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @dev the ERC-165 identifier for this interface is `0x51945447`
interface IERC6551Executable {
    /**
     * @dev Executes a low-level operation if the caller is a valid signer on the account.
     *
     * Reverts and bubbles up error if operation fails.
     *
     * Accounts implementing this interface MUST accept the following operation parameter values:
     * - 0 = CALL
     * - 1 = DELEGATECALL
     * - 2 = CREATE
     * - 3 = CREATE2
     *
     * Accounts implementing this interface MAY support additional operations or restrict a signer's
     * ability to execute certain operations.
     *
     * @param to        The target address of the operation
     * @param value     The Ether value to be sent to the target
     * @param data      The encoded operation calldata
     * @param operation A value indicating the type of operation to perform
     * @return The result of the operation
     */
    function execute(address to, uint256 value, bytes calldata data, uint8 operation)
        external
        payable
        returns (bytes memory);
}

File 46 of 47 : ERC6551AccountLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Create2.sol";
import "./ERC6551BytecodeLib.sol";

library ERC6551AccountLib {
    function computeAddress(
        address registry,
        address _implementation,
        bytes32 _salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) internal pure returns (address) {
        bytes32 bytecodeHash = keccak256(
            ERC6551BytecodeLib.getCreationCode(
                _implementation, _salt, chainId, tokenContract, tokenId
            )
        );

        return Create2.computeAddress(_salt, bytecodeHash, registry);
    }

    function isERC6551Account(address account, address expectedImplementation, address registry)
        internal
        view
        returns (bool)
    {
        // invalid bytecode size
        if (account.code.length != 0xAD) return false;

        address _implementation = implementation(account);

        // implementation does not exist
        if (_implementation.code.length == 0) return false;

        // invalid implementation
        if (_implementation != expectedImplementation) return false;

        (bytes32 _salt, uint256 chainId, address tokenContract, uint256 tokenId) = context(account);

        return account
            == computeAddress(registry, _implementation, _salt, chainId, tokenContract, tokenId);
    }

    function implementation(address account) internal view returns (address _implementation) {
        assembly {
            // copy proxy implementation (0x14 bytes)
            extcodecopy(account, 0xC, 0xA, 0x14)
            _implementation := mload(0x00)
        }
    }

    function implementation() internal view returns (address _implementation) {
        return implementation(address(this));
    }

    function token(address account) internal view returns (uint256, address, uint256) {
        bytes memory encodedData = new bytes(0x60);

        assembly {
            // copy 0x60 bytes from end of context
            extcodecopy(account, add(encodedData, 0x20), 0x4d, 0x60)
        }

        return abi.decode(encodedData, (uint256, address, uint256));
    }

    function token() internal view returns (uint256, address, uint256) {
        return token(address(this));
    }

    function salt(address account) internal view returns (bytes32) {
        bytes memory encodedData = new bytes(0x20);

        assembly {
            // copy 0x20 bytes from beginning of context
            extcodecopy(account, add(encodedData, 0x20), 0x2d, 0x20)
        }

        return abi.decode(encodedData, (bytes32));
    }

    function salt() internal view returns (bytes32) {
        return salt(address(this));
    }

    function context(address account) internal view returns (bytes32, uint256, address, uint256) {
        bytes memory encodedData = new bytes(0x80);

        assembly {
            // copy full context (0x80 bytes)
            extcodecopy(account, add(encodedData, 0x20), 0x2D, 0x80)
        }

        return abi.decode(encodedData, (bytes32, uint256, address, uint256));
    }

    function context() internal view returns (bytes32, uint256, address, uint256) {
        return context(address(this));
    }
}

File 47 of 47 : ERC6551BytecodeLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

library ERC6551BytecodeLib {
    /**
     * @dev Returns the creation code of the token bound account for a non-fungible token.
     *
     * @return result The creation code of the token bound account
     */
    function getCreationCode(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) internal pure returns (bytes memory result) {
        assembly {
            result := mload(0x40) // Grab the free memory pointer
            // Layout the variables and bytecode backwards
            mstore(add(result, 0xb7), tokenId)
            mstore(add(result, 0x97), shr(96, shl(96, tokenContract)))
            mstore(add(result, 0x77), chainId)
            mstore(add(result, 0x57), salt)
            mstore(add(result, 0x37), 0x5af43d82803e903d91602b57fd5bf3)
            mstore(add(result, 0x28), implementation)
            mstore(add(result, 0x14), 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73)
            mstore(result, 0xb7) // Store the length
            mstore(0x40, add(result, 0xd7)) // Allocate the memory
        }
    }

    /**
     * @dev Returns the create2 address computed from `salt`, `bytecodeHash`, `deployer`.
     *
     * @return result The create2 address computed from `salt`, `bytecodeHash`, `deployer`
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer)
        internal
        pure
        returns (address result)
    {
        assembly {
            result := mload(0x40) // Grab the free memory pointer
            mstore8(result, 0xff)
            mstore(add(result, 0x35), bytecodeHash)
            mstore(add(result, 0x01), shl(96, deployer))
            mstore(add(result, 0x15), salt)
            result := keccak256(result, 0x55)
        }
    }
}

Settings
{
  "evmVersion": "paris",
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"entryPoint_","type":"address"},{"internalType":"address","name":"multicallForwarder","type":"address"},{"internalType":"address","name":"erc6551Registry","type":"address"},{"internalType":"address","name":"_guardian","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountLocked","type":"error"},{"inputs":[],"name":"ContractCreationFailed","type":"error"},{"inputs":[],"name":"Create2EmptyBytecode","type":"error"},{"inputs":[],"name":"Create2FailedDeployment","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"Create2InsufficientBalance","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"ExceedsMaxLockTime","type":"error"},{"inputs":[],"name":"InvalidAccountProof","type":"error"},{"inputs":[],"name":"InvalidERC6551Registry","type":"error"},{"inputs":[],"name":"InvalidEntryPoint","type":"error"},{"inputs":[],"name":"InvalidInput","type":"error"},{"inputs":[],"name":"InvalidMulticallForwarder","type":"error"},{"inputs":[],"name":"InvalidOperation","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"OwnershipCycle","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockedUntil","type":"uint256"}],"name":"LockUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"address","name":"implementation","type":"address"}],"name":"OverrideUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"gasFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"serviceFee","type":"uint256"}],"name":"PaidFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"bool","name":"hasPermission","type":"bool"}],"name":"PermissionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RefundedEther","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint256","name":"_l1AdminGasLimit","type":"uint256"},{"internalType":"uint256","name":"_l1BridgeGasLimit","type":"uint256"},{"internalType":"uint256","name":"_l2GasLimit","type":"uint256"},{"internalType":"address payable","name":"_feeWallet","type":"address"}],"name":"bridgeEthBalance","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"entryPoint","outputs":[{"internalType":"contract IEntryPoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc6551Registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint8","name":"operation","type":"uint8"}],"name":"execute","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint8","name":"operation","type":"uint8"}],"internalType":"struct BatchExecutor.Operation[]","name":"operations","type":"tuple[]"}],"name":"executeBatch","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint8","name":"operation","type":"uint8"},{"components":[{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NestedAccountExecutor.ERC6551AccountInfo[]","name":"proof","type":"tuple[]"}],"name":"executeNested","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"extcall","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"bytecode","type":"bytes"}],"name":"extcreate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"bytes","name":"bytecode","type":"bytes"}],"name":"extcreate2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"extsload","outputs":[{"internalType":"bytes32","name":"value","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"isValidSigner","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockedUntil","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockedUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"overrides","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"permissions","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4[]","name":"selectors","type":"bytes4[]"},{"internalType":"address[]","name":"implementations","type":"address[]"}],"name":"setOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"callers","type":"address[]"},{"internalType":"bool[]","name":"_permissions","type":"bool[]"}],"name":"setPermissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"state","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"uint256","name":"callGasLimit","type":"uint256"},{"internalType":"uint256","name":"verificationGasLimit","type":"uint256"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"uint256","name":"maxFeePerGas","type":"uint256"},{"internalType":"uint256","name":"maxPriorityFeePerGas","type":"uint256"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct UserOperation","name":"userOp","type":"tuple"},{"internalType":"bytes32","name":"userOpHash","type":"bytes32"},{"internalType":"uint256","name":"missingAccountFunds","type":"uint256"}],"name":"validateUserOp","outputs":[{"internalType":"uint256","name":"validationData","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101206040523060a0523480156200001657600080fd5b5060405162003b7638038062003b76833981016040819052620000399162000105565b8383838382828181876001600160a01b0381166200006a57604051632039d3c960e01b815260040160405180910390fd5b6001600160a01b03908116608052811662000097576040516246a29560e81b815260040160405180910390fd5b6001600160a01b0390811660c05290811660e0528216620000cb5760405163754c753360e11b815260040160405180910390fd5b50506001600160a01b031661010052506200016295505050505050565b80516001600160a01b03811681146200010057600080fd5b919050565b600080600080608085870312156200011c57600080fd5b6200012785620000e8565b93506200013760208601620000e8565b92506200014760408601620000e8565b91506200015760608601620000e8565b905092959194509250565b60805160a05160c05160e05161010051613990620001e66000396000611ccb01526000818161043a015281816104990152818161276e0152612bbd01526000818161024f01528181610aa901526124aa015260008181610aca01526124890152600081816104f80152818161127501528181611bf001526120b501526139906000f3fe6080604052600436106101d15760003560e01c80637a8f7356116100f7578063c19d93fb11610095578063ee9c605411610064578063ee9c6054146105bc578063f23a6e61146105fd578063fa2b96851461061d578063fc0c546a14610630576101e0565b8063c19d93fb1461055c578063ce0617ec14610571578063d087d28814610587578063dd4670641461059c576101e0565b8063a4e2d634116100d1578063a4e2d634146104d2578063b0d691fe146104e9578063b709467c1461051c578063bc197c811461053c576101e0565b80637a8f73561461046a5780637da0a8771461048a5780638da5cb5b146104bd576101e0565b80631fb1ecf01161016f57806345a24e3e1161013e57806345a24e3e146103ca57806351945447146103ea578063523e3260146103fd578063572b6c051461041d576101e0565b80631fb1ecf01461034a57806334715fb11461036a5780633a871cdd1461038a57806343629a73146103aa576101e0565b8063150b7a02116101ab578063150b7a02146102895780631626ba7e146102c25780631e2eaeaf146102e25780631f9838b51461030f576101e0565b806301ffc9a7146101e8578063039721b11461021d578063056d5afe1461023d576101e0565b366101e0576101de610668565b005b6101de610668565b3480156101f457600080fd5b50610208610203366004612d11565b610771565b60405190151581526020015b60405180910390f35b34801561022957600080fd5b506101de610238366004612d78565b61079f565b34801561024957600080fd5b506102717f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610214565b34801561029557600080fd5b506102a96102a4366004612eb0565b610983565b6040516001600160e01b03199091168152602001610214565b3480156102ce57600080fd5b506102a96102dd366004612f5e565b610a26565b3480156102ee57600080fd5b506103016102fd366004612faa565b5490565b604051908152602001610214565b34801561031b57600080fd5b5061020861032a366004612fc3565b600260209081526000928352604080842090915290825290205460ff1681565b61035d61035836600461300d565b610a51565b604051610214919061312d565b34801561037657600080fd5b50610271610385366004613140565b610cb8565b34801561039657600080fd5b506103016103a5366004613187565b610cd7565b6103bd6103b83660046131db565b610cf6565b604051610214919061321d565b3480156103d657600080fd5b506102716103e5366004612f5e565b610e83565b61035d6103f8366004613281565b610ed5565b34801561040957600080fd5b506102a96104183660046132f2565b610f1e565b34801561042957600080fd5b5061020861043836600461332e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b34801561047657600080fd5b506101de610485366004612d78565b610f8c565b34801561049657600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610271565b3480156104c957600080fd5b506102716111ca565b3480156104de57600080fd5b506000544210610208565b3480156104f557600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610271565b34801561052857600080fd5b5061035d61053736600461334b565b6111f1565b34801561054857600080fd5b506102a9610557366004613404565b61123c565b34801561056857600080fd5b50600354610301565b34801561057d57600080fd5b5061030160005481565b34801561059357600080fd5b50610301611271565b3480156105a857600080fd5b506101de6105b7366004612faa565b611323565b3480156105c857600080fd5b506102716105d73660046134b2565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b34801561060957600080fd5b506102a96106183660046134e7565b611423565b6101de61062b366004613550565b611458565b34801561063c57600080fd5b50610645611833565b604080519384526001600160a01b03909216602084015290820152606001610214565b600080600061067561184b565b9250925092506000610688848484611859565b6001600160a01b0380821660009081526001602090815260408083206001600160e01b0319843516845290915290205491925016801561076a5760006106cd30611875565b9050600080826001600160a01b031684600036336040516020016106f49493929190613591565b60408051601f198184030181529082905261070e916135cf565b6000604051808303816000865af19150503d806000811461074b576040519150601f19603f3d011682016040523d82523d6000602084013e610750565b606091505b50915091508161076257805160208201fd5b805160208201f35b5050505050565b60008061077d836118b0565b9050801561078e5750600192915050565b6107966118ee565b50600092915050565b60008060006107ac61184b565b92509250925060006107bf848484611859565b90506001600160a01b0381166107e85760405163ea8e4eb560e01b815260040160405180910390fd5b336001600160a01b038216146108115760405163ea8e4eb560e01b815260040160405180910390fd5b6108196119a1565b8685811461083a5760405163b4fa3fb360e01b815260040160405180910390fd5b60005b8181101561097757878782818110610857576108576135eb565b905060200201602081019061086c919061360f565b6001600160a01b0384166000908152600260205260408120908c8c85818110610897576108976135eb565b90506020020160208101906108ac919061332e565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f394777a58092892d136a90c4bb7e4350c72ac50fba6a0208128677f36527dcf5838b8b84818110610908576109086135eb565b905060200201602081019061091d919061332e565b8a8a8581811061092f5761092f6135eb565b9050602002016020810190610944919061360f565b604080516001600160a01b03948516815293909216602084015215159082015260600160405180910390a160010161083d565b50505050505050505050565b60008060008061099161184b565b91945092509050336001600160a01b0383161480156109af57508086145b80156109ba57504683145b156109f1576040517fb79e3f3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f9610668565b507f150b7a0200000000000000000000000000000000000000000000000000000000979650505050505050565b6000610a338484846119ce565b15610a465750630b135d3f60e11b610a4a565b5060005b9392505050565b6060816000610a5e611b58565b90503660005b83811015610c6d57868682818110610a7e57610a7e6135eb565b90506060020191506000826020016020810190610a9b919061332e565b905060408301356000610af37f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008735468787611b62565b9050826001600160a01b03163b600003610b2057604051631052dd2560e21b815260040160405180910390fd5b6001600160a01b0381163b15610bb057806001600160a01b031663a4e2d6346040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b92919061362c565b15610bb057604051636315bfbb60e01b815260040160405180910390fd5b6040516331a9108f60e11b8152600481018390526001600160a01b03841690636352211e90602401602060405180830381865afa925050508015610c11575060408051601f3d908101601f19168201909252610c0e91810190613649565b60015b610c2e57604051631052dd2560e21b815260040160405180910390fd5b866001600160a01b0316816001600160a01b031614610c6057604051631052dd2560e21b815260040160405180910390fd5b5094505050600101610a64565b50610c7782611bec565b610c945760405163ea8e4eb560e01b815260040160405180910390fd5b610c9c6119a1565b610ca98b8b8b8b8b611df8565b9b9a5050505050505050505050565b6000610cc2611ff7565b610cce85858585612031565b95945050505050565b6000610ce16120aa565b610ceb8484612122565b9050610a4a826121a2565b6060610d08610d03611b58565b611bec565b610d255760405163ea8e4eb560e01b815260040160405180910390fd5b610d2d6119a1565b8160008167ffffffffffffffff811115610d4957610d49612df9565b604051908082528060200260200182016040528015610d7c57816020015b6060815260200190600190039081610d675790505b50905060005b82811015610e7857610e53868683818110610d9f57610d9f6135eb565b9050602002810190610db19190613666565b610dbf90602081019061332e565b878784818110610dd157610dd16135eb565b9050602002810190610de39190613666565b60200135888885818110610df957610df96135eb565b9050602002810190610e0b9190613666565b610e1990604081019061367c565b8a8a87818110610e2b57610e2b6135eb565b9050602002810190610e3d9190613666565b610e4e9060808101906060016136c3565b611df8565b828281518110610e6557610e656135eb565b6020908102919091010152600101610d82565b509150505b92915050565b6000610e8d611ff7565b610ecd8484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506121ef92505050565b949350505050565b6060610ee2610d03611b58565b610eff5760405163ea8e4eb560e01b815260040160405180910390fd5b610f076119a1565b610f148686868686611df8565b9695505050505050565b6000610f608484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061222c92505050565b15610a4657507f523e326000000000000000000000000000000000000000000000000000000000610a4a565b6000806000610f9961184b565b9250925092506000610fac848484611859565b90506001600160a01b038116610fd55760405163ea8e4eb560e01b815260040160405180910390fd5b336001600160a01b03821614610ffe5760405163ea8e4eb560e01b815260040160405180910390fd5b6110066119a1565b600061101130611875565b9050806001600160a01b03163b60000361102e5761102e306122da565b8786811461104f5760405163b4fa3fb360e01b815260040160405180910390fd5b60005b818110156111bd5788888281811061106c5761106c6135eb565b9050602002016020810190611081919061332e565b6001600160a01b0385166000908152600160205260408120908d8d858181106110ac576110ac6135eb565b90506020020160208101906110c19190612d11565b6001600160e01b0319168152602081019190915260400160002080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790557f2c722487e90aca38ec1b074c3403210bd2bfb769b4da7f12f7bf0b9e37517c18848c8c84818110611145576111456135eb565b905060200201602081019061115a9190612d11565b8b8b8581811061116c5761116c6135eb565b9050602002016020810190611181919061332e565b604080516001600160a01b0394851681526001600160e01b031993909316602084015292168183015290519081900360600190a1600101611052565b5050505050505050505050565b6000806000806111d861184b565b9250925092506111e9838383612312565b935050505090565b60606111fb611ff7565b610cce858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123b192505050565b6000611246610668565b507fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006040517f35567e1a000000000000000000000000000000000000000000000000000000008152306004820152600060248201526001600160a01b0391909116906335567e1a90604401602060405180830381865afa1580156112fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131e91906136de565b905090565b600080600061133061184b565b9250925092506000611343848484611859565b90506001600160a01b03811661136c5760405163ea8e4eb560e01b815260040160405180910390fd5b336001600160a01b038216146113955760405163ea8e4eb560e01b815260040160405180910390fd5b6113a3426301e1338061370d565b8511156113dc576040517f0c0a7be800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113e46119a1565b60008590556040518581527fa7b24c66dd3269a292a60b3facdbb8f3e7557d1e19e64d99e0d6ee7250be63ad9060200160405180910390a15050505050565b600061142d610668565b507ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b33732b8ff41daf40028d71c06bd71fb1cbb04ffcef02146114e65760405162461bcd60e51b815260206004820152602360248201527f5442413a204e6f74205363726f6c6c204e46542041646d696e20436f6e74726160448201527f637421000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006114f23a86613720565b90506000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611541576040519150601f19603f3d011682016040523d82523d6000602084013e611546565b606091505b50509050806115bd5760405162461bcd60e51b815260206004820152602260248201527f5442413a204661696c656420746f207472616e736665722067617320636f737460448201527f732e00000000000000000000000000000000000000000000000000000000000060648201526084016114dd565b604080516001600160a01b0385168152602081018490529081018390527f8db4725004998bf7e0f7d6045f8187bc99bfb456879e2e7ce3a7010c210d931a9060600160405180910390a16000730d7e906bd9cafa154b048cfa766cc1e54e39af9b6001600160a01b031663e3176bd56040518163ffffffff1660e01b8152600401602060405180830381865afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167f91906136de565b9050600061168d8287613720565b9050600061169b8247613737565b905073f8b1378579659d8f7ee5f3c929c2f3e332e41fd663ce0b63ce476116c06111ca565b6040516001600160e01b031960e085901b1681526001600160a01b03909116600482015260248101859052604481018c90526064016000604051808303818588803b15801561170e57600080fd5b505af1158015611722573d6000803e3d6000fd5b505050505060004711156118285747600061173b6111ca565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114611785576040519150601f19603f3d011682016040523d82523d6000602084013e61178a565b606091505b50509050806117db5760405162461bcd60e51b815260206004820152601f60248201527f5442413a204661696c656420746f207265696d6275727365204f776e65722e0060448201526064016114dd565b7f5e90a7af0e257106295d4cabfe31a7f0bc7100b422f59e277d09b25932f9aa746118046111ca565b604080516001600160a01b039092168252602082018590520160405180910390a150505b505050505050505050565b600080600061184061184b565b925092509250909192565b60008060006118403061242a565b600080611867858585612312565b9050610cce8186868661247f565b6000610e7d7f97f795a08410e77dc9dbbaba3915f17c601e45642518dd578bd440d8775bfee46118a48461254e565b805190602001206125c8565b60006001600160e01b031982167f51945447000000000000000000000000000000000000000000000000000000001480610e7d5750610e7d826125d5565b60008060006118fb61184b565b925092509250600061190e848484611859565b6001600160a01b0380821660009081526001602090815260408083206001600160e01b0319843516845290915290205491925016801561076a57600080826001600160a01b031660003660405161196692919061374a565b600060405180830381855afa9150503d806000811461074b576040519150601f19603f3d011682016040523d82523d6000602084013e610750565b6000544210156119c457604051636315bfbb60e01b815260040160405180910390fd5b6119cc612613565b565b600080838360408181106119e4576119e46135eb565b919091013560f81c915060009050818103611acb57611a0760206000868861375a565b611a1091613784565b60001c9050611a2e816040518060200160405280600081525061222c565b158015611a4457506001600160a01b0381163014155b15611a5457600092505050610a4a565b3660008686611a6760406020838561375a565b611a7091613784565b611a7b92829061375a565b91509150611ac0838984848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061264d92505050565b945050505050610a4a565b6000611b0d8787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061273d92505050565b91506000816003811115611b2357611b236137a2565b14611b345760009350505050610a4a565b611b4d826040518060200160405280600081525061222c565b979650505050505050565b600061131e612767565b6040805160b78082018490526001600160a01b038516609783015260778201869052605782018790526e5af43d82803e903d91602b57fd5bf3603783015260288201889052733d60ad80600a3d3981f3363d3d373d3d3d363d736014830152815260d781019091528051602090910120600090611be086828a6127dc565b98975050505050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031603611c2f57506001919050565b6000806000611c3c61184b565b925092509250468314611d465730611c7a611c55611b58565b7fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef0190565b6001600160a01b031603611c9357506001949350505050565b6040517f672657ca0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063672657ca90602401602060405180830381865afa158015611d12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d36919061362c565b15611d4657506001949350505050565b6000611d53848484612312565b9050806001600160a01b0316866001600160a01b031603611d7a5750600195945050505050565b6000611d888286868661247f565b9050806001600160a01b0316876001600160a01b031603611db0575060019695505050505050565b6001600160a01b038082166000908152600260209081526040808320938b168352929052205460ff1615611deb575060019695505050505050565b5060009695505050505050565b606060ff8216611e4a57611e43868686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123b192505050565b9050610cce565b60001960ff831601611eb4576000611e6130611875565b9050806001600160a01b03163b600003611e7e57611e7e306122da565b611eac8187898888604051602001611e98939291906137b8565b6040516020818303038152906040526123b1565b915050610cce565b60011960ff831601611f3e57611f008585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506121ef92505050565b604051602001611f28919060609190911b6bffffffffffffffffffffffff1916815260140190565b6040516020818303038152906040529050610cce565b60021960ff831601611fc5576000611f59602082868861375a565b611f6291613784565b9050366000611f74866020818a61375a565b91509150611f8488848484612031565b604051602001611fac919060609190911b6bffffffffffffffffffffffff1916815260140190565b6040516020818303038152906040529350505050610cce565b6040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61200030611875565b6001600160a01b0316336001600160a01b0316146119cc5760405163ea8e4eb560e01b815260040160405180910390fd5b60008083838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050825192935087929150506020830188f591506001600160a01b0382166120a15760405163a28c247360e01b815260040160405180910390fd5b50949350505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146119cc5760405162461bcd60e51b815260206004820152601c60248201527f6163636f756e743a206e6f742066726f6d20456e747279506f696e740000000060448201526064016114dd565b604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c80830185905283518084039091018152605c90920190925280519101206000906121899061218461014086018661367c565b6119ce565b1561219657506000610e7d565b50600192915050565b50565b801561219f57604051600090339060001990849084818181858888f193505050503d806000811461076a576040519150601f19603f3d011682016040523d82523d6000602084013e61076a565b805160009082906020820185f091506001600160a01b0382166122255760405163a28c247360e01b815260040160405180910390fd5b5092915050565b60008060008061223a61184b565b925092509250600061224d848484612312565b9050806001600160a01b0316876001600160a01b031603612275576001945050505050610e7d565b60006122838286868661247f565b9050806001600160a01b0316886001600160a01b0316036122ac57600195505050505050610e7d565b6001600160a01b038082166000908152600260209081526040808320938c168352929052205460ff16611be0565b61230e60007f97f795a08410e77dc9dbbaba3915f17c601e45642518dd578bd440d8775bfee46123098461254e565b612806565b5050565b600046841461232357506000610a4a565b826001600160a01b03163b60000361233d57506000610a4a565b6040516331a9108f60e11b8152600481018390526001600160a01b03841690636352211e90602401602060405180830381865afa92505050801561239e575060408051601f3d908101601f1916820190925261239b91810190613649565b60015b6123aa57506000610a4a565b9050610a4a565b60606000846001600160a01b031684846040516123ce91906135cf565b60006040518083038185875af1925050503d806000811461240b576040519150601f19603f3d011682016040523d82523d6000602084013e612410565b606091505b50925090508061242257815160208301fd5b509392505050565b60408051606080825260808201909252600091829182918291906020820181803683370190505090506060604d60208301873c8080602001905181019061247191906137e4565b935093509350509193909250565b6000845b6124ce817f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006128d1565b15610cce57806001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612511573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253591906137e4565b91965094509250612547858585612312565b9050612483565b60606040518060400160405280600e81526020017f604380600d600039806000f3fe73000000000000000000000000000000000000815250826040518060600160405280602e815260200161392d602e91396040516020016125b29392919061381d565b6040516020818303038152906040529050919050565b6000610a4a8383306127dc565b60006001600160e01b031982167f6faff5f1000000000000000000000000000000000000000000000000000000001480610e7d5750610e7d82612980565b60035461261e6129e7565b60405160200161263093929190613869565b60408051601f198184030181529190528051602090910120600355565b6000806000856001600160a01b0316858560405160240161266f92919061389f565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16630b135d3f60e11b179052516126b991906135cf565b600060405180830381855afa9150503d80600081146126f4576040519150601f19603f3d011682016040523d82523d6000602084013e6126f9565b606091505b509150915081801561270d57506020815110155b8015610f1457508051630b135d3f60e11b9061273290830160209081019084016136de565b149695505050505050565b60008060008061274d86866129fa565b92509250925061275d8282612a47565b5090949350505050565b60003660147f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316331480156127a45750808210155b156127d4576000366127b68385613737565b6127c192829061375a565b6127ca916138b8565b60601c9250505090565b339250505090565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b60008347101561284b576040517fe4bbecac000000000000000000000000000000000000000000000000000000008152476004820152602481018590526044016114dd565b8151600003612886576040517f4ca249dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8282516020840186f590506001600160a01b038116610a4a576040517f741752c200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000836001600160a01b03163b60ad146128ed57506000610a4a565b60006128f885612b4b565b9050806001600160a01b03163b600003612916576000915050610a4a565b836001600160a01b0316816001600160a01b031614612939576000915050610a4a565b60008060008061294889612b5d565b935093509350935061295e878686868686611b62565b6001600160a01b0316896001600160a01b031614955050505050509392505050565b60006001600160e01b031982167f4e2312e0000000000000000000000000000000000000000000000000000000001480610e7d57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610e7d565b3660006129f2612bb5565b915091509091565b60008060008351604103612a345760208401516040850151606086015160001a612a2688828585612c25565b955095509550505050612a40565b50508151600091506002905b9250925092565b6000826003811115612a5b57612a5b6137a2565b03612a64575050565b6001826003811115612a7857612a786137a2565b03612aaf576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002826003811115612ac357612ac36137a2565b03612afd576040517ffce698f7000000000000000000000000000000000000000000000000000000008152600481018290526024016114dd565b6003826003811115612b1157612b116137a2565b0361230e576040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600481018290526024016114dd565b60006014600a600c843c505060005190565b60408051608080825260a0820190925260009182918291829182916020820181803683370190505090506080602d60208301883c80806020019051810190612ba591906138ed565b9450945094509450509193509193565b3660008160147f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633148015612bf35750808210155b15612c1d5760008036612c068486613737565b92612c139392919061375a565b9350935050509091565b600036612c13565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115612c605750600091506003905082612cea565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612cb4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612ce057506000925060019150829050612cea565b9250600091508190505b9450945094915050565b80356001600160e01b031981168114612d0c57600080fd5b919050565b600060208284031215612d2357600080fd5b610a4a82612cf4565b60008083601f840112612d3e57600080fd5b50813567ffffffffffffffff811115612d5657600080fd5b6020830191508360208260051b8501011115612d7157600080fd5b9250929050565b60008060008060408587031215612d8e57600080fd5b843567ffffffffffffffff80821115612da657600080fd5b612db288838901612d2c565b90965094506020870135915080821115612dcb57600080fd5b50612dd887828801612d2c565b95989497509550505050565b6001600160a01b038116811461219f57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612e3857612e38612df9565b604052919050565b600082601f830112612e5157600080fd5b813567ffffffffffffffff811115612e6b57612e6b612df9565b612e7e601f8201601f1916602001612e0f565b818152846020838601011115612e9357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215612ec657600080fd5b8435612ed181612de4565b93506020850135612ee181612de4565b925060408501359150606085013567ffffffffffffffff811115612f0457600080fd5b612f1087828801612e40565b91505092959194509250565b60008083601f840112612f2e57600080fd5b50813567ffffffffffffffff811115612f4657600080fd5b602083019150836020828501011115612d7157600080fd5b600080600060408486031215612f7357600080fd5b83359250602084013567ffffffffffffffff811115612f9157600080fd5b612f9d86828701612f1c565b9497909650939450505050565b600060208284031215612fbc57600080fd5b5035919050565b60008060408385031215612fd657600080fd5b8235612fe181612de4565b91506020830135612ff181612de4565b809150509250929050565b803560ff81168114612d0c57600080fd5b600080600080600080600060a0888a03121561302857600080fd5b873561303381612de4565b965060208801359550604088013567ffffffffffffffff8082111561305757600080fd5b6130638b838c01612f1c565b909750955085915061307760608b01612ffc565b945060808a013591508082111561308d57600080fd5b818a0191508a601f8301126130a157600080fd5b8135818111156130b057600080fd5b8b60206060830285010111156130c557600080fd5b60208301945080935050505092959891949750929550565b60005b838110156130f85781810151838201526020016130e0565b50506000910152565b600081518084526131198160208601602086016130dd565b601f01601f19169290920160200192915050565b602081526000610a4a6020830184613101565b6000806000806060858703121561315657600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561317b57600080fd5b612dd887828801612f1c565b60008060006060848603121561319c57600080fd5b833567ffffffffffffffff8111156131b357600080fd5b840161016081870312156131c657600080fd5b95602085013595506040909401359392505050565b600080602083850312156131ee57600080fd5b823567ffffffffffffffff81111561320557600080fd5b61321185828601612d2c565b90969095509350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b8281101561327457603f19888603018452613262858351613101565b94509285019290850190600101613246565b5092979650505050505050565b60008060008060006080868803121561329957600080fd5b85356132a481612de4565b945060208601359350604086013567ffffffffffffffff8111156132c757600080fd5b6132d388828901612f1c565b90945092506132e6905060608701612ffc565b90509295509295909350565b60008060006040848603121561330757600080fd5b833561331281612de4565b9250602084013567ffffffffffffffff811115612f9157600080fd5b60006020828403121561334057600080fd5b8135610a4a81612de4565b6000806000806060858703121561336157600080fd5b843561336c81612de4565b935060208501359250604085013567ffffffffffffffff81111561317b57600080fd5b600082601f8301126133a057600080fd5b8135602067ffffffffffffffff8211156133bc576133bc612df9565b8160051b6133cb828201612e0f565b92835284810182019282810190878511156133e557600080fd5b83870192505b84831015611b4d578235825291830191908301906133eb565b600080600080600060a0868803121561341c57600080fd5b853561342781612de4565b9450602086013561343781612de4565b9350604086013567ffffffffffffffff8082111561345457600080fd5b61346089838a0161338f565b9450606088013591508082111561347657600080fd5b61348289838a0161338f565b9350608088013591508082111561349857600080fd5b506134a588828901612e40565b9150509295509295909350565b600080604083850312156134c557600080fd5b82356134d081612de4565b91506134de60208401612cf4565b90509250929050565b600080600080600060a086880312156134ff57600080fd5b853561350a81612de4565b9450602086013561351a81612de4565b93506040860135925060608601359150608086013567ffffffffffffffff81111561354457600080fd5b6134a588828901612e40565b6000806000806080858703121561356657600080fd5b843593506020850135925060408501359150606085013561358681612de4565b939692955090935050565b60006bffffffffffffffffffffffff19808760601b16835284866014850137848301818560601b166014820152602881019250505095945050505050565b600082516135e18184602087016130dd565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b801515811461219f57600080fd5b60006020828403121561362157600080fd5b8135610a4a81613601565b60006020828403121561363e57600080fd5b8151610a4a81613601565b60006020828403121561365b57600080fd5b8151610a4a81612de4565b60008235607e198336030181126135e157600080fd5b6000808335601e1984360301811261369357600080fd5b83018035915067ffffffffffffffff8211156136ae57600080fd5b602001915036819003821315612d7157600080fd5b6000602082840312156136d557600080fd5b610a4a82612ffc565b6000602082840312156136f057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e7d57610e7d6136f7565b8082028115828204841417610e7d57610e7d6136f7565b81810381811115610e7d57610e7d6136f7565b8183823760009101908152919050565b6000808585111561376a57600080fd5b8386111561377757600080fd5b5050820193919092039150565b80356020831015610e7d57600019602084900360031b1b1692915050565b634e487b7160e01b600052602160045260246000fd5b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b6000806000606084860312156137f957600080fd5b83519250602084015161380b81612de4565b80925050604084015190509250925092565b6000845161382f8184602089016130dd565b606085901b6bffffffffffffffffffffffff1916908301908152835161385c8160148401602088016130dd565b0160140195945050505050565b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b828152604060208201526000610ecd6040830184613101565b6bffffffffffffffffffffffff1981358181169160148510156138e55780818660140360031b1b83161692505b505092915050565b6000806000806080858703121561390357600080fd5b8451935060208501519250604085015161391c81612de4565b606095909501519396929550505056fe3314601d573d3dfd5b363d3d373d3d6014360360143d5160601c5af43d6000803e80603e573d6000fd5b3d6000f3a26469706673582212200ecf4dd34456d06c5d59478ff869930eb6c7ba3216912a04fb12ee6cdcfb03f264736f6c634300081700330000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd000000000000000000000000000000006551c19487814612e58fe068137757580000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101d15760003560e01c80637a8f7356116100f7578063c19d93fb11610095578063ee9c605411610064578063ee9c6054146105bc578063f23a6e61146105fd578063fa2b96851461061d578063fc0c546a14610630576101e0565b8063c19d93fb1461055c578063ce0617ec14610571578063d087d28814610587578063dd4670641461059c576101e0565b8063a4e2d634116100d1578063a4e2d634146104d2578063b0d691fe146104e9578063b709467c1461051c578063bc197c811461053c576101e0565b80637a8f73561461046a5780637da0a8771461048a5780638da5cb5b146104bd576101e0565b80631fb1ecf01161016f57806345a24e3e1161013e57806345a24e3e146103ca57806351945447146103ea578063523e3260146103fd578063572b6c051461041d576101e0565b80631fb1ecf01461034a57806334715fb11461036a5780633a871cdd1461038a57806343629a73146103aa576101e0565b8063150b7a02116101ab578063150b7a02146102895780631626ba7e146102c25780631e2eaeaf146102e25780631f9838b51461030f576101e0565b806301ffc9a7146101e8578063039721b11461021d578063056d5afe1461023d576101e0565b366101e0576101de610668565b005b6101de610668565b3480156101f457600080fd5b50610208610203366004612d11565b610771565b60405190151581526020015b60405180910390f35b34801561022957600080fd5b506101de610238366004612d78565b61079f565b34801561024957600080fd5b506102717f000000000000000000000000000000006551c19487814612e58fe0681377575881565b6040516001600160a01b039091168152602001610214565b34801561029557600080fd5b506102a96102a4366004612eb0565b610983565b6040516001600160e01b03199091168152602001610214565b3480156102ce57600080fd5b506102a96102dd366004612f5e565b610a26565b3480156102ee57600080fd5b506103016102fd366004612faa565b5490565b604051908152602001610214565b34801561031b57600080fd5b5061020861032a366004612fc3565b600260209081526000928352604080842090915290825290205460ff1681565b61035d61035836600461300d565b610a51565b604051610214919061312d565b34801561037657600080fd5b50610271610385366004613140565b610cb8565b34801561039657600080fd5b506103016103a5366004613187565b610cd7565b6103bd6103b83660046131db565b610cf6565b604051610214919061321d565b3480156103d657600080fd5b506102716103e5366004612f5e565b610e83565b61035d6103f8366004613281565b610ed5565b34801561040957600080fd5b506102a96104183660046132f2565b610f1e565b34801561042957600080fd5b5061020861043836600461332e565b7f000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd6001600160a01b0390811691161490565b34801561047657600080fd5b506101de610485366004612d78565b610f8c565b34801561049657600080fd5b507f000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd610271565b3480156104c957600080fd5b506102716111ca565b3480156104de57600080fd5b506000544210610208565b3480156104f557600080fd5b507f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789610271565b34801561052857600080fd5b5061035d61053736600461334b565b6111f1565b34801561054857600080fd5b506102a9610557366004613404565b61123c565b34801561056857600080fd5b50600354610301565b34801561057d57600080fd5b5061030160005481565b34801561059357600080fd5b50610301611271565b3480156105a857600080fd5b506101de6105b7366004612faa565b611323565b3480156105c857600080fd5b506102716105d73660046134b2565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b34801561060957600080fd5b506102a96106183660046134e7565b611423565b6101de61062b366004613550565b611458565b34801561063c57600080fd5b50610645611833565b604080519384526001600160a01b03909216602084015290820152606001610214565b600080600061067561184b565b9250925092506000610688848484611859565b6001600160a01b0380821660009081526001602090815260408083206001600160e01b0319843516845290915290205491925016801561076a5760006106cd30611875565b9050600080826001600160a01b031684600036336040516020016106f49493929190613591565b60408051601f198184030181529082905261070e916135cf565b6000604051808303816000865af19150503d806000811461074b576040519150601f19603f3d011682016040523d82523d6000602084013e610750565b606091505b50915091508161076257805160208201fd5b805160208201f35b5050505050565b60008061077d836118b0565b9050801561078e5750600192915050565b6107966118ee565b50600092915050565b60008060006107ac61184b565b92509250925060006107bf848484611859565b90506001600160a01b0381166107e85760405163ea8e4eb560e01b815260040160405180910390fd5b336001600160a01b038216146108115760405163ea8e4eb560e01b815260040160405180910390fd5b6108196119a1565b8685811461083a5760405163b4fa3fb360e01b815260040160405180910390fd5b60005b8181101561097757878782818110610857576108576135eb565b905060200201602081019061086c919061360f565b6001600160a01b0384166000908152600260205260408120908c8c85818110610897576108976135eb565b90506020020160208101906108ac919061332e565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f394777a58092892d136a90c4bb7e4350c72ac50fba6a0208128677f36527dcf5838b8b84818110610908576109086135eb565b905060200201602081019061091d919061332e565b8a8a8581811061092f5761092f6135eb565b9050602002016020810190610944919061360f565b604080516001600160a01b03948516815293909216602084015215159082015260600160405180910390a160010161083d565b50505050505050505050565b60008060008061099161184b565b91945092509050336001600160a01b0383161480156109af57508086145b80156109ba57504683145b156109f1576040517fb79e3f3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f9610668565b507f150b7a0200000000000000000000000000000000000000000000000000000000979650505050505050565b6000610a338484846119ce565b15610a465750630b135d3f60e11b610a4a565b5060005b9392505050565b6060816000610a5e611b58565b90503660005b83811015610c6d57868682818110610a7e57610a7e6135eb565b90506060020191506000826020016020810190610a9b919061332e565b905060408301356000610af37f000000000000000000000000000000006551c19487814612e58fe068137757587f000000000000000000000000787a700be36966c316fc737dc21abe2bb904ed718735468787611b62565b9050826001600160a01b03163b600003610b2057604051631052dd2560e21b815260040160405180910390fd5b6001600160a01b0381163b15610bb057806001600160a01b031663a4e2d6346040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b92919061362c565b15610bb057604051636315bfbb60e01b815260040160405180910390fd5b6040516331a9108f60e11b8152600481018390526001600160a01b03841690636352211e90602401602060405180830381865afa925050508015610c11575060408051601f3d908101601f19168201909252610c0e91810190613649565b60015b610c2e57604051631052dd2560e21b815260040160405180910390fd5b866001600160a01b0316816001600160a01b031614610c6057604051631052dd2560e21b815260040160405180910390fd5b5094505050600101610a64565b50610c7782611bec565b610c945760405163ea8e4eb560e01b815260040160405180910390fd5b610c9c6119a1565b610ca98b8b8b8b8b611df8565b9b9a5050505050505050505050565b6000610cc2611ff7565b610cce85858585612031565b95945050505050565b6000610ce16120aa565b610ceb8484612122565b9050610a4a826121a2565b6060610d08610d03611b58565b611bec565b610d255760405163ea8e4eb560e01b815260040160405180910390fd5b610d2d6119a1565b8160008167ffffffffffffffff811115610d4957610d49612df9565b604051908082528060200260200182016040528015610d7c57816020015b6060815260200190600190039081610d675790505b50905060005b82811015610e7857610e53868683818110610d9f57610d9f6135eb565b9050602002810190610db19190613666565b610dbf90602081019061332e565b878784818110610dd157610dd16135eb565b9050602002810190610de39190613666565b60200135888885818110610df957610df96135eb565b9050602002810190610e0b9190613666565b610e1990604081019061367c565b8a8a87818110610e2b57610e2b6135eb565b9050602002810190610e3d9190613666565b610e4e9060808101906060016136c3565b611df8565b828281518110610e6557610e656135eb565b6020908102919091010152600101610d82565b509150505b92915050565b6000610e8d611ff7565b610ecd8484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506121ef92505050565b949350505050565b6060610ee2610d03611b58565b610eff5760405163ea8e4eb560e01b815260040160405180910390fd5b610f076119a1565b610f148686868686611df8565b9695505050505050565b6000610f608484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061222c92505050565b15610a4657507f523e326000000000000000000000000000000000000000000000000000000000610a4a565b6000806000610f9961184b565b9250925092506000610fac848484611859565b90506001600160a01b038116610fd55760405163ea8e4eb560e01b815260040160405180910390fd5b336001600160a01b03821614610ffe5760405163ea8e4eb560e01b815260040160405180910390fd5b6110066119a1565b600061101130611875565b9050806001600160a01b03163b60000361102e5761102e306122da565b8786811461104f5760405163b4fa3fb360e01b815260040160405180910390fd5b60005b818110156111bd5788888281811061106c5761106c6135eb565b9050602002016020810190611081919061332e565b6001600160a01b0385166000908152600160205260408120908d8d858181106110ac576110ac6135eb565b90506020020160208101906110c19190612d11565b6001600160e01b0319168152602081019190915260400160002080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790557f2c722487e90aca38ec1b074c3403210bd2bfb769b4da7f12f7bf0b9e37517c18848c8c84818110611145576111456135eb565b905060200201602081019061115a9190612d11565b8b8b8581811061116c5761116c6135eb565b9050602002016020810190611181919061332e565b604080516001600160a01b0394851681526001600160e01b031993909316602084015292168183015290519081900360600190a1600101611052565b5050505050505050505050565b6000806000806111d861184b565b9250925092506111e9838383612312565b935050505090565b60606111fb611ff7565b610cce858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123b192505050565b6000611246610668565b507fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b60007f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27896040517f35567e1a000000000000000000000000000000000000000000000000000000008152306004820152600060248201526001600160a01b0391909116906335567e1a90604401602060405180830381865afa1580156112fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131e91906136de565b905090565b600080600061133061184b565b9250925092506000611343848484611859565b90506001600160a01b03811661136c5760405163ea8e4eb560e01b815260040160405180910390fd5b336001600160a01b038216146113955760405163ea8e4eb560e01b815260040160405180910390fd5b6113a3426301e1338061370d565b8511156113dc576040517f0c0a7be800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113e46119a1565b60008590556040518581527fa7b24c66dd3269a292a60b3facdbb8f3e7557d1e19e64d99e0d6ee7250be63ad9060200160405180910390a15050505050565b600061142d610668565b507ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b33732b8ff41daf40028d71c06bd71fb1cbb04ffcef02146114e65760405162461bcd60e51b815260206004820152602360248201527f5442413a204e6f74205363726f6c6c204e46542041646d696e20436f6e74726160448201527f637421000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60006114f23a86613720565b90506000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611541576040519150601f19603f3d011682016040523d82523d6000602084013e611546565b606091505b50509050806115bd5760405162461bcd60e51b815260206004820152602260248201527f5442413a204661696c656420746f207472616e736665722067617320636f737460448201527f732e00000000000000000000000000000000000000000000000000000000000060648201526084016114dd565b604080516001600160a01b0385168152602081018490529081018390527f8db4725004998bf7e0f7d6045f8187bc99bfb456879e2e7ce3a7010c210d931a9060600160405180910390a16000730d7e906bd9cafa154b048cfa766cc1e54e39af9b6001600160a01b031663e3176bd56040518163ffffffff1660e01b8152600401602060405180830381865afa15801561165b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167f91906136de565b9050600061168d8287613720565b9050600061169b8247613737565b905073f8b1378579659d8f7ee5f3c929c2f3e332e41fd663ce0b63ce476116c06111ca565b6040516001600160e01b031960e085901b1681526001600160a01b03909116600482015260248101859052604481018c90526064016000604051808303818588803b15801561170e57600080fd5b505af1158015611722573d6000803e3d6000fd5b505050505060004711156118285747600061173b6111ca565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114611785576040519150601f19603f3d011682016040523d82523d6000602084013e61178a565b606091505b50509050806117db5760405162461bcd60e51b815260206004820152601f60248201527f5442413a204661696c656420746f207265696d6275727365204f776e65722e0060448201526064016114dd565b7f5e90a7af0e257106295d4cabfe31a7f0bc7100b422f59e277d09b25932f9aa746118046111ca565b604080516001600160a01b039092168252602082018590520160405180910390a150505b505050505050505050565b600080600061184061184b565b925092509250909192565b60008060006118403061242a565b600080611867858585612312565b9050610cce8186868661247f565b6000610e7d7f97f795a08410e77dc9dbbaba3915f17c601e45642518dd578bd440d8775bfee46118a48461254e565b805190602001206125c8565b60006001600160e01b031982167f51945447000000000000000000000000000000000000000000000000000000001480610e7d5750610e7d826125d5565b60008060006118fb61184b565b925092509250600061190e848484611859565b6001600160a01b0380821660009081526001602090815260408083206001600160e01b0319843516845290915290205491925016801561076a57600080826001600160a01b031660003660405161196692919061374a565b600060405180830381855afa9150503d806000811461074b576040519150601f19603f3d011682016040523d82523d6000602084013e610750565b6000544210156119c457604051636315bfbb60e01b815260040160405180910390fd5b6119cc612613565b565b600080838360408181106119e4576119e46135eb565b919091013560f81c915060009050818103611acb57611a0760206000868861375a565b611a1091613784565b60001c9050611a2e816040518060200160405280600081525061222c565b158015611a4457506001600160a01b0381163014155b15611a5457600092505050610a4a565b3660008686611a6760406020838561375a565b611a7091613784565b611a7b92829061375a565b91509150611ac0838984848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061264d92505050565b945050505050610a4a565b6000611b0d8787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061273d92505050565b91506000816003811115611b2357611b236137a2565b14611b345760009350505050610a4a565b611b4d826040518060200160405280600081525061222c565b979650505050505050565b600061131e612767565b6040805160b78082018490526001600160a01b038516609783015260778201869052605782018790526e5af43d82803e903d91602b57fd5bf3603783015260288201889052733d60ad80600a3d3981f3363d3d373d3d3d363d736014830152815260d781019091528051602090910120600090611be086828a6127dc565b98975050505050505050565b60007f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27896001600160a01b0316826001600160a01b031603611c2f57506001919050565b6000806000611c3c61184b565b925092509250468314611d465730611c7a611c55611b58565b7fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef0190565b6001600160a01b031603611c9357506001949350505050565b6040517f672657ca0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063672657ca90602401602060405180830381865afa158015611d12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d36919061362c565b15611d4657506001949350505050565b6000611d53848484612312565b9050806001600160a01b0316866001600160a01b031603611d7a5750600195945050505050565b6000611d888286868661247f565b9050806001600160a01b0316876001600160a01b031603611db0575060019695505050505050565b6001600160a01b038082166000908152600260209081526040808320938b168352929052205460ff1615611deb575060019695505050505050565b5060009695505050505050565b606060ff8216611e4a57611e43868686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506123b192505050565b9050610cce565b60001960ff831601611eb4576000611e6130611875565b9050806001600160a01b03163b600003611e7e57611e7e306122da565b611eac8187898888604051602001611e98939291906137b8565b6040516020818303038152906040526123b1565b915050610cce565b60011960ff831601611f3e57611f008585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506121ef92505050565b604051602001611f28919060609190911b6bffffffffffffffffffffffff1916815260140190565b6040516020818303038152906040529050610cce565b60021960ff831601611fc5576000611f59602082868861375a565b611f6291613784565b9050366000611f74866020818a61375a565b91509150611f8488848484612031565b604051602001611fac919060609190911b6bffffffffffffffffffffffff1916815260140190565b6040516020818303038152906040529350505050610cce565b6040517f398d4d3200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61200030611875565b6001600160a01b0316336001600160a01b0316146119cc5760405163ea8e4eb560e01b815260040160405180910390fd5b60008083838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050825192935087929150506020830188f591506001600160a01b0382166120a15760405163a28c247360e01b815260040160405180910390fd5b50949350505050565b336001600160a01b037f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d278916146119cc5760405162461bcd60e51b815260206004820152601c60248201527f6163636f756e743a206e6f742066726f6d20456e747279506f696e740000000060448201526064016114dd565b604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c80830185905283518084039091018152605c90920190925280519101206000906121899061218461014086018661367c565b6119ce565b1561219657506000610e7d565b50600192915050565b50565b801561219f57604051600090339060001990849084818181858888f193505050503d806000811461076a576040519150601f19603f3d011682016040523d82523d6000602084013e61076a565b805160009082906020820185f091506001600160a01b0382166122255760405163a28c247360e01b815260040160405180910390fd5b5092915050565b60008060008061223a61184b565b925092509250600061224d848484612312565b9050806001600160a01b0316876001600160a01b031603612275576001945050505050610e7d565b60006122838286868661247f565b9050806001600160a01b0316886001600160a01b0316036122ac57600195505050505050610e7d565b6001600160a01b038082166000908152600260209081526040808320938c168352929052205460ff16611be0565b61230e60007f97f795a08410e77dc9dbbaba3915f17c601e45642518dd578bd440d8775bfee46123098461254e565b612806565b5050565b600046841461232357506000610a4a565b826001600160a01b03163b60000361233d57506000610a4a565b6040516331a9108f60e11b8152600481018390526001600160a01b03841690636352211e90602401602060405180830381865afa92505050801561239e575060408051601f3d908101601f1916820190925261239b91810190613649565b60015b6123aa57506000610a4a565b9050610a4a565b60606000846001600160a01b031684846040516123ce91906135cf565b60006040518083038185875af1925050503d806000811461240b576040519150601f19603f3d011682016040523d82523d6000602084013e612410565b606091505b50925090508061242257815160208301fd5b509392505050565b60408051606080825260808201909252600091829182918291906020820181803683370190505090506060604d60208301873c8080602001905181019061247191906137e4565b935093509350509193909250565b6000845b6124ce817f000000000000000000000000787a700be36966c316fc737dc21abe2bb904ed717f000000000000000000000000000000006551c19487814612e58fe068137757586128d1565b15610cce57806001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612511573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253591906137e4565b91965094509250612547858585612312565b9050612483565b60606040518060400160405280600e81526020017f604380600d600039806000f3fe73000000000000000000000000000000000000815250826040518060600160405280602e815260200161392d602e91396040516020016125b29392919061381d565b6040516020818303038152906040529050919050565b6000610a4a8383306127dc565b60006001600160e01b031982167f6faff5f1000000000000000000000000000000000000000000000000000000001480610e7d5750610e7d82612980565b60035461261e6129e7565b60405160200161263093929190613869565b60408051601f198184030181529190528051602090910120600355565b6000806000856001600160a01b0316858560405160240161266f92919061389f565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16630b135d3f60e11b179052516126b991906135cf565b600060405180830381855afa9150503d80600081146126f4576040519150601f19603f3d011682016040523d82523d6000602084013e6126f9565b606091505b509150915081801561270d57506020815110155b8015610f1457508051630b135d3f60e11b9061273290830160209081019084016136de565b149695505050505050565b60008060008061274d86866129fa565b92509250925061275d8282612a47565b5090949350505050565b60003660147f000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd6001600160a01b0316331480156127a45750808210155b156127d4576000366127b68385613737565b6127c192829061375a565b6127ca916138b8565b60601c9250505090565b339250505090565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b60008347101561284b576040517fe4bbecac000000000000000000000000000000000000000000000000000000008152476004820152602481018590526044016114dd565b8151600003612886576040517f4ca249dc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8282516020840186f590506001600160a01b038116610a4a576040517f741752c200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000836001600160a01b03163b60ad146128ed57506000610a4a565b60006128f885612b4b565b9050806001600160a01b03163b600003612916576000915050610a4a565b836001600160a01b0316816001600160a01b031614612939576000915050610a4a565b60008060008061294889612b5d565b935093509350935061295e878686868686611b62565b6001600160a01b0316896001600160a01b031614955050505050509392505050565b60006001600160e01b031982167f4e2312e0000000000000000000000000000000000000000000000000000000001480610e7d57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610e7d565b3660006129f2612bb5565b915091509091565b60008060008351604103612a345760208401516040850151606086015160001a612a2688828585612c25565b955095509550505050612a40565b50508151600091506002905b9250925092565b6000826003811115612a5b57612a5b6137a2565b03612a64575050565b6001826003811115612a7857612a786137a2565b03612aaf576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002826003811115612ac357612ac36137a2565b03612afd576040517ffce698f7000000000000000000000000000000000000000000000000000000008152600481018290526024016114dd565b6003826003811115612b1157612b116137a2565b0361230e576040517fd78bce0c000000000000000000000000000000000000000000000000000000008152600481018290526024016114dd565b60006014600a600c843c505060005190565b60408051608080825260a0820190925260009182918291829182916020820181803683370190505090506080602d60208301883c80806020019051810190612ba591906138ed565b9450945094509450509193509193565b3660008160147f000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd6001600160a01b031633148015612bf35750808210155b15612c1d5760008036612c068486613737565b92612c139392919061375a565b9350935050509091565b600036612c13565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115612c605750600091506003905082612cea565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612cb4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612ce057506000925060019150829050612cea565b9250600091508190505b9450945094915050565b80356001600160e01b031981168114612d0c57600080fd5b919050565b600060208284031215612d2357600080fd5b610a4a82612cf4565b60008083601f840112612d3e57600080fd5b50813567ffffffffffffffff811115612d5657600080fd5b6020830191508360208260051b8501011115612d7157600080fd5b9250929050565b60008060008060408587031215612d8e57600080fd5b843567ffffffffffffffff80821115612da657600080fd5b612db288838901612d2c565b90965094506020870135915080821115612dcb57600080fd5b50612dd887828801612d2c565b95989497509550505050565b6001600160a01b038116811461219f57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612e3857612e38612df9565b604052919050565b600082601f830112612e5157600080fd5b813567ffffffffffffffff811115612e6b57612e6b612df9565b612e7e601f8201601f1916602001612e0f565b818152846020838601011115612e9357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215612ec657600080fd5b8435612ed181612de4565b93506020850135612ee181612de4565b925060408501359150606085013567ffffffffffffffff811115612f0457600080fd5b612f1087828801612e40565b91505092959194509250565b60008083601f840112612f2e57600080fd5b50813567ffffffffffffffff811115612f4657600080fd5b602083019150836020828501011115612d7157600080fd5b600080600060408486031215612f7357600080fd5b83359250602084013567ffffffffffffffff811115612f9157600080fd5b612f9d86828701612f1c565b9497909650939450505050565b600060208284031215612fbc57600080fd5b5035919050565b60008060408385031215612fd657600080fd5b8235612fe181612de4565b91506020830135612ff181612de4565b809150509250929050565b803560ff81168114612d0c57600080fd5b600080600080600080600060a0888a03121561302857600080fd5b873561303381612de4565b965060208801359550604088013567ffffffffffffffff8082111561305757600080fd5b6130638b838c01612f1c565b909750955085915061307760608b01612ffc565b945060808a013591508082111561308d57600080fd5b818a0191508a601f8301126130a157600080fd5b8135818111156130b057600080fd5b8b60206060830285010111156130c557600080fd5b60208301945080935050505092959891949750929550565b60005b838110156130f85781810151838201526020016130e0565b50506000910152565b600081518084526131198160208601602086016130dd565b601f01601f19169290920160200192915050565b602081526000610a4a6020830184613101565b6000806000806060858703121561315657600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561317b57600080fd5b612dd887828801612f1c565b60008060006060848603121561319c57600080fd5b833567ffffffffffffffff8111156131b357600080fd5b840161016081870312156131c657600080fd5b95602085013595506040909401359392505050565b600080602083850312156131ee57600080fd5b823567ffffffffffffffff81111561320557600080fd5b61321185828601612d2c565b90969095509350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b8281101561327457603f19888603018452613262858351613101565b94509285019290850190600101613246565b5092979650505050505050565b60008060008060006080868803121561329957600080fd5b85356132a481612de4565b945060208601359350604086013567ffffffffffffffff8111156132c757600080fd5b6132d388828901612f1c565b90945092506132e6905060608701612ffc565b90509295509295909350565b60008060006040848603121561330757600080fd5b833561331281612de4565b9250602084013567ffffffffffffffff811115612f9157600080fd5b60006020828403121561334057600080fd5b8135610a4a81612de4565b6000806000806060858703121561336157600080fd5b843561336c81612de4565b935060208501359250604085013567ffffffffffffffff81111561317b57600080fd5b600082601f8301126133a057600080fd5b8135602067ffffffffffffffff8211156133bc576133bc612df9565b8160051b6133cb828201612e0f565b92835284810182019282810190878511156133e557600080fd5b83870192505b84831015611b4d578235825291830191908301906133eb565b600080600080600060a0868803121561341c57600080fd5b853561342781612de4565b9450602086013561343781612de4565b9350604086013567ffffffffffffffff8082111561345457600080fd5b61346089838a0161338f565b9450606088013591508082111561347657600080fd5b61348289838a0161338f565b9350608088013591508082111561349857600080fd5b506134a588828901612e40565b9150509295509295909350565b600080604083850312156134c557600080fd5b82356134d081612de4565b91506134de60208401612cf4565b90509250929050565b600080600080600060a086880312156134ff57600080fd5b853561350a81612de4565b9450602086013561351a81612de4565b93506040860135925060608601359150608086013567ffffffffffffffff81111561354457600080fd5b6134a588828901612e40565b6000806000806080858703121561356657600080fd5b843593506020850135925060408501359150606085013561358681612de4565b939692955090935050565b60006bffffffffffffffffffffffff19808760601b16835284866014850137848301818560601b166014820152602881019250505095945050505050565b600082516135e18184602087016130dd565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b801515811461219f57600080fd5b60006020828403121561362157600080fd5b8135610a4a81613601565b60006020828403121561363e57600080fd5b8151610a4a81613601565b60006020828403121561365b57600080fd5b8151610a4a81612de4565b60008235607e198336030181126135e157600080fd5b6000808335601e1984360301811261369357600080fd5b83018035915067ffffffffffffffff8211156136ae57600080fd5b602001915036819003821315612d7157600080fd5b6000602082840312156136d557600080fd5b610a4a82612ffc565b6000602082840312156136f057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610e7d57610e7d6136f7565b8082028115828204841417610e7d57610e7d6136f7565b81810381811115610e7d57610e7d6136f7565b8183823760009101908152919050565b6000808585111561376a57600080fd5b8386111561377757600080fd5b5050820193919092039150565b80356020831015610e7d57600019602084900360031b1b1692915050565b634e487b7160e01b600052602160045260246000fd5b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b6000806000606084860312156137f957600080fd5b83519250602084015161380b81612de4565b80925050604084015190509250925092565b6000845161382f8184602089016130dd565b606085901b6bffffffffffffffffffffffff1916908301908152835161385c8160148401602088016130dd565b0160140195945050505050565b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b828152604060208201526000610ecd6040830184613101565b6bffffffffffffffffffffffff1981358181169160148510156138e55780818660140360031b1b83161692505b505092915050565b6000806000806080858703121561390357600080fd5b8451935060208501519250604085015161391c81612de4565b606095909501519396929550505056fe3314601d573d3dfd5b363d3d373d3d6014360360143d5160601c5af43d6000803e80603e573d6000fd5b3d6000f3a26469706673582212200ecf4dd34456d06c5d59478ff869930eb6c7ba3216912a04fb12ee6cdcfb03f264736f6c63430008170033

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

0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd000000000000000000000000000000006551c19487814612e58fe068137757580000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : entryPoint_ (address): 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
Arg [1] : multicallForwarder (address): 0xcA1167915584462449EE5b4Ea51c37fE81eCDCCD
Arg [2] : erc6551Registry (address): 0x000000006551c19487814612e58FE06813775758
Arg [3] : _guardian (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789
Arg [1] : 000000000000000000000000ca1167915584462449ee5b4ea51c37fe81ecdccd
Arg [2] : 000000000000000000000000000000006551c19487814612e58fe06813775758
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.