ETH Price: $3,836.63 (-3.75%)

Contract

0xf6B6C15256de133cC722313bfFBb75280Bb2B228
 

Overview

ETH Balance

0.000101572413272222 ETH

ETH Value

$0.39 (@ $3,836.63/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Loopooor ...101800422024-10-17 12:58:1953 days ago1729169899IN
0xf6B6C152...80Bb2B228
0 ETH0.000008850.00229694
Create Loopooor ...101365982024-10-16 12:50:1154 days ago1729083011IN
0xf6B6C152...80Bb2B228
0.0001 ETH0.000016220.00411621
Create Loopooor ...101365712024-10-16 12:49:1754 days ago1729082957IN
0xf6B6C152...80Bb2B228
0.0001 ETH0.000016530.00419449
Create Loopooor ...97408732024-10-07 8:59:2163 days ago1728291561IN
0xf6B6C152...80Bb2B228
0 ETH0.00001250.00336655
Create Loopooor ...93797232024-09-29 0:21:0171 days ago1727569261IN
0xf6B6C152...80Bb2B228
0.17 ETH0.000009350.00243838
Create Loopooor ...93795662024-09-29 0:15:4771 days ago1727568947IN
0xf6B6C152...80Bb2B228
0.18 ETH0.00000970.0025281
Create Loopooor ...91862202024-09-24 12:50:5576 days ago1727182255IN
0xf6B6C152...80Bb2B228
0.002 ETH0.000013830.0036045
Create Loopooor ...91855652024-09-24 12:29:0576 days ago1727180945IN
0xf6B6C152...80Bb2B228
0.001 ETH0.000015630.00407278
Create Loopooor ...91836132024-09-24 11:24:0176 days ago1727177041IN
0xf6B6C152...80Bb2B228
0.0001 ETH0.000012720.00331512
Create Loopooor ...82291762024-09-02 9:09:2798 days ago1725268167IN
0xf6B6C152...80Bb2B228
0.001 ETH0.00000410.00106837
Create Loopooor ...82104842024-09-01 22:46:2398 days ago1725230783IN
0xf6B6C152...80Bb2B228
0.0025 ETH0.000000490.00011211
Create Loopooor ...76944142024-08-21 0:04:03110 days ago1724198643IN
0xf6B6C152...80Bb2B228
0.005 ETH0.000024960.0065051
Create Loopooor ...66174842024-07-27 1:46:23135 days ago1722044783IN
0xf6B6C152...80Bb2B228
0 ETH0.000003580.00081893
Create Loopooor ...65652272024-07-25 20:44:29136 days ago1721940269IN
0xf6B6C152...80Bb2B228
0 ETH0.000001850.00049999
Create Loopooor ...64909832024-07-24 3:29:41138 days ago1721791781IN
0xf6B6C152...80Bb2B228
0.0001 ETH0.000004090.0012
Post Agent Creat...64889872024-07-24 2:23:09138 days ago1721787789IN
0xf6B6C152...80Bb2B228
0 ETH00.00002032
Create Loopooor ...64772762024-07-23 19:52:47138 days ago1721764367IN
0xf6B6C152...80Bb2B228
0.03 ETH0.000012660.0033
Create Loopooor ...62497492024-07-18 13:28:33144 days ago1721309313IN
0xf6B6C152...80Bb2B228
0.0001 ETH0.000005790.0017
Create Loopooor ...62467002024-07-18 11:46:55144 days ago1721303215IN
0xf6B6C152...80Bb2B228
0.1 ETH0.000012470.0038
Create Loopooor ...62428932024-07-18 9:40:01144 days ago1721295601IN
0xf6B6C152...80Bb2B228
0 ETH0.000003690.0014
Create Loopooor ...61107572024-07-15 8:15:29147 days ago1721031329IN
0xf6B6C152...80Bb2B228
0.03 ETH0.000029090.00757925
Create Loopooor ...60488782024-07-13 21:52:51148 days ago1720907571IN
0xf6B6C152...80Bb2B228
0.19594699 ETH0.000000690.00018643
Create Loopooor ...59233592024-07-11 0:08:53151 days ago1720656533IN
0xf6B6C152...80Bb2B228
0 ETH0.000010720.00244736
Create Loopooor ...57463902024-07-06 21:49:55155 days ago1720302595IN
0xf6B6C152...80Bb2B228
0 ETH0.000000310.00010082
Create Loopooor ...55770022024-07-02 23:43:39159 days ago1719963819IN
0xf6B6C152...80Bb2B228
0.025 ETH0.000001750.00045608
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
101365982024-10-16 12:50:1154 days ago1729083011
0xf6B6C152...80Bb2B228
0.0001 ETH
101365712024-10-16 12:49:1754 days ago1729082957
0xf6B6C152...80Bb2B228
0.0001 ETH
93797232024-09-29 0:21:0171 days ago1727569261
0xf6B6C152...80Bb2B228
0.17 ETH
93795662024-09-29 0:15:4771 days ago1727568947
0xf6B6C152...80Bb2B228
0.18 ETH
91862202024-09-24 12:50:5576 days ago1727182255
0xf6B6C152...80Bb2B228
0.002 ETH
91855652024-09-24 12:29:0576 days ago1727180945
0xf6B6C152...80Bb2B228
0.001 ETH
91836132024-09-24 11:24:0176 days ago1727177041
0xf6B6C152...80Bb2B228
0.0001 ETH
82291762024-09-02 9:09:2798 days ago1725268167
0xf6B6C152...80Bb2B228
0.001 ETH
82104842024-09-01 22:46:2398 days ago1725230783
0xf6B6C152...80Bb2B228
0.0025 ETH
76944142024-08-21 0:04:03110 days ago1724198643
0xf6B6C152...80Bb2B228
0.005 ETH
64909832024-07-24 3:29:41138 days ago1721791781
0xf6B6C152...80Bb2B228
0.0001 ETH
64772762024-07-23 19:52:47138 days ago1721764367
0xf6B6C152...80Bb2B228
0.03 ETH
62497492024-07-18 13:28:33144 days ago1721309313
0xf6B6C152...80Bb2B228
0.0001 ETH
62467002024-07-18 11:46:55144 days ago1721303215
0xf6B6C152...80Bb2B228
0.1 ETH
61107572024-07-15 8:15:29147 days ago1721031329
0xf6B6C152...80Bb2B228
0.03 ETH
60488782024-07-13 21:52:51148 days ago1720907571
0xf6B6C152...80Bb2B228
0.19594699 ETH
55770022024-07-02 23:43:39159 days ago1719963819
0xf6B6C152...80Bb2B228
0.025 ETH
55757492024-07-02 23:01:53159 days ago1719961313
0xf6B6C152...80Bb2B228
0.05 ETH
55192382024-07-01 15:38:11161 days ago1719848291
0xf6B6C152...80Bb2B228
0.01 ETH
55159882024-07-01 13:49:51161 days ago1719841791
0xf6B6C152...80Bb2B228
0.005 ETH
54328112024-06-29 15:37:17163 days ago1719675437
0xf6B6C152...80Bb2B228
0.02 ETH
54174972024-06-29 7:06:49163 days ago1719644809
0xf6B6C152...80Bb2B228
0.03 ETH
53815772024-06-28 11:09:29164 days ago1719572969
0xf6B6C152...80Bb2B228
0.001 ETH
53317102024-06-27 7:27:15165 days ago1719473235
0xf6B6C152...80Bb2B228
0.02 ETH
53295842024-06-27 6:16:23165 days ago1719468983
0xf6B6C152...80Bb2B228
0.01089799 ETH
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LoopooorAgentFactory

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200000 runs

Other Settings:
paris EvmVersion
File 1 of 27 : LoopooorAgentFactory.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { MulticallableERC2771Context } from "./../utils/MulticallableERC2771Context.sol";
import { Calls } from "./../libraries/Calls.sol";
import { Errors } from "./../libraries/Errors.sol";
import { IBlastooorStrategyAgents } from "./../interfaces/tokens/IBlastooorStrategyAgents.sol";
import { IExplorerAgents } from "./../interfaces/tokens/IExplorerAgents.sol";
import { IERC6551Registry } from "./../interfaces/erc6551/IERC6551Registry.sol";
import { IAgentRegistry } from "./../interfaces/utils/IAgentRegistry.sol";
import { ILoopooorAgentFactory } from "./../interfaces/factory/ILoopooorAgentFactory.sol";
import { Blastable } from "./../utils/Blastable.sol";
import { Ownable2Step } from "./../utils/Ownable2Step.sol";
import { ILoopooorModuleD } from "./../interfaces/modules/ILoopooorModuleD.sol";


/**
 * @title LoopooorAgentFactory
 * @author AgentFi
 * @notice A factory for strategy agents.
 *
 * Users can use [`createAgent()`](#createagent) to create a new agent. The agent will be created based on settings stored in the factory by the contract owner. These settings can be viewed via [`getAgentCreationSettings()`](#getagentcreationsettings).
 */
contract LoopooorAgentFactory is Blastable, Ownable2Step, MulticallableERC2771Context, ILoopooorAgentFactory {

    /***************************************
    STATE VARIABLES
    ***************************************/

    // addresses
    address internal immutable _erc6551Registry;
    address internal immutable _agentRegistry;
    address internal immutable _genesisAgentNft;
    address internal immutable _strategyAgentNft;
    address internal immutable _explorerAgentNft;
    address internal immutable _weth;

    // agent creation settings
    bool internal _isActive;
    address internal _strategyAccountImpl;
    address internal _explorerAccountImpl;
    bytes internal _strategyInitializationCall;
    bytes internal _explorerInitializationCall;

    address internal constant _eth = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

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

    /**
     * @notice Constructs the factory contract.
     * @param owner_ The owner of the contract.
     * @param blast_ The address of the blast gas reward contract.
     * @param gasCollector_ The address of the gas collector.
     * @param blastPoints_ The address of the blast points contract.
     * @param pointsOperator_ The address of the blast points operator.
     * @param multicallForwarder_ The MulticallForwarder address.
     * @param genesisAgentNft_ The genesis agents contract.
     * @param strategyAgentNft_ The strategy agents contract.
     * @param explorerAgentNft_ The explorer agents contract.
     * @param erc6551Registry_ The erc6551 registry contract.
     * @param agentRegistry_ The agent registry contract.
     * @param weth_ The address of wrapped ether.
     */
    constructor(
        address owner_,
        address blast_,
        address gasCollector_,
        address blastPoints_,
        address pointsOperator_,
        address multicallForwarder_,
        address genesisAgentNft_,
        address strategyAgentNft_,
        address explorerAgentNft_,
        address erc6551Registry_,
        address agentRegistry_,
        address weth_
    ) Blastable(blast_, gasCollector_, blastPoints_, pointsOperator_) MulticallableERC2771Context(multicallForwarder_) {
        _transferOwnership(owner_);
        _genesisAgentNft = genesisAgentNft_;
        _strategyAgentNft = strategyAgentNft_;
        _explorerAgentNft = explorerAgentNft_;
        _erc6551Registry = erc6551Registry_;
        _agentRegistry = agentRegistry_;
        _weth = weth_;
    }

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Gets the addresses that have been statically set.
     */
    function getStaticAddresses() external view override returns (
        address erc6551Registry_,
        address agentRegistry_,
        address genesisAgentNft_,
        address strategyAgentNft_,
        address explorerAgentNft_,
        address weth_
    ) {
        erc6551Registry_ = _erc6551Registry;
        agentRegistry_ = _agentRegistry;
        genesisAgentNft_ = _genesisAgentNft;
        strategyAgentNft_ = _strategyAgentNft;
        explorerAgentNft_ = _explorerAgentNft;
        weth_ = _weth;
    }

    /**
     * @notice Gets the agent creation settings.
     */
    function getAgentCreationSettings() external view override returns (
        address strategyAccountImpl_,
        address explorerAccountImpl_,
        bytes memory strategyInitializationCall_,
        bytes memory explorerInitializationCall_,
        bool isActive_
    ) {
        strategyAccountImpl_ = _strategyAccountImpl;
        explorerAccountImpl_ = _explorerAccountImpl;
        strategyInitializationCall_ = _strategyInitializationCall;
        explorerInitializationCall_ = _explorerInitializationCall;
        isActive_ = _isActive;
    }

    /***************************************
    CREATE AGENT FUNCTIONS
    ***************************************/

    /**
     * @notice Creates a new Loopooor strategy agent.
     * The new agent will be minted to an existing root agent.
     * Can only be called by the owner of the root agent.
     * @param mintParams Parameters to use to mint the position.
     * @param deposit The token and amount to deposit.
     * @param rootAgentAddress The address of the root agent to transfer the v3 agent to.
     * @return strategyAgentID The ID of the newly created strategy agent.
     * @return strategyAddress The address of the newly created strategy agent.
     */
    function createLoopooorAgentForRoot(
        MintParams calldata mintParams,
        TokenDeposit calldata deposit,
        address rootAgentAddress
    ) external payable override returns (
        uint256 strategyAgentID,
        address strategyAddress
    ) {
        // checks
        _createAgentForRootPrecheck(rootAgentAddress);
        // create loopooor agent
        (strategyAgentID, strategyAddress) = _createLoopooorAgent(mintParams, deposit);
        // transfer strategy agent to root agent
        IBlastooorStrategyAgents(_strategyAgentNft).transferFrom(address(this), rootAgentAddress, strategyAgentID);
    }

    /**
     * @notice Creates a new Loopooor strategy agent.
     * The new agent will be minted to a new explorer agent.
     * @param mintParams Parameters to use to mint the position.
     * @param deposit The token and amount to deposit.
     * @return strategyAgentID The ID of the newly created strategy agent.
     * @return strategyAddress The address of the newly created strategy agent.
     * @return explorerAgentID The ID of the newly created explorer agent.
     * @return explorerAddress The address of the newly created explorer agent.
     */
    function createLoopooorAgentAndExplorer(
        MintParams calldata mintParams,
        TokenDeposit calldata deposit
    ) external payable override returns (
        uint256 strategyAgentID,
        address strategyAddress,
        uint256 explorerAgentID,
        address explorerAddress
    ) {
        // checks
        if(!_isActive) revert Errors.CreationSettingsPaused();
        // create explorer agent
        (explorerAgentID, explorerAddress) = _createExplorerAgent();
        // create loopooor agent
        (strategyAgentID, strategyAddress) = _createLoopooorAgent(mintParams, deposit);
        // transfer loopooor agent to explorer agent
        IBlastooorStrategyAgents(_strategyAgentNft).transferFrom(address(this), explorerAddress, strategyAgentID);
        // transfer explorer agent to msg sender
        IExplorerAgents(_explorerAgentNft).transferFrom(address(this), _msgSender(), explorerAgentID);
    }

    /***************************************
    HELPER FUNCTIONS
    ***************************************/

    /**
     * @notice Creates a new Loopooor agent.
     * @param mintParams Parameters to use to mint the position.
     * @param deposit The token and amount to deposit.
     * @return strategyAgentID The ID of the newly created strategy agent.
     * @return strategyAddress The address of the newly created strategy agent.
     */
    function _createLoopooorAgent(
        MintParams calldata mintParams,
        TokenDeposit calldata deposit
    ) internal returns (
        uint256 strategyAgentID,
        address strategyAddress
    ) {
        // create nft
        (strategyAgentID, strategyAddress) = _createStrategyAgent();
        // handle token deposits and strategy initialization
        // eth
        if(deposit.token == address(0) || deposit.token == _eth) {
            Calls.sendValue(strategyAddress, deposit.amount);
        }
        // erc20
        else {
            SafeERC20.safeTransferFrom(IERC20(deposit.token), _msgSender(), strategyAddress, deposit.amount);
        }
        ILoopooorModuleD(payable(strategyAddress)).moduleD_depositBalance(
            mintParams.wrapMint,
            mintParams.otoken,
            mintParams.underlying,
            mintParams.mode,
            mintParams.leverage
        );
    }

    /***************************************
    HELPER FUNCTIONS for creating the agent nft and tba
    ***************************************/

    /**
     * @notice Creates a new strategy agent.
     * Includes the agent NFT and TBA.
     * Initializes the strategy but doesn't initialize the position.
     * @return strategyAgentID The ID of the new agent.
     * @return strategyAddress The address of the new agent.
     */
    function _createStrategyAgent() internal returns (
        uint256 strategyAgentID,
        address strategyAddress
    ) {
        // create nft
        address strategies = _strategyAgentNft;
        strategyAgentID = IBlastooorStrategyAgents(strategies).createAgent();
        // create account
        address accountImpl = _strategyAccountImpl;
        bytes32 salt = bytes32(uint256(0));
        strategyAddress = IERC6551Registry(_erc6551Registry).createAccount(
            accountImpl,
            salt,
            block.chainid,
            strategies,
            strategyAgentID
        );
        // register account
        IAgentRegistry(_agentRegistry).registerAgent(IAgentRegistry.RegisterAgentParam({
            agentAddress: strategyAddress,
            implementationAddress: accountImpl,
            collection: strategies,
            agentID: strategyAgentID
        }));
        // initialize account
        Calls.functionCall(strategyAddress, _strategyInitializationCall);
    }

    /**
     * @notice Creates a new explorer agent.
     * Includes the agent NFT and TBA.
     * Initializes the explorer but doesn't initialize the position.
     * @return explorerAgentID The ID of the new agent.
     * @return explorerAddress The address of the new agent.
     */
    function _createExplorerAgent() internal returns (
        uint256 explorerAgentID,
        address explorerAddress
    ) {
        // create nft
        address explorers = _explorerAgentNft;
        explorerAgentID = IExplorerAgents(explorers).createAgent();
        // create account
        address accountImpl = _explorerAccountImpl;
        bytes32 salt = bytes32(uint256(0));
        explorerAddress = IERC6551Registry(_erc6551Registry).createAccount(
            accountImpl,
            salt,
            block.chainid,
            explorers,
            explorerAgentID
        );
        // register account
        IAgentRegistry(_agentRegistry).registerAgent(IAgentRegistry.RegisterAgentParam({
            agentAddress: explorerAddress,
            implementationAddress: accountImpl,
            collection: explorers,
            agentID: explorerAgentID
        }));
        // initialize account
        Calls.functionCall(explorerAddress, _explorerInitializationCall);
    }

    /***************************************
    HELPER FUNCTIONS for prechecks
    ***************************************/

    /**
     * @notice A precheck for creating new agents to an exist root agent.
     * @param rootAgentAddress The address of the root agent to mint to.
     */
    function _createAgentForRootPrecheck(
        address rootAgentAddress
    ) internal view {
        // check if is active
        if(!_isActive) revert Errors.CreationSettingsPaused();
        // check agent registry
        (address collection, uint256 rootAgentID) = IAgentRegistry(_agentRegistry).getNftOfTba(rootAgentAddress);
        // check if in one of permitted collections
        if(
            (collection == address(0)) || (
                (collection != _genesisAgentNft) &&
                (collection != _strategyAgentNft) &&
                (collection != _explorerAgentNft)
            )
        ) revert Errors.NotAnAgent();
        // check if owner
        if(IERC721(collection).ownerOf(rootAgentID) != _msgSender()) revert Errors.NotOwnerOfAgent();
    }

    /***************************************
    OWNER FUNCTIONS
    ***************************************/

    /**
     * @notice Posts a new AgentCreationSettings.
     * Can only be called by the contract owner.
     */
    function postAgentCreationSettings(
        AgentCreationSettings calldata creationSettings
    ) external payable override onlyOwner {
        _strategyAccountImpl = creationSettings.strategyAccountImpl;
        _explorerAccountImpl = creationSettings.explorerAccountImpl;
        _strategyInitializationCall = creationSettings.strategyInitializationCall;
        _explorerInitializationCall = creationSettings.explorerInitializationCall;
        _isActive = creationSettings.isActive;
        emit AgentCreationSettingsPosted();
    }
}

File 2 of 27 : 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 3 of 27 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 27 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 5 of 27 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 6 of 27 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

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

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 7 of 27 : 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 8 of 27 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 9 of 27 : 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 10 of 27 : 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 11 of 27 : IERC6551Registry.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;


/**
 * @title IERC6551Registry
 * @notice The registry is a singleton contract that serves as the entry point for all token bound account address queries.
 */
interface IERC6551Registry {

    /**
     * @notice The registry MUST emit the ERC6551AccountCreated event upon successful account creation.
     */
    event ERC6551AccountCreated(
        address account,
        address indexed implementation,
        bytes32 salt,
        uint256 chainId,
        address indexed tokenContract,
        uint256 indexed tokenId
    );

    /**
     * @notice The registry MUST revert with AccountCreationFailed error if the create2 operation fails.
     */
    error AccountCreationFailed();

    /**
     * @notice Creates a token bound account for a non-fungible token.
     *
     * If account has already been created, returns the account address without calling create2.
     *
     * Emits ERC6551AccountCreated event.
     *
     * @param implementation The address of the implementation contract.
     * @param salt Arbitrary value to modify resulting address.
     * @param chainId The id of the chain that the tokenContract is deployed on.
     * @param tokenContract The address of the nft contract.
     * @param tokenId The id of the nft.
     * @return account_ The address of the token bound account.
     */
    function createAccount(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external returns (address account_);

    /**
     * @notice Returns the computed token bound account address for a non-fungible token.
     * @param implementation The address of the implementation contract.
     * @param salt Arbitrary value to modify resulting address.
     * @param chainId The id of the chain that the tokenContract is deployed on.
     * @param tokenContract The address of the nft contract.
     * @param tokenId The id of the nft.
     * @return account_ The address of the token bound account.
     */
    function account(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external view returns (address account_);
}

File 12 of 27 : IWrapMintV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

interface IWrapMintV2 {
    /* Events */
    event MintFixedRate(address indexed fixedRate, address indexed owner, uint256 principal, uint256 yield);
    event BurnFixedRate(address indexed fixedRate, uint256 principal, uint256 yieldToUnlock, uint256 yieldToRelease);
    event MintVariableRate(address indexed variableRate, address indexed owner, uint256 amount);
    event BurnVariableRate(address indexed variableRate, uint256 amount, uint256 yield, uint256 fee);
    event UpdateExchange(address indexed exchange, bool status);
    event UpdateFixedRateNft(address indexed nft);
    event UpdateVariableRateNft(address indexed nft);
    event UpdateDuoAssetToken(address indexed duoAssetToken);

    function duoAssetToken() external view returns (address);

    /** @notice mint a fixed rate contract (represented as NFT), input with ERC20 token */
    function mintFixedRate(
        address exchange,
        address token,
        uint256 amountIn,
        uint256 amountOutMin,
        uint256 minLockedYield,
        bytes calldata data
    ) external returns (address fixedRateContract, uint256 amountOut, uint256 lockedYield);

    /** @notice mint a fixed rate contract (represented as NFT), input with ETH */
    function mintFixedRateEth(
        address exchange,
        uint256 amountIn,
        uint256 amountOutMin,
        uint256 minLockedYield,
        bytes calldata data
    ) external payable returns (address fixedRateContract, uint256 amountOut, uint256 lockedYield);

    /** @notice mint a variable rate contract, input with ETH */
    function mintVariableRateEth(
        address exchange,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata data
    ) external payable returns (address variableRateContract, uint256 amountOut);

    /**
     * @notice mint a variable rate contract, input with ERC20 token
     */
    function mintVariableRate(
        address exchange,
        address token,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes calldata data
    ) external returns (address variableRateContract, uint256 amountOut);

    /**
     * @notice burn a variable rate contract, together with asset token, receiving principal and yield
     * @param variableRate the variable rate contract to burn
     * @param amount the amount of variable rate contract to burn
     * @param minYield the minimum amount of yield to unlock
     * @return yield the amount of yield unlocked
     * @return fee the amount of fee
     */
    function burnVariableRate(
        address variableRate,
        uint256 amount,
        uint256 minYield
    ) external returns (uint256 yield, uint256 fee);

    /**
     * @notice burn a fixed rate contract, together with asset token, receiving principal and yield
     * @param fixedRate the fixed rate contract to burn
     * @param amount the amount of fixed rate contract to burn
     * @return yieldToUnlock the amount of yield to unlock
     * @return yieldToRelease the amount of yield to release
     */
    function burnFixedRate(
        address fixedRate,
        uint256 amount
    ) external returns (uint256 yieldToUnlock, uint256 yieldToRelease);
}

File 13 of 27 : IOErc20Delegator.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

interface IOErc20Delegator {
    // View
    function balanceOf(address account) external view returns (uint256);
    function comptroller() external view returns (address);
    function underlying() external view returns (address);

    /**
     * @notice Sender borrows assets from the protocol to their own address
     * @param borrowAmount The amount of the underlying asset to borrow
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function borrow(uint borrowAmount) external returns (uint);

    /**
     * @notice Sender supplies assets into the market and receives oTokens in exchange
     * @dev Accrues interest whether or not the operation succeeds, unless reverted
     * @param mintAmount The amount of the underlying asset to supply
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function mint(uint mintAmount) external returns (uint);

    /**
     * @notice Sender repays their own borrow
     * @param repayAmount The amount to repay, or -1 for the full outstanding amount
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function repayBorrow(uint repayAmount) external returns (uint);

    /**
     * @notice Sender redeems oTokens in exchange for the underlying asset
     * @dev Accrues interest whether or not the operation succeeds, unless reverted
     * @param redeemTokens The number of oTokens to redeem into underlying
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function redeem(uint redeemTokens) external returns (uint);

    /**
     * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex
     * @param account The address whose balance should be calculated after updating borrowIndex
     * @return The calculated balance
     */
    function borrowBalanceCurrent(address account) external returns (uint);

    /**
     * @notice Return the borrow balance of account based on stored data
     * @param account The address whose balance should be calculated
     * @return The calculated balance
     */
    function borrowBalanceStored(address account) external view returns (uint);

    /**
     * @notice Calculates the exchange rate from the underlying to the OToken
     * @dev This function does not accrue interest before calculating the exchange rate
     * @return Calculated exchange rate scaled by 1e18
     */
    function exchangeRateStored() external view returns (uint);

    /**
     * @notice Accrue interest then return the up-to-date exchange rate
     * @return Calculated exchange rate scaled by 1e18
     */
    function exchangeRateCurrent() external returns (uint);
}

File 14 of 27 : IOrbitSpaceStationV4.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

interface IOrbitSpaceStationV4 {
    /**
     * @notice Returns whether the given account is entered in the given asset
     * @param account The address of the account to check
     * @param oToken The oToken to check
     * @return True if the account is in the asset, otherwise false.
     */
    function checkMembership(address account, address oToken) external view returns (bool);

    /**
     * @notice Add assets to be included in account liquidity calculation
     * @param oTokens The list of addresses of the oToken markets to be enabled
     * @return Success indicator for whether each corresponding market was entered
     */
    function enterMarkets(address[] memory oTokens) external returns (uint[] memory);

    /**
     * @notice Determine the current account liquidity wrt collateral requirements
     * @return (possible error code (semi-opaque),
                account liquidity in excess of collateral requirements,
     *          account shortfall below collateral requirements)
     */
    function getAccountLiquidity(address account) external view returns (uint, uint, uint);

    function oracle() external view returns (address);

    //isListed, collateralFactorMantissa, isComped
    function markets(address oTokenAddress) external view returns (bool, uint, bool);
}

File 15 of 27 : ILoopooorAgentFactory.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { ILoopooorModuleD } from "./../modules/ILoopooorModuleD.sol";


/**
 * @title ILoopooorAgentFactory
 * @author AgentFi
 * @notice A factory for v3 strategy agents.
 *
 * Users can use [`createAgent()`](#createagent) to create a new agent. The agent will be created based on settings stored in the factory by the contract owner. These settings can be viewed via [`getAgentCreationSettings()`](#getagentcreationsettings).
 */
interface ILoopooorAgentFactory {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when a new AgentCreationSettings is posted.
    event AgentCreationSettingsPosted();

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Gets the addresses that have been statically set.
     */
    function getStaticAddresses() external view returns (
        address erc6551Registry_,
        address agentRegistry_,
        address genesisAgentNft_,
        address strategyAgentNft_,
        address explorerAgentNft_,
        address weth_
    );

    /**
     * @notice Gets the agent creation settings.
     */
    function getAgentCreationSettings() external view returns (
        address strategyAccountImpl_,
        address explorerAccountImpl_,
        bytes memory strategyInitializationCall_,
        bytes memory explorerInitializationCall_,
        bool isActive_
    );

    /***************************************
    CREATE AGENT FUNCTIONS
    ***************************************/

    struct MintParams {
        address wrapMint;
        address otoken;
        address underlying;
        ILoopooorModuleD.MODE mode;
        uint256 leverage;
    }

    struct TokenDeposit {
        address token;
        uint256 amount;
    }

    /**
     * @notice Creates a new Loopooor strategy agent.
     * The new agent will be minted to an existing root agent.
     * Can only be called by the owner of the root agent.
     * @param mintParams Parameters to use to mint the position.
     * @param deposit The token and amount to deposit.
     * @param rootAgentAddress The address of the root agent to transfer the v3 agent to.
     * @return strategyAgentID The ID of the newly created strategy agent.
     * @return strategyAddress The address of the newly created strategy agent.
     */
    function createLoopooorAgentForRoot(
        MintParams calldata mintParams,
        TokenDeposit calldata deposit,
        address rootAgentAddress
    ) external payable returns (
        uint256 strategyAgentID,
        address strategyAddress
    );

    /**
     * @notice Creates a new Loopooor strategy agent.
     * The new agent will be minted to a new explorer agent.
     * @param mintParams Parameters to use to mint the position.
     * @param deposit The token and amount to deposit.
     * @return strategyAgentID The ID of the newly created strategy agent.
     * @return strategyAddress The address of the newly created strategy agent.
     * @return explorerAgentID The ID of the newly created explorer agent.
     * @return explorerAddress The address of the newly created explorer agent.
     */
    function createLoopooorAgentAndExplorer(
        MintParams calldata mintParams,
        TokenDeposit calldata deposit
    ) external payable returns (
        uint256 strategyAgentID,
        address strategyAddress,
        uint256 explorerAgentID,
        address explorerAddress
    );

    /***************************************
    OWNER FUNCTIONS
    ***************************************/

    struct AgentCreationSettings {
        address strategyAccountImpl;
        address explorerAccountImpl;
        bytes strategyInitializationCall;
        bytes explorerInitializationCall;
        bool isActive;
    }

    /**
     * @notice Posts a new AgentCreationSettings.
     * Can only be called by the contract owner.
     */
    function postAgentCreationSettings(
        AgentCreationSettings calldata creationSettings
    ) external payable;
}

File 16 of 27 : ILoopooorModuleD.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IOErc20Delegator } from "./../external/Orbit/IOErc20Delegator.sol";
import { IOrbitSpaceStationV4 } from "./../external/Orbit/IOrbitSpaceStationV4.sol";
import { IWrapMintV2 } from "./../external/Duo/IWrapMintV2.sol";

/**
 * @title ILoopooorModuleD
 * @author AgentFi
 * @notice Interface for the LoopooorModuleD contract.
 */
interface ILoopooorModuleD {
    /***************************************
    ENUMS
    ***************************************/

    enum MODE {
        INITIAL, // Initial state
        FIXED_RATE, // Mint Fixed Rate
        VARIABLE_RATE // Mint Variable Rate
    }

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Returns the name of the module.
     * @return name_ The name of the module.
     */
    function moduleName() external pure returns (string memory name_);

    /**
     * @notice Returns the type of the strategy.
     * @return type_ The type of the strategy.
     */
    function strategyType() external pure returns (string memory type_);

    /**
     * @notice Returns the Ethereum address.
     * @return The Ethereum address.
     */
    function eth() external pure returns (address);

    /**
     * @notice Returns the Wrapped Ethereum address.
     * @return The Wrapped Ethereum address.
     */
    function weth() external pure returns (address);

    /**
     * @notice Returns the current mode of the contract.
     * @return The current mode of the contract.
     */
    function mode() external view returns (MODE);

    /**
     * @notice Returns the address of the rate contract.
     * @return The address of the rate contract.
     */
    function rateContract() external view returns (address);

    /**
     * @notice Returns the address of the underlying asset.
     * @return The address of the underlying asset.
     */
    function underlying() external view returns (address);

    /**
     * @notice Returns the address of the WrapMint contract.
     * @return The address of the WrapMint contract.
     */
    function wrapMint() external view returns (address);

    /**
     * @notice Returns the oToken contract.
     * @return The oToken contract.
     */
    function oToken() external view returns (IOErc20Delegator);

    /**
     * @notice Returns the Orbit comptroller contract.
     * @return The Orbit comptroller contract.
     */
    function comptroller() external view returns (IOrbitSpaceStationV4);

    /**
     * @notice Returns the supply balance of the contract.
     * @return supply_ The supply balance of the contract.
     */
    function supplyBalance() external view returns (uint256 supply_);

    /**
     * @notice Returns the borrow balance of the contract.
     * @return borrow_ The borrow balance of the contract.
     */
    function borrowBalance() external view returns (uint256 borrow_);

    /**
     * @notice Returns the address of the Duo asset.
     * @return The address of the Duo asset.
     */
    function duoAsset() external view returns (IERC20);

    /***************************************
    LOW LEVEL DUO MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Mints a fixed rate position using the WrapMint contract.
     * @param wrapMint The address of the wrap contract.
     * @param exchange The address of the exchange contract.
     * @param token The address of the token to be used.
     * @param amountIn The amount of tokens to be deposited.
     * @param amountOutMin The minimum amount of tokens to be received.
     * @param minLockedYield The minimum locked yield.
     * @param data Additional data for the WrapMint contract.
     * @return fixedRateContract_ The address of the fixed rate contract.
     * @return amountOut The amount of tokens received.
     * @return lockedYield The locked yield.
     */
    function moduleD_mintFixedRate(
        address wrapMint,
        address exchange,
        address token,
        uint256 amountIn,
        uint256 amountOutMin,
        uint256 minLockedYield,
        bytes memory data
    ) external payable returns (address fixedRateContract_, uint256 amountOut, uint256 lockedYield);

    /**
     * @notice Mints a fixed rate position using the WrapMint contract with Ether.
     * @param wrapMint The address of the wrap contract.
     * @param exchange The address of the exchange contract.
     * @param amountIn The amount of Ether to be deposited.
     * @param amountOutMin The minimum amount of tokens to be received.
     * @param minLockedYield The minimum locked yield.
     * @param data Additional data for the WrapMint contract.
     * @return fixedRateContract_ The address of the fixed rate contract.
     * @return amountOut The amount of tokens received.
     * @return lockedYield The locked yield.
     */
    function moduleD_mintFixedRateEth(
        address wrapMint,
        address exchange,
        uint256 amountIn,
        uint256 amountOutMin,
        uint256 minLockedYield,
        bytes calldata data
    ) external payable returns (address fixedRateContract_, uint256 amountOut, uint256 lockedYield);

    /**
     * @notice Mints a variable rate position using the WrapMint contract.
     * @param wrapMint The address of the wrap contract.
     * @param exchange The address of the exchange contract.
     * @param token The address of the token to be used.
     * @param amountIn The amount of tokens to be deposited.
     * @param amountOutMin The minimum amount of tokens to be received.
     * @param data Additional data for the WrapMint contract.
     * @return variableRateContract_ The address of the variable rate contract.
     * @return amountOut The amount of tokens received.
     */
    function moduleD_mintVariableRate(
        address wrapMint,
        address exchange,
        address token,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes memory data
    ) external payable returns (address variableRateContract_, uint256 amountOut);

    /**
     * @notice Mints a variable rate position using the WrapMint contract with Ether.
     * @param wrapMint The address of the wrap contract.
     * @param exchange The address of the exchange contract.
     * @param amountIn The amount of Ether to be deposited.
     * @param amountOutMin The minimum amount of tokens to be received.
     * @param data Additional data for the WrapMint contract.
     * @return variableRateContract_ The address of the variable rate contract.
     * @return amountOut The amount of tokens received.
     */
    function moduleD_mintVariableRateEth(
        address wrapMint,
        address exchange,
        uint256 amountIn,
        uint256 amountOutMin,
        bytes memory data
    ) external payable returns (address variableRateContract_, uint256 amountOut);

    /**
     * @notice Burns a variable rate position using the WrapMint contract.
     * @param wrapMint The address of the wrap contract.
     * @param variableRate The address of the variable rate contract.
     * @param amount The amount of tokens to be burned.
     * @param minYield The minimum yield to be received.
     * @return yieldToUnlock The amount of yield to be unlocked.
     * @return yieldToRelease The amount of yield to be released.
     */
    function moduleD_burnVariableRate(
        address wrapMint,
        address variableRate,
        uint256 amount,
        uint256 minYield
    ) external payable returns (uint256 yieldToUnlock, uint256 yieldToRelease);

    /**
     * @notice Burns a fixed rate position using the WrapMint contract.
     * @param wrapMint The address of the wrap contract.
     * @param fixedRate The address of the fixed rate contract.
     * @param amount The amount of tokens to be burned.
     * @return yieldToUnlock The amount of yield to be unlocked.
     * @return yieldToRelease The amount of yield to be released.
     */
    function moduleD_burnFixedRate(address wrapMint, address fixedRate, uint256 amount)
        external
        payable
        returns (uint256 yieldToUnlock, uint256 yieldToRelease);

    /***************************************
    LOW LEVEL ORBITER MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Borrows tokens from the Orbit protocol.
     * @param oToken The address of the oToken contract.
     * @param borrowAmount The amount of tokens to be borrowed.
     * @return The amount of tokens borrowed.
     */
    function moduleD_borrow(address oToken, uint256 borrowAmount) external payable returns (uint256);

    /**
     * @notice Mints tokens in the Orbit protocol.
     * @param oToken The address of the oToken contract.
     * @param mintAmount The amount of tokens to be minted.
     * @return The amount of tokens minted.
     */
    function moduleD_mint(address oToken, uint256 mintAmount) external payable returns (uint256);

    /**
     * @notice Repays a borrow in the Orbit protocol.
     * @param oToken The address of the oToken contract.
     * @param repayAmount The amount of tokens to be repaid.
     * @return The amount of tokens repaid.
     */
    function moduleD_repayBorrow(address oToken, uint256 repayAmount) external payable returns (uint256);

    /**
     * @notice Redeems tokens from the Orbit protocol.
     * @param oToken The address of the oToken contract.
     * @param redeemTokens The amount of tokens to be redeemed.
     * @return The amount of tokens redeemed.
     */
    function moduleD_redeem(address oToken, uint256 redeemTokens) external payable returns (uint256);

    /**
     * @notice Enters the specified markets in the Orbit protocol.
     * @param comptroller The address of the comptroller contract.
     * @param oTokens The addresses of the oTokens to enter.
     * @return The error codes for each market entered.
     */
    function moduleD_enterMarkets(address comptroller, address[] memory oTokens) external payable returns (uint256[] memory);

    /***************************************
    HIGH LEVEL AGENT MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Deposits the balance into the Orbit protocol and mints a fixed or variable rate position.
     * @param wrapMint_ The address of the WrapMint contract.
     * @param oToken_ The address of the oToken contract.
     * @param underlying_ The address of the underlying asset.
     * @param mode_ The mode to be used (fixed or variable rate).
     * @param leverage The leverage to be used.
     */
    function moduleD_depositBalance(
        address wrapMint_,
        address oToken_,
        address underlying_,
        MODE mode_,
        uint256 leverage
    ) external payable;

    /**
     * @notice Withdraws the balance from the Orbit protocol and burns the fixed or variable rate position.
     */
    function moduleD_withdrawBalance() external payable;

    /**
     * @notice Withdraws the balance from the Orbit protocol and burns the fixed or variable rate position, then sends the balance to the specified receiver.
     * @param receiver The address to send the balance to.
     */
    function moduleD_withdrawBalanceTo(address receiver) external payable;

    /**
     * @notice Sends the balance of the specified token to the specified receiver.
     * @param receiver The address to send the balance to.
     * @param token The address of the token to be sent.
     */
    function moduleD_sendBalanceTo(address receiver, address token) external payable;
}

File 17 of 27 : IBlastooorStrategyAgents.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";


/**
 * @title IBlastooorStrategyAgents
 * @author AgentFi
 * @notice The Blastooor Strategy ERC721 token contract. Creates new agents and manages ownership of agents in the AgentFi protocol.
 *
 * Each agent is represented as an NFT. The owner of the NFT is the owner of the agent. Transferring the NFT means transferring the agent and its contents.
 *
 * Each agent is also a smart contract account. The account is created at the same time the agent is created. Ownership of the account is delegated to the owner of the NFT using ERC6551 Token Bound Accounts.
 *
 * Agents can be created via [`createAgent()`](#createagent). Only whitelisted accounts may create agents - these may be any address, but are designed to be smart contracts called factories. This ERC721 contract manages the creation and registration of agents. The factory contract handles any additional logic - verifying implementation, initializing the agent, etc. A user that wants to create an agent should call a factory contract, which in turn calls this contract.
 *
 * The list of factories can be queried via [`factoryIsWhitelisted()`](#factoryiswhitelisted) and maintained by the contract owner via [`setWhitelist()`](#setwhitelist).
 *
 * Agents are ERC721s with the enumerable, metadata, and exists extensions. Info about the associated TBAs is stored in another contract.
 */
interface IBlastooorStrategyAgents is IERC721Enumerable {

    /// @notice Emitted when a factory is whitelisted or blacklisted.
    event FactoryWhitelisted(address indexed factory, bool wasWhitelisted);
    /// @notice Emitted when the base URI is set.
    event BaseURISet(string baseURI);
    /// @notice Emitted when the contract URI is set.
    event ContractURISet(string contractURI);

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Returns true if the agent exists.
     * @param agentID The ID of the agent to query.
     * @return status True if the agent exists, false otherwise.
     */
    function exists(uint256 agentID) external view returns (bool status);

    /***************************************
    CREATE AGENT FUNCTIONS
    ***************************************/

    /**
     * @notice Creates a new agent.
     * @dev The new agent will be minted to `msg.sender`. This function is designed to be called from another contract to perform additional setup.
     * @return agentID The ID of the newly created agent.
     */
    function createAgent() external payable returns (uint256 agentID);

    /***************************************
    WHITELIST FUNCTIONS
    ***************************************/

    /**
     * @notice Returns true if the factory has been whitelisted.
     * All addresses are whitelisted if address zero is whitelisted.
     * @param factory The address of the factory to query.
     * @return isWhitelisted True if the factory has been whitelisted, false otherwise.
     */
    function factoryIsWhitelisted(address factory) external view returns (bool isWhitelisted);

    struct SetWhitelistParam {
        address factory;
        bool shouldWhitelist;
    }

    /**
     * @notice Adds or removes factories to the whitelist.
     * Can only be called by the contract owner.
     * @param params The list of factories and if they should be whitelisted or blacklisted.
     */
    function setWhitelist(SetWhitelistParam[] memory params) external payable;

    /***************************************
    METADATA FUNCTIONS
    ***************************************/

    /**
     * @notice Returns the base URI for computing tokenURI.
     * @return uri The base URI.
     */
    function baseURI() external view returns (string memory uri);

    /**
     * @notice Sets the base URI for computing tokenURI.
     * Can only be called by the contract owner.
     * @param uri The new base URI.
     */
    function setBaseURI(string calldata uri) external payable;

    /**
     * @notice Returns the contract URI.
     * @return uri The contract URI.
     */
    function contractURI() external view returns (string memory uri);

    /**
     * @notice Sets the contract URI.
     * Can only be called by the contract owner.
     * @param uri The new contract URI.
     */
    function setContractURI(string calldata uri) external payable;
}

File 18 of 27 : IExplorerAgents.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";


/**
 * @title IExplorerAgents
 * @author AgentFi
 * @notice The Explorers ERC721 token contract. Creates new agents and manages ownership of agents in the AgentFi protocol.
 *
 * Each agent is represented as an NFT. The owner of the NFT is the owner of the agent. Transferring the NFT means transferring the agent and its contents.
 *
 * Each agent is also a smart contract account. The account is created at the same time the agent is created. Ownership of the account is delegated to the owner of the NFT using ERC6551 Token Bound Accounts.
 *
 * Agents can be created via [`createAgent()`](#createagent). Only whitelisted accounts may create agents - these may be any address, but are designed to be smart contracts called factories. This ERC721 contract manages the creation and registration of agents. The factory contract handles any additional logic - verifying implementation, initializing the agent, etc. A user that wants to create an agent should call a factory contract, which in turn calls this contract.
 *
 * The list of factories can be queried via [`factoryIsWhitelisted()`](#factoryiswhitelisted) and maintained by the contract owner via [`setWhitelist()`](#setwhitelist).
 *
 * Agents are ERC721s with the enumerable, metadata, and exists extensions. Info about the associated TBAs is stored in another contract.
 */
interface IExplorerAgents is IERC721Enumerable {

    /// @notice Emitted when a factory is whitelisted or blacklisted.
    event FactoryWhitelisted(address indexed factory, bool wasWhitelisted);
    /// @notice Emitted when the base URI is set.
    event BaseURISet(string baseURI);
    /// @notice Emitted when the contract URI is set.
    event ContractURISet(string contractURI);

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Returns true if the agent exists.
     * @param agentID The ID of the agent to query.
     * @return status True if the agent exists, false otherwise.
     */
    function exists(uint256 agentID) external view returns (bool status);

    /***************************************
    CREATE AGENT FUNCTIONS
    ***************************************/

    /**
     * @notice Creates a new agent.
     * @dev The new agent will be minted to `msg.sender`. This function is designed to be called from another contract to perform additional setup.
     * @return agentID The ID of the newly created agent.
     */
    function createAgent() external payable returns (uint256 agentID);

    /***************************************
    WHITELIST FUNCTIONS
    ***************************************/

    /**
     * @notice Returns true if the factory has been whitelisted.
     * All addresses are whitelisted if address zero is whitelisted.
     * @param factory The address of the factory to query.
     * @return isWhitelisted True if the factory has been whitelisted, false otherwise.
     */
    function factoryIsWhitelisted(address factory) external view returns (bool isWhitelisted);

    struct SetWhitelistParam {
        address factory;
        bool shouldWhitelist;
    }

    /**
     * @notice Adds or removes factories to the whitelist.
     * Can only be called by the contract owner.
     * @param params The list of factories and if they should be whitelisted or blacklisted.
     */
    function setWhitelist(SetWhitelistParam[] memory params) external payable;

    /***************************************
    METADATA FUNCTIONS
    ***************************************/

    /**
     * @notice Returns the base URI for computing tokenURI.
     * @return uri The base URI.
     */
    function baseURI() external view returns (string memory uri);

    /**
     * @notice Sets the base URI for computing tokenURI.
     * Can only be called by the contract owner.
     * @param uri The new base URI.
     */
    function setBaseURI(string calldata uri) external payable;

    /**
     * @notice Returns the contract URI.
     * @return uri The contract URI.
     */
    function contractURI() external view returns (string memory uri);

    /**
     * @notice Sets the contract URI.
     * Can only be called by the contract owner.
     * @param uri The new contract URI.
     */
    function setContractURI(string calldata uri) external payable;
}

File 19 of 27 : IAgentRegistry.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;


/**
 * @title IAgentRegistry
 * @author AgentFi
 * @notice Tracks Agents, NFTs, and TBAs in the AgentFi ecosystem.
 *
 * Does NOT replace the ERC6551Registry, merely an enumeration on top of it.
 */
interface IAgentRegistry {

    /***************************************
    STATE VARIABLES
    ***************************************/

    /// @notice Emitted when an operator is added or removed.
    event OperatorSet(address indexed account, bool isOperator);
    /// @notice Emitted when an agent is registered.
    event AgentRegistered(address indexed agentAddress, address indexed collection, uint256 indexed agentID);

    struct AgentInfo {
        address agentAddress;
        address implementationAddress;
    }

    struct TokenInfo {
        address collection;
        uint256 agentID;
    }

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Returns true if the account is an operator.
     * @param account The account to query.
     * @return isAuthorized True if is an operator, false otherwise.
     */
    function isOperator(address account) external view returns (bool isAuthorized);

    /**
     * @notice Returns the list of known agent TBAs for an agent NFT.
     * @param collection The address of the collection to query.
     * @param agentID The ID of the agent to query.
     * @return tbas The list of registered TBAs for this agent.
     */
    function getTbasOfNft(address collection, uint256 agentID) external view returns (AgentInfo[] memory tbas);

    /**
     * @notice Returns the NFT associated with an agent TBA.
     * Returns zeros if not registered.
     * @param tba The address of the TBA to query.
     * @return collection The address of the NFT collection.
     * @return agentID The ID of the agent.
     */
    function getNftOfTba(address tba) external view returns (address collection, uint256 agentID);

    /**
     * @notice Returns true if the TBA is known.
     * @param tba The address of the TBA to query.
     * @return isRegistered True if the agent is registerd, false otherwise.
     */
    function isTbaRegisteredAgent(address tba) external view returns (bool isRegistered);

    /***************************************
    OPERATOR FUNCTIONS
    ***************************************/

    struct RegisterAgentParam {
        address agentAddress;
        address implementationAddress;
        address collection;
        uint256 agentID;
    }

    /**
     * @notice Registers a new agent.
     * Can only be called by an operator.
     * @param params The agent to register.
     */
    function registerAgent(RegisterAgentParam calldata params) external payable;

    /**
     * @notice Registers a new agent. Fails gracefully if the agent has already been registered.
     * Can only be called by an operator.
     * @param params The agent to register.
     */
    function tryRegisterAgent(RegisterAgentParam calldata params) external payable;

    /**
     * @notice Registers a list of new agents.
     * Can only be called by an operator.
     * @param params The agents to register.
     */
    function registerAgents(RegisterAgentParam[] calldata params) external payable;

    /**
     * @notice Registers a list of new agents. Fails gracefully if the agent has already been registered.
     * Can only be called by an operator.
     * @param params The agents to register.
     */
    function tryRegisterAgents(RegisterAgentParam[] calldata params) external payable;

    /***************************************
    OWNER FUNCTIONS
    ***************************************/

    struct SetOperatorParam {
        address account;
        bool isAuthorized;
    }

    /**
     * @notice Sets the status of a list of operators.
     * Can only be called by the contract owner.
     * @param params The list to set.
     */
    function setOperators(SetOperatorParam[] calldata params) external payable;
}

File 20 of 27 : IBlastable.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;


/**
 * @title IBlastable
 * @author AgentFi
 * @notice An abstract contract that configures the connection to Blast during deployment
 *
 * This involves collecting ETH yield, gas rewards, and Blast Points. ETH yield is earned by this contract automatically, while gas rewards and Blast Points are delegated to dedicated collectors.
 */
interface IBlastable {

    /**
     * @notice Returns the address of the Blast contract.
     * @return blast_ The adress of the Blast contract.
     */
    function blast() external view returns (address blast_);

    /**
     * @notice Returns the address of the BlastPoints contract.
     * @return blastPoints_ The adress of the BlastPoints contract.
     */
    function blastPoints() external view returns (address blastPoints_);
}

File 21 of 27 : IMulticallableERC2771Context.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;


/**
 * @title IMulticallableERC2771Context
 * @author AgentFi
 * @notice An extension to ERC2771Context that also allows for self `multicall()`.
 *
 * Separately these two standards are safe. The combination of the two can cause an address spoofing vulnerability if not implemented properly.
 *
 * If your contract has the two (extends both Multicall and ERC2771Context) then inherit this contract instead.
 */
interface IMulticallableERC2771Context {

    /***************************************
    MULTICALL
    ***************************************/

    /**
     * @notice Receives and executes a batch of function calls on this contract.
     * @param data A list of function calls to execute.
     * @return results The results of each function call.
     */
    function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}

File 22 of 27 : IOwnable2Step.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;


/**
 * @title IOwnable2Step
 * @author AgentFi
 * @notice An abstract contract that provides a basic access control system through ERC173.
 */
interface IOwnable2Step {

    /***************************************
    EVENTS
    ***************************************/

    /// @notice Emitted when the contract ownership process is started.
    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
    /// @notice Emitted when the contract ownership process is completed.
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Returns the address of the current owner.
     * @return owner_ The current owner.
     */
    function owner() external view returns (address owner_);

    /**
     * @notice Returns the address of the pending owner.
     * @return pendingOwner_ The pending owner.
     */
    function pendingOwner() external view returns (address pendingOwner_);

    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() external payable;

    /**
     * @notice Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     * @param newOwner The address of the new owner.
     */
    function transferOwnership(address newOwner) external payable;

    /**
     * @notice Completes the ownership transfer of the contract to the new account.
     * Can only be called by the pending owner.
     */
    function acceptOwnership() external payable;

    /***************************************
    TOKEN BALANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Rescues tokens that may have been accidentally transferred in.
     * Can only be called by the contract owner.
     * @dev If the inheriting contract requires tokens in the contract, overwrite this with a revert.
     * @param receiver The receiver of the rescued tokens.
     * @param tokens The tokens to rescue. Can be ETH or ERC20s.
     */
    function sweep(address receiver, address[] calldata tokens) external payable;
}

File 23 of 27 : Calls.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

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


/**
 * @title Calls
 * @author AgentFi
 * @notice A library for safely making low level calls.
 */
library Calls {

    /**
     * @notice Safely transfers the gas token using a low level `call`.
     * @dev If `target` reverts with a revert reason, it is bubbled up by this function.
     * @param target The address of the contract to `call`.
     * @return result The result of the function call.
     */
    function sendValue(
        address target,
        uint256 value
    ) internal returns (bytes memory result) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance();
        }
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value:value}("");
        if(success) {
            result = returndata;
        } else {
            // look for revert reason and bubble it up if present
            if(returndata.length > 0) {
                // the easiest way to bubble the revert reason is using memory via assembly
                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert Errors.CallFailed();
            }
        }
    }

    /**
     * @notice Safely performs a Solidity function call using a low level `call`.
     * @dev If `target` reverts with a revert reason, it is bubbled up by this function.
     * @param target The address of the contract to `delegatecall`.
     * @param data The data to pass to the target.
     * @return result The result of the function call.
     */
    function functionCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory result) {
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call(data);
        if(success) {
            result = returndata;
        } else {
            // look for revert reason and bubble it up if present
            if(returndata.length > 0) {
                // the easiest way to bubble the revert reason is using memory via assembly
                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert Errors.CallFailed();
            }
        }
    }

    /**
     * @notice Safely performs a Solidity function call using a low level `call`.
     * @dev If `target` reverts with a revert reason, it is bubbled up by this function.
     * @param target The address of the contract to `delegatecall`.
     * @param data The data to pass to the target.
     * @return result The result of the function call.
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory result) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance();
        }
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value:value}(data);
        if(success) {
            result = returndata;
        } else {
            // look for revert reason and bubble it up if present
            if(returndata.length > 0) {
                // the easiest way to bubble the revert reason is using memory via assembly
                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert Errors.CallFailed();
            }
        }
    }

    /**
     * @notice Safely performs a Solidity function call using a low level `delegatecall`.
     * @dev If `target` reverts with a revert reason, it is bubbled up by this function.
     * @param target The address of the contract to `delegatecall`.
     * @param data The data to pass to the target.
     * @return result The result of the function call.
     */
    function functionDelegateCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory result) {
        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        if(success) {
            result = returndata;
        } else {
            // look for revert reason and bubble it up if present
            if(returndata.length > 0) {
                // the easiest way to bubble the revert reason is using memory via assembly
                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert Errors.DelegateCallFailed();
            }
        }
    }

    /**
     * @notice Verify that an address has contract code, otherwise reverts.
     * @param target The address to verify.
     */
    function verifyHasCode(
        address target
    ) internal view {
        // checks
        uint256 contractSize;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            contractSize := extcodesize(target)
        }
        if(contractSize == 0) revert Errors.NotAContract();
    }
}

