creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Storage of the initializable contract.\n     *\n     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n     * when using with upgradeable contracts.\n     *\n     * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n     */\n    struct InitializableStorage {\n        /**\n         * @dev Indicates that the contract has been initialized.\n         */\n        uint64 _initialized;\n        /**\n         * @dev Indicates that the contract is in the process of being initialized.\n         */\n        bool _initializing;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n    /**\n     * @dev The contract is already initialized.\n     */\n    error InvalidInitialization();\n\n    /**\n     * @dev The contract is not initializing.\n     */\n    error NotInitializing();\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint64 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n     * production.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        // Cache values to avoid duplicated sloads\n        bool isTopLevelCall = !$._initializing;\n        uint64 initialized = $._initialized;\n\n        // Allowed calls:\n        // - initialSetup: the contract is not in the initializing state and no previous version was\n        //                 initialized\n        // - construction: the contract is initialized at version 1 (no reininitialization) and the\n        //                 current contract is just being deployed\n        bool initialSetup = initialized == 0 && isTopLevelCall;\n        bool construction = initialized == 1 && address(this).code.length == 0;\n\n        if (!initialSetup && !construction) {\n            revert InvalidInitialization();\n        }\n        $._initialized = 1;\n        if (isTopLevelCall) {\n            $._initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            $._initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint64 version) {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing || $._initialized >= version) {\n            revert InvalidInitialization();\n        }\n        $._initialized = version;\n        $._initializing = true;\n        _;\n        $._initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        _checkInitializing();\n        _;\n    }\n\n    /**\n     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n     */\n    function _checkInitializing() internal view virtual {\n        if (!_isInitializing()) {\n            revert NotInitializing();\n        }\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing) {\n            revert InvalidInitialization();\n        }\n        if ($._initialized != type(uint64).max) {\n            $._initialized = type(uint64).max;\n            emit Initialized(type(uint64).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint64) {\n        return _getInitializableStorage()._initialized;\n    }\n\n    /**\n     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _getInitializableStorage()._initializing;\n    }\n\n    /**\n     * @dev Returns a pointer to the storage namespace.\n     */\n    // solhint-disable-next-line var-name-mixedcase\n    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n        assembly {\n            $.slot := INITIALIZABLE_STORAGE\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard\n    struct ReentrancyGuardStorage {\n        uint256 _status;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {\n        assembly {\n            $.slot := ReentrancyGuardStorageLocation\n        }\n    }\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    function __ReentrancyGuard_init() internal onlyInitializing {\n        __ReentrancyGuard_init_unchained();\n    }\n\n    function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        $._status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if ($._status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        $._status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        $._status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        return $._status == ENTERED;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n */\ninterface IERC1155 is IERC165 {\n    /**\n     * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.\n     */\n    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n    /**\n     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n     * transfers.\n     */\n    event TransferBatch(\n        address indexed operator,\n        address indexed from,\n        address indexed to,\n        uint256[] ids,\n        uint256[] values\n    );\n\n    /**\n     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n     * `approved`.\n     */\n    event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n    /**\n     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n     *\n     * If an {URI} event was emitted for `id`, the standard\n     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n     * returned by {IERC1155MetadataURI-uri}.\n     */\n    event URI(string value, uint256 indexed id);\n\n    /**\n     * @dev Returns the value of tokens of token type `id` owned by `account`.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function balanceOf(address account, uint256 id) external view returns (uint256);\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n     *\n     * Requirements:\n     *\n     * - `accounts` and `ids` must have the same length.\n     */\n    function balanceOfBatch(\n        address[] calldata accounts,\n        uint256[] calldata ids\n    ) external view returns (uint256[] memory);\n\n    /**\n     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n     *\n     * Emits an {ApprovalForAll} event.\n     *\n     * Requirements:\n     *\n     * - `operator` cannot be the caller.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n     *\n     * See {setApprovalForAll}.\n     */\n    function isApprovedForAll(address account, address operator) external view returns (bool);\n\n    /**\n     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.\n     *\n     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\n     * to an untrusted contract, when invoking {onERC1155Received} on the receiver.\n     * Ensure to follow the checks-effects-interactions pattern and consider employing\n     * reentrancy guards when interacting with untrusted contracts.\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n     * - `from` must have a balance of tokens of type `id` of at least `value` amount.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n     * acceptance magic value.\n     */\n    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n     *\n     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens\n     * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.\n     * Ensure to follow the checks-effects-interactions pattern and consider employing\n     * reentrancy guards when interacting with untrusted contracts.\n     *\n     * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.\n     *\n     * Requirements:\n     *\n     * - `ids` and `values` must have the same length.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n     * acceptance magic value.\n     */\n    function safeBatchTransferFrom(\n        address from,\n        address to,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external;\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface that must be implemented by smart contracts in order to receive\n * ERC-1155 token transfers.\n */\ninterface IERC1155Receiver is IERC165 {\n    /**\n     * @dev Handles the receipt of a single ERC1155 token type. This function is\n     * called at the end of a `safeTransferFrom` after the balance has been updated.\n     *\n     * NOTE: To accept the transfer, this must return\n     * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n     * (i.e. 0xf23a6e61, or its own function selector).\n     *\n     * @param operator The address which initiated the transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param id The ID of the token being transferred\n     * @param value The amount of tokens being transferred\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n     */\n    function onERC1155Received(\n        address operator,\n        address from,\n        uint256 id,\n        uint256 value,\n        bytes calldata data\n    ) external returns (bytes4);\n\n    /**\n     * @dev Handles the receipt of a multiple ERC1155 token types. This function\n     * is called at the end of a `safeBatchTransferFrom` after the balances have\n     * been updated.\n     *\n     * NOTE: To accept the transfer(s), this must return\n     * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n     * (i.e. 0xbc197c81, or its own function selector).\n     *\n     * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param ids An array containing ids of each token being transferred (order and length must match values array)\n     * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n     */\n    function onERC1155BatchReceived(\n        address operator,\n        address from,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165, ERC165} from \"../../../utils/introspection/ERC165.sol\";\nimport {IERC1155Receiver} from \"../IERC1155Receiver.sol\";\n\n/**\n * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\n *\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\n * stuck.\n */\nabstract contract ERC1155Holder is ERC165, IERC1155Receiver {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    function onERC1155Received(\n        address,\n        address,\n        uint256,\n        uint256,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155Received.selector;\n    }\n\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155BatchReceived.selector;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n     *   {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n     * reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721Receiver} from \"../IERC721Receiver.sol\";\n\n/**\n * @dev Implementation of the {IERC721Receiver} interface.\n *\n * Accepts all token transfers.\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or\n * {IERC721-setApprovalForAll}.\n */\nabstract contract ERC721Holder is IERC721Receiver {\n    /**\n     * @dev See {IERC721Receiver-onERC721Received}.\n     *\n     * Always returns `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert FailedInnerCall();\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/errors/AddressError.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title Library for address related errors.\n */\nlibrary AddressError {\n    /**\n     * @dev Thrown when a zero address was passed as a function parameter (0x0000000000000000000000000000000000000000).\n     */\n    error ZeroAddress();\n\n    /**\n     * @dev Thrown when an address representing a contract is expected, but no code is found at the address.\n     * @param contr The address that was expected to be a contract.\n     */\n    error NotAContract(address contr);\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/errors/ChangeError.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title Library for change related errors.\n */\nlibrary ChangeError {\n    /**\n     * @dev Thrown when a change is expected but none is detected.\n     */\n    error NoChange();\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/interfaces/IUUPSImplementation.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title Contract to be used as the implementation of a Universal Upgradeable Proxy Standard (UUPS) proxy.\n *\n * Important: A UUPS proxy requires its upgradeability functions to be in the implementation as opposed to the proxy. This means that if the proxy is upgraded to an implementation that does not support this interface, it will no longer be upgradeable.\n */\ninterface IUUPSImplementation {\n    /**\n     * @notice Thrown when an incoming implementation will not be able to receive future upgrades.\n     */\n    error ImplementationIsSterile(address implementation);\n\n    /**\n     * @notice Thrown intentionally when testing future upgradeability of an implementation.\n     */\n    error UpgradeSimulationFailed();\n\n    /**\n     * @notice Emitted when the implementation of the proxy has been upgraded.\n     * @param self The address of the proxy whose implementation was upgraded.\n     * @param implementation The address of the proxy's new implementation.\n     */\n    event Upgraded(address indexed self, address implementation);\n\n    /**\n     * @notice Allows the proxy to be upgraded to a new implementation.\n     * @param newImplementation The address of the proxy's new implementation.\n     * @dev Will revert if `newImplementation` is not upgradeable.\n     * @dev The implementation of this function needs to be protected by some sort of access control such as `onlyOwner`.\n     */\n    function upgradeTo(address newImplementation) external;\n\n    /**\n     * @notice Function used to determine if a new implementation will be able to receive future upgrades in `upgradeTo`.\n     * @param newImplementation The address of the new implementation being tested for future upgradeability.\n     * @dev This function will always revert, but will revert with different error messages. The function `upgradeTo` uses this error to determine the future upgradeability of the implementation in question.\n     */\n    function simulateUpgradeTo(address newImplementation) external;\n\n    /**\n     * @notice Retrieves the current implementation of the proxy.\n     * @return The address of the current implementation.\n     */\n    function getImplementation() external view returns (address);\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/proxy/ProxyStorage.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\ncontract ProxyStorage {\n    bytes32 private constant _SLOT_PROXY_STORAGE =\n        keccak256(abi.encode(\"io.synthetix.core-contracts.Proxy\"));\n\n    struct ProxyStore {\n        address implementation;\n        bool simulatingUpgrade;\n    }\n\n    function _proxyStore() internal pure returns (ProxyStore storage store) {\n        bytes32 s = _SLOT_PROXY_STORAGE;\n        assembly {\n            store.slot := s\n        }\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/proxy/UUPSImplementation.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\nimport \"../interfaces/IUUPSImplementation.sol\";\nimport \"../errors/AddressError.sol\";\nimport \"../errors/ChangeError.sol\";\nimport \"../utils/AddressUtil.sol\";\nimport \"./ProxyStorage.sol\";\n\nabstract contract UUPSImplementation is IUUPSImplementation, ProxyStorage {\n    /**\n     * @inheritdoc IUUPSImplementation\n     */\n    function simulateUpgradeTo(address newImplementation) public override {\n        ProxyStore storage store = _proxyStore();\n\n        store.simulatingUpgrade = true;\n\n        address currentImplementation = store.implementation;\n        store.implementation = newImplementation;\n\n        (bool rollbackSuccessful, ) = newImplementation.delegatecall(\n            abi.encodeCall(this.upgradeTo, (currentImplementation))\n        );\n\n        if (!rollbackSuccessful || _proxyStore().implementation != currentImplementation) {\n            revert UpgradeSimulationFailed();\n        }\n\n        store.simulatingUpgrade = false;\n\n        // solhint-disable-next-line reason-string\n        revert();\n    }\n\n    /**\n     * @inheritdoc IUUPSImplementation\n     */\n    function getImplementation() external view override returns (address) {\n        return _proxyStore().implementation;\n    }\n\n    function _upgradeTo(address newImplementation) internal virtual {\n        if (newImplementation == address(0)) {\n            revert AddressError.ZeroAddress();\n        }\n\n        if (!AddressUtil.isContract(newImplementation)) {\n            revert AddressError.NotAContract(newImplementation);\n        }\n\n        ProxyStore storage store = _proxyStore();\n\n        if (newImplementation == store.implementation) {\n            revert ChangeError.NoChange();\n        }\n\n        if (!store.simulatingUpgrade && _implementationIsSterile(newImplementation)) {\n            revert ImplementationIsSterile(newImplementation);\n        }\n\n        store.implementation = newImplementation;\n\n        emit Upgraded(address(this), newImplementation);\n    }\n\n    function _implementationIsSterile(\n        address candidateImplementation\n    ) internal virtual returns (bool) {\n        (bool simulationReverted, bytes memory simulationResponse) = address(this).delegatecall(\n            abi.encodeCall(this.simulateUpgradeTo, (candidateImplementation))\n        );\n\n        return\n            !simulationReverted &&\n            keccak256(abi.encodePacked(simulationResponse)) ==\n            keccak256(abi.encodePacked(UpgradeSimulationFailed.selector));\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/AddressUtil.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\nlibrary AddressUtil {\n    function isContract(address account) internal view returns (bool) {\n        uint256 size;\n\n        assembly {\n            size := extcodesize(account)\n        }\n\n        return size > 0;\n    }\n}\n"
      },
      "src/accounts/utils/RequestTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\ncontract RequestTypes {\n    struct Request {\n        address _address;\n        address _address2;\n        uint256 _uint256;\n        bytes32 _nonce;\n        uint32 _uint32;\n        bool _bool;\n        bytes4 _selector;\n    }\n}\n"
      },
      "src/apps/base/AppAccountBase.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { ERC165 } from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport { ERC721Holder } from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\nimport { ERC1155Holder } from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\";\nimport { ReentrancyGuardUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport { IUUPSImplementation } from \"@synthetixio/core-contracts/contracts/interfaces/IUUPSImplementation.sol\";\nimport { UUPSImplementation } from \"@synthetixio/core-contracts/contracts/proxy/UUPSImplementation.sol\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport { IERC721 } from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport { IERC1155 } from \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\n\nimport { IAppAccountBase } from \"src/interfaces/apps/base/IAppAccountBase.sol\";\nimport { IAppBeaconBase } from \"src/interfaces/apps/base/IAppBeaconBase.sol\";\n\nimport { AppBase } from \"src/apps/base/AppBase.sol\";\nimport { AppSecurityModifiers } from \"src/apps/base/AppSecurityModifiers.sol\";\n\nabstract contract AppAccountBase is\n    IAppAccountBase,\n    UUPSImplementation,\n    AppSecurityModifiers,\n    ERC165,\n    ERC721Holder,\n    ERC1155Holder,\n    ReentrancyGuardUpgradeable\n{\n    /*///////////////////////////////////////////////////////////////\n                                FALLBACK\n    ///////////////////////////////////////////////////////////////*/\n\n    receive() external payable { }\n\n    /*///////////////////////////////////////////////////////////////\n                                CONSTRUCTOR\n    ///////////////////////////////////////////////////////////////*/\n\n    constructor() {\n        _disableInitializers();\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                INITIALIZER\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Initialize the app account with the main account and the app beacon.\n     * @param _mainAccount the address of the main account, this is the owner of the app.\n     * @param _appBeacon the beacon for the app account.\n     */\n    function initialize(address _mainAccount, address _appBeacon) external virtual initializer {\n        AppBase._setMainAccount(_mainAccount);\n        if (!IERC165(_appBeacon).supportsInterface(type(IAppBeaconBase).interfaceId)) {\n            revert InvalidAppBeacon();\n        }\n        AppBase._setAppBeacon(_appBeacon);\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                VIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, ERC1155Holder) returns (bool) {\n        return interfaceId == type(IAppAccountBase).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @notice Returns the app version number of the app account.\n     * @return A uint64 representing the version of the app.\n     * @dev NOTE: This number must be updated whenever a new version is deployed.\n     * The number should always only be incremented by 1.\n     */\n    function appVersion() public pure virtual returns (uint64) {\n        return 1;\n    }\n\n    /**\n     * @notice Get the app's main account.\n     * @return The main account associated with this app.\n     */\n    function getMainAccount() external view returns (address) {\n        return AppBase._getMainAccount();\n    }\n\n    /**\n     * @notice Get the app config beacon.\n     * @return The app config beacon address.\n     */\n    function getAppBeacon() external view returns (address) {\n        return AppBase._getAppBeacon();\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                            MUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Transfer Ether to the main account from the app account.\n     * @param _amount The amount of Ether to transfer.\n     */\n    function transferEtherToMainAccount(uint256 _amount) external nonReentrant requiresAuthorizedOperationsParty {\n        _transferEtherToMainAccount(_amount);\n    }\n\n    /**\n     * @notice Transfer ERC20 tokens to the main account from the app account.\n     * @param _token The address of the ERC20 token.\n     * @param _amount The amount of tokens to transfer.\n     */\n    function transferERC20ToMainAccount(address _token, uint256 _amount) external nonReentrant requiresAuthorizedOperationsParty {\n        _transferERC20ToMainAccount(_token, _amount);\n    }\n\n    /**\n     * @notice Transfer ERC721 tokens to the main account from the app account.\n     * @param _token The address of the ERC721 token.\n     * @param _tokenId The token ID to transfer.\n     */\n    function transferERC721ToMainAccount(address _token, uint256 _tokenId) external nonReentrant requiresAuthorizedOperationsParty {\n        _transferERC721ToMainAccount(_token, _tokenId);\n    }\n\n    /**\n     * @notice Transfer ERC1155 tokens to the main account from the app account.\n     * @param _token The address of the ERC1155 token.\n     * @param _tokenId The token ID to transfer.\n     * @param _amount The amount of tokens to transfer.\n     * @param _data Additional data to pass in the transfer.\n     */\n    function transferERC1155ToMainAccount(address _token, uint256 _tokenId, uint256 _amount, bytes calldata _data)\n        external\n        nonReentrant\n        requiresAuthorizedOperationsParty\n    {\n        _transferERC1155ToMainAccount(_token, _tokenId, _amount, _data);\n    }\n\n    /**\n     * @notice Transfers batch ERC1155 tokens to the main account from the app account.\n     * @param _token The address of the ERC1155 token.\n     * @param _ids The IDs of the ERC1155 tokens.\n     * @param _amounts The amounts of the ERC1155 tokens.\n     * @param _data Data to send with the transfer.\n     */\n    function transferERC1155BatchToMainAccount(\n        address _token,\n        uint256[] calldata _ids,\n        uint256[] calldata _amounts,\n        bytes calldata _data\n    ) external nonReentrant requiresAuthorizedOperationsParty {\n        _transferERC1155BatchToMainAccount(_token, _ids, _amounts, _data);\n    }\n\n    /**\n     * @notice Recovers all ether in the app account to the main account.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverEtherToMainAccount() external requiresAuthorizedRecoveryParty nonReentrant {\n        emit EtherRecoveredToMainAccount(address(this).balance);\n        _transferEtherToMainAccount(address(this).balance);\n    }\n\n    /**\n     * @notice Recovers the full balance of an ERC20 token to the main account.\n     * @param _token The address of the token to be recovered to the main account.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC20ToMainAccount(address _token) public nonReentrant requiresAuthorizedRecoveryParty {\n        uint256 balance = IERC20(_token).balanceOf(address(this));\n        emit ERC20RecoveredToMainAccount(_token, balance);\n        _transferERC20ToMainAccount(_token, balance);\n    }\n\n    /**\n     * @notice Recovers a specified ERC721 token to the main account.\n     * @param _token The ERC721 token address to recover.\n     * @param _tokenId The ID of the ERC721 token to recover.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC721ToMainAccount(address _token, uint256 _tokenId) external requiresAuthorizedRecoveryParty nonReentrant {\n        emit ERC721RecoveredToMainAccount(_token, _tokenId);\n        _transferERC721ToMainAccount(_token, _tokenId);\n    }\n\n    /**\n     * @notice Recovers a specified ERC1155 token to the main account.\n     * @param _token The ERC1155 token address to recover.\n     * @param _tokenId The id of the token to recover.\n     * @param _data The data for the transaction.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC1155ToMainAccount(address _token, uint256 _tokenId, bytes calldata _data)\n        external\n        requiresAuthorizedRecoveryParty\n        nonReentrant\n    {\n        uint256 balance = IERC1155(_token).balanceOf(address(this), _tokenId);\n        emit ERC1155RecoveredToMainAccount(_token, _tokenId, balance, _data);\n        _transferERC1155ToMainAccount(_token, _tokenId, balance, _data);\n    }\n\n    /**\n     * @notice Recovers multiple ERC1155 tokens to the main account.\n     * @param _token The address of the ERC1155 token.\n     * @param _tokenIds The IDs of the ERC1155 tokens.\n     * @param _amounts The values of the ERC1155 tokens.\n     * @param _data Data to send with the transfer.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC1155BatchToMainAccount(\n        address _token,\n        uint256[] calldata _tokenIds,\n        uint256[] calldata _amounts,\n        bytes calldata _data\n    ) external requiresAuthorizedRecoveryParty nonReentrant {\n        emit ERC1155BatchRecoveredToMainAccount(_token, _tokenIds, _amounts, _data);\n        _transferERC1155BatchToMainAccount(_token, _tokenIds, _amounts, _data);\n    }\n\n    /**\n     * @notice Upgrade to a new account implementation\n     * @param _newImplementation The address of the new account implementation\n     * @dev when this function is called, the UUPSImplementation contract will do\n     * a simulation of the upgrade. If the simulation fails, the upgrade will not be performed.\n     * So when simulatingUpgrade is true, we bypass the security logic as the way the simulation is\n     * done would always revert.\n     * @dev NOTE: DO NOT CALL THIS FUNCTION DIRECTLY. USE upgradeAppVersion INSTEAD.\n     */\n    function upgradeTo(address _newImplementation) public {\n        /// @dev if we are in the middle of a simulation, then we use the default _upgradeTo function\n        if (_proxyStore().simulatingUpgrade) {\n            _upgradeTo(_newImplementation);\n            return;\n        }\n        /// @dev if not in a simulation, then we perform the actual upgrade\n        _upgradeToLatestImplementation(_newImplementation);\n    }\n\n    /**\n     * @notice Upgrade the app account to the latest implementation and beacon.\n     * @param _appBeacon The address of the new app beacon.\n     * @param _latestAppImplementation The address of the latest app implementation.\n     * @dev Requires the sender to be the main account.\n     */\n    function upgradeAppVersion(address _appBeacon, address _latestAppImplementation) external {\n        if (_appBeacon != AppBase._getAppBeacon()) {\n            _updateAppBeacon(_appBeacon);\n        }\n        if (_latestAppImplementation != IUUPSImplementation(address(this)).getImplementation()) {\n            upgradeTo(_latestAppImplementation);\n        }\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                INTERNAL FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Upgrade the account implementation to the latest version\n     * @dev Checks are done in the main account\n     * @dev requires the sender to be the main account\n     */\n    function _upgradeToLatestImplementation(address _newImplementation) internal virtual requiresMainAccountSender {\n        _upgradeTo(_newImplementation);\n    }\n\n    /**\n     * @notice Updates the app beacon to the latest beacon as set in the current beacon.\n     * @dev requires the sender to be the main account\n     */\n    function _updateAppBeacon(address _newAppBeacon) internal requiresMainAccountSender {\n        AppBase._setAppBeacon(_newAppBeacon);\n    }\n\n    /**\n     * @notice Transfer Ether to the main account from the app account.\n     * @param _amount The amount of Ether to transfer.\n     */\n    function _transferEtherToMainAccount(uint256 _amount) internal {\n        emit EtherTransferredToMainAccount(_amount);\n        (bool success,) = payable(AppBase._getMainAccount()).call{ value: _amount }(\"\");\n        if (!success) revert ETHTransferFailed();\n    }\n\n    /**\n     * @notice Transfer ERC20 tokens to the main account from the app account.\n     * @param _token The address of the ERC20 token.\n     * @param _amount The amount of tokens to transfer.\n     */\n    function _transferERC20ToMainAccount(address _token, uint256 _amount) internal {\n        emit ERC20TransferredToMainAccount(_token, _amount);\n        SafeERC20.safeTransfer(IERC20(_token), AppBase._getMainAccount(), _amount);\n    }\n\n    /**\n     * @notice Transfer ERC721 tokens to the main account from the app account.\n     * @param _token The address of the ERC721 token.\n     * @param _tokenId The token ID to transfer.\n     */\n    function _transferERC721ToMainAccount(address _token, uint256 _tokenId) internal {\n        emit ERC721TransferredToMainAccount(_token, _tokenId);\n        IERC721(_token).safeTransferFrom(address(this), AppBase._getMainAccount(), _tokenId);\n    }\n\n    /**\n     * @notice Transfer ERC1155 tokens to the main account from the app account.\n     * @param _token The address of the ERC1155 token.\n     * @param _tokenId The token ID to transfer.\n     * @param _amount The amount of tokens to transfer.\n     * @param _data Additional data to pass in the transfer.\n     */\n    function _transferERC1155ToMainAccount(address _token, uint256 _tokenId, uint256 _amount, bytes calldata _data) internal {\n        emit ERC1155TransferredToMainAccount(_token, _tokenId, _amount, _data);\n        IERC1155(_token).safeTransferFrom(address(this), AppBase._getMainAccount(), _tokenId, _amount, _data);\n    }\n\n    /**\n     * @notice Transfers multiple ERC1155 tokens to the main account from the app account.\n     * @param _token The address of the ERC1155 token.\n     * @param _tokenIds The IDs of the ERC1155 token.\n     * @param _amounts The amounts of tokens to transfer.\n     * @param _data Data to send with the transfer.\n     */\n    function _transferERC1155BatchToMainAccount(\n        address _token,\n        uint256[] calldata _tokenIds,\n        uint256[] calldata _amounts,\n        bytes calldata _data\n    ) internal {\n        emit ERC1155BatchTransferredToMainAccount(_token, _tokenIds, _amounts, _data);\n        IERC1155(_token).safeBatchTransferFrom(address(this), AppBase._getMainAccount(), _tokenIds, _amounts, _data);\n    }\n}\n"
      },
      "src/apps/base/AppBase.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { Error } from \"src/libraries/Error.sol\";\n\n/**\n * @title AppBase storage struct\n */\nlibrary AppBase {\n    struct Data {\n        address mainAccount; // main account address\n        address appBeacon; // Address of beacon for app configuration\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tEVENTS / ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    event MainAccountSet(address mainAccount);\n    event AppBeaconSet(address appBeacon);\n\n    /**\n     * @dev Returns the account stored at the specified account id.\n     */\n    function getStorage() internal pure returns (Data storage data) {\n        bytes32 s = keccak256(abi.encode(\"io.infinex.AppBase\"));\n        assembly {\n            data.slot := s\n        }\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                VIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Get the Main Account.\n     * @return The Main Account address.\n     */\n    function _getMainAccount() internal view returns (address) {\n        Data storage data = getStorage();\n        return data.mainAccount;\n    }\n\n    /**\n     * @notice Get the App Beacon.\n     * @return The App Beacon.\n     */\n    function _getAppBeacon() internal view returns (address) {\n        Data storage data = getStorage();\n        return data.appBeacon;\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                MUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Set the Main Account address.\n     * @param _mainAccount The address to be set as Main Account.\n     */\n    function _setMainAccount(address _mainAccount) internal {\n        Data storage data = getStorage();\n        if (_mainAccount == address(0)) revert Error.NullAddress();\n        emit MainAccountSet(_mainAccount);\n        data.mainAccount = _mainAccount;\n    }\n\n    /**\n     * @notice Set an app beacon for the account.\n     * @param _appBeacon The app beacon associated with the account.\n     */\n    function _setAppBeacon(address _appBeacon) internal {\n        Data storage data = getStorage();\n        if (_appBeacon == address(0)) revert Error.NullAddress();\n        emit AppBeaconSet(_appBeacon);\n        data.appBeacon = _appBeacon;\n    }\n}\n"
      },
      "src/apps/base/AppERC2771Context.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\n// SPDX-License-Identifier: MIT\n// Originally sourced from OpenZeppelin Contracts (last updated v4.9.3) (metatx/ERC2771Context.sol)\npragma solidity ^0.8.21;\n\nimport { AppBase } from \"src/apps/base/AppBase.sol\";\nimport { IBaseModule } from \"src/interfaces/accounts/IBaseModule.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nlibrary AppERC2771Context {\n    function _msgSender() internal view returns (address) {\n        uint256 calldataLength = msg.data.length;\n        uint256 contextSuffixLength = _contextSuffixLength();\n        if (_isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {\n            return address(bytes20(msg.data[calldataLength - contextSuffixLength:]));\n        } else {\n            return msg.sender;\n        }\n    }\n\n    // slither-disable-start dead-code\n    function _msgData() internal view returns (bytes calldata) {\n        uint256 calldataLength = msg.data.length;\n        uint256 contextSuffixLength = _contextSuffixLength();\n        if (_isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {\n            return msg.data[:calldataLength - contextSuffixLength];\n        } else {\n            return msg.data;\n        }\n    }\n\n    /**\n     * @notice Checks if a forwarder is trusted.\n     * @param forwarder The address of the forwarder to check.\n     * @return A boolean indicating whether the forwarder is trusted or not.\n     */\n    function _isTrustedForwarder(address forwarder) internal view returns (bool) {\n        return IBaseModule(AppBase._getMainAccount()).isTrustedForwarder(forwarder);\n    }\n\n    /**\n     * @dev ERC-2771 specifies the context as being a single address (20 bytes).\n     */\n    function _contextSuffixLength() internal pure returns (uint256) {\n        return 20;\n    }\n    // slither-disable-end dead-code\n}\n"
      },
      "src/apps/base/AppSecurityModifiers.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { AppERC2771Context } from \"src/apps/base/AppERC2771Context.sol\";\nimport { AppBase } from \"src/apps/base/AppBase.sol\";\n\nimport { IAccountUtilsModule } from \"src/interfaces/accounts/IAccountUtilsModule.sol\";\n\ncontract AppSecurityModifiers {\n    /*///////////////////////////////////////////////////////////////\n                                ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    error InvalidKeySignature(address from);\n\n    /*///////////////////////////////////////////////////////////////\n                            SECURITY CHECK MODIFIERS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Modifier to check if the sender is the main account.\n     */\n    modifier requiresMainAccountSender() {\n        if (msg.sender != AppBase._getMainAccount()) {\n            revert InvalidKeySignature(msg.sender);\n        }\n\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is an sudo key.\n     */\n    modifier requiresSudoKeySender() {\n        if (!_isValidSudoKey(AppERC2771Context._msgSender())) {\n            revert InvalidKeySignature(AppERC2771Context._msgSender());\n        }\n\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is a sudo or operation key.\n     * If not, it reverts with an error message.\n     */\n    modifier requiresAuthorizedOperationsParty() {\n        if (!_isAuthorizedOperationsParty(AppERC2771Context._msgSender())) {\n            revert InvalidKeySignature(AppERC2771Context._msgSender());\n        }\n\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is an sudo key, a recovery key or a trusted recovery keeper.\n     * If not, it reverts with an error message.\n     */\n    modifier requiresAuthorizedRecoveryParty() {\n        if (!_isAuthorizedRecoveryParty(AppERC2771Context._msgSender())) {\n            revert InvalidKeySignature(AppERC2771Context._msgSender());\n        }\n\n        _;\n    }\n\n    /**\n     * @notice Validate with the parent account if a key is a sudoKey.\n     * @param _key The key to check.\n     */\n    function _isValidSudoKey(address _key) internal view returns (bool) {\n        return IAccountUtilsModule(AppBase._getMainAccount()).isValidSudoKey(_key);\n    }\n\n    /**\n     * @notice Validate with the parent account if a key is an authorized operations party.\n     * @param _key The key to check.\n     */\n    function _isAuthorizedOperationsParty(address _key) internal view returns (bool) {\n        return IAccountUtilsModule(AppBase._getMainAccount()).isAuthorizedOperationsParty(_key);\n    }\n\n    /**\n     * @notice Validate with the parent account if a key is an authorized recovery party.\n     * @param _key The key to check.\n     */\n    function _isAuthorizedRecoveryParty(address _key) internal view returns (bool) {\n        return IAccountUtilsModule(AppBase._getMainAccount()).isAuthorizedRecoveryParty(_key);\n    }\n}\n"
      },
      "src/apps/curve/CurveAppError.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nlibrary CurveAppError {\n    /*///////////////////////////////////////////////////////////////\n                                GENERIC\n    ///////////////////////////////////////////////////////////////*/\n\n    error TokenIndexMismatch();\n    error InvalidPoolAddress(address poolAddress);\n    error UnsupportedPool(address poolAddress);\n    error InvalidToken();\n    error ZeroAddress();\n}\n"
      },
      "src/apps/curve/CurveStableSwapApp.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport { AppAccountBase } from \"src/apps/base/AppAccountBase.sol\";\nimport { AppBase } from \"src/apps/base/AppBase.sol\";\nimport { CurveAppError } from \"src/apps/curve/CurveAppError.sol\";\n\nimport { ICurveStableSwapApp } from \"src/interfaces/curve/ICurveStableSwapApp.sol\";\nimport { ICurveStableSwapAppBeacon } from \"src/interfaces/curve/ICurveStableSwapAppBeacon.sol\";\nimport { ICurveStableSwapNG } from \"src/interfaces/curve/ICurveStableSwapNG.sol\";\nimport { ICurveStableSwapFactoryNG } from \"src/interfaces/curve/ICurveStableSwapFactoryNG.sol\";\n\ncontract CurveStableSwapApp is AppAccountBase, ICurveStableSwapApp {\n    using SafeERC20 for IERC20;\n\n    constructor() {\n        _disableInitializers();\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tMUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Allows the authorized operations party to exchange tokens on the stable swap pool.\n     * @param _stableSwapPool The address of the stable swap pool.\n     * @param _fromToken The address of the ERC20 token provided to exchange.\n     * @param _toToken The address of the ERC20 token to receive from the exchange.\n     * @param _fromAmount The amount of tokens to exchange.\n     * @param _minToAmount The minimum amount of tokens to receive.\n     */\n    function exchange(address _stableSwapPool, address _fromToken, address _toToken, uint256 _fromAmount, uint256 _minToAmount)\n        external\n        nonReentrant\n        requiresAuthorizedOperationsParty\n    {\n        _validatePoolAddress(_stableSwapPool);\n        // convert token addresses to pool indices, reverts if pool and tokens aren't valid\n        (int128 fromTokenIndex, int128 toTokenIndex,) = ICurveStableSwapFactoryNG(_getAppBeacon().curveStableswapFactoryNG())\n            .get_coin_indices(_stableSwapPool, _fromToken, _toToken);\n        IERC20(_fromToken).approve(_stableSwapPool, _fromAmount);\n        uint256 receivedAmount = ICurveStableSwapNG(_stableSwapPool).exchange(fromTokenIndex, toTokenIndex, _fromAmount, _minToAmount);\n        emit TokensExchanged(_stableSwapPool, _fromToken, _toToken, _fromAmount, receivedAmount);\n    }\n\n    /**\n     * @notice Adds liquidity to the specified pool\n     * @dev The arrays indices have to match the indices of the tokens in the pool.\n     * @param _stableSwapPool The address of the pool to add liquidity to.\n     * @param _tokens An array of token addresses to add as liquidity.\n     * @param _amounts An array of token amounts to add as liquidity.\n     * @param _minLPAmount The minimum amount of LP tokens to receive.\n     */\n    function addLiquidity(address _stableSwapPool, address[] calldata _tokens, uint256[] calldata _amounts, uint256 _minLPAmount)\n        external\n        nonReentrant\n        requiresAuthorizedOperationsParty\n    {\n        _validatePoolAddress(_stableSwapPool);\n        address[] memory coins = ICurveStableSwapFactoryNG(_getAppBeacon().curveStableswapFactoryNG()).get_coins(_stableSwapPool);\n        // check and approve the pool to add the tokens as liquidity\n        for (uint256 i = 0; i < _tokens.length; i++) {\n            if (coins[i] != _tokens[i]) revert CurveAppError.InvalidToken();\n            IERC20(_tokens[i]).approve(_stableSwapPool, _amounts[i]);\n        }\n\n        // provide the liquidity\n        uint256 lpAmount = ICurveStableSwapNG(_stableSwapPool).add_liquidity(_amounts, _minLPAmount);\n        emit LiquidityAdded(_stableSwapPool, _amounts, lpAmount);\n    }\n\n    /**\n     * @notice Removes liquidity for a single token from the Curve stable swap pool.\n     * @param _stableSwapPool The address of the Curve stable swap pool.\n     * @param _tokenIndex The index of the token to remove liquidity.\n     * @param _lpAmount The amount of LP tokens to burn.\n     * @param _minReceiveAmount The minimum amount of tokens to receive in return.\n     * @return The amount of tokens received after removing liquidity.\n     */\n    function removeSingleTokenLiquidity(address _stableSwapPool, int128 _tokenIndex, uint256 _lpAmount, uint256 _minReceiveAmount)\n        external\n        nonReentrant\n        requiresAuthorizedOperationsParty\n        returns (uint256)\n    {\n        return _removeSingleTokenLiquidity(_stableSwapPool, _tokenIndex, _lpAmount, _minReceiveAmount);\n    }\n\n    /**\n     * @notice Withdraw coins from a Curve stable swap pool in an imbalanced amount.\n     * @param _stableSwapPool The address of the Curve stable swap pool.\n     * @param _lpAmount The max amount of LP tokens to burn.\n     * @param _amounts The amount of tokens to receive in return.\n     */\n    function removeLiquidityImbalance(address _stableSwapPool, uint256 _lpAmount, uint256[] calldata _amounts)\n        external\n        nonReentrant\n        requiresAuthorizedOperationsParty\n    {\n        _removeLiquidityImbalance(_stableSwapPool, _lpAmount, _amounts);\n    }\n\n    /**\n     * @notice Swaps ERC20 tokens to USDC at the current exchange amount and then recovers to mainAccount\n     * @param _stableSwapPool The address of the stable swap pool.\n     * @param _fromToken The address of the ERC20 token to recover.\n     * @param _minToAmount The minimum amount of USDC to receive.\n     * @dev This function must be called by an authorized recovery party.\n     */\n    function recoverERC20ToUSDC(address _stableSwapPool, address _fromToken, uint256 _minToAmount)\n        external\n        nonReentrant\n        requiresAuthorizedRecoveryParty\n    {\n        _validatePoolAddress(_stableSwapPool);\n        uint256 balance = IERC20(_fromToken).balanceOf(address(this));\n        ICurveStableSwapAppBeacon appBeacon = _getAppBeacon();\n        address USDC = appBeacon.USDC();\n        // convert token addresses to pool indices, reverts if pool and tokens aren't valid\n        (int128 fromTokenIndex, int128 toTokenIndex,) =\n            ICurveStableSwapFactoryNG(_getAppBeacon().curveStableswapFactoryNG()).get_coin_indices(_stableSwapPool, _fromToken, USDC);\n        IERC20(_fromToken).approve(_stableSwapPool, balance);\n        // swap to USDC\n        uint256 receivedAmount = ICurveStableSwapNG(_stableSwapPool).exchange(fromTokenIndex, toTokenIndex, balance, _minToAmount);\n        emit TokensExchanged(_stableSwapPool, _fromToken, USDC, balance, receivedAmount);\n        uint256 USDCRecoverBalance = IERC20(USDC).balanceOf(address(this));\n        emit ERC20RecoveredToMainAccount(USDC, USDCRecoverBalance);\n        _transferERC20ToMainAccount(USDC, USDCRecoverBalance);\n    }\n\n    /**\n     * @notice Removes all Liquidity as USDC with specified slippage amount and then recovers to mainAccount\n     * @param _LPToken The address of the pool to remove liquidity from.\n     * @param _USDCIndex The address of the LP token and pool to recover from.\n     * @param _minReceiveAmount The minimum amount of USDC to receive.\n     * @dev This function must be called by an authorized recovery party.\n     */\n    function recoverUSDCFromLP(address _LPToken, int128 _USDCIndex, uint256 _minReceiveAmount)\n        external\n        nonReentrant\n        requiresAuthorizedRecoveryParty\n    {\n        // pool address is validated by _removeSingleTokenLiquidity\n        ICurveStableSwapAppBeacon appBeacon = _getAppBeacon();\n        address USDC = appBeacon.USDC();\n\n        if (ICurveStableSwapNG(_LPToken).coins(uint256(uint128(_USDCIndex))) != USDC) revert CurveAppError.TokenIndexMismatch();\n\n        // recover funds\n        uint256 lpBalance = IERC20(_LPToken).balanceOf(address(this));\n\n        // the LP token is the pool address\n        uint256 USDCRemoved = _removeSingleTokenLiquidity(_LPToken, _USDCIndex, lpBalance, _minReceiveAmount);\n\n        emit ERC20RecoveredToMainAccount(USDC, USDCRemoved);\n        _transferERC20ToMainAccount(USDC, IERC20(USDC).balanceOf(address(this)));\n    }\n\n    /**\n     * @notice Removes a single token from an LP for the purpose of recovery\n     * @param _LPToken The address of the LP token/pool to remove liquidity from.\n     * @param _tokenIndex The index of the token to remove from the liquidity pool\n     * @param _minToAmount The minimum amount of token to withdraw from the liquidity pool.\n     * @dev This function must be called by an authorized recovery party.\n     */\n    function recoverERC20FromLP(address _LPToken, int128 _tokenIndex, uint256 _minToAmount)\n        external\n        nonReentrant\n        requiresAuthorizedRecoveryParty\n    {\n        // pool address is validated by _removeSingleTokenLiquidity\n        // remove token from pool\n        uint256 lpBalance = IERC20(_LPToken).balanceOf(address(this));\n        _removeSingleTokenLiquidity(_LPToken, _tokenIndex, lpBalance, _minToAmount);\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                INTERNAL FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Removes liquidity for a single token from the Curve stable swap pool.\n     * @param _stableSwapPool The address of the Curve stable swap pool.\n     * @param _tokenIndex The index of the token to remove liquidity for.\n     * @param _lpAmount The amount of LP tokens to burn.\n     * @param _minReceiveAmount The minimum amount of tokens to receive in return.\n     * @return amountRemoved The amount of tokens that were removed from the pool.\n     */\n    function _removeSingleTokenLiquidity(address _stableSwapPool, int128 _tokenIndex, uint256 _lpAmount, uint256 _minReceiveAmount)\n        internal\n        returns (uint256 amountRemoved)\n    {\n        _validatePoolAddress(_stableSwapPool);\n        amountRemoved = ICurveStableSwapNG(_stableSwapPool).remove_liquidity_one_coin(_lpAmount, _tokenIndex, _minReceiveAmount);\n        emit LiquidityRemovedSingleToken(_stableSwapPool, amountRemoved, _lpAmount);\n    }\n\n    /**\n     * @notice Withdraw coins from a Curve stable swap pool in an imbalanced amount.\n     * @param _stableSwapPool The address of the Curve stable swap pool.\n     * @param _lpAmount The max amount of LP tokens to be burned for the token amounts to be removed\n     * @param _amounts The amounts of tokens to be removed from the pool.\n     */\n    function _removeLiquidityImbalance(address _stableSwapPool, uint256 _lpAmount, uint256[] calldata _amounts) internal {\n        _validatePoolAddress(_stableSwapPool);\n        uint256 amountLPBurnt = ICurveStableSwapNG(_stableSwapPool).remove_liquidity_imbalance(_amounts, _lpAmount);\n        emit LiquidityRemoved(_stableSwapPool, _amounts, amountLPBurnt);\n    }\n\n    function _validatePoolAddress(address _stableSwapPool) internal {\n        ICurveStableSwapAppBeacon appBeacon = _getAppBeacon();\n        if (!appBeacon.isSupportedPool(_stableSwapPool)) revert CurveAppError.UnsupportedPool(_stableSwapPool);\n        if (ICurveStableSwapFactoryNG(appBeacon.curveStableswapFactoryNG()).get_implementation_address(_stableSwapPool) == address(0))\n        {\n            revert CurveAppError.InvalidPoolAddress(_stableSwapPool);\n        }\n    }\n\n    /**\n     * @dev Returns the beacon contract for the Curve StableSwap app.\n     * @return The beacon contract for the Curve StableSwap app.\n     */\n    function _getAppBeacon() internal view returns (ICurveStableSwapAppBeacon) {\n        return (ICurveStableSwapAppBeacon(AppBase._getAppBeacon()));\n    }\n}\n"
      },
      "src/interfaces/accounts/IAccountUtilsModule.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\ninterface IAccountUtilsModule {\n    event AccountInfinexProtocolBeaconImplementationUpgraded(address infinexProtocolConfigBeacon);\n\n    event AccountSynthetixInformationBeaconUpgraded(address synthetixInformationBeacon);\n\n    event AccountCircleBridgeParamsUpgraded(address circleBridge, address circleMinter, uint32 defaultDestinationCCTPDomain);\n\n    event AccountWormholeCircleBridgeParamsUpgraded(address wormholeCircleBridge, uint16 defaultDestinationWormholeChainId);\n\n    event AccountUSDCAddressUpgraded(address USDC);\n\n    /*///////////////////////////////////////////////////////////////\n                                    VIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Get the Infinex Protocol Config\n     * @return The Infinex Protocol Config Beacon\n     */\n    function infinexProtocolConfigBeacon() external view returns (address);\n\n    /**\n     * @notice Check if the provided operation key is valid\n     * @param _operationKey The operation key to check\n     * @return A boolean indicating if the key is valid\n     */\n    function isValidOperationKey(address _operationKey) external view returns (bool);\n\n    /**\n     * @notice Check if the provided sudo key is valid\n     * @param _sudoKey The sudo key to check\n     * @return A boolean indicating if the sudo key is valid\n     */\n    function isValidSudoKey(address _sudoKey) external view returns (bool);\n\n    /**\n     * @notice Check if the provided recovery key is valid\n     * @param _recoveryKey The recovery key to check\n     * @return A boolean indicating if the recovery key is valid\n     */\n    function isValidRecoveryKey(address _recoveryKey) external view returns (bool);\n\n    /**\n     * @notice Checks if the given address is an authorized operations party.\n     * @param _key The address to check.\n     * @return A boolean indicating whether the address is an authorized operations party.\n     * @dev Update this function whenever the logic for requiresAuthorizedOperationsParty\n     * from SecurityModifiers changes\n     */\n    function isAuthorizedOperationsParty(address _key) external view returns (bool);\n\n    /**\n     * @notice Checks if the given address is an authorized recovery party.\n     * @param _key The address to check.\n     * @return A boolean indicating whether the address is an authorized recovery party.\n     * @dev Update this function whenever the logic for requiresAuthorizedRecoveryParty\n     * from SecurityModifiers changes\n     */\n    function isAuthorizedRecoveryParty(address _key) external view returns (bool);\n\n    /**\n     * @notice Retrieves the Circle Bridge parameters.\n     * @return The address of the circleBridge\n     * @return The address of the minter.\n     * @return The default circle bridge destination domain.\n     */\n    function getCircleBridgeParams() external view returns (address, address, uint32);\n\n    /**\n     * @notice Retrieves the wormhole circle bridge\n     * @return The wormhole circle bridge address.\n     */\n    function getWormholeCircleBridge() external view returns (address);\n\n    /**\n     * @notice Retrieves the Wormhole Circle Bridge parameters.\n     * @return The address of the wormholeCircleBridge\n     * @return The address of the wormholeCircleBridge and the default defaultDestinationWormholeChainId\n     */\n    function getWormholeCircleBridgeParams() external view returns (address, uint16);\n\n    /**\n     * @notice Retrieves the USDC address.\n     * @return The address of USDC\n     */\n    function getUSDCAddress() external view returns (address);\n\n    /**\n     * @notice Retrieves the maximum withdrawal fee.\n     * @return The maximum withdrawal fee.\n     */\n    function getMaxWithdrawalFee() external pure returns (uint256);\n\n    /*///////////////////////////////////////////////////////////////\n                                MUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Upgrade to a new beacon implementation and updates any new parameters along with it\n     * @param _newInfinexProtocolConfigBeacon The address of the new beacon\n     * @dev requires the sender to be the sudo key\n     * @dev Requires passing the new beacon address which matches the latest to ensure that the upgrade both\n     * is as the user intended, and is to the latest beacon implementation. Prevents the user from opting in to a\n     * specific version and upgrading to a later version that may have been deployed between the opt-in and the upgrade\n     */\n    function upgradeProtocolBeaconParameters(address _newInfinexProtocolConfigBeacon) external;\n\n    /**\n     * @notice Updates the parameters for the Circle Bridge to the latest from the Infinex Protocol Config Beacon.\n     * Update is opt in to prevent malicious automatic updates.\n     * @dev requires the sender to be the sudo key\n     */\n    function updateCircleBridgeParams() external;\n\n    /**\n     * @notice Updates the parameters for the Wormhole Circle Bridge to the latest from the Infinex Protocol Config Beacon.\n     * Update is opt in to prevent malicious automatic updates.\n     * @dev requires the sender to be the sudo key\n     */\n    function updateWormholeCircleBridge() external;\n\n    /**\n     * @notice Updates the USDC address from the Infinex Protocol Config Beacon.\n     * Update is opt in to prevent malicious automatic updates.\n     * @dev requires the sender to be the sudo key\n     */\n    function updateUSDCAddress() external;\n}\n"
      },
      "src/interfaces/accounts/IBaseModule.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { RequestTypes } from \"src/accounts/utils/RequestTypes.sol\";\n\ninterface IBaseModule {\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tEVENTS / ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    event AccountImplementationUpgraded(address accountImplementation);\n    event AccountMigratedFrom(uint64 previousVersion, uint64 currentVersion);\n\n    /*///////////////////////////////////////////////////////////////\n                                 \t\tINITIALIZER\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Initialize the account with the sudo key\n     */\n    function initialize(address _sudoKey) external;\n\n    /**\n     * @notice Reinitialize the account with the current version\n     * @dev Only to be called by the upgradeTo function\n     */\n    function reinitialize(uint64 _previousVersion) external;\n\n    /**\n     * @notice Reinitialize the account with the current version\n     * @dev Only to be called once to reinitialize accounts created with v1\n     */\n    function reinitializeLegacyAccount() external;\n\n    /*///////////////////////////////////////////////////////////////\n                                    VIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Returns the version number of the account.\n     * @return A uint64 representing the version of the account.\n     * @dev The version number is provided by the OZ Initializable library\n     */\n    function accountVersion() external view returns (uint64);\n\n    /**\n     * @notice Check if the provided nonce is valid\n     * @param _nonce The nonce to check\n     * @return A boolean indicating if the nonce is valid\n     */\n    function isValidNonce(bytes32 _nonce) external view returns (bool);\n\n    /**\n     * @notice Check if the provided forwarder is trusted\n     * @param _forwarder The forwarder to check\n     * @return A boolean indicating if the forwarder is trusted\n     */\n    function isTrustedForwarder(address _forwarder) external view returns (bool);\n\n    /**\n     * @notice Get all trusted forwarders\n     * @return An array of addresses of all trusted forwarders\n     */\n    function trustedForwarders() external view returns (address[] memory);\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tMUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Enables or disables an operation key for the account\n     * @param _operationKey The address of the operation key to be set\n     * @param _isValid Whether the key is to be set as valid or invalid\n     * @dev This function requires the sender to be the sudo key holder\n     */\n    function setOperationKeyStatus(address _operationKey, bool _isValid) external;\n\n    /**\n     * @notice Enables or disables a recovery key for the account\n     * @param _recoveryKey The address of the recovery key to be set\n     * @param _isValid Whether the key is to be set as valid or invalid\n     * @dev This function requires the sender to be the sudo key holder\n     */\n    function setRecoveryKeyStatus(address _recoveryKey, bool _isValid) external;\n\n    /**\n     * @notice Enables or disables a sudo key for the account\n     * @param _sudoKey The address of the sudo key to be set\n     * @param _isValid Whether the key is to be set as valid or invalid\n     * @dev This function requires the sender to be the sudo key holder\n     */\n    function setSudoKeyStatus(address _sudoKey, bool _isValid) external;\n\n    /**\n     * @notice Add a new trusted forwarder\n     * @param _request The Request struct containing:\n     *  RequestData {\n     *  address _address; - The address of the new trusted forwarder.\n     *\tbytes32 _nonce; - The nonce of the signature\n     *  }\n     * @param _signature The required signature for executing the transaction\n     * Required signature:\n     * - sudo key\n     */\n    function addTrustedForwarder(RequestTypes.Request calldata _request, bytes calldata _signature) external;\n\n    /**\n     * @notice Remove a trusted forwarder\n     * @param _request The Request struct containing:\n     *  RequestData {\n     *  address _address; - The address of the trusted forwarder to be removed.\n     *\tbytes32 _nonce; - The nonce of the signature\n     *  }\n     * @param _signature The required signature for executing the transaction\n     * Required signature:\n     * - sudo key\n     */\n    function removeTrustedForwarder(RequestTypes.Request calldata _request, bytes calldata _signature) external;\n}\n"
      },
      "src/interfaces/apps/base/IAppAccountBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title IAppAccountBase\n * @notice Interface for the App Account Base\n */\ninterface IAppAccountBase {\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\tEVENTS\n    ///////////////////////////////////////////////////////////////*/\n\n    event EtherTransferredToMainAccount(uint256 amount);\n    event ERC20TransferredToMainAccount(address indexed token, uint256 amount);\n    event ERC721TransferredToMainAccount(address indexed token, uint256 tokenId);\n    event ERC1155TransferredToMainAccount(address indexed token, uint256 tokenId, uint256 amount, bytes data);\n    event ERC1155BatchTransferredToMainAccount(address indexed token, uint256[] _ids, uint256[] _values, bytes _data);\n    event EtherRecoveredToMainAccount(uint256 amount);\n    event ERC20RecoveredToMainAccount(address indexed token, uint256 amount);\n    event ERC721RecoveredToMainAccount(address indexed token, uint256 tokenId);\n    event ERC1155RecoveredToMainAccount(address indexed token, uint256 tokenId, uint256 amount, bytes data);\n    event ERC1155BatchRecoveredToMainAccount(address indexed token, uint256[] tokenIds, uint256[] amounts, bytes _data);\n\n    /*///////////////////////////////////////////////////////////////\n                                ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    error InvalidAppBeacon();\n    error ImplementationMismatch(address implementation, address latestImplementation);\n    error ETHTransferFailed();\n\n    /*///////////////////////////////////////////////////////////////\n                                 \t\tINITIALIZER\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Initialize the app account with the main account and the app beacon.\n     * @param _mainAccount the address of the main account, this is the owner of the app.\n     * @param _appBeacon the beacon for the app account.\n     */\n    function initialize(address _mainAccount, address _appBeacon) external;\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tVIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Returns the app version number of the app account.\n     * @return A uint64 representing the version of the app.\n     * @dev NOTE: This number must be updated whenever a new version is deployed.\n     * The number should always only be incremented by 1.\n     */\n    function appVersion() external pure returns (uint64);\n\n    /**\n     * @notice Get the app's main account.\n     * @return The main account associated with this app.\n     */\n    function getMainAccount() external view returns (address);\n\n    /**\n     * @notice Get the app config beacon.\n     * @return The app config beacon address.\n     */\n    function getAppBeacon() external view returns (address);\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tMUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Transfer Ether to the main account from the app account.\n     * @param _amount The amount of Ether to transfer.\n     */\n    function transferEtherToMainAccount(uint256 _amount) external;\n\n    /**\n     * @notice Transfer ERC20 tokens to the main account from the app account.\n     * @param _token The address of the ERC20 token.\n     * @param _amount The amount of tokens to transfer.\n     */\n    function transferERC20ToMainAccount(address _token, uint256 _amount) external;\n\n    /**\n     * @notice Transfer ERC721 tokens to the main account from the app account.\n     * @param _token The address of the ERC721 token.\n     * @param _tokenId The ID of the ERC721 token.\n     */\n    function transferERC721ToMainAccount(address _token, uint256 _tokenId) external;\n\n    /**\n     * @notice Transfer ERC1155 tokens to the main account from the app account.\n     * @param _token The address of the ERC1155 token.\n     * @param _tokenId The ID of the ERC1155 token.\n     * @param _amount The amount of tokens to transfer.\n     * @param _data Data to send with the transfer.\n     */\n    function transferERC1155ToMainAccount(address _token, uint256 _tokenId, uint256 _amount, bytes calldata _data) external;\n\n    /**\n     * @notice Transfers batch ERC1155 tokens to the main account from the app account.\n     * @param _token The address of the ERC1155 token.\n     * @param _ids The IDs of the ERC1155 tokens.\n     * @param _amounts The amounts of the ERC1155 tokens.\n     * @param _data Data to send with the transfer.\n     */\n    function transferERC1155BatchToMainAccount(\n        address _token,\n        uint256[] calldata _ids,\n        uint256[] calldata _amounts,\n        bytes calldata _data\n    ) external;\n\n    /**\n     * @notice Recovers all ether in the app account to the main account.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverEtherToMainAccount() external;\n\n    /**\n     * @notice Recovers the full balance of an ERC20 token to the main account.\n     * @param _token The address of the token to be recovered to the main account.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC20ToMainAccount(address _token) external;\n\n    /**\n     * @notice Recovers a specified ERC721 token to the main account.\n     * @param _token The ERC721 token address to recover.\n     * @param _tokenId The ID of the ERC721 token to recover.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC721ToMainAccount(address _token, uint256 _tokenId) external;\n\n    /**\n     * @notice Recovers all the tokens of a specified ERC1155 token to the main account.\n     * @param _token The ERC1155 token address to recover.\n     * @param _tokenId The id of the token to recover.\n     * @param _data The data for the transaction.\n     * @dev Requires the sender to be an authorized recovery party.\n     */\n    function recoverERC1155ToMainAccount(address _token, uint256 _tokenId, bytes calldata _data) external;\n\n    /**\n     * @notice Recovers batch ERC1155 tokens to the main account.\n     * @param _token The address of the ERC1155 token.\n     * @param _ids The IDs of the ERC1155 tokens.\n     * @param _values The values of the ERC1155 tokens.\n     * @param _data Data to send with the transfer.\n     */\n    function recoverERC1155BatchToMainAccount(\n        address _token,\n        uint256[] calldata _ids,\n        uint256[] calldata _values,\n        bytes calldata _data\n    ) external;\n\n    /**\n     * @notice Upgrade the app account to the latest implementation and beacon.\n     * @param _appBeacon The address of the new app beacon.\n     * @param _latestAppImplementation The address of the latest app implementation.\n     * @dev Requires the sender to be the main account.\n     */\n    function upgradeAppVersion(address _appBeacon, address _latestAppImplementation) external;\n}\n"
      },
      "src/interfaces/apps/base/IAppBeaconBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title IAppBeaconBase\n * @notice Interface for the App Beacon Base\n */\ninterface IAppBeaconBase {\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\tSTRUCTS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Struct containing the config for the app beacon.\n     * @param appName The name of the app.\n     * @param latestAppImplementation The address of the latest app implementation.\n     * @param latestAppBeacon The address of the latest app beacon.\n     */\n    struct AppBeaconConfig {\n        string appName;\n        address latestAppImplementation;\n        address latestAppBeacon;\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    error ZeroAddress();\n    error InvalidAppAccountImplementation();\n    error InvalidAppBeacon();\n\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\tEVENTS\n    ///////////////////////////////////////////////////////////////*/\n\n    event LatestAppImplementationSet(address latestAppImplementation);\n    event LatestAppBeaconSet(address latestAppBeacon);\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tVIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Gets the name of the app associated to the beacon.\n     * @return The name of the app beacon.\n     */\n    function getAppName() external view returns (string memory);\n\n    /**\n     * @notice Gets the latest app implementation.\n     * @return The address of the latest app implementation.\n     */\n    function getLatestAppImplementation() external view returns (address);\n\n    /**\n     * @notice Gets the latest beacon address for the app.\n     * @return The address of the latest app beacon.\n     */\n    function getLatestAppBeacon() external view returns (address);\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t    MUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Sets the latest app implementation address.\n     * @param _latestAppImplementation The address of the latest implementation for the app.\n     */\n    function setLatestAppImplementation(address _latestAppImplementation) external;\n\n    /**\n     * @notice Sets the latest app beacon address.\n     * @param _latestAppBeacon The address of the latest app beacon associated with the app.\n     */\n    function setLatestAppBeacon(address _latestAppBeacon) external;\n}\n"
      },
      "src/interfaces/curve/ICurveStableSwapApp.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title ICurveStableSwapApp\n * @notice Interface for the curve stable swap app.\n */\ninterface ICurveStableSwapApp {\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t    EVENTS\n    ///////////////////////////////////////////////////////////////*/\n\n    event TokensExchanged(address indexed stableSwapPool, address fromToken, address toToken, uint256 fromAmount, uint256 toAmount);\n    event LiquidityAdded(address indexed stableSwapPool, uint256[] amounts, uint256 lpAmount);\n    event LiquidityRemoved(address indexed stableSwapPool, uint256[] amounts, uint256 lpAmount);\n    event LiquidityRemovedSingleToken(address indexed stableSwapPool, uint256 amountRemoved, uint256 lpAmountBurnt);\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tMUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Allows the authorized operations party to exchange tokens on the stable swap pool.\n     * @param _stableSwapPool The address of the stable swap pool.\n     * @param _fromToken The address of the ERC20 token provided to exchange.\n     * @param _toToken The address of the ERC20 token to receive from the exchange.\n     * @param _fromAmount The amount of tokens to exchange.\n     * @param _minToAmount The minimum amount of tokens to receive.\n     */\n    function exchange(address _stableSwapPool, address _fromToken, address _toToken, uint256 _fromAmount, uint256 _minToAmount)\n        external;\n\n    /**\n     * @notice Adds liquidity to the specified pool\n     * @dev The arrays indices have to match the indices of the tokens in the pool.\n     * @param _stableSwapPool The address of the pool to add liquidity to.\n     * @param _tokens An array of token addresses to add as liquidity.\n     * @param _amounts An array of token amounts to add as liquidity.\n     * @param _minLPAmount The minimum amount of LP tokens to receive.\n     */\n    function addLiquidity(address _stableSwapPool, address[] calldata _tokens, uint256[] calldata _amounts, uint256 _minLPAmount)\n        external;\n\n    /**\n     * @notice Removes liquidity for a single token from the Curve stable swap pool.\n     * @param _stableSwapPool The address of the Curve stable swap pool.\n     * @param _tokenIndex The index of the token to remove liquidity.\n     * @param _lpAmount The amount of LP tokens to burn.\n     * @param _minReceiveAmount The minimum amount of tokens to receive in return.\n     * @return The amount of tokens received after removing liquidity.\n     */\n    function removeSingleTokenLiquidity(address _stableSwapPool, int128 _tokenIndex, uint256 _lpAmount, uint256 _minReceiveAmount)\n        external\n        returns (uint256);\n\n    /**\n     * @notice Withdraw coins from a Curve stable swap pool in an imbalanced amount.\n     * @param _stableSwapPool The address of the Curve stable swap pool.\n     * @param _lpAmount The max amount of LP tokens to burn.\n     * @param _amounts The amount of tokens to receive in return.\n     */\n    function removeLiquidityImbalance(address _stableSwapPool, uint256 _lpAmount, uint256[] calldata _amounts) external;\n\n    /**\n     * @notice Swaps ERC20 tokens to USDC at the current exchange amount and then recovers to mainAccount\n     * @param _stableSwapPool The address of the stable swap pool.\n     * @param _fromToken The address of the ERC20 token to recover.\n     * @param _minToAmount The minimum amount of USDC to receive.\n     * @dev This function must be called by an authorized recovery party.\n     */\n    function recoverERC20ToUSDC(address _stableSwapPool, address _fromToken, uint256 _minToAmount) external;\n\n    /**\n     * @notice Removes all Liquidity as USDC with specified slippage amount and then recovers to mainAccount\n     * @param _LPToken The address of the pool to remove liquidity from.\n     * @param _USDCIndex The address of the LP token and pool to recover from.\n     * @param _minReceiveAmount The minimum amount of USDC to receive.\n     * @dev This function must be called by an authorized recovery party.\n     */\n    function recoverUSDCFromLP(address _LPToken, int128 _USDCIndex, uint256 _minReceiveAmount) external;\n\n    /**\n     * @notice Removes a single token from an LP for the purpose of recovery\n     * @param _LPToken The address of the LP token/pool to remove liquidity from.\n     * @param _tokenIndex The index of the token to remove from the liquidity pool\n     * @param _minToAmount The minimum amount of token to withdraw from the liquidity pool.\n     * @dev This function must be called by an authorized recovery party.\n     */\n    function recoverERC20FromLP(address _LPToken, int128 _tokenIndex, uint256 _minToAmount) external;\n}\n"
      },
      "src/interfaces/curve/ICurveStableSwapAppBeacon.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title ICurveStableSwapAppBeacon\n * @notice Interface for the curve app beacon.\n */\ninterface ICurveStableSwapAppBeacon {\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t        STRUCTS\n    ///////////////////////////////////////////////////////////////*/\n\n    struct PoolData {\n        address pool;\n        int128 fromTokenIndex;\n        int128 toTokenIndex;\n        uint256 amountReceived;\n        address[] tokens;\n        uint256[] balances;\n        uint256[] decimals;\n        bool isUnderlying;\n    }\n\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t    VIEW FUNCTIONS/VARIABLES\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Gets the curve stable swap factory address.\n     * @return The address of the curve stable swap factory.\n     */\n    function curveStableswapFactoryNG() external view returns (address);\n\n    /**\n     * @notice Gets the USDC address.\n     * @return The address of the USDC token.\n     */\n    function USDC() external view returns (address);\n\n    /**\n     * @notice Checks if a pool has been vetted by the council and can be safely used by the app\n     * @param _pool The address of the pool.\n     * @return True if the pool is supported, false otherwise.\n     */\n    function isSupportedPool(address _pool) external view returns (bool);\n\n    /**\n     * @notice Get the pool data for the given tokens. Data will be empty if type is underyling\n     * @param _fromToken The address of the token to swap from.\n     * @param _toToken The address of the token to swap to.\n     * @return poolData The pool data for the given tokens.\n     */\n    function getPoolDatafromTokens(address _fromToken, address _toToken, uint256 _fromAmount)\n        external\n        returns (PoolData memory poolData);\n\n    /**\n     * @notice A safety feature to limit the pools that can be used by the app to only vetted and suppported pools\n     * @dev Only the contract owner can call this function.\n     * @param _pool The address of the pool.\n     * @param _supported The supported status of the pool.\n     */\n    function setIsSupportedPool(address _pool, bool _supported) external;\n}\n"
      },
      "src/interfaces/curve/ICurveStableSwapFactoryNG.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n// from https://github.com/curvefi/stableswap-ng\n\n/**\n * @title ICurveStableSwapFactoryNG\n * @notice Interface for the curve stable swap factory.\n */\ninterface ICurveStableSwapFactoryNG {\n    /**\n     * @notice Find an available pool for exchanging two coins\n     * @param _from Address of coin to be sent\n     * @param _to Address of coin to be received\n     * @param i Index value. When multiple pools are available\n     *        this value is used to return the n'th address.\n     * @return Pool address\n     */\n    function find_pool_for_coins(address _from, address _to, uint256 i) external view returns (address);\n\n    /**\n     * @notice Find an available pool for exchanging two coins\n     * @param _from Address of coin to be sent\n     * @param _to Address of coin to be received\n     * @return Pool address\n     */\n    function find_pool_for_coins(address _from, address _to) external view returns (address);\n\n    /**\n     * @notice Get the base pool for a given factory metapool\n     * @param _pool Metapool address\n     * @return Address of base pool\n     */\n    function get_base_pool(address _pool) external view returns (address);\n\n    /**\n     * @notice Get the number of coins in a pool\n     * @param _pool Pool address\n     * @return Number of coins\n     */\n    function get_n_coins(address _pool) external view returns (uint256);\n\n    /**\n     * @notice Get the coins within a pool\n     * @param _pool Pool address\n     * @return List of coin addresses\n     */\n    function get_coins(address _pool) external view returns (address[] memory);\n\n    /**\n     * @notice Get the underlying coins within a pool\n     * @dev Reverts if a pool does not exist or is not a metapool\n     * @param _pool Pool address\n     * @return List of coin addresses\n     */\n    function get_underlying_coins(address _pool) external view returns (address[] memory);\n\n    /**\n     * @notice Get decimal places for each coin within a pool\n     * @param _pool Pool address\n     * @return uint256 list of decimals\n     */\n    function get_decimals(address _pool) external view returns (uint256[] memory);\n\n    /**\n     * @notice Get decimal places for each underlying coin within a pool\n     * @param _pool Pool address\n     * @return uint256 list of decimals\n     */\n    function get_underlying_decimals(address _pool) external view returns (uint256[] memory);\n\n    /**\n     * @notice Get rates for coins within a metapool\n     * @param _pool Pool address\n     * @return Rates for each coin, precision normalized to 10**18\n     */\n    function get_metapool_rates(address _pool) external view returns (uint256[] memory);\n\n    /**\n     * @notice Get balances for each coin within a pool\n     * @dev For pools using lending, these are the wrapped coin balances\n     * @param _pool Pool address\n     * @return uint256 list of balances\n     */\n    function get_balances(address _pool) external view returns (uint256[] memory);\n\n    /**\n     * @notice Get balances for each underlying coin within a metapool\n     * @param _pool Metapool address\n     * @return uint256 list of underlying balances\n     */\n    function get_underlying_balances(address _pool) external view returns (uint256[] memory);\n\n    /**\n     * @notice Get the amplfication co-efficient for a pool\n     * @param _pool Pool address\n     * @return uint256 A\n     */\n    function get_A(address _pool) external view returns (uint256);\n\n    /**\n     * @notice Get the fees for a pool\n     * @dev Fees are expressed as integers\n     * @param _pool Pool address\n     * @return Pool fee and admin fee as uint256 with 1e10 precision\n     */\n    function get_fees(address _pool) external view returns (uint256, uint256);\n\n    /**\n     * @notice Get the current admin balances (uncollected fees) for a pool\n     * @param _pool Pool address\n     * @return List of uint256 admin balances\n     */\n    function get_admin_balances(address _pool) external view returns (uint256[] memory);\n\n    /**\n     * @notice Convert coin addresses to indices for use with pool methods\n     * @param _pool Pool address\n     * @param _from Coin address to be used as `i` within a pool\n     * @param _to Coin address to be used as `j` within a pool\n     * @return int128 `i`, int128 `j`, boolean indicating if `i` and `j` are underlying coins\n     */\n    function get_coin_indices(address _pool, address _from, address _to) external view returns (int128, int128, bool);\n\n    /**\n     * @notice Get the address of the liquidity gauge contract for a factory pool\n     * @dev Returns `empty(address)` if a gauge has not been deployed\n     * @param _pool Pool address\n     * @return Implementation contract address\n     */\n    function get_gauge(address _pool) external view returns (address);\n\n    /**\n     * @notice Get the address of the implementation contract used for a factory pool\n     * @param _pool Pool address\n     * @return Implementation contract address\n     */\n    function get_implementation_address(address _pool) external view returns (address);\n\n    /**\n     * @notice Verify `_pool` is a metapool\n     * @param _pool Pool address\n     * @return True if `_pool` is a metapool\n     */\n    function is_meta(address _pool) external view returns (bool);\n\n    /**\n     * @notice Query the asset type of `_pool`\n     * @param _pool Pool Address\n     * @return Dynarray of uint8 indicating the pool asset type\n     *         Asset Types:\n     *             0. Standard ERC20 token with no additional features\n     *             1. Oracle - token with rate oracle (e.g. wrapped staked ETH)\n     *             2. Rebasing - token with rebase (e.g. staked ETH)\n     *             3. ERC4626 - e.g. sDAI\n     */\n    function get_pool_asset_types(address _pool) external view returns (uint8[] memory);\n\n    /**\n     * @notice Deploy a new plain pool\n     * @param _name Name of the new plain pool\n     * @param _symbol Symbol for the new plain pool - will be\n     *                concatenated with factory symbol\n     * @param _coins List of addresses of the coins being used in the pool.\n     * @param _A Amplification co-efficient - a lower value here means\n     *           less tolerance for imbalance within the pool's assets.\n     *           Suggested values include:\n     *            * Uncollateralized algorithmic stablecoins: 5-10\n     *            * Non-redeemable, collateralized assets: 100\n     *            * Redeemable assets: 200-400\n     * @param _fee Trade fee, given as an integer with 1e10 precision. The\n     *             maximum is 1% (100000000). 50% of the fee is distributed to veCRV holders.\n     * @param _offpeg_fee_multiplier Off-peg fee multiplier\n     * @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2)\n     *                     Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866\n     * @param _implementation_idx Index of the implementation to use\n     * @param _asset_types Asset types for pool, as an integer\n     * @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures\n     *                    of the oracle addresses that gives rate oracles.\n     *                    Calculated as: keccak(text=event_signature.replace(\" \", \"\"))[:4]\n     * @param _oracles Array of rate oracle addresses.\n     * @return Address of the deployed pool\n     */\n    function deploy_plain_pool(\n        string memory _name,\n        string memory _symbol,\n        address[] memory _coins,\n        uint256 _A,\n        uint256 _fee,\n        uint256 _offpeg_fee_multiplier,\n        uint256 _ma_exp_time,\n        uint256 _implementation_idx,\n        uint8[] memory _asset_types,\n        bytes4[] memory _method_ids,\n        address[] memory _oracles\n    ) external returns (address);\n    /**\n     * @notice Deploy a new metapool\n     * @param _base_pool Address of the base pool to use\n     *                   within the metapool\n     * @param _name Name of the new metapool\n     * @param _symbol Symbol for the new metapool - will be\n     *                concatenated with the base pool symbol\n     * @param _coin Address of the coin being used in the metapool\n     * @param _A Amplification co-efficient - a higher value here means\n     *           less tolerance for imbalance within the pool's assets.\n     *           Suggested values include:\n     *            * Uncollateralized algorithmic stablecoins: 5-10\n     *            * Non-redeemable, collateralized assets: 100\n     *            * Redeemable assets: 200-400\n     * @param _fee Trade fee, given as an integer with 1e10 precision. The\n     *             the maximum is 1% (100000000).\n     *             50% of the fee is distributed to veCRV holders.\n     * @param _offpeg_fee_multiplier Off-peg fee multiplier\n     * @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2)\n     *                     Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866\n     * @param _implementation_idx Index of the implementation to use\n     * @param _asset_type Asset type for token, as an integer\n     * @param _method_id  First four bytes of the Keccak-256 hash of the function signatures\n     *                    of the oracle addresses that gives rate oracles.\n     *                    Calculated as: keccak(text=event_signature.replace(\" \", \"\"))[:4]\n     * @param _oracle Rate oracle address.\n     * @return Address of the deployed pool\n     */\n    function deploy_metapool(\n        address _base_pool,\n        string memory _name,\n        string memory _symbol,\n        address _coin,\n        uint256 _A,\n        uint256 _fee,\n        uint256 _offpeg_fee_multiplier,\n        uint256 _ma_exp_time,\n        uint256 _implementation_idx,\n        uint8 _asset_type,\n        bytes4 _method_id,\n        address _oracle\n    ) external returns (address);\n    /**\n     * @notice Deploy a liquidity gauge for a factory pool\n     * @param _pool Factory pool address to deploy a gauge for\n     * @return Address of the deployed gauge\n     */\n    function deploy_gauge(address _pool) external returns (address);\n\n    /**\n     * @notice Add a base pool to the registry, which may be used in factory metapools\n     * @dev 1. Only callable by admin\n     *      2. Rebasing tokens are not allowed in the base pool.\n     *      3. Do not add base pool which contains native tokens (e.g. ETH).\n     *      4. As much as possible: use standard ERC20 tokens.\n     *      Should you choose to deviate from these recommendations, audits are advised.\n     * @param _base_pool Pool address to add\n     * @param _base_lp_token LP token of the base pool\n     * @param _asset_types Asset type for pool, as an integer\n     * @param _n_coins Number of coins in the pool\n     */\n    function add_base_pool(address _base_pool, address _base_lp_token, uint8[] memory _asset_types, uint256 _n_coins) external;\n\n    /**\n     * @notice Set implementation contracts for pools\n     * @dev Only callable by admin\n     * @param _implementation_index Implementation index where implementation is stored\n     * @param _implementation Implementation address to use when deploying plain pools\n     */\n    function set_pool_implementations(uint256 _implementation_index, address _implementation) external;\n\n    /**\n     * @notice Set implementation contracts for metapools\n     * @dev Only callable by admin\n     * @param _implementation_index Implementation index where implementation is stored\n     * @param _implementation Implementation address to use when deploying meta pools\n     */\n    function set_metapool_implementations(uint256 _implementation_index, address _implementation) external;\n\n    /**\n     * @notice Set implementation contracts for StableSwap Math\n     * @dev Only callable by admin\n     * @param _math_implementation Address of the math implementation contract\n     */\n    function set_math_implementation(address _math_implementation) external;\n\n    /**\n     * @notice Set implementation contracts for liquidity gauge\n     * @dev Only callable by admin\n     * @param _gauge_implementation Address of the gauge blueprint implementation contract\n     */\n    function set_gauge_implementation(address _gauge_implementation) external;\n\n    /**\n     * @notice Set implementation contracts for Views methods\n     * @dev Only callable by admin\n     * @param _views_implementation Implementation address of views contract\n     */\n    function set_views_implementation(address _views_implementation) external;\n}\n"
      },
      "src/interfaces/curve/ICurveStableSwapNG.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n// from https://github.com/curvefi/stableswap-ng\n\n/**\n * @title ICurveStableSwapNG\n * @notice Interface for the curve stable swap pool.\n */\ninterface ICurveStableSwapNG {\n    /**\n     * @notice Calculate the current input dx given output dy\n     * @dev Index values can be found via the `coins` public getter method\n     * @param i Index value for the coin to send\n     * @param j Index value of the coin to receive\n     * @param dy Amount of `j` being received after exchange\n     * @param pool Address of the pool\n     * @return Amount of `i` predicted\n     */\n    function get_dx(int128 i, int128 j, uint256 dy, address pool) external view returns (uint256);\n\n    /**\n     * @notice Calculate the current output dy given input dx\n     * @dev Index values can be found via the `coins` public getter method\n     * @param i Index value for the coin to send\n     * @param j Index value of the coin to receive\n     * @param dx Amount of `i` being exchanged\n     * @return Amount of `j` predicted\n     */\n    function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256);\n\n    /**\n     * @notice Calculate the amount received when withdrawing a single coin\n     * @param _burn_amount Amount of LP tokens to burn in the withdrawal\n     * @param i Index value of the coin to withdraw\n     * @return Amount of coin received\n     */\n    function calc_withdraw_one_coin(uint256 _burn_amount, int128 i) external view returns (uint256);\n\n    /**\n     * @notice Returns the address of the token at the specified index.\n     * @param i The index of the token.\n     * @return The address of the token at the specified index.\n     */\n    function coins(uint256 i) external view returns (address);\n\n    /**\n     * @notice Returns the number of underlying coins in the pool.\n     * @return The number of underlying coins in the pool.\n     */\n    function N_COINS() external view returns (uint256);\n\n    /**\n     * @notice Perform an exchange between two coins\n     * @dev Index values can be found via the `coins` public getter method\n     * @param i Index value for the coin to send\n     * @param j Index value of the coin to receive\n     * @param _dx Amount of `i` being exchanged\n     * @param _min_dy Minimum amount of `j` to receive\n     * @return Actual amount of `j` received\n     */\n    function exchange(int128 i, int128 j, uint256 _dx, uint256 _min_dy) external returns (uint256);\n\n    /**\n     * @notice Deposit coins into the pool\n     * @param _amounts List of amounts of coins to deposit\n     * @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit\n     * @return Amount of LP tokens received by depositing\n     */\n    function add_liquidity(uint256[] memory _amounts, uint256 _min_mint_amount) external returns (uint256);\n\n    /**\n     * @notice Withdraw a single coin from the pool\n     * @param _burn_amount Amount of LP tokens to burn in the withdrawal\n     * @param i Index value of the coin to withdraw\n     * @param _min_received Minimum amount of coin to receive\n     * @return Amount of coin received\n     */\n    function remove_liquidity_one_coin(uint256 _burn_amount, int128 i, uint256 _min_received) external returns (uint256);\n\n    /**\n     * @notice Withdraw coins from the pool in an imbalanced amount\n     * @param _amounts List of amounts of underlying coins to withdraw\n     * @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal\n     * @return Actual amount of the LP token burned in the withdrawal\n     */\n    function remove_liquidity_imbalance(uint256[] memory _amounts, uint256 _max_burn_amount) external returns (uint256);\n\n    /**\n     * @notice Withdraw coins from the pool\n     * @dev Withdrawal amounts are based on current deposit ratios\n     * @param _burn_amount Quantity of LP tokens to burn in the withdrawal\n     * @param _min_amounts Minimum amounts of underlying coins to receive\n     * @param _receiver Address that receives the withdrawn coins\n     * @param _claim_admin_fees Whether to claim admin fees\n     * @return List of amounts of coins that were withdrawn\n     */\n    function remove_liquidity(uint256 _burn_amount, uint256[] memory _min_amounts, address _receiver, bool _claim_admin_fees)\n        external\n        returns (uint256[] memory);\n}\n"
      },
      "src/libraries/Error.sol": {
        "content": "//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nlibrary Error {\n    /*///////////////////////////////////////////////////////////////\n                                            GENERIC\n    ///////////////////////////////////////////////////////////////*/\n\n    error AlreadyExists();\n\n    error DoesNotExist();\n\n    error Unauthorized();\n\n    error InvalidLength();\n\n    error NotOwner();\n\n    error InvalidWormholeChainId();\n\n    error InvalidCallerContext();\n\n    /*///////////////////////////////////////////////////////////////\n                                            ADDRESS\n    ///////////////////////////////////////////////////////////////*/\n\n    error ImplementationMismatch(address implementation, address latestImplementation);\n\n    error InvalidWithdrawalAddress(address to);\n\n    error NullAddress();\n\n    error SameAddress();\n\n    error InvalidSolanaAddress();\n\n    error AddressAlreadySet();\n\n    error InsufficientAllowlistDelay();\n\n    /*///////////////////////////////////////////////////////////////\n                                    AMOUNT / BALANCE\n    ///////////////////////////////////////////////////////////////*/\n\n    error InsufficientBalance();\n\n    error InsufficientWithdrawalAmount(uint256 amount);\n\n    error InsufficientBalanceForFee(uint256 balance, uint256 fee);\n\n    error InvalidNonce(bytes32 nonce);\n\n    error ZeroValue();\n\n    error AmountDeltaZeroValue();\n\n    error DecimalsMoreThan18(uint256 decimals);\n\n    error InsufficientBridgeAmount();\n\n    error BridgeMaxAmountExceeded();\n\n    error ETHTransferFailed();\n\n    error OutOfBounds();\n\n    /*///////////////////////////////////////////////////////////////\n                                            ACCOUNT\n    ///////////////////////////////////////////////////////////////*/\n\n    error CreateAccountDisabled();\n\n    error InvalidKeysForSalt();\n\n    error PredictAddressDisabled();\n\n    error FundsRecoveryActivationDeadlinePending();\n\n    error InvalidAppAccount();\n\n    error InvalidAppBeacon();\n\n    /*///////////////////////////////////////////////////////////////\n                                        KEY MANAGEMENT\n    ///////////////////////////////////////////////////////////////*/\n\n    error InvalidRequest();\n\n    error InvalidKeySignature(address from);\n\n    error KeyAlreadyInvalid();\n\n    error KeyAlreadyValid();\n\n    error KeyNotFound();\n\n    error CannotRemoveLastKey();\n\n    /*///////////////////////////////////////////////////////////////\n                                     GAS FEE REBATE\n    ///////////////////////////////////////////////////////////////*/\n\n    error InvalidDeductGasFunction(bytes4 sig);\n\n    /*///////////////////////////////////////////////////////////////\n                                FEATURE FLAGS\n    ///////////////////////////////////////////////////////////////*/\n\n    error FundsRecoveryNotActive();\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "paris",
      "remappings": [
        "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "@pythnetwork/entropy-sdk-solidity/=node_modules/@pythnetwork/entropy-sdk-solidity/",
        "@synthetixio/core-contracts/=node_modules/@synthetixio/core-contracts/",
        "@synthetixio/core-modules/=node_modules/@synthetixio/core-modules/",
        "@synthetixio/main/=node_modules/@synthetixio/main/",
        "@synthetixio/oracle-manager/=node_modules/@synthetixio/oracle-manager/",
        "@synthetixio/perps-market/=node_modules/@synthetixio/perps-market/",
        "@synthetixio/spot-market/=node_modules/@synthetixio/spot-market/",
        "cannon-std/=lib/cannon-std/src/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/",
        "src/=src/",
        "test/=test/",
        "wormhole-circle-integration/=lib/wormhole-circle-integration/evm/src/",
        "wormhole/=lib/wormhole-circle-integration/evm/src/"
      ],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}