creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n    address private _pendingOwner;\n\n    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n    function __Ownable2Step_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable2Step_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns the address of the pending owner.\n     */\n    function pendingOwner() public view virtual returns (address) {\n        return _pendingOwner;\n    }\n\n    /**\n     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual override onlyOwner {\n        _pendingOwner = newOwner;\n        emit OwnershipTransferStarted(owner(), newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual override {\n        delete _pendingOwner;\n        super._transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev The new owner accepts the ownership transfer.\n     */\n    function acceptOwnership() public virtual {\n        address sender = _msgSender();\n        require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n        _transferOwnership(sender);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\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 Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\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 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\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        require(_initializing, \"Initializable: contract is not initializing\");\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        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized != type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _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 _initializing;\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\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, it is bubbled up by this\n     * function (like regular Solidity function calls).\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     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\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     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\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 amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` 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 amount) 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 `amount` as the allowance of `spender` over the 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 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` 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 amount) external returns (bool);\n}\n"
      },
      "contracts/interfaces/IBaseOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\n/**\n * @title IBaseOracle\n * @author BlueberryProtocol\n * @notice Interface for a basic oracle that provides price data for assets.\n */\ninterface IBaseOracle {\n    /**\n     * @notice Event emitted when a new LP token is registered within its respective implementation.\n     * @param token Address of the LP token being registered\n     */\n    event RegisterLpToken(address token);\n\n    /**\n     * @notice Fetches the price of the given token in USD with 18 decimals precision.\n     * @param token Address of the ERC-20 token for which the price is requested.\n     * @return The USD price of the given token, multiplied by 10**18.\n     */\n    function getPrice(address token) external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/ichi/IICHIVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\ninterface IICHIVault is IERC20, IERC20Metadata {\n    function ichiVaultFactory() external view returns (address);\n\n    function pool() external view returns (address);\n\n    function token0() external view returns (address);\n\n    function token1() external view returns (address);\n\n    function allowToken0() external view returns (bool);\n\n    function allowToken1() external view returns (bool);\n\n    function fee() external view returns (uint24);\n\n    function tickSpacing() external view returns (int24);\n\n    function currentTick() external view returns (int24);\n\n    function twapPeriod() external view returns (uint32);\n\n    function affiliate() external view returns (address);\n\n    function baseLower() external view returns (int24);\n\n    function baseUpper() external view returns (int24);\n\n    function limitLower() external view returns (int24);\n\n    function limitUpper() external view returns (int24);\n\n    function deposit0Max() external view returns (uint256);\n\n    function deposit1Max() external view returns (uint256);\n\n    function maxTotalSupply() external view returns (uint256);\n\n    function hysteresis() external view returns (uint256);\n\n    function getTotalAmounts() external view returns (uint256, uint256);\n\n    function deposit(uint256, uint256, address) external returns (uint256);\n\n    function withdraw(uint256, address) external returns (uint256, uint256);\n\n    function rebalance(\n        int24 _baseLower,\n        int24 _baseUpper,\n        int24 _limitLower,\n        int24 _limitUpper,\n        int256 swapQuantity\n    ) external;\n\n    function setDepositMax(uint256 _deposit0Max, uint256 _deposit1Max) external;\n\n    function setAffiliate(address _affiliate) external;\n\n    event DeployICHIVault(\n        address indexed sender,\n        address indexed pool,\n        bool allowToken0,\n        bool allowToken1,\n        address owner,\n        uint256 twapPeriod\n    );\n\n    event SetTwapPeriod(address sender, uint32 newTwapPeriod);\n\n    event Deposit(address indexed sender, address indexed to, uint256 shares, uint256 amount0, uint256 amount1);\n\n    event Withdraw(address indexed sender, address indexed to, uint256 shares, uint256 amount0, uint256 amount1);\n\n    event Rebalance(\n        int24 tick,\n        uint256 totalAmount0,\n        uint256 totalAmount1,\n        uint256 feeAmount0,\n        uint256 feeAmount1,\n        uint256 totalSupply\n    );\n\n    event MaxTotalSupply(address indexed sender, uint256 maxTotalSupply);\n\n    event Hysteresis(address indexed sender, uint256 hysteresis);\n\n    event DepositMax(address indexed sender, uint256 deposit0Max, uint256 deposit1Max);\n\n    event Affiliate(address indexed sender, address affiliate);\n}\n"
      },
      "contracts/libraries/UniV3/UniV3WrappedLibContainer.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\nlibrary UniV3WrappedLibContainer {\n    // TickMath\n    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n    uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n    uint160 internal constant MAX_SQRT_RATIO =\n        1461446703485210103287273052203988822378723970342;\n\n    // OracleLibrary\n    function consult(\n        address pool,\n        uint32 secondsAgo\n    )\n        external\n        view\n        returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity)\n    {}\n\n    function getQuoteAtTick(\n        int24 tick,\n        uint128 baseAmount,\n        address baseToken,\n        address quoteToken\n    ) external pure returns (uint256 quoteAmount) {}\n\n    function getSqrtRatioAtTick(\n        int24 tick\n    ) external pure returns (uint160 sqrtPriceX96) {}\n\n    function getAmountsForLiquidity(\n        uint160 sqrtRatioX96,\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint128 liquidity\n    ) external pure returns (uint256 amount0, uint256 amount1) {}\n\n    function getLiquidityForAmounts(\n        uint160 sqrtRatioX96,\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint256 amount0,\n        uint256 amount1\n    ) external pure returns (uint128 liquidity) {}\n}\n"
      },
      "contracts/oracle/BaseOracleExt.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\npragma solidity 0.8.22;\n\nimport \"../utils/BlueberryConst.sol\" as Constants;\n\nabstract contract BaseOracleExt {\n    /*//////////////////////////////////////////////////////////////////////////\n                                      FUNCTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Internal function to validate deviations of 2 given prices\n     * @param price0 First price to validate, base 1e18\n     * @param price1 Second price to validate, base 1e18\n     * @param maxPriceDeviation Max price deviation of 2 prices, base 10000\n     */\n    function _isValidPrices(uint256 price0, uint256 price1, uint256 maxPriceDeviation) internal pure returns (bool) {\n        uint256 maxPrice = price0 > price1 ? price0 : price1;\n        uint256 minPrice = price0 > price1 ? price1 : price0;\n        return (((maxPrice - minPrice) * Constants.DENOMINATOR) / maxPrice) <= maxPriceDeviation;\n    }\n}\n"
      },
      "contracts/oracle/IchiVaultOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\npragma solidity 0.8.22;\n\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\nimport { UniV3WrappedLibContainer } from \"../libraries/UniV3/UniV3WrappedLibContainer.sol\";\n\nimport \"../utils/BlueberryConst.sol\" as Constants;\nimport \"../utils/BlueberryErrors.sol\" as Errors;\n\nimport { UsingBaseOracle } from \"./UsingBaseOracle.sol\";\nimport { BaseOracleExt } from \"./BaseOracleExt.sol\";\n\nimport { IBaseOracle } from \"../interfaces/IBaseOracle.sol\";\nimport { IICHIVault } from \"../interfaces/ichi/IICHIVault.sol\";\n\n/**\n * @title Ichi Vault Oracle\n * @author BlueberryProtocol\n * @notice Oracle contract provides price feeds of Ichi Vault tokens\n * @dev The logic of this oracle is using legacy & traditional mathematics of Uniswap V2 Lp Oracle.\n *      Base token prices are fetched from Chainlink or Band Protocol.\n *      To prevent flashloan price manipulations, it compares spot & twap prices from Uni V3 Pool.\n */\ncontract IchiVaultOracle is IBaseOracle, UsingBaseOracle, BaseOracleExt {\n    /*//////////////////////////////////////////////////////////////////////////\n                                      STRUCTS \n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @dev Struct to store token info related to ICHI Vaults\n     * @param token0 Address of token0\n     * @param token1 Address of token1\n     * @param token0Decimals Decimals of token0\n     * @param token1Decimals Decimals of token1\n     * @param vaultDecimals Decimals of ICHI Vault\n     */\n    struct VaultInfo {\n        address token0;\n        address token1;\n        uint8 token0Decimals;\n        uint8 token1Decimals;\n        uint8 vaultDecimals;\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      STORAGE \n    //////////////////////////////////////////////////////////////////////////*/\n\n    /// @dev Mapping to keep track of token info related to ICHI Vaults\n    mapping(address => VaultInfo) private _vaultInfo;\n\n    /// @dev Mapping to keep track of the maximum price deviation allowed for each token\n    mapping(address => uint256) private _maxPriceDeviations;\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      EVENTS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Event emitted when the maximum price deviation for a token is set or updated.\n     * @param token The address of the token.\n     * @param maxPriceDeviation The new maximum price deviation (in 1e18 format).\n     */\n    event SetPriceDeviation(address indexed token, uint256 maxPriceDeviation);\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                     CONSTRUCTOR\n    //////////////////////////////////////////////////////////////////////////*/\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      FUNCTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n    /**\n     * @notice Initializes the contract\n     * @param base The base oracle instance.\n     * @param owner Address of the owner of the contract.\n     */\n    function initialize(IBaseOracle base, address owner) external initializer {\n        __UsingBaseOracle_init(base, owner);\n    }\n\n    /**\n     * @notice Register ICHI Vault token to oracle\n     * @dev Stores persistent data of ICHI Vault token\n     * @dev An oracle cannot be used for a LP token unless it is registered\n     * @param vaultToken LP Token to register\n     */\n    function registerVault(address vaultToken) external onlyOwner {\n        if (vaultToken == address(0)) revert Errors.ZERO_ADDRESS();\n\n        IICHIVault vault = IICHIVault(vaultToken);\n        address token0 = vault.token0();\n        address token1 = vault.token1();\n\n        _vaultInfo[vaultToken] = VaultInfo({\n            token0: token0,\n            token1: token1,\n            token0Decimals: IERC20Metadata(token0).decimals(),\n            token1Decimals: IERC20Metadata(token1).decimals(),\n            vaultDecimals: vault.decimals()\n        });\n\n        emit RegisterLpToken(vaultToken);\n    }\n\n    /**\n     * @notice Set price deviations for given token\n     * @dev Input token is the underlying token of ICHI Vaults which is token0 or token1 of Uni V3 Pool\n     * @param token Token to price deviation\n     * @param maxPriceDeviation Max price deviation (in 1e18) of price feeds\n     */\n    function setPriceDeviation(address token, uint256 maxPriceDeviation) external onlyOwner {\n        /// Validate inputs\n        if (token == address(0)) revert Errors.ZERO_ADDRESS();\n        if (maxPriceDeviation > Constants.MAX_PRICE_DEVIATION) {\n            revert Errors.OUT_OF_DEVIATION_CAP(maxPriceDeviation);\n        }\n\n        _maxPriceDeviations[token] = maxPriceDeviation;\n\n        emit SetPriceDeviation(token, maxPriceDeviation);\n    }\n\n    /**\n     * @notice Get token0 spot price quoted in token1\n     * @param vault ICHI Vault address\n     * @return price spot price of token0 quoted in token1\n     */\n    function spotPrice0InToken1(IICHIVault vault) public view returns (uint256) {\n        return\n            UniV3WrappedLibContainer.getQuoteAtTick(\n                vault.currentTick(), // current tick\n                uint128(Constants.PRICE_PRECISION), // amountIn\n                vault.token0(), // tokenIn\n                vault.token1() // tokenOut\n            );\n    }\n\n    /**\n     * @notice Get token0 twap price quoted in token1\n     * @param vault ICHI Vault address\n     * @return price spot price of token0 quoted in token1\n     */\n    function twapPrice0InToken1(IICHIVault vault) public view returns (uint256) {\n        uint32 twapPeriod = vault.twapPeriod();\n        if (twapPeriod > Constants.MAX_TIME_GAP) revert Errors.TOO_LONG_DELAY(twapPeriod);\n        if (twapPeriod < Constants.MIN_TIME_GAP) revert Errors.TOO_LOW_MEAN(twapPeriod);\n\n        (int24 twapTick, ) = UniV3WrappedLibContainer.consult(vault.pool(), twapPeriod);\n\n        return\n            UniV3WrappedLibContainer.getQuoteAtTick(\n                twapTick,\n                uint128(Constants.PRICE_PRECISION), /// amountIn\n                vault.token0(), /// tokenIn\n                vault.token1() /// tokenOut\n            );\n    }\n\n    /// @inheritdoc IBaseOracle\n    function getPrice(address token) external view override returns (uint256) {\n        IICHIVault vault = IICHIVault(token);\n        VaultInfo memory vaultInfo = getVaultInfo(token);\n\n        if (vaultInfo.token0 == address(0)) revert Errors.ORACLE_NOT_SUPPORT_LP(token);\n\n        uint256 totalSupply = vault.totalSupply();\n        if (totalSupply == 0) return 0;\n\n        address token0 = vaultInfo.token0;\n        address token1 = vaultInfo.token1;\n\n        /// Check price manipulations on Uni V3 pool by flashloan attack\n        uint256 spotPrice = spotPrice0InToken1(vault);\n        uint256 twapPrice = twapPrice0InToken1(vault);\n        uint256 maxPriceDeviation = _maxPriceDeviations[token0];\n        if (!_isValidPrices(spotPrice, twapPrice, maxPriceDeviation)) revert Errors.EXCEED_DEVIATION();\n\n        IBaseOracle base = getBaseOracle();\n\n        /// Total reserve / total supply\n        (uint256 r0, uint256 r1) = vault.getTotalAmounts();\n        uint256 px0 = base.getPrice(address(token0));\n        uint256 px1 = base.getPrice(address(token1));\n\n        uint256 totalReserve = (r0 * px0) /\n            10 ** vaultInfo.token0Decimals +\n            (r1 * px1) /\n            10 ** vaultInfo.token1Decimals;\n\n        return (totalReserve * 10 ** vaultInfo.vaultDecimals) / totalSupply;\n    }\n\n    /**\n     * @notice Fetches the vault info for a given LP token.\n     * @param token Token address\n     * @return VaultInfo struct of given token\n     */\n    function getVaultInfo(address token) public view returns (VaultInfo memory) {\n        return _vaultInfo[token];\n    }\n\n    /**\n     * @notice Fetches the max price deviation for a given token.\n     * @param token Token address\n     * @return The max price deviation (in 1e18 format).\n     */\n    function getMaxPriceDeviation(address token) external view returns (uint256) {\n        return _maxPriceDeviations[token];\n    }\n}\n"
      },
      "contracts/oracle/UsingBaseOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\npragma solidity 0.8.22;\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport { IBaseOracle } from \"../interfaces/IBaseOracle.sol\";\n\n/**\n * @title UsingBaseOracle\n * @author BlueberryProtocol\n * @dev This contract serves as a base for other contracts that need access\n *      to an external oracle service. It provides an immutable reference to a\n *      specified oracle source.\n */\nabstract contract UsingBaseOracle is Ownable2StepUpgradeable {\n    /// @dev Base oracle source\n    IBaseOracle internal _base;\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                     CONSTRUCTOR\n    //////////////////////////////////////////////////////////////////////////*/\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                       FUNCTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /* solhint-disable func-name-mixedcase */\n    /**\n     * @dev Initializes the Base oracle source.\n     * @param base Address of the Base oracle source.\n     * @param owner Address of the owner.\n     */\n    function __UsingBaseOracle_init(IBaseOracle base, address owner) internal onlyInitializing {\n        _base = base;\n        __Ownable2Step_init();\n        _transferOwnership(owner);\n    }\n\n    /* solhint-enable func-name-mixedcase */\n\n    /// @notice Returns the address of the Base oracle source.\n    function getBaseOracle() public view returns (IBaseOracle) {\n        return _base;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     *      variables without shifting down storage in the inheritance chain.\n     *      See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[10] private __gap;\n}\n"
      },
      "contracts/utils/BlueberryConst.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\n/**\n * @title BlueberryErrors\n * @author BlueberryProtocol\n * @notice This contract contains the error messages for Blueberry Protocol.\n */\npragma solidity 0.8.22;\n\n/// @dev Common denominator for percentage-based calculations.\nuint256 constant DENOMINATOR = 10000;\n\n/// @dev Minimum threshold for liquidity operations, represented as a fraction of the DENOMINATOR.\nuint256 constant MIN_LIQ_THRESHOLD = 8000; // represent 80%\n\n/// @dev Precision factor to maintain price accuracy.\nuint256 constant PRICE_PRECISION = 1e18;\n\n/// @dev Maximum allowed price deviation, represented as a fraction of the DENOMINATOR.\nuint256 constant MAX_PRICE_DEVIATION = 1000; // represent 10%\n\n/// @dev Minimum time interval for specific time-dependent operations.\nuint32 constant MIN_TIME_GAP = 3 minutes;\n\n/// @dev Maximum time interval for specific time-dependent operations.\nuint32 constant MAX_TIME_GAP = 2 days;\n\n/// @dev Maximum allowed fee rate, represented as a fraction of the DENOMINATOR.\nuint256 constant MAX_FEE_RATE = 2000; // represent 20%\n\n/// @dev Maximum allowed time for vault withdrawal fee calculations.\nuint256 constant MAX_WITHDRAW_VAULT_FEE_WINDOW = 60 days;\n\n/// @dev Maximum delay permitted for swap operations.\nuint32 constant MAX_DELAY_ON_SWAP = 2 hours;\n\n/// @dev Allowed grace period time for sequencer operations.\nuint32 constant SEQUENCER_GRACE_PERIOD_TIME = 3600;\n\n/// @dev Precision factor for Chainlink price feed values.\nuint256 constant CHAINLINK_PRICE_FEED_PRECISION = 1e8;\n\n/// @dev Warm-up period before a liquidation repayment can be initiated.\nuint256 constant LIQUIDATION_REPAY_WARM_UP_PERIOD = 4 hours;\n"
      },
      "contracts/utils/BlueberryErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n/**\n * @title BlueberryErrors\n * @author BlueberryProtocol\n * @notice containing all errors used in Blueberry protocol\n */\n/// title BlueberryErrors\n/// @notice containing all errors used in Blueberry protocol\npragma solidity 0.8.22;\n\n/*//////////////////////////////////////////////////////////////////////////\n                                COMMON ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when an action involves zero amount of tokens.\nerror ZERO_AMOUNT();\n\n/// @notice Thrown when the address provided is the zero address.\nerror ZERO_ADDRESS();\n\n/// @notice Thrown when the lengths of input arrays do not match.\nerror INPUT_ARRAY_MISMATCH();\n\n/// @notice Thrown when the caller is not authorized to call the function.\nerror UNAUTHORIZED();\n\n/*//////////////////////////////////////////////////////////////////////////\n                                ORACLE ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the delay time exceeds allowed limits.\nerror TOO_LONG_DELAY(uint256 delayTime);\n\n/// @notice Thrown when there's no maximum delay set for a token.\nerror NO_MAX_DELAY(address token);\n\n/// @notice Thrown when the price information for a token is outdated.\nerror PRICE_OUTDATED(address token);\n\n/// @notice Thrown when the price obtained is negative.\nerror PRICE_NEGATIVE(address token);\n\n/// @notice Thrown when the sequencer is offline\nerror SEQUENCER_DOWN(address sequencer);\n\n/// @notice Thrown when the grace period for a sequencer is not over yet.\nerror SEQUENCER_GRACE_PERIOD_NOT_OVER(address sequencer);\n\n/// @notice Thrown when the price deviation exceeds allowed limits.\nerror OUT_OF_DEVIATION_CAP(uint256 deviation);\n\n/// @notice Thrown when the number of sources exceeds the allowed length.\nerror EXCEED_SOURCE_LEN(uint256 length);\n\n/// @notice Thrown when no primary source is available for the token.\nerror NO_PRIMARY_SOURCE(address token);\n\n/// @notice Thrown when no valid price source is available for the token.\nerror NO_VALID_SOURCE(address token);\n\n/// @notice Thrown when the deviation value exceeds the threshold.\nerror EXCEED_DEVIATION();\n\n/// @notice Thrown when the mean price is below the acceptable threshold.\nerror TOO_LOW_MEAN(uint256 mean);\n\n/// @notice Thrown when no mean price is set for the token.\nerror NO_MEAN(address token);\n\n/// @notice Thrown when no stable pool exists for the token.\nerror NO_STABLEPOOL(address token);\n\n/// @notice Thrown when the price fetch process fails for a token.\nerror PRICE_FAILED(address token);\n\n/// @notice Thrown when the liquidation threshold is set too high.\nerror LIQ_THRESHOLD_TOO_HIGH(uint256 threshold);\n\n/// @notice Thrown when the liquidation threshold is set too low.\nerror LIQ_THRESHOLD_TOO_LOW(uint256 threshold);\n\n/// @notice Thrown when the oracle doesn't support a specific token.\nerror ORACLE_NOT_SUPPORT(address token);\n\n/// @notice Thrown when the oracle doesn't support a specific LP pair token.\nerror ORACLE_NOT_SUPPORT_LP(address lp);\n\n/// @notice Thrown when the oracle doesn't support a specific wToken.\nerror ORACLE_NOT_SUPPORT_WTOKEN(address wToken);\n\n/// @notice Thrown when there is no route to fetch data for the oracle\nerror NO_ORACLE_ROUTE(address token);\n\n/// @notice Thrown when a value is out of an acceptable range.\nerror VALUE_OUT_OF_RANGE();\n\n/// @notice Thrown when specified limits are incorrect.\nerror INCORRECT_LIMITS();\n\n/// @notice Thrown when Curve LP is already registered.\nerror CRV_LP_ALREADY_REGISTERED(address lp);\n\n/// @notice Thrown when a pool is subject to read-only reentrancy manipulation.\nerror REENTRANCY_RISK(address pool);\n\n/*//////////////////////////////////////////////////////////////////////////\n                            GENERAL SPELL ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the caller isn't recognized as a bank.\nerror NOT_BANK(address caller);\n\n/// @notice Thrown when the collateral doesn't exist for a strategy.\nerror COLLATERAL_NOT_EXIST(uint256 strategyId, address colToken);\n\n/// @notice Thrown when the strategy ID doesn't correspond to an existing strategy.\nerror STRATEGY_NOT_EXIST(address spell, uint256 strategyId);\n\n/// @notice Thrown when the position size exceeds maximum limits.\nerror EXCEED_MAX_POS_SIZE(uint256 strategyId);\n\n/// @notice Thrown when the position size is below minimum requirements.\nerror EXCEED_MIN_POS_SIZE(uint256 strategyId);\n\n/// @notice Thrown when the loan-to-value ratio exceeds allowed maximum.\nerror EXCEED_MAX_LTV();\n\n/// @notice Thrown when the strategy ID provided is incorrect.\nerror INCORRECT_STRATEGY_ID(uint256 strategyId);\n\n/// @notice Thrown when the position size is invalid.\nerror INVALID_POS_SIZE();\n\n/// @notice Thrown when an incorrect liquidity pool token is provided.\nerror INCORRECT_LP(address lpToken);\n\n/// @notice Thrown when an incorrect pool ID is provided.\nerror INCORRECT_PID(uint256 pid);\n\n/// @notice Thrown when an incorrect collateral token is provided.\nerror INCORRECT_COLTOKEN(address colToken);\n\n/// @notice Thrown when an incorrect underlying token is provided.\nerror INCORRECT_UNDERLYING(address uToken);\n\n/// @notice Thrown when an incorrect debt token is provided.\nerror INCORRECT_DEBT(address debtToken);\n\n/// @notice Thrown when a swap fails.\nerror SWAP_FAILED(address swapToken);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                VAULT ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when borrowing from the vault fails.\nerror BORROW_FAILED(uint256 amount);\n\n/// @notice Thrown when repaying to the vault fails.\nerror REPAY_FAILED(uint256 amount);\n\n/// @notice Thrown when lending to the vault fails.\nerror LEND_FAILED(uint256 amount);\n\n/// @notice Thrown when redeeming from the vault fails.\nerror REDEEM_FAILED(uint256 amount);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                WRAPPER ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when a duplicate tokenId is added.\nerror DUPLICATE_TOKEN_ID(uint256 tokenId);\n\n/// @notice Thrown when an invalid token ID is provided.\nerror INVALID_TOKEN_ID(uint256 tokenId);\n\n/// @notice Thrown when an incorrect pool ID is provided.\nerror BAD_PID(uint256 pid);\n\n/// @notice Thrown when a mismatch in reward per share is detected.\nerror BAD_REWARD_PER_SHARE(uint256 rewardPerShare);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                BANK ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when a function is called without a required execution flag.\nerror NOT_UNDER_EXECUTION();\n\n/// @notice Thrown when a transaction isn't initiated by the expected spell.\nerror NOT_FROM_SPELL(address from);\n\n/// @notice Thrown when the sender is not the owner of a given position ID.\nerror NOT_FROM_OWNER(uint256 positionId, address sender);\n\n/// @notice Thrown when a spell address isn't whitelisted.\nerror SPELL_NOT_WHITELISTED(address spell);\n\n/// @notice Thrown when a token isn't whitelisted.\nerror TOKEN_NOT_WHITELISTED(address token);\n\n/// @notice Thrown when a bank isn't listed for a given token.\nerror BANK_NOT_LISTED(address token);\n\n/// @notice Thrown when a bank doesn't exist for an index.\nerror BANK_NOT_EXIST(uint8 index);\n\n/// @notice Thrown when a bank is already listed for a given token.\nerror BANK_ALREADY_LISTED();\n\n/// @notice Thrown when the bank limit is reached.\nerror BANK_LIMIT();\n\n/// @notice Thrown when the BTOKEN is already added.\nerror BTOKEN_ALREADY_ADDED();\n\n/// @notice Thrown when the lending action isn't allowed.\nerror LEND_NOT_ALLOWED();\n\n/// @notice Thrown when the borrowing action isn't allowed.\nerror BORROW_NOT_ALLOWED();\n\n/// @notice Thrown when the repaying action isn't allowed.\nerror REPAY_NOT_ALLOWED();\n\n/// @notice Thrown when the redeeming action isn't allowed.\nerror WITHDRAW_LEND_NOT_ALLOWED();\n\n/// @notice Thrown when certain actions are locked.\nerror LOCKED();\n\n/// @notice Thrown when an action isn't executed.\nerror NOT_IN_EXEC();\n\n/// @notice Thrown when the repayment allowance hasn't been warmed up.\nerror REPAY_ALLOW_NOT_WARMED_UP();\n\n/// @notice Thrown when a different collateral type exists.\nerror DIFF_COL_EXIST(address collToken);\n\n/// @notice Thrown when a position is not eligible for liquidation.\nerror NOT_LIQUIDATABLE(uint256 positionId);\n\n/// @notice Thrown when a position is flagged as bad or invalid.\nerror BAD_POSITION(uint256 posId);\n\n/// @notice Thrown when collateral for a specific position is flagged as bad or invalid.\nerror BAD_COLLATERAL(uint256 positionId);\n\n/// @notice Thrown when there's insufficient collateral for an operation.\nerror INSUFFICIENT_COLLATERAL();\n\n/// @notice Thrown when an attempted repayment exceeds the actual debt.\nerror REPAY_EXCEEDS_DEBT(uint256 repay, uint256 debt);\n\n/// @notice Thrown when an invalid utility token is provided.\nerror INVALID_UTOKEN(address uToken);\n\n/// @notice Thrown when a borrow operation results in zero shares.\nerror BORROW_ZERO_SHARE(uint256 borrowAmount);\n\n/*//////////////////////////////////////////////////////////////////////////\n                            CONFIGURATION ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when a certain ratio is too high for an operation.\nerror RATIO_TOO_HIGH(uint256 ratio);\n\n/// @notice Thrown when an invalid fee distribution is detected.\nerror INVALID_FEE_DISTRIBUTION();\n\n/// @notice Thrown when no treasury is set for fee distribution.\nerror NO_TREASURY_SET();\n\n/// @notice Thrown when a fee window has already started.\nerror FEE_WINDOW_ALREADY_STARTED();\n\n/// @notice Thrown when a fee window duration is too long.\nerror FEE_WINDOW_TOO_LONG(uint256 windowTime);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                UTILITY ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when an operation has surpassed its deadline.\nerror EXPIRED(uint256 deadline);\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {
        "contracts/libraries/UniV3/UniV3WrappedLibContainer.sol": {
          "UniV3WrappedLibContainer": "0x20ece8e8848e887e6db8ba4f89c4cc9bfc8ae13f"
        }
      }
    }
  }}