File 24 of 27 : Errors.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;


/**
 * @title Errors
 * @author AgentFi
 * @notice A library of custom error types used in BOOM!.
 */
library Errors {

    // call errors
    /// @notice Thrown when a low level call reverts without a reason.
    error CallFailed();
    /// @notice Thrown when a low level delegatecall reverts without a reason.
    error DelegateCallFailed();
    /// @notice Thrown if the owner tries to execute an operation that is not a call.
    error OnlyCallsAllowed();
    /// @notice Thrown when a function should not be delegatecalled.
    error NoDelegateCall();
    /// @notice Thrown when using an address with no code.
    error NotAContract();
    /// @notice Thrown when a contract deployment fails.
    error ContractNotDeployed();
    /// @notice Thrown when the sender has an insufficient balance of the token they are sending.
    error InsufficientBalance();

    // ownership & authentication errors
    /// @notice Thrown when calling a function reserved for the contract owner.
    error NotContractOwner();
    /// @notice Thrown when calling a function reserved for the pending contract owner.
    error NotPendingContractOwner();
    /// @notice Thrown when calling a function reserved for the owner of a erc6551 account.
    error ERC6551InvalidSigner();
    /// @notice Thrown when attempting a function reserved for the owner of the agent.
    error NotOwnerOfAgent();
    /// @notice Thrown when a signature is invalid.
    error InvalidSignature();

    // generic input errors
    /// @notice Thrown when address zero is used where it should not be.
    error AddressZero();
    /// @notice Thrown when a nonzero address is used where the zero address is expected
    error AddressNotZero();
    /// @notice Thrown when an address is used where it should not be.
    //error AddressIllegal();
    /// @notice Thrown when a zero amount used where it should not be.
    error AmountZero();
    /// @notice Thrown when the number of elements in an array is not what was expected.
    error LengthMismatch();
    /// @notice Thrown when receiving an array of length zero.
    error LengthZero();
    /// @notice Thrown when looking up a name that is unknown.
    error UnknownName();
    /// @notice Thrown when accessing an element that is out of range.
    error OutOfRange();
    /// @notice Thrown when gas token values do not match.
    error ValueMismatch();
    /// @notice Thrown when an entry has already been registered.
    error AlreadyRegistered();

    // execution errors
    /// @notice Thrown when a call reenters illegally.
    error ReentrancyGuard();
    /// @notice Thrown when attempting to initialize a contract that has already been initialized.
    error AlreadyInitialized();

    // nft errors
    /// @notice Thrown when querying an agent that does not exist.
    error AgentDoesNotExist();
    /// @notice Thrown when transferring an agent nft to the agent account.
    error OwnershipCycle();
    /// @notice Thrown when referrencing an account that is not an agent.
    error NotAnAgent();

    // agent creation errors
    /// @notice Thrown when attempting to create an agent from an account that is not whitelisted.
    error FactoryNotWhitelisted();
    /// @notice Thrown when call a contract that has been paused.
    error ContractPaused();
    /// @notice Thrown when using a factory and a creation settings that has been paused.
    error CreationSettingsPaused();
    /// @notice Thrown when minting an nft over the max total supply.
    error OverMaxSupply();
    /// @notice Thrown when minting an nft over the max public mint.
    error OverMaxPublicMint();
    /// @notice Thrown when minting an nft but the mint has not been started.
    error MintNotStarted();
    /// @notice Thrown when minting via the allowlist but the period has ended.
    error AllowlistMintEnded();
    /// @notice Thrown when minting too many agents at once.
    error OverMaxMintPerTx();
    /// @notice Thrown when minting an nft over the max allowlist mint total.
    error OverMaxAllowlistMintTotal();
    /// @notice Thrown when minting an nft over the max allowlist mint per user.
    error OverMaxAllowlistMintPerAccount();
    /// @notice Thrown when minting from the treasury allocation before treasury mint starts.
    error TreasuryMintNotStarted();
    /// @notice Thrown when not paying enough to mint an nft.
    error InsufficientPayment();
    /// @notice Thrown when minting from the treasury allocation without approval.
    error NotTreasuryMinter();
    /// @notice Thrown when minting more agents than allowed per user.
    error OverMaxCreationsPerUser();
    /// @notice Thrown when minting more agents than allowed per agent.
    error OverMaxCreationsPerAgent();

    // erc2535 errors
    /// @notice Thrown when installing a function that is already installed.
    error AddFunctionDuplicate();
    /// @notice Thrown when replacing a function with itself.
    error ReplaceFunctionSame();
    /// @notice Thrown when removing a function that has not currently installed.
    error RemoveFunctionDoesNotExist();
    /// @notice Thrown when removing a function that cannot be removed.
    error RemoveFunctionImmutable();
    /// @notice Thrown when calling a function that does not exist in this contract.
    error FunctionDoesNotExist();
    /// @notice Thrown when attempting to install a module that is not whitelisted.
    error ModuleNotWhitelisted();

    // quoter errors
    /// @notice Thrown when failing to decode an error message.
    error UnknownError();
    /// @notice Thrown when a revert was intentionally thrown in order to return a value.
    error RevertForAmount(uint256 amount);

    /// @notice Thrown when calling a function on a proxy that should only be called on the implementation.
    error NotImplementation();
    /// @notice Thrown when calling a function on an implementation contract that can only be called by the gas collector.
    error NotGasCollector();
    /// @notice Thrown when trying to mint without the minter role.
    error NotMinter();
    /// @notice Thrown when calling the dispatcher without the operator role.
    error NotOperator();

    // erc6551 errors
    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 InvalidSender();

    //ModuleC Errors
    error PositionAlreadyExists(); // Throw if trying to create a position, but one exists
    error NoPositionFound(); // Throw if trying to operate on a position, but none exists
    error InvalidTickParam(); // Throw if tick params is invalid
    error InvalidSlippageParam(); // Throw if slippage params is invalid
    error InvalidManagerParam(); // Throw if nfp manager param is invalid

    // ModuleD errors
    /// @notice Thrown when creating an agent with an invalid mode.
    error InvalidMode();

    // processing errors
    /// @notice Thrown when processing an empty queue.
    error NoMoreItemsInQueue();
}

File 25 of 27 : Blastable.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { IBlastable } from "./../interfaces/utils/IBlastable.sol";


/**
 * @title Blastable
 * @author AgentFi
 * @notice An abstract contract that configures the connection to Blast during deployment
 *
 * This involves collecting ETH yield, gas rewards, and Blast Points. ETH yield is earned by this contract automatically, while gas rewards and Blast Points are delegated to dedicated collectors.
 */
abstract contract Blastable is IBlastable {

    address internal immutable __blast;
    address internal immutable __gasCollector;
    address internal immutable __blastPoints;
    address internal immutable __pointsOperator;

    /**
     * @notice Constructs the Blastable contract.
     * Configures the contract to receive automatic yield, claimable gas, and assigns a gas collector.
     * @param blast_ The address of the blast gas reward contract.
     * @param gasCollector_ The address of the gas collector.
     * @param blastPoints_ The address of the blast points contract.
     * @param pointsOperator_ The address of the blast points operator.
     */
    constructor(
        address blast_,
        address gasCollector_,
        address blastPoints_,
        address pointsOperator_
    ) {
        __blast = blast_;
        __gasCollector = gasCollector_;
        __blastPoints = blastPoints_;
        __pointsOperator = pointsOperator_;
        // allow these calls to fail on local fork
        // check success after deployment
        blast_.call(abi.encodeWithSignature("configureAutomaticYield()"));
        blast_.call(abi.encodeWithSignature("configureClaimableGas()"));
        if(gasCollector_ != address(0)) blast_.call(abi.encodeWithSignature("configureGovernor(address)", gasCollector_));
        if(pointsOperator_ != address(0)) blastPoints_.call(abi.encodeWithSignature("configurePointsOperator(address)", pointsOperator_));
    }

    /**
     * @notice Returns the address of the Blast contract.
     * @return blast_ The adress of the Blast contract.
     */
    function blast() public view override returns (address blast_) {
        blast_ = __blast;
    }

    /**
     * @notice Returns the address of the BlastPoints contract.
     * @return blastPoints_ The adress of the BlastPoints contract.
     */
    function blastPoints() public view override returns (address blastPoints_) {
        blastPoints_ = __blastPoints;
    }

    /**
     * @notice Allows this contract to receive the gas token.
     */
    // solhint-disable-next-line no-empty-blocks
    receive() external payable virtual {}
}

File 26 of 27 : MulticallableERC2771Context.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import { ERC2771Context } from "@openzeppelin/contracts/metatx/ERC2771Context.sol";
import { Calls } from "./../libraries/Calls.sol";
import { IMulticallableERC2771Context } from "./../interfaces/utils/IMulticallableERC2771Context.sol";


/**
 * @title MulticallableERC2771Context
 * @author AgentFi
 * @notice An extension to ERC2771Context that also allows for self `multicall()`.
 *
 * Separately these two standards are safe. The combination of the two can cause an address spoofing vulnerability if not implemented properly.
 *
 * If your contract has the two (extends both Multicall and ERC2771Context) then inherit this contract instead.
 */
abstract contract MulticallableERC2771Context is ERC2771Context, IMulticallableERC2771Context {

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

    /**
     * @notice Initializes the contract with a trusted forwarder, which will be able to invoke functions on this contract on behalf of other accounts.
     * @param multicallForwarder_ The MulticallForwarder address.
     */
    constructor(address multicallForwarder_) ERC2771Context(multicallForwarder_) {}

    /***************************************
    MULTICALL
    ***************************************/

    /**
     * @notice Receives and executes a batch of function calls on this contract.
     * @param data A list of function calls to execute.
     * @return results The results of each function call.
     */
    function multicall(bytes[] calldata data) external override returns (bytes[] memory results) {
        results = new bytes[](data.length);
        address sender = _msgSender();
        bool isForwarder = msg.sender != sender;
        for(uint256 i = 0; i < data.length; ++i) {
            if(isForwarder) {
                results[i] = Calls.functionDelegateCall(address(this), abi.encodePacked(data[i], sender));
            } else {
                results[i] = Calls.functionDelegateCall(address(this), data[i]);
            }
        }
    }
}

File 27 of 27 : Ownable2Step.sol
// SPDX-License-Identifier: none
pragma solidity 0.8.24;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IOwnable2Step } from "./../interfaces/utils/IOwnable2Step.sol";
import { Calls } from "./../libraries/Calls.sol";
import { Errors } from "./../libraries/Errors.sol";


/**
 * @title Ownable2Step
 * @author AgentFi
 * @notice An abstract contract that provides a basic access control system through ERC173.
 *
 * Based on OpenZeppelins's implementation.
 *
 * Also includes [`sweep()`](#sweep) to allow the owner to rescue any tokens that may have been sent in.
 */
abstract contract Ownable2Step is IOwnable2Step {

    /***************************************
    VARIABLES
    ***************************************/

    address private _owner;
    address private _pendingOwner;

    /**
     * @notice Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /***************************************
    VIEW FUNCTIONS
    ***************************************/

    /**
     * @notice Returns the address of the current owner.
     * @return owner_ The current owner.
     */
    function owner() public view override returns (address owner_) {
        owner_ = _owner;
    }

    /**
     * @notice Returns the address of the pending owner.
     * @return pendingOwner_ The pending owner.
     */
    function pendingOwner() public view override returns (address pendingOwner_) {
        pendingOwner_ = _pendingOwner;
    }

    /***************************************
    MUTATOR FUNCTIONS
    ***************************************/

    /**
     * @notice Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public payable override onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @notice Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     * @param newOwner The address of the new owner.
     */
    function transferOwnership(address newOwner) public payable override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(_owner, newOwner);
    }

    /**
     * @notice Completes the ownership transfer of the contract to the new account.
     * Can only be called by the pending owner.
     */
    function acceptOwnership() public payable override {
        address sender = msg.sender;
        if(_pendingOwner != sender) revert Errors.NotPendingContractOwner();
        _transferOwnership(sender);
    }

    /***************************************
    TOKEN BALANCE FUNCTIONS
    ***************************************/

    /**
     * @notice Rescues tokens that may have been accidentally transferred in.
     * Can only be called by the contract owner.
     * @dev If the inheriting contract requires tokens in the contract, overwrite this with a revert.
     * @param receiver The receiver of the rescued tokens.
     * @param tokens The tokens to rescue. Can be ETH or ERC20s.
     */
    function sweep(address receiver, address[] calldata tokens) external payable virtual override onlyOwner {
        for(uint256 i = 0; i < tokens.length; ++i) {
            address token = tokens[i];
            if(token == address(0)) {
                Calls.sendValue(payable(receiver), address(this).balance);
            } else {
                IERC20 tkn = IERC20(token);
                SafeERC20.safeTransfer(tkn, receiver, tkn.balanceOf(address(this)));
            }
        }
    }

    /***************************************
    HELPER FUNCTIONS
    ***************************************/

    /**
     * @notice Throws if the sender is not the owner.
     */
    function _checkOwner() internal view {
        if(_owner != msg.sender) revert Errors.NotContractOwner();
    }

    /**
     * @notice Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal {
        _pendingOwner = address(0);
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"blast_","type":"address"},{"internalType":"address","name":"gasCollector_","type":"address"},{"internalType":"address","name":"blastPoints_","type":"address"},{"internalType":"address","name":"pointsOperator_","type":"address"},{"internalType":"address","name":"multicallForwarder_","type":"address"},{"internalType":"address","name":"genesisAgentNft_","type":"address"},{"internalType":"address","name":"strategyAgentNft_","type":"address"},{"internalType":"address","name":"explorerAgentNft_","type":"address"},{"internalType":"address","name":"erc6551Registry_","type":"address"},{"internalType":"address","name":"agentRegistry_","type":"address"},{"internalType":"address","name":"weth_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CallFailed","type":"error"},{"inputs":[],"name":"CreationSettingsPaused","type":"error"},{"inputs":[],"name":"DelegateCallFailed","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"NotAnAgent","type":"error"},{"inputs":[],"name":"NotContractOwner","type":"error"},{"inputs":[],"name":"NotOwnerOfAgent","type":"error"},{"inputs":[],"name":"NotPendingContractOwner","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[],"name":"AgentCreationSettingsPosted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"blast","outputs":[{"internalType":"address","name":"blast_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blastPoints","outputs":[{"internalType":"address","name":"blastPoints_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"wrapMint","type":"address"},{"internalType":"address","name":"otoken","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"enum ILoopooorModuleD.MODE","name":"mode","type":"uint8"},{"internalType":"uint256","name":"leverage","type":"uint256"}],"internalType":"struct ILoopooorAgentFactory.MintParams","name":"mintParams","type":"tuple"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ILoopooorAgentFactory.TokenDeposit","name":"deposit","type":"tuple"}],"name":"createLoopooorAgentAndExplorer","outputs":[{"internalType":"uint256","name":"strategyAgentID","type":"uint256"},{"internalType":"address","name":"strategyAddress","type":"address"},{"internalType":"uint256","name":"explorerAgentID","type":"uint256"},{"internalType":"address","name":"explorerAddress","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"wrapMint","type":"address"},{"internalType":"address","name":"otoken","type":"address"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"enum ILoopooorModuleD.MODE","name":"mode","type":"uint8"},{"internalType":"uint256","name":"leverage","type":"uint256"}],"internalType":"struct ILoopooorAgentFactory.MintParams","name":"mintParams","type":"tuple"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ILoopooorAgentFactory.TokenDeposit","name":"deposit","type":"tuple"},{"internalType":"address","name":"rootAgentAddress","type":"address"}],"name":"createLoopooorAgentForRoot","outputs":[{"internalType":"uint256","name":"strategyAgentID","type":"uint256"},{"internalType":"address","name":"strategyAddress","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getAgentCreationSettings","outputs":[{"internalType":"address","name":"strategyAccountImpl_","type":"address"},{"internalType":"address","name":"explorerAccountImpl_","type":"address"},{"internalType":"bytes","name":"strategyInitializationCall_","type":"bytes"},{"internalType":"bytes","name":"explorerInitializationCall_","type":"bytes"},{"internalType":"bool","name":"isActive_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStaticAddresses","outputs":[{"internalType":"address","name":"erc6551Registry_","type":"address"},{"internalType":"address","name":"agentRegistry_","type":"address"},{"internalType":"address","name":"genesisAgentNft_","type":"address"},{"internalType":"address","name":"strategyAgentNft_","type":"address"},{"internalType":"address","name":"explorerAgentNft_","type":"address"},{"internalType":"address","name":"weth_","type":"address"}],"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":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"pendingOwner_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"strategyAccountImpl","type":"address"},{"internalType":"address","name":"explorerAccountImpl","type":"address"},{"internalType":"bytes","name":"strategyInitializationCall","type":"bytes"},{"internalType":"bytes","name":"explorerInitializationCall","type":"bytes"},{"internalType":"bool","name":"isActive","type":"bool"}],"internalType":"struct ILoopooorAgentFactory.AgentCreationSettings","name":"creationSettings","type":"tuple"}],"name":"postAgentCreationSettings","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"sweep","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101e06040523480156200001257600080fd5b5060405162002c6238038062002c62833981016040819052620000359162000387565b6001600160a01b03808c166080819052818c1660a052818b1660c05290891660e05260408051600481526024810182526020810180516001600160e01b031663388a0bbd60e11b1790529051899283928f928f928f928f926200009991906200047c565b6000604051808303816000865af19150503d8060008114620000d8576040519150601f19603f3d011682016040523d82523d6000602084013e620000dd565b606091505b505060408051600481526024810182526020810180516001600160e01b0316634e606c4760e01b17905290516001600160a01b03871692506200012191906200047c565b6000604051808303816000865af19150503d806000811462000160576040519150601f19603f3d011682016040523d82523d6000602084013e62000165565b606091505b5050506001600160a01b0383161562000210576040516001600160a01b03848116602483015285169060440160408051601f198184030181529181526020820180516001600160e01b0316631d70c8d360e31b17905251620001c891906200047c565b6000604051808303816000865af19150503d806000811462000207576040519150601f19603f3d011682016040523d82523d6000602084013e6200020c565b606091505b5050505b6001600160a01b03811615620002b8576040516001600160a01b03828116602483015283169060440160408051601f198184030181529181526020820180516001600160e01b03166336b91f2b60e01b179052516200027091906200047c565b6000604051808303816000865af19150503d8060008114620002af576040519150601f19603f3d011682016040523d82523d6000602084013e620002b4565b606091505b5050505b505050506001600160a01b03166101005250620002d58c62000310565b6001600160a01b0395861661016052938516610180529184166101a052831661012052821661014052166101c05250620004ad945050505050565b600180546001600160a01b0319908116909155600080546001600160a01b03848116938216841783556040519116929183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200038257600080fd5b919050565b6000806000806000806000806000806000806101808d8f031215620003ab57600080fd5b620003b68d6200036a565b9b50620003c660208e016200036a565b9a50620003d660408e016200036a565b9950620003e660608e016200036a565b9850620003f660808e016200036a565b97506200040660a08e016200036a565b96506200041660c08e016200036a565b95506200042660e08e016200036a565b9450620004376101008e016200036a565b9350620004486101208e016200036a565b9250620004596101408e016200036a565b91506200046a6101608e016200036a565b90509295989b509295989b509295989b565b6000825160005b818110156200049f576020818601810151858301520162000483565b506000920191825250919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516126cb6200059760003960006104090152600081816103e1015281816105e201528181610df101526117b30152600081816103b90152818161058201528181610b9b0152818161175b015261198f01526000818161038f015261170401526000818161036701528181610fe6015281816116750152611b8401526000818161034201528181610ef00152611a8e0152600081816101ea01528181610258015261124e01526000505060006102f6015260005050600061011201526126cb6000f3fe6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063b910ea9211610059578063b910ea9214610439578063de487ac514610476578063e30c397814610489578063f2fde38b146104b457600080fd5b80638da5cb5b1461028f578063ac9650d8146102ba578063b2bd6b50146102e7578063b3ed220b1461031a57600080fd5b8063715018a6116100c6578063715018a61461023757806379ba5097146102415780637da0a877146102495780638a179be41461027c57600080fd5b8063175e1a7d14610103578063416c4e101461015c57806356b1c3e9146101a7578063572b6c05146101cd57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61016f61016a366004611ea9565b6104c7565b6040805194855273ffffffffffffffffffffffffffffffffffffffff9384166020860152840191909152166060820152608001610153565b3480156101b357600080fd5b506101bc6106ba565b604051610153959493929190611f4c565b3480156101d957600080fd5b506102276101e8366004611fce565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff90811691161490565b6040519015158152602001610153565b61023f610819565b005b61023f61082d565b34801561025557600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610132565b61023f61028a366004612037565b61088c565b34801561029b57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610132565b3480156102c657600080fd5b506102da6102d536600461208c565b6109a3565b60405161015391906120ce565b3480156102f357600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610132565b34801561032657600080fd5b506040805173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811682527f0000000000000000000000000000000000000000000000000000000000000000811660208301527f00000000000000000000000000000000000000000000000000000000000000008116928201929092527f0000000000000000000000000000000000000000000000000000000000000000821660608201527f0000000000000000000000000000000000000000000000000000000000000000821660808201527f00000000000000000000000000000000000000000000000000000000000000009190911660a082015260c001610153565b61044c610447366004612150565b610b2d565b6040805192835273ffffffffffffffffffffffffffffffffffffffff909116602083015201610153565b61023f61048436600461219a565b610c01565b34801561049557600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610132565b61023f6104c2366004611fce565b610d6c565b600080600080600160149054906101000a900460ff16610513576040517f680d9f2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61051b610dea565b909250905061052a86866110de565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8481166024830152604482018490529296509094507f0000000000000000000000000000000000000000000000000000000000000000909116906323b872dd90606401600060405180830381600087803b1580156105c857600080fd5b505af11580156105dc573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166323b872dd30610625611247565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff92831660048201529116602482015260448101859052606401600060405180830381600087803b15801561069957600080fd5b505af11580156106ad573d6000803e3d6000fd5b5050505092959194509250565b6002546003546004805473ffffffffffffffffffffffffffffffffffffffff93841693909216916060918291600091906106f3906121d7565b80601f016020809104026020016040519081016040528092919081815260200182805461071f906121d7565b801561076c5780601f106107415761010080835404028352916020019161076c565b820191906000526020600020905b81548152906001019060200180831161074f57829003601f168201915b5050505050925060058054610780906121d7565b80601f01602080910402602001604051908101604052809291908181526020018280546107ac906121d7565b80156107f95780601f106107ce576101008083540402835291602001916107f9565b820191906000526020600020905b8154815290600101906020018083116107dc57829003601f168201915b50505050509150600160149054906101000a900460ff1690509091929394565b6108216112c9565b61082b600061131a565b565b600154339073ffffffffffffffffffffffffffffffffffffffff168114610880576040517f3d6f519e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108898161131a565b50565b6108946112c9565b60005b8181101561099d5760008383838181106108b3576108b3612224565b90506020020160208101906108c89190611fce565b905073ffffffffffffffffffffffffffffffffffffffff81166108f5576108ef8547611399565b50610994565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528190610992908290889073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610969573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098d9190612253565b611492565b505b50600101610897565b50505050565b60608167ffffffffffffffff8111156109be576109be61226c565b6040519080825280602002602001820160405280156109f157816020015b60608152602001906001900390816109dc5790505b50905060006109fe611247565b90503373ffffffffffffffffffffffffffffffffffffffff8216141560005b84811015610b24578115610a9c57610a7a30878784818110610a4157610a41612224565b9050602002810190610a53919061229b565b86604051602001610a6693929190612300565b604051602081830303815290604052611518565b848281518110610a8c57610a8c612224565b6020026020010181905250610b1c565b610afe30878784818110610ab257610ab2612224565b9050602002810190610ac4919061229b565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061151892505050565b848281518110610b1057610b10612224565b60200260200101819052505b600101610a1d565b50505092915050565b600080610b39836115d7565b610b4385856110de565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8681166024830152604482018490529294509092507f0000000000000000000000000000000000000000000000000000000000000000909116906323b872dd90606401600060405180830381600087803b158015610be157600080fd5b505af1158015610bf5573d6000803e3d6000fd5b50505050935093915050565b610c096112c9565b610c166020820182611fce565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055610c6b6040820160208301611fce565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055610cbd604082018261229b565b600491610ccb919083612389565b50610cd9606082018261229b565b600591610ce7919083612389565b50610cf860a08201608083016124b2565b6001805491151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9092169190911790556040517fec0a2ce18c2c66448518f6a0f7199cd7066aba5a22fbab83e615f7df3195dfef90600090a150565b610d746112c9565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227009190a350565b60008060007f000000000000000000000000000000000000000000000000000000000000000090508073ffffffffffffffffffffffffffffffffffffffff1663457e8e1e6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e839190612253565b6003546040517f8a54c52f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820181905260006024830181905246604484015285841660648401526084830185905293965092917f00000000000000000000000000000000000000000000000000000000000000001690638a54c52f9060a4016020604051808303816000875af1158015610f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5d91906124cf565b6040805160808101825273ffffffffffffffffffffffffffffffffffffffff808416825285811660208301908152878216838501908152606084018b815294517f2b2ea1070000000000000000000000000000000000000000000000000000000081529351831660048501529051821660248401525181166044830152915160648201529195507f00000000000000000000000000000000000000000000000000000000000000001690632b2ea10790608401600060405180830381600087803b15801561102a57600080fd5b505af115801561103e573d6000803e3d6000fd5b505050506110d68460058054611053906121d7565b80601f016020809104026020016040519081016040528092919081815260200182805461107f906121d7565b80156110cc5780601f106110a1576101008083540402835291602001916110cc565b820191906000526020600020905b8154815290600101906020018083116110af57829003601f168201915b5050505050611921565b505050509091565b6000806110e9611988565b909250905060006110fd6020850185611fce565b73ffffffffffffffffffffffffffffffffffffffff161480611154575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61113c6020850185611fce565b73ffffffffffffffffffffffffffffffffffffffff16145b1561116d57611167818460200135611399565b50611190565b61119061117d6020850185611fce565b611185611247565b838660200135611bf1565b73ffffffffffffffffffffffffffffffffffffffff811663cbefbc266111b96020870187611fce565b6111c96040880160208901611fce565b6111d96060890160408a01611fce565b6111e960808a0160608b016124ec565b89608001356040518663ffffffff1660e01b815260040161120e95949392919061250d565b600060405180830381600087803b15801561122857600080fd5b505af115801561123c573d6000803e3d6000fd5b505050509250929050565b60003660147f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16331480156112915750808210155b156112c1576000366112a38385612584565b6112ae9282906125be565b6112b7916125e8565b60601c9250505090565b339250505090565b60005473ffffffffffffffffffffffffffffffffffffffff16331461082b576040517fbfcafd3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556000805473ffffffffffffffffffffffffffffffffffffffff848116938216841783556040519116929183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060814710156113d5576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808473ffffffffffffffffffffffffffffffffffffffff168460405160006040518083038185875af1925050503d8060008114611430576040519150601f19603f3d011682016040523d82523d6000602084013e611435565b606091505b509150915081156114485780925061148a565b8051156114585780518082602001fd5b6040517f3204506f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505092915050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261151391859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611c37565b505050565b60606000808473ffffffffffffffffffffffffffffffffffffffff1684604051611542919061262e565b600060405180830381855af49150503d806000811461157d576040519150601f19603f3d011682016040523d82523d6000602084013e611582565b606091505b509150915081156115955780925061148a565b8051156115a55780518082602001fd5b6040517f18cecad500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015474010000000000000000000000000000000000000000900460ff1661162b576040517f680d9f2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f1e17c0ca00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015260009182917f00000000000000000000000000000000000000000000000000000000000000001690631e17c0ca906024016040805180830381865afa1580156116bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116df919061264a565b909250905073ffffffffffffffffffffffffffffffffffffffff8216158061180257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156117aa57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561180257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611839576040517f0907fef200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611841611247565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff91821691841690636352211e90602401602060405180830381865afa1580156118b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d491906124cf565b73ffffffffffffffffffffffffffffffffffffffff1614611513576040517f4c90cf4400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405161194b919061262e565b6000604051808303816000865af19150503d8060008114611430576040519150601f19603f3d011682016040523d82523d6000602084013e611435565b60008060007f000000000000000000000000000000000000000000000000000000000000000090508073ffffffffffffffffffffffffffffffffffffffff1663457e8e1e6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156119fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a219190612253565b6002546040517f8a54c52f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820181905260006024830181905246604484015285841660648401526084830185905293965092917f00000000000000000000000000000000000000000000000000000000000000001690638a54c52f9060a4016020604051808303816000875af1158015611ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afb91906124cf565b6040805160808101825273ffffffffffffffffffffffffffffffffffffffff808416825285811660208301908152878216838501908152606084018b815294517f2b2ea1070000000000000000000000000000000000000000000000000000000081529351831660048501529051821660248401525181166044830152915160648201529195507f00000000000000000000000000000000000000000000000000000000000000001690632b2ea10790608401600060405180830381600087803b158015611bc857600080fd5b505af1158015611bdc573d6000803e3d6000fd5b505050506110d68460048054611053906121d7565b60405173ffffffffffffffffffffffffffffffffffffffff848116602483015283811660448301526064820183905261099d9186918216906323b872dd906084016114cc565b6000611c5973ffffffffffffffffffffffffffffffffffffffff841683611cd2565b90508051600014158015611c7e575080806020019051810190611c7c9190612678565b155b15611513576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b6060611ce083836000611ce9565b90505b92915050565b606081471015611d27576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611cc9565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051611d50919061262e565b60006040518083038185875af1925050503d8060008114611d8d576040519150601f19603f3d011682016040523d82523d6000602084013e611d92565b606091505b5091509150611da2868383611dae565b925050505b9392505050565b606082611dc357611dbe82611e3d565b611da7565b8151158015611de7575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611e36576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401611cc9565b5080611da7565b805115611e4d5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060a08284031215611e9157600080fd5b50919050565b600060408284031215611e9157600080fd5b60008060e08385031215611ebc57600080fd5b611ec68484611e7f565b9150611ed58460a08501611e97565b90509250929050565b60005b83811015611ef9578181015183820152602001611ee1565b50506000910152565b60008151808452611f1a816020860160208601611ede565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525060a06040830152611f8560a0830186611f02565b8281036060840152611f978186611f02565b91505082151560808301529695505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461088957600080fd5b600060208284031215611fe057600080fd5b8135611da781611fac565b60008083601f840112611ffd57600080fd5b50813567ffffffffffffffff81111561201557600080fd5b6020830191508360208260051b850101111561203057600080fd5b9250929050565b60008060006040848603121561204c57600080fd5b833561205781611fac565b9250602084013567ffffffffffffffff81111561207357600080fd5b61207f86828701611feb565b9497909650939450505050565b6000806020838503121561209f57600080fd5b823567ffffffffffffffff8111156120b657600080fd5b6120c285828601611feb565b90969095509350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015612143577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612131858351611f02565b945092850192908501906001016120f7565b5092979650505050505050565b6000806000610100848603121561216657600080fd5b6121708585611e7f565b925061217f8560a08601611e97565b915060e084013561218f81611fac565b809150509250925092565b6000602082840312156121ac57600080fd5b813567ffffffffffffffff8111156121c357600080fd5b6121cf84828501611e7f565b949350505050565b600181811c908216806121eb57607f821691505b602082108103611e91577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561226557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126122d057600080fd5b83018035915067ffffffffffffffff8211156122eb57600080fd5b60200191503681900382131561203057600080fd5b8284823760609190911b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169101908152601401919050565b601f821115611513576000816000526020600020601f850160051c810160208610156123625750805b601f850160051c820191505b818110156123815782815560010161236e565b505050505050565b67ffffffffffffffff8311156123a1576123a161226c565b6123b5836123af83546121d7565b83612339565b6000601f84116001811461240757600085156123d15750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b17835561249d565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b828110156124565786850135825560209485019460019092019101612436565b5086821015612491577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b801515811461088957600080fd5b6000602082840312156124c457600080fd5b8135611da7816124a4565b6000602082840312156124e157600080fd5b8151611da781611fac565b6000602082840312156124fe57600080fd5b813560038110611da757600080fd5b73ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528416604082015260a0810160038410612571577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6060820193909352608001529392505050565b81810381811115611ce3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080858511156125ce57600080fd5b838611156125db57600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000813581811691601485101561148a5760149490940360031b84901b1690921692915050565b60008251612640818460208701611ede565b9190910192915050565b6000806040838503121561265d57600080fd5b825161266881611fac565b6020939093015192949293505050565b60006020828403121561268a57600080fd5b8151611da7816124a456fea26469706673582212203df6ae877e752365e8ffa9eb6cd82bbcb04d828bec2ed6c9dfbd1226950e258264736f6c63430008180033000000000000000000000000a214a4fc09c42202c404e2976c50373fe5f5b7890000000000000000000000004300000000000000000000000000000000000002000000000000000000000000f237c20584daca970498917470864f4d027de4ca0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800000000000000000000000000454c0c1cf7be9341d82ce0f16979b8689ed4aad0000000000000000000000000ad55f8b65d5738c6f63b54e651a09cc5d873e4d80000000000000000000000005066a1975be96b777dddf57b496397effddcb4a900000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf18000000000000000000000000000000006551c19487814612e58fe0681377575800000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf0000000000000000000000004300000000000000000000000000000000000004

Deployed Bytecode

0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063b910ea9211610059578063b910ea9214610439578063de487ac514610476578063e30c397814610489578063f2fde38b146104b457600080fd5b80638da5cb5b1461028f578063ac9650d8146102ba578063b2bd6b50146102e7578063b3ed220b1461031a57600080fd5b8063715018a6116100c6578063715018a61461023757806379ba5097146102415780637da0a877146102495780638a179be41461027c57600080fd5b8063175e1a7d14610103578063416c4e101461015c57806356b1c3e9146101a7578063572b6c05146101cd57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b507f00000000000000000000000043000000000000000000000000000000000000025b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61016f61016a366004611ea9565b6104c7565b6040805194855273ffffffffffffffffffffffffffffffffffffffff9384166020860152840191909152166060820152608001610153565b3480156101b357600080fd5b506101bc6106ba565b604051610153959493929190611f4c565b3480156101d957600080fd5b506102276101e8366004611fce565b7f000000000000000000000000ad55f8b65d5738c6f63b54e651a09cc5d873e4d873ffffffffffffffffffffffffffffffffffffffff90811691161490565b6040519015158152602001610153565b61023f610819565b005b61023f61082d565b34801561025557600080fd5b507f000000000000000000000000ad55f8b65d5738c6f63b54e651a09cc5d873e4d8610132565b61023f61028a366004612037565b61088c565b34801561029b57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610132565b3480156102c657600080fd5b506102da6102d536600461208c565b6109a3565b60405161015391906120ce565b3480156102f357600080fd5b507f0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800610132565b34801561032657600080fd5b506040805173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000006551c19487814612e58fe06813775758811682527f00000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf811660208301527f0000000000000000000000005066a1975be96b777dddf57b496397effddcb4a98116928201929092527f00000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef821660608201527f000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf18821660808201527f00000000000000000000000043000000000000000000000000000000000000049190911660a082015260c001610153565b61044c610447366004612150565b610b2d565b6040805192835273ffffffffffffffffffffffffffffffffffffffff909116602083015201610153565b61023f61048436600461219a565b610c01565b34801561049557600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610132565b61023f6104c2366004611fce565b610d6c565b600080600080600160149054906101000a900460ff16610513576040517f680d9f2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61051b610dea565b909250905061052a86866110de565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8481166024830152604482018490529296509094507f00000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef909116906323b872dd90606401600060405180830381600087803b1580156105c857600080fd5b505af11580156105dc573d6000803e3d6000fd5b505050507f000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf1873ffffffffffffffffffffffffffffffffffffffff166323b872dd30610625611247565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff92831660048201529116602482015260448101859052606401600060405180830381600087803b15801561069957600080fd5b505af11580156106ad573d6000803e3d6000fd5b5050505092959194509250565b6002546003546004805473ffffffffffffffffffffffffffffffffffffffff93841693909216916060918291600091906106f3906121d7565b80601f016020809104026020016040519081016040528092919081815260200182805461071f906121d7565b801561076c5780601f106107415761010080835404028352916020019161076c565b820191906000526020600020905b81548152906001019060200180831161074f57829003601f168201915b5050505050925060058054610780906121d7565b80601f01602080910402602001604051908101604052809291908181526020018280546107ac906121d7565b80156107f95780601f106107ce576101008083540402835291602001916107f9565b820191906000526020600020905b8154815290600101906020018083116107dc57829003601f168201915b50505050509150600160149054906101000a900460ff1690509091929394565b6108216112c9565b61082b600061131a565b565b600154339073ffffffffffffffffffffffffffffffffffffffff168114610880576040517f3d6f519e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108898161131a565b50565b6108946112c9565b60005b8181101561099d5760008383838181106108b3576108b3612224565b90506020020160208101906108c89190611fce565b905073ffffffffffffffffffffffffffffffffffffffff81166108f5576108ef8547611399565b50610994565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528190610992908290889073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610969573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098d9190612253565b611492565b505b50600101610897565b50505050565b60608167ffffffffffffffff8111156109be576109be61226c565b6040519080825280602002602001820160405280156109f157816020015b60608152602001906001900390816109dc5790505b50905060006109fe611247565b90503373ffffffffffffffffffffffffffffffffffffffff8216141560005b84811015610b24578115610a9c57610a7a30878784818110610a4157610a41612224565b9050602002810190610a53919061229b565b86604051602001610a6693929190612300565b604051602081830303815290604052611518565b848281518110610a8c57610a8c612224565b6020026020010181905250610b1c565b610afe30878784818110610ab257610ab2612224565b9050602002810190610ac4919061229b565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061151892505050565b848281518110610b1057610b10612224565b60200260200101819052505b600101610a1d565b50505092915050565b600080610b39836115d7565b610b4385856110de565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8681166024830152604482018490529294509092507f00000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef909116906323b872dd90606401600060405180830381600087803b158015610be157600080fd5b505af1158015610bf5573d6000803e3d6000fd5b50505050935093915050565b610c096112c9565b610c166020820182611fce565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055610c6b6040820160208301611fce565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055610cbd604082018261229b565b600491610ccb919083612389565b50610cd9606082018261229b565b600591610ce7919083612389565b50610cf860a08201608083016124b2565b6001805491151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9092169190911790556040517fec0a2ce18c2c66448518f6a0f7199cd7066aba5a22fbab83e615f7df3195dfef90600090a150565b610d746112c9565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227009190a350565b60008060007f000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf1890508073ffffffffffffffffffffffffffffffffffffffff1663457e8e1e6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e839190612253565b6003546040517f8a54c52f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820181905260006024830181905246604484015285841660648401526084830185905293965092917f000000000000000000000000000000006551c19487814612e58fe068137757581690638a54c52f9060a4016020604051808303816000875af1158015610f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5d91906124cf565b6040805160808101825273ffffffffffffffffffffffffffffffffffffffff808416825285811660208301908152878216838501908152606084018b815294517f2b2ea1070000000000000000000000000000000000000000000000000000000081529351831660048501529051821660248401525181166044830152915160648201529195507f00000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf1690632b2ea10790608401600060405180830381600087803b15801561102a57600080fd5b505af115801561103e573d6000803e3d6000fd5b505050506110d68460058054611053906121d7565b80601f016020809104026020016040519081016040528092919081815260200182805461107f906121d7565b80156110cc5780601f106110a1576101008083540402835291602001916110cc565b820191906000526020600020905b8154815290600101906020018083116110af57829003601f168201915b5050505050611921565b505050509091565b6000806110e9611988565b909250905060006110fd6020850185611fce565b73ffffffffffffffffffffffffffffffffffffffff161480611154575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61113c6020850185611fce565b73ffffffffffffffffffffffffffffffffffffffff16145b1561116d57611167818460200135611399565b50611190565b61119061117d6020850185611fce565b611185611247565b838660200135611bf1565b73ffffffffffffffffffffffffffffffffffffffff811663cbefbc266111b96020870187611fce565b6111c96040880160208901611fce565b6111d96060890160408a01611fce565b6111e960808a0160608b016124ec565b89608001356040518663ffffffff1660e01b815260040161120e95949392919061250d565b600060405180830381600087803b15801561122857600080fd5b505af115801561123c573d6000803e3d6000fd5b505050509250929050565b60003660147f000000000000000000000000ad55f8b65d5738c6f63b54e651a09cc5d873e4d873ffffffffffffffffffffffffffffffffffffffff16331480156112915750808210155b156112c1576000366112a38385612584565b6112ae9282906125be565b6112b7916125e8565b60601c9250505090565b339250505090565b60005473ffffffffffffffffffffffffffffffffffffffff16331461082b576040517fbfcafd3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556000805473ffffffffffffffffffffffffffffffffffffffff848116938216841783556040519116929183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060814710156113d5576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808473ffffffffffffffffffffffffffffffffffffffff168460405160006040518083038185875af1925050503d8060008114611430576040519150601f19603f3d011682016040523d82523d6000602084013e611435565b606091505b509150915081156114485780925061148a565b8051156114585780518082602001fd5b6040517f3204506f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505092915050565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261151391859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611c37565b505050565b60606000808473ffffffffffffffffffffffffffffffffffffffff1684604051611542919061262e565b600060405180830381855af49150503d806000811461157d576040519150601f19603f3d011682016040523d82523d6000602084013e611582565b606091505b509150915081156115955780925061148a565b8051156115a55780518082602001fd5b6040517f18cecad500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015474010000000000000000000000000000000000000000900460ff1661162b576040517f680d9f2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f1e17c0ca00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015260009182917f00000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf1690631e17c0ca906024016040805180830381865afa1580156116bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116df919061264a565b909250905073ffffffffffffffffffffffffffffffffffffffff8216158061180257507f0000000000000000000000005066a1975be96b777dddf57b496397effddcb4a973ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156117aa57507f00000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561180257507f000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf1873ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611839576040517f0907fef200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611841611247565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff91821691841690636352211e90602401602060405180830381865afa1580156118b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d491906124cf565b73ffffffffffffffffffffffffffffffffffffffff1614611513576040517f4c90cf4400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405161194b919061262e565b6000604051808303816000865af19150503d8060008114611430576040519150601f19603f3d011682016040523d82523d6000602084013e611435565b60008060007f00000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef90508073ffffffffffffffffffffffffffffffffffffffff1663457e8e1e6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156119fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a219190612253565b6002546040517f8a54c52f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820181905260006024830181905246604484015285841660648401526084830185905293965092917f000000000000000000000000000000006551c19487814612e58fe068137757581690638a54c52f9060a4016020604051808303816000875af1158015611ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afb91906124cf565b6040805160808101825273ffffffffffffffffffffffffffffffffffffffff808416825285811660208301908152878216838501908152606084018b815294517f2b2ea1070000000000000000000000000000000000000000000000000000000081529351831660048501529051821660248401525181166044830152915160648201529195507f00000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf1690632b2ea10790608401600060405180830381600087803b158015611bc857600080fd5b505af1158015611bdc573d6000803e3d6000fd5b505050506110d68460048054611053906121d7565b60405173ffffffffffffffffffffffffffffffffffffffff848116602483015283811660448301526064820183905261099d9186918216906323b872dd906084016114cc565b6000611c5973ffffffffffffffffffffffffffffffffffffffff841683611cd2565b90508051600014158015611c7e575080806020019051810190611c7c9190612678565b155b15611513576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b6060611ce083836000611ce9565b90505b92915050565b606081471015611d27576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611cc9565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051611d50919061262e565b60006040518083038185875af1925050503d8060008114611d8d576040519150601f19603f3d011682016040523d82523d6000602084013e611d92565b606091505b5091509150611da2868383611dae565b925050505b9392505050565b606082611dc357611dbe82611e3d565b611da7565b8151158015611de7575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611e36576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401611cc9565b5080611da7565b805115611e4d5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060a08284031215611e9157600080fd5b50919050565b600060408284031215611e9157600080fd5b60008060e08385031215611ebc57600080fd5b611ec68484611e7f565b9150611ed58460a08501611e97565b90509250929050565b60005b83811015611ef9578181015183820152602001611ee1565b50506000910152565b60008151808452611f1a816020860160208601611ede565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525060a06040830152611f8560a0830186611f02565b8281036060840152611f978186611f02565b91505082151560808301529695505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461088957600080fd5b600060208284031215611fe057600080fd5b8135611da781611fac565b60008083601f840112611ffd57600080fd5b50813567ffffffffffffffff81111561201557600080fd5b6020830191508360208260051b850101111561203057600080fd5b9250929050565b60008060006040848603121561204c57600080fd5b833561205781611fac565b9250602084013567ffffffffffffffff81111561207357600080fd5b61207f86828701611feb565b9497909650939450505050565b6000806020838503121561209f57600080fd5b823567ffffffffffffffff8111156120b657600080fd5b6120c285828601611feb565b90969095509350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015612143577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612131858351611f02565b945092850192908501906001016120f7565b5092979650505050505050565b6000806000610100848603121561216657600080fd5b6121708585611e7f565b925061217f8560a08601611e97565b915060e084013561218f81611fac565b809150509250925092565b6000602082840312156121ac57600080fd5b813567ffffffffffffffff8111156121c357600080fd5b6121cf84828501611e7f565b949350505050565b600181811c908216806121eb57607f821691505b602082108103611e91577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561226557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126122d057600080fd5b83018035915067ffffffffffffffff8211156122eb57600080fd5b60200191503681900382131561203057600080fd5b8284823760609190911b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169101908152601401919050565b601f821115611513576000816000526020600020601f850160051c810160208610156123625750805b601f850160051c820191505b818110156123815782815560010161236e565b505050505050565b67ffffffffffffffff8311156123a1576123a161226c565b6123b5836123af83546121d7565b83612339565b6000601f84116001811461240757600085156123d15750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b17835561249d565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b828110156124565786850135825560209485019460019092019101612436565b5086821015612491577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b801515811461088957600080fd5b6000602082840312156124c457600080fd5b8135611da7816124a4565b6000602082840312156124e157600080fd5b8151611da781611fac565b6000602082840312156124fe57600080fd5b813560038110611da757600080fd5b73ffffffffffffffffffffffffffffffffffffffff868116825285811660208301528416604082015260a0810160038410612571577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6060820193909352608001529392505050565b81810381811115611ce3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600080858511156125ce57600080fd5b838611156125db57600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000813581811691601485101561148a5760149490940360031b84901b1690921692915050565b60008251612640818460208701611ede565b9190910192915050565b6000806040838503121561265d57600080fd5b825161266881611fac565b6020939093015192949293505050565b60006020828403121561268a57600080fd5b8151611da7816124a456fea26469706673582212203df6ae877e752365e8ffa9eb6cd82bbcb04d828bec2ed6c9dfbd1226950e258264736f6c63430008180033

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

000000000000000000000000a214a4fc09c42202c404e2976c50373fe5f5b7890000000000000000000000004300000000000000000000000000000000000002000000000000000000000000f237c20584daca970498917470864f4d027de4ca0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800000000000000000000000000454c0c1cf7be9341d82ce0f16979b8689ed4aad0000000000000000000000000ad55f8b65d5738c6f63b54e651a09cc5d873e4d80000000000000000000000005066a1975be96b777dddf57b496397effddcb4a900000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf18000000000000000000000000000000006551c19487814612e58fe0681377575800000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf0000000000000000000000004300000000000000000000000000000000000004

-----Decoded View---------------
Arg [0] : owner_ (address): 0xA214a4fc09C42202C404E2976c50373fE5F5B789
Arg [1] : blast_ (address): 0x4300000000000000000000000000000000000002
Arg [2] : gasCollector_ (address): 0xf237c20584DaCA970498917470864f4d027de4ca
Arg [3] : blastPoints_ (address): 0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800
Arg [4] : pointsOperator_ (address): 0x454c0C1CF7be9341d82ce0F16979B8689ED4AAD0
Arg [5] : multicallForwarder_ (address): 0xAD55F8b65d5738C6f63b54E651A09cC5d873e4d8
Arg [6] : genesisAgentNft_ (address): 0x5066A1975BE96B777ddDf57b496397efFdDcB4A9
Arg [7] : strategyAgentNft_ (address): 0x73E75E837e4F3884ED474988c304dE8A437aCbEf
Arg [8] : explorerAgentNft_ (address): 0xFB0B3C31eAf58743603e8Ee1e122547EC053Bf18
Arg [9] : erc6551Registry_ (address): 0x000000006551c19487814612e58FE06813775758
Arg [10] : agentRegistry_ (address): 0x12F0A3453F63516815fe41c89fAe84d218Af0FAF
Arg [11] : weth_ (address): 0x4300000000000000000000000000000000000004

-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 000000000000000000000000a214a4fc09c42202c404e2976c50373fe5f5b789
Arg [1] : 0000000000000000000000004300000000000000000000000000000000000002
Arg [2] : 000000000000000000000000f237c20584daca970498917470864f4d027de4ca
Arg [3] : 0000000000000000000000002536fe9ab3f511540f2f9e2ec2a805005c3dd800
Arg [4] : 000000000000000000000000454c0c1cf7be9341d82ce0f16979b8689ed4aad0
Arg [5] : 000000000000000000000000ad55f8b65d5738c6f63b54e651a09cc5d873e4d8
Arg [6] : 0000000000000000000000005066a1975be96b777dddf57b496397effddcb4a9
Arg [7] : 00000000000000000000000073e75e837e4f3884ed474988c304de8a437acbef
Arg [8] : 000000000000000000000000fb0b3c31eaf58743603e8ee1e122547ec053bf18
Arg [9] : 000000000000000000000000000000006551c19487814612e58fe06813775758
Arg [10] : 00000000000000000000000012f0a3453f63516815fe41c89fae84d218af0faf
Arg [11] : 0000000000000000000000004300000000000000000000000000000000000004


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
[ Download: CSV Export  ]
[ 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.