{
  "language": "Solidity",
  "sources": {
    "@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/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"
    },
    "@openzeppelin/contracts/utils/structs/EnumerableMap.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.\n\npragma solidity ^0.8.0;\n\nimport \"./EnumerableSet.sol\";\n\n/**\n * @dev Library for managing an enumerable variant of Solidity's\n * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]\n * type.\n *\n * Maps have the following properties:\n *\n * - Entries are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Entries are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableMap for EnumerableMap.UintToAddressMap;\n *\n *     // Declare a set state variable\n *     EnumerableMap.UintToAddressMap private myMap;\n * }\n * ```\n *\n * The following map types are supported:\n *\n * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0\n * - `address -> uint256` (`AddressToUintMap`) since v4.6.0\n * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0\n * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0\n * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableMap.\n * ====\n */\nlibrary EnumerableMap {\n    using EnumerableSet for EnumerableSet.Bytes32Set;\n\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Map type with\n    // bytes32 keys and values.\n    // The Map implementation uses private functions, and user-facing\n    // implementations (such as Uint256ToAddressMap) are just wrappers around\n    // the underlying Map.\n    // This means that we can only create new EnumerableMaps for types that fit\n    // in bytes32.\n\n    struct Bytes32ToBytes32Map {\n        // Storage of keys\n        EnumerableSet.Bytes32Set _keys;\n        mapping(bytes32 => bytes32) _values;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {\n        map._values[key] = value;\n        return map._keys.add(key);\n    }\n\n    /**\n     * @dev Removes a key-value pair from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {\n        delete map._values[key];\n        return map._keys.remove(key);\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {\n        return map._keys.contains(key);\n    }\n\n    /**\n     * @dev Returns the number of key-value pairs in the map. O(1).\n     */\n    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {\n        return map._keys.length();\n    }\n\n    /**\n     * @dev Returns the key-value pair stored at position `index` in the map. O(1).\n     *\n     * Note that there are no guarantees on the ordering of entries inside the\n     * array, and it may change when more entries are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {\n        bytes32 key = map._keys.at(index);\n        return (key, map._values[key]);\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {\n        bytes32 value = map._values[key];\n        if (value == bytes32(0)) {\n            return (contains(map, key), bytes32(0));\n        } else {\n            return (true, value);\n        }\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {\n        bytes32 value = map._values[key];\n        require(value != 0 || contains(map, key), \"EnumerableMap: nonexistent key\");\n        return value;\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        Bytes32ToBytes32Map storage map,\n        bytes32 key,\n        string memory errorMessage\n    ) internal view returns (bytes32) {\n        bytes32 value = map._values[key];\n        require(value != 0 || contains(map, key), errorMessage);\n        return value;\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {\n        return map._keys.values();\n    }\n\n    // UintToUintMap\n\n    struct UintToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {\n        return set(map._inner, bytes32(key), bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {\n        return remove(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {\n        return contains(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(UintToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (uint256(key), uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(key)));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(key), errorMessage));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintToAddressMap\n\n    struct UintToAddressMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {\n        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {\n        return remove(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {\n        return contains(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(UintToAddressMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (uint256(key), address(uint160(uint256(value))));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));\n        return (success, address(uint160(uint256(value))));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {\n        return address(uint160(uint256(get(map._inner, bytes32(key)))));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        UintToAddressMap storage map,\n        uint256 key,\n        string memory errorMessage\n    ) internal view returns (address) {\n        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressToUintMap\n\n    struct AddressToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {\n        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(AddressToUintMap storage map, address key) internal returns (bool) {\n        return remove(map._inner, bytes32(uint256(uint160(key))));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(AddressToUintMap storage map, address key) internal view returns (bool) {\n        return contains(map._inner, bytes32(uint256(uint160(key))));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(AddressToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (address(uint160(uint256(key))), uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        AddressToUintMap storage map,\n        address key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(AddressToUintMap storage map) internal view returns (address[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // Bytes32ToUintMap\n\n    struct Bytes32ToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {\n        return set(map._inner, key, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {\n        return remove(map._inner, key);\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {\n        return contains(map._inner, key);\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (key, uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, key);\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {\n        return uint256(get(map._inner, key));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        Bytes32ToUintMap storage map,\n        bytes32 key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, key, errorMessage));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"
    },
    "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"
    },
    "contracts/dependencies/BlastWrapperUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"./PropelOwnableUpgradeable.sol\";\nimport \"../interfaces/IBlast.sol\";\nimport \"../interfaces/IWETH.sol\";\n\ncontract BlastWrapperUpgradeable is PropelOwnableUpgradeable {\n\n\tfunction __Init_Blast(IPropelCore _propelCore) internal {\n\t\t__InitCore(_propelCore);\n\t\tblast().configureClaimableGas();\n\t\tWETH().configure(YieldMode.CLAIMABLE);\n\t}\n\n\tfunction getClaimableWETH() public view returns(uint256) {\n\t\treturn WETH().getClaimableAmount(address(this));\n\t}\n\n\tfunction claimAllYield(address to) external onlyOwner {\n\t\tuint256 amount = getClaimableWETH();\n\t\trequire(amount > 0, \"no claimable amount\");\n\t\tWETH().claim(to, amount);\n\t}\n\n\tfunction claimAllGas(address to) external onlyOwner {\n\t\tblast().claimAllGas(address(this), to);\n\t}\n}\n"
    },
    "contracts/dependencies/PropelMath.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nlibrary PropelMath {\n\tuint256 internal constant DECIMAL_PRECISION = 1e18;\n\n\t/* Precision for Nominal ICR (independent of price). Rationale for the value:\n\t *\n\t * - Making it “too high” could lead to overflows.\n\t * - Making it “too low” could lead to an ICR equal to zero, due to truncation from Solidity floor division.\n\t *\n\t * This value of 1e20 is chosen for safety: the NICR will only overflow for numerator > ~1e39,\n\t * and will only truncate to 0 if the denominator is at least 1e20 times greater than the numerator.\n\t *\n\t */\n\tuint256 internal constant NICR_PRECISION = 1e20;\n\n\tfunction _min(uint256 _a, uint256 _b) internal pure returns (uint256) {\n\t\treturn (_a < _b) ? _a : _b;\n\t}\n\n\tfunction _max(uint256 _a, uint256 _b) internal pure returns (uint256) {\n\t\treturn (_a >= _b) ? _a : _b;\n\t}\n\n\t/*\n\t * Multiply two decimal numbers and use normal rounding rules:\n\t * -round product up if 19'th mantissa digit >= 5\n\t * -round product down if 19'th mantissa digit < 5\n\t *\n\t * Used only inside the exponentiation, _decPow().\n\t */\n\tfunction decMul(uint256 x, uint256 y) internal pure returns (uint256 decProd) {\n\t\tuint256 prod_xy = x * y;\n\n\t\tdecProd = (prod_xy + (DECIMAL_PRECISION / 2)) / DECIMAL_PRECISION;\n\t}\n\n\t/*\n\t * _decPow: Exponentiation function for 18-digit decimal base, and integer exponent n.\n\t *\n\t * Uses the efficient \"exponentiation by squaring\" algorithm. O(log(n)) complexity.\n\t *\n\t * TroveManager._calcDecayedBaseRate\n\t *\n\t * The exponent is capped to avoid reverting due to overflow. The cap 525600000 equals\n\t * \"minutes in 1000 years\": 60 * 24 * 365 * 1000\n\t *\n\t * If a period of > 1000 years is ever used as an exponent in either of the above functions, the result will be\n\t * negligibly different from just passing the cap, since:\n\t *\n\t * the decayed base rate will be 0 for 1000 years or > 1000 years\n\t */\n\tfunction _decPow(uint256 _base, uint256 _minutes) internal pure returns (uint256) {\n\t\tif (_minutes > 525600000) {\n\t\t\t_minutes = 525600000;\n\t\t} // cap to avoid overflow\n\n\t\tif (_minutes == 0) {\n\t\t\treturn DECIMAL_PRECISION;\n\t\t}\n\n\t\tuint256 y = DECIMAL_PRECISION;\n\t\tuint256 x = _base;\n\t\tuint256 n = _minutes;\n\n\t\t// Exponentiation-by-squaring\n\t\twhile (n > 1) {\n\t\t\tif (n % 2 == 0) {\n\t\t\t\tx = decMul(x, x);\n\t\t\t\tn = n / 2;\n\t\t\t} else {\n\t\t\t\t// if (n % 2 != 0)\n\t\t\t\ty = decMul(x, y);\n\t\t\t\tx = decMul(x, x);\n\t\t\t\tn = (n - 1) / 2;\n\t\t\t}\n\t\t}\n\n\t\treturn decMul(x, y);\n\t}\n\n\tfunction _getAbsoluteDifference(uint256 _a, uint256 _b) internal pure returns (uint256) {\n\t\treturn (_a >= _b) ? _a - _b : _b - _a;\n\t}\n\n\tfunction _computeNominalCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) {\n\t\tif (_debt > 0) {\n\t\t\treturn (_coll * NICR_PRECISION) / _debt;\n\t\t}\n\t\t// Return the maximal value for uint256 if the Trove has a debt of 0. Represents \"infinite\" CR.\n\t\telse {\n\t\t\t// if (_debt == 0)\n\t\t\treturn 2 ** 256 - 1;\n\t\t}\n\t}\n\n\tfunction _computeCR(uint256 _coll, uint256 _debt, uint256 _price) internal pure returns (uint256) {\n\t\tif (_debt > 0) {\n\t\t\tuint256 newCollRatio = (_coll * _price) / _debt;\n\n\t\t\treturn newCollRatio;\n\t\t}\n\t\t// Return the maximal value for uint256 if the Trove has a debt of 0. Represents \"infinite\" CR.\n\t\telse {\n\t\t\t// if (_debt == 0)\n\t\t\treturn type(uint256).max;\n\t\t}\n\t}\n\n\tfunction _computeCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) {\n\t\tif (_debt > 0) {\n\t\t\tuint256 newCollRatio = (_coll) / _debt;\n\n\t\t\treturn newCollRatio;\n\t\t}\n\t\t// Return the maximal value for uint256 if the Trove has a debt of 0. Represents \"infinite\" CR.\n\t\telse {\n\t\t\t// if (_debt == 0)\n\t\t\treturn type(uint256).max;\n\t\t}\n\t}\n}\n"
    },
    "contracts/dependencies/PropelOwnableUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IPropelCore.sol\";\n\n/**\n    @title Propel Ownable\n    @notice Contracts inheriting `PropelOwnable` have the same owner as `PropelCore`.\n            The ownership cannot be independently modified or renounced.\n */\ncontract PropelOwnableUpgradeable is Initializable {\n\tIPropelCore public PropelCore;\n\n\tfunction __InitCore(IPropelCore _PropelCore) internal {\n\t\tPropelCore = _PropelCore;\n\t}\n\n\tmodifier onlyOwner() {\n\t\trequire(msg.sender == owner(), \"Only owner\");\n\t\t_;\n\t}\n\n\tmodifier onlyGuardian() {\n\t\trequire(msg.sender == guardian(), \"Only guardian\");\n\t\t_;\n\t}\n\n\tfunction owner() public view returns (address) {\n\t\treturn PropelCore.owner();\n\t}\n\n\tfunction guardian() public view returns (address) {\n\t\treturn PropelCore.guardian();\n\t}\n\n\tfunction WETH() public view returns(IWETH) {\n\t\treturn PropelCore.WETH();\n\t}\n\n\tfunction blast() public view returns(IBlast) {\n\t\treturn PropelCore.blast();\n\t}\n}\n"
    },
    "contracts/helpers/TroveState.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"../interfaces/IBorrowerOperations.sol\";\nimport \"../interfaces/ITroveManager.sol\";\nimport \"../interfaces/ISortedTroves.sol\";\nimport \"../interfaces/IStabilityPool.sol\";\n\ncontract TroveState {\n\tIBorrowerOperations public bo;\n\tITroveManager public tm;\n\tIStabilityPool public sp;\n\n\tstruct State {\n\t\tuint256 coll;\n\t\tuint256 debt;\n\t\tuint256 interest;\n\t\tuint256 MCR;\n\t\tuint256 ICR;\n\t\tuint256 CCR;\n\t\tuint256 TCR;\n\t\tuint256 price;\n\t\tuint256 maxCap;\n\t\tuint256 entireSystemDebt;\n\t\tuint256 entireSystemColl;\n\t\tuint256 spStaked;\n\t\tuint256 spWETHGains;\n\t\tuint256 spEsPropelGains;\n\t}\n\n\tconstructor(IBorrowerOperations _bo, ITroveManager _tm, IStabilityPool _sp) {\n\t\tbo = _bo;\n\t\ttm = _tm;\n\t\tsp = _sp;\n\t}\n\n\tfunction getState(address _borrower) public returns (State memory state) {\n\t\t(state.coll, state.debt) = tm.getTroveCollAndDebt(_borrower);\n\t\tstate.interest = tm.getTroveInterest(_borrower, state.debt);\n\t\tstate.maxCap = tm.maxSystemDebt();\n\t\tstate.MCR = tm.MCR();\n\t\tstate.CCR = tm.CCR();\n\t\tstate.TCR = bo.getTCR();\n\t\tstate.price = tm.fetchPrice();\n\t\tstate.ICR = tm.getCurrentICR(_borrower,state.price);\n\t\tstate.entireSystemDebt = tm.getEntireSystemDebt();\n\t\tstate.entireSystemColl = tm.getEntireSystemColl();\n\t\tstate.spStaked = sp.getTotalPropelUSDDeposits();\n\t\tuint256[] memory collGains = sp.getDepositorCollateralGain(_borrower);\n\t\tif (collGains.length > 0) {\n\t\t\tstate.spWETHGains = collGains[0];\n\t\t}\n\t\tstate.spEsPropelGains = sp.claimableReward(_borrower);\n\t}\n}\n"
    },
    "contracts/interfaces/IBlast.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nenum YieldMode {\n\tAUTOMATIC,\n\tVOID,\n\tCLAIMABLE\n}\n\nenum GasMode {\n\tVOID,\n\tCLAIMABLE\n}\n\ninterface IERC20Rebasing {\n\t// changes the yield mode of the caller and update the balance\n\t// to reflect the configuration\n\tfunction configure(YieldMode) external returns (uint256);\n\n\t// \"claimable\" yield mode accounts can call this this claim their yield\n\t// to another address\n\tfunction claim(address recipient, uint256 amount) external returns (uint256);\n\n\t// read the claimable amount for an account\n\tfunction getClaimableAmount(address account) external view returns (uint256);\n}\n\ninterface IBlast {\n\t// configure\n\tfunction configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external;\n\n\tfunction configure(YieldMode _yield, GasMode gasMode, address governor) external;\n\n\t// base configuration options\n\tfunction configureClaimableYield() external;\n\n\tfunction configureClaimableYieldOnBehalf(address contractAddress) external;\n\n\tfunction configureAutomaticYield() external;\n\n\tfunction configureAutomaticYieldOnBehalf(address contractAddress) external;\n\n\tfunction configureVoidYield() external;\n\n\tfunction configureVoidYieldOnBehalf(address contractAddress) external;\n\n\tfunction configureClaimableGas() external;\n\n\tfunction configureClaimableGasOnBehalf(address contractAddress) external;\n\n\tfunction configureVoidGas() external;\n\n\tfunction configureVoidGasOnBehalf(address contractAddress) external;\n\n\tfunction configureGovernor(address _governor) external;\n\n\tfunction configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;\n\n\t// claim yield\n\tfunction claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256);\n\n\tfunction claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);\n\n\t// claim gas\n\tfunction claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256);\n\n\tfunction claimGasAtMinClaimRate(address contractAddress, address recipientOfGas, uint256 minClaimRateBips) external returns (uint256);\n\n\tfunction claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);\n\n\tfunction claimGas(address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume) external returns (uint256);\n\n\t// read functions\n\tfunction readClaimableYield(address contractAddress) external view returns (uint256);\n\n\tfunction readYieldConfiguration(address contractAddress) external view returns (uint8);\n\n\tfunction readGasParams(address contractAddress) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode);\n}\n"
    },
    "contracts/interfaces/IBorrowerOperations.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITroveManager.sol\";\n\ninterface IBorrowerOperations {\n\tstruct SystemBalances {\n\t\tuint256[] collaterals;\n\t\tuint256[] debts;\n\t\tuint256[] prices;\n\t}\n\n\tenum BorrowerOperation {\n\t\topenTrove,\n\t\tcloseTrove,\n\t\tadjustTrove\n\t}\n\n\tevent BorrowingFeePaid(address indexed borrower, uint256 amount);\n\tevent CollateralConfigured(ITroveManager troveManager, IERC20 collateralToken);\n\tevent TroveCreated(address indexed _borrower, uint256 arrayIndex);\n\tevent TroveManagerRemoved(ITroveManager troveManager);\n\tevent TroveUpdated(address indexed _borrower, uint256 _debt, uint256 _coll, uint256 stake, BorrowerOperation operation);\n\n\tfunction addColl(ITroveManager troveManager, address account, uint256 _collateralAmount, address _upperHint, address _lowerHint) external;\n\n\tfunction adjustTrove(ITroveManager troveManager, address account, uint256 _maxFeePercentage, uint256 _collDeposit, uint256 _collWithdrawal, uint256 _debtChange, bool _isDebtIncrease, address _upperHint, address _lowerHint) external;\n\n\tfunction closeTrove(ITroveManager troveManager, address account) external;\n\n\tfunction configureCollateral(ITroveManager troveManager, IERC20 collateralToken) external;\n\n\tfunction fetchBalances() external returns (SystemBalances memory balances);\n\n\tfunction getGlobalSystemBalances() external returns (uint256 totalPricedCollateral, uint256 totalDebt);\n\n\tfunction getTCR() external returns (uint256 globalTotalCollateralRatio);\n\n\tfunction openTrove(ITroveManager troveManager, address account, uint256 _maxFeePercentage, uint256 _collateralAmount, uint256 _debtAmount, address _upperHint, address _lowerHint) external;\n\n\tfunction removeTroveManager(ITroveManager troveManager) external;\n\n\tfunction repayDebt(ITroveManager troveManager, address account, uint256 _debtAmount, address _upperHint, address _lowerHint) external;\n\n\tfunction setMinNetDebt(uint256 _minNetDebt) external;\n\n\tfunction withdrawColl(ITroveManager troveManager, address account, uint256 _collWithdrawal, address _upperHint, address _lowerHint) external;\n\n\tfunction withdrawDebt(ITroveManager troveManager, address account, uint256 _maxFeePercentage, uint256 _debtAmount, address _upperHint, address _lowerHint) external;\n\n\tfunction factory() external view returns (address);\n\n\tfunction getCompositeDebt(uint256 _debt) external view returns (uint256);\n\n\tfunction minNetDebt() external view returns (uint256);\n\n\tfunction checkRecoveryMode(uint256 TCR) external pure returns (bool);\n}\n"
    },
    "contracts/interfaces/IEsPropel.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IEsPropel is IERC20 {\n\tevent SenderUpdated(address sender, bool enabled);\n\tevent ReceiverUpdated(address receiver, bool enabled);\n\n\tfunction mint(address account, uint256 amount) external;\n\n\tfunction burn(uint256 amount) external;\n\n\tfunction burnFrom(address account, uint256 amount) external;\n\n\tfunction burnFromPropel(address account, uint256 amount) external;\n\n\tfunction sendToken(address account, uint256 amount) external;\n}\n"
    },
    "contracts/interfaces/IEsPropelStaking.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"./IEsPropel.sol\";\n\ninterface IEsPropelStaking {\n\tevent TokenUpdated(address token);\n\tevent FeeIncreased(address token, uint256 amount);\n\tevent StakedWithLock(address user, uint256 id, uint256 lockIndex, uint256 amount);\n\tevent StakedWithoutLock(address user, uint256 id, uint256 amount);\n\tevent Claimed(address user, uint256 id, uint256 amount);\n\tevent Withdrawn(address user, uint256 id, uint256 amount);\n\n\tfunction tokensLength() external view returns (uint256);\n\n\tfunction tokenAt(uint256 i) external view returns (address, uint256);\n\n\tfunction earned(address user, address token, uint256 id) external view returns (uint256);\n\n\tfunction submit(address token, uint256 amount) external;\n\n\tfunction esPropel() external view returns (IEsPropel);\n\n\tfunction tokenExists(address _token) external view returns (bool);\n\n\tfunction totalStakes() external view returns (uint256);\n}\n"
    },
    "contracts/interfaces/IPriceFeed.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"../interfaces/IPyth.sol\";\n\ninterface IPriceFeed {\n\tstruct OracleRecord {\n\t\tIPyth pyth;\n\t\tuint32 decimals;\n\t\tuint32 heartbeat;\n\t\tbool isFeedWorking;\n\t}\n\n\tstruct PriceRecord {\n\t\tuint96 scaledPrice;\n\t\tuint32 timestamp;\n\t\tuint32 lastUpdated;\n\t}\n\n\tstruct FeedResponse {\n\t\tint64 price;\n\t\t// Confidence interval around the price\n\t\tuint64 conf;\n\t\t// Price exponent\n\t\tint32 expo;\n\t\t// Unix timestamp describing when the price was published\n\t\tuint publishTime;\n\t\tbool success;\n\t}\n\n\t// Custom Errors --------------------------------------------------------------------------------------------------\n\n\terror PriceFeed__InvalidFeedResponseError();\n\terror PriceFeed__FeedFrozenError();\n\terror PriceFeed__UnknownFeedError();\n\terror PriceFeed__HeartbeatOutOfBoundsError();\n\n\t// Events ---------------------------------------------------------------------------------------------------------\n\n\tevent NewOracleRegistered(address pyth);\n\tevent PriceFeedStatusUpdated(address oracle, bool isWorking);\n\tevent PriceRecordUpdated(uint256 _price);\n\n\tfunction fetchPrice(address _token) external returns (uint256);\n}\n"
    },
    "contracts/interfaces/IPropelBase.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\ninterface IPropelBase {\n\tfunction DECIMAL_PRECISION() external view returns (uint256);\n\n\t// Critical system collateral ratio. If the system's total collateral ratio (TCR) falls below the CCR, Recovery Mode is triggered.\n\tfunction CCR() external view returns (uint256); // 150%\n\n\t// Amount of debt to be locked in gas pool on opening troves\n\tfunction DEBT_GAS_COMPENSATION() external view returns (uint256);\n\n\tfunction PERCENT_DIVISOR() external view returns (uint256);\n}\n"
    },
    "contracts/interfaces/IPropelCore.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"../interfaces/IBlast.sol\";\nimport \"../interfaces/IWETH.sol\";\n\ninterface IPropelCore {\n\tevent FeeReceiverSet(address feeReceiver);\n\tevent GuardianSet(address guardian);\n\tevent NewOwnerAccepted(address oldOwner, address owner);\n\tevent NewOwnerCommitted(address owner, address pendingOwner, uint256 deadline);\n\tevent NewOwnerRevoked(address owner, address revokedOwner);\n\tevent Paused();\n\tevent PriceFeedSet(address priceFeed);\n\tevent Unpaused();\n\n\tfunction acceptTransferOwnership() external;\n\n\tfunction commitTransferOwnership(address newOwner) external;\n\n\tfunction revokeTransferOwnership() external;\n\n\tfunction setFeeReceiver(address _feeReceiver) external;\n\n\tfunction setGuardian(address _guardian) external;\n\n\tfunction setPaused(bool _paused) external;\n\n\tfunction setPriceFeed(address _priceFeed) external;\n\n\tfunction OWNERSHIP_TRANSFER_DELAY() external view returns (uint256);\n\n\tfunction feeReceiver() external view returns (address);\n\n\tfunction guardian() external view returns (address);\n\n\tfunction owner() external view returns (address);\n\n\tfunction WETH() external view returns(IWETH);\n\n\tfunction blast() external view returns(IBlast);\n\n\tfunction ownershipTransferDeadline() external view returns (uint256);\n\n\tfunction paused() external view returns (bool);\n\n\tfunction pendingOwner() external view returns (address);\n\n\tfunction startTime() external view returns (uint256);\n}\n"
    },
    "contracts/interfaces/IPyth.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\ninterface IPyth {\n\tstruct Price {\n\t\t// Price\n\t\tint64 price;\n\t\t// Confidence interval around the price\n\t\tuint64 conf;\n\t\t// Price exponent\n\t\tint32 expo;\n\t\t// Unix timestamp describing when the price was published\n\t\tuint publishTime;\n\t}\n\n\tfunction getPrice(bytes32 id) external view returns (Price memory);\n\n\tfunction getPriceUnsafe(bytes32 id) external view returns (Price memory price);\n}\n"
    },
    "contracts/interfaces/ISortedTroves.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\ninterface ISortedTroves {\n\tevent NodeAdded(address _id, uint256 _NICR);\n\tevent NodeRemoved(address _id);\n\n\tfunction insert(address _id, uint256 _NICR, address _prevId, address _nextId) external;\n\n\tfunction reInsert(address _id, uint256 _newNICR, address _prevId, address _nextId) external;\n\n\tfunction remove(address _id) external;\n\n\tfunction setAddresses(address _troveManagerAddress) external;\n\n\tfunction contains(address _id) external view returns (bool);\n\n\tfunction data() external view returns (address head, address tail, uint256 size);\n\n\tfunction findInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view returns (address, address);\n\n\tfunction getFirst() external view returns (address);\n\n\tfunction getLast() external view returns (address);\n\n\tfunction getNext(address _id) external view returns (address);\n\n\tfunction getPrev(address _id) external view returns (address);\n\n\tfunction getSize() external view returns (uint256);\n\n\tfunction isEmpty() external view returns (bool);\n\n\tfunction troveManager() external view returns (address);\n\n\tfunction validInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view returns (bool);\n}\n"
    },
    "contracts/interfaces/IStabilityPool.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IStabilityPool {\n\tevent CollateralGainWithdrawn(address indexed _depositor, uint256[] _collateral);\n\tevent CollateralOverwritten(address oldCollateral, address newCollateral);\n\tevent DepositSnapshotUpdated(address indexed _depositor, uint256 _P, uint256 _G);\n\tevent EpochUpdated(uint128 _currentEpoch);\n\tevent G_Updated(uint256 _G, uint128 _epoch, uint128 _scale);\n\tevent P_Updated(uint256 _P);\n\tevent RewardClaimed(address indexed account, address indexed recipient, uint256 claimed);\n\tevent S_Updated(uint256 idx, uint256 _S, uint128 _epoch, uint128 _scale);\n\tevent ScaleUpdated(uint128 _currentScale);\n\tevent StabilityPoolPropelUSDBalanceUpdated(uint256 _newBalance);\n\tevent UserDepositChanged(address indexed _depositor, uint256 _newDeposit);\n\n\t// function claimCollateralGains(address recipient, uint256[] calldata collateralIndexes) external;\n\n\t// function claimReward(address recipient) external returns (uint256 amount);\n\n\tfunction enableCollateral(IERC20 _collateral) external;\n\n\tfunction offset(IERC20 collateral, uint256 _debtToOffset, uint256 _collToAdd) external;\n\n\tfunction provideToSP(uint256 _amount) external;\n\n\tfunction startCollateralSunset(IERC20 collateral) external;\n\n\tfunction withdrawFromSP(uint256 _amount) external;\n\n\tfunction DECIMAL_PRECISION() external view returns (uint256);\n\n\tfunction P() external view returns (uint256);\n\n\tfunction SCALE_FACTOR() external view returns (uint256);\n\n\tfunction SUNSET_DURATION() external view returns (uint128);\n\n\tfunction claimableReward(address _depositor) external view returns (uint256);\n\n\tfunction currentEpoch() external view returns (uint128);\n\n\tfunction currentScale() external view returns (uint128);\n\n\tfunction depositSnapshots(address) external view returns (uint256 P, uint256 G, uint128 scale, uint128 epoch);\n\n\tfunction depositSums(address, uint256) external view returns (uint256);\n\n\tfunction epochToScaleToG(uint128, uint128) external view returns (uint256);\n\n\tfunction epochToScaleToSums(uint128, uint128, uint256) external view returns (uint256);\n\n\tfunction factory() external view returns (address);\n\n\tfunction getCompoundedDeposit(address _depositor) external view returns (uint256);\n\n\tfunction getDepositorCollateralGain(address _depositor) external view returns (uint256[] memory collateralGains);\n\n\tfunction getTotalPropelUSDDeposits() external view returns (uint256);\n\n\tfunction lastDebtLossError_Offset() external view returns (uint256);\n\n\tfunction lastEsPropelError() external view returns (uint256);\n\n\tfunction liquidationManager() external view returns (address);\n}\n"
    },
    "contracts/interfaces/ITroveManager.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./IPropelBase.sol\";\nimport \"./ISortedTroves.sol\";\nimport \"./IPriceFeed.sol\";\n\ninterface ITroveManager is IPropelBase {\n\t// Store the necessary data for a trove\n\tstruct Trove {\n\t\tuint256 debt;\n\t\tuint256 coll;\n\t\tuint256 stake;\n\t\tStatus status;\n\t\tuint128 arrayIndex;\n\t}\n\n\tstruct RedemptionTotals {\n\t\tuint256 remainingDebt;\n\t\tuint256 totalDebtToRedeem;\n\t\tuint256 totalCollateralDrawn;\n\t\tuint256 totalInterest;\n\t\tuint256 collateralFee;\n\t\tuint256 collateralToSendToRedeemer;\n\t\tuint256 decayedBaseRate;\n\t\tuint256 price;\n\t\tuint256 totalDebtSupplyAtStart;\n\t}\n\n\tstruct SingleRedemptionValues {\n\t\tuint256 debtLot;\n\t\tuint256 collateralLot;\n\t\tuint256 interestLot;\n\t\tbool cancelledPartial;\n\t}\n\n\t// Object containing the collateral and debt snapshots for a given active trove\n\tstruct RewardSnapshot {\n\t\tuint256 collateral;\n\t\tuint256 debt;\n\t\tuint256 interest;\n\t}\n\n\tenum TroveManagerOperation {\n\t\tapplyPendingRewards,\n\t\tliquidateInNormalMode,\n\t\tliquidateInRecoveryMode,\n\t\tredeemCollateral\n\t}\n\n\tenum Status {\n\t\tnonExistent,\n\t\tactive,\n\t\tclosedByOwner,\n\t\tclosedByLiquidation,\n\t\tclosedByRedemption\n\t}\n\n\tevent InsterstPaid(address _account, address _borrower, uint256 _interest);\n\tevent TroveUpdated(address indexed _borrower, uint256 _debt, uint256 _coll, uint256 _stake, TroveManagerOperation _operation);\n\tevent Redemption(uint256 _attemptedDebtAmount, uint256 _actualDebtAmount, uint256 _collateralSent, uint256 _InterestDebt, uint256 _collateralFee);\n\tevent BaseRateUpdated(uint256 _baseRate);\n\tevent LastFeeOpTimeUpdated(uint256 _lastFeeOpTime);\n\tevent TotalStakesUpdated(uint256 _newTotalStakes);\n\tevent SystemSnapshotsUpdated(uint256 _totalStakesSnapshot, uint256 _totalCollateralSnapshot);\n\tevent LTermsUpdated(uint256 _L_collateral, uint256 _L_debt);\n\tevent TroveSnapshotsUpdated(uint256 _L_collateral, uint256 _L_debt, uint256 _L_Interest_Debt);\n\tevent TroveIndexUpdated(address _borrower, uint256 _newIndex);\n\tevent CollateralSent(address _to, uint256 _amount);\n\tevent RewardClaimed(address indexed account, address indexed recipient, uint256 claimed);\n\n\tfunction addCollateralSurplus(address borrower, uint256 collSurplus) external;\n\n\tfunction applyPendingRewards(address _borrower) external returns (uint256 coll, uint256 debt);\n\n\tfunction claimCollateral(address _receiver) external;\n\n\tfunction closeTrove(address _borrower, address _receiver, uint256 collAmount, uint256 debtAmount) external;\n\n\tfunction closeTroveByLiquidation(address _borrower) external;\n\n\tfunction decayBaseRateAndGetBorrowingFee(uint256 _debt) external returns (uint256);\n\n\tfunction decreaseDebtAndSendCollateral(address account, uint256 debt, uint256 coll) external;\n\n\tfunction finalizeLiquidation(address _liquidator, uint256 _debt, uint256 _coll, uint256 _collSurplus, uint256 _debtGasComp, uint256 _collGasComp, uint256 _interest) external;\n\n\tfunction getEntireSystemBalances() external returns (uint256, uint256, uint256);\n\n\tfunction movePendingTroveRewardsToActiveBalances(uint256 _debt, uint256 _collateral) external;\n\n\tfunction openTrove(address _borrower, uint256 _collateralAmount, uint256 _compositeDebt, uint256 NICR, address _upperHint, address _lowerHint) external returns (uint256 stake, uint256 arrayIndex);\n\n\tfunction redeemCollateral(uint256 _debtAmount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint256 _partialRedemptionHintNICR, uint256 _maxIterations, uint256 _maxFeePercentage) external;\n\n\tfunction setAddresses(address _priceFeedAddress, address _sortedTrovesAddress, IERC20 _collateralToken) external;\n\n\tfunction setParameters(uint256 _minuteDecayFactor, uint256 _redemptionFeeFloor, uint256 _maxRedemptionFee, uint256 _borrowingFeeFloor, uint256 _maxBorrowingFee, uint256 _maxSystemDebt, uint256 _MCR, uint32 _interestRate) external;\n\n\tfunction setPaused(bool _paused) external;\n\n\tfunction setPriceFeed(address _priceFeedAddress) external;\n\n\tfunction updateTroveFromAdjustment(bool _isDebtIncrease, uint256 _debtChange, uint256 _netDebtChange, bool _isCollIncrease, uint256 _collChange, address _upperHint, address _lowerHint, address _borrower, address _receiver) external returns (uint256, uint256, uint256);\n\n\tfunction fetchPrice() external returns (uint256);\n\n\tfunction distributeInterestDebt() external returns (uint256);\n\n\tfunction repayInterest(address _account, address _borrower, uint256 _debt) external;\n\n\tfunction BOOTSTRAP_PERIOD() external view returns (uint256);\n\n\tfunction L_collateral() external view returns (uint256);\n\n\tfunction L_debt() external view returns (uint256);\n\n\tfunction MCR() external view returns (uint256);\n\n\tfunction getTrove(address _borrower) external view returns (Trove memory);\n\n\tfunction baseRate() external view returns (uint256);\n\n\tfunction borrowerOperationsAddress() external view returns (address);\n\n\tfunction borrowingFeeFloor() external view returns (uint256);\n\n\tfunction collateralToken() external view returns (IERC20);\n\n\tfunction defaultedCollateral() external view returns (uint256);\n\n\tfunction defaultedDebt() external view returns (uint256);\n\n\tfunction getBorrowingFee(uint256 _debt) external view returns (uint256);\n\n\tfunction getBorrowingFeeWithDecay(uint256 _debt) external view returns (uint256);\n\n\tfunction getBorrowingRate() external view returns (uint256);\n\n\tfunction getBorrowingRateWithDecay() external view returns (uint256);\n\n\tfunction getCurrentICR(address _borrower, uint256 _price) external view returns (uint256);\n\n\tfunction getEntireDebtAndColl(address _borrower) external view returns (uint256 debt, uint256 coll, uint256 pendingDebtReward, uint256 pendingCollateralReward);\n\n\tfunction getEntireSystemColl() external view returns (uint256);\n\n\tfunction getEntireSystemDebt() external view returns (uint256);\n\n\tfunction getGlobalSystemDebt() external view returns (uint256);\n\n\tfunction getTroveInterest(address _borrower, uint256 _debt) external view returns (uint256);\n\n\tfunction getRedemptionICR(address _borrower, uint256 _price) external view returns (uint256);\n\n\tfunction getNominalICR(address _borrower) external view returns (uint256);\n\n\tfunction getPendingCollAndDebtRewards(address _borrower) external view returns (uint256, uint256);\n\n\tfunction getRedemptionFeeWithDecay(uint256 _collateralDrawn) external view returns (uint256);\n\n\tfunction getRedemptionRate() external view returns (uint256);\n\n\tfunction getRedemptionRateWithDecay() external view returns (uint256);\n\n\tfunction getTotalActiveCollateral() external view returns (uint256);\n\n\tfunction getTotalActiveDebt() external view returns (uint256);\n\n\tfunction getTroveCollAndDebt(address _borrower) external view returns (uint256 coll, uint256 debt);\n\n\tfunction getTroveFromTroveOwnersArray(uint256 _index) external view returns (address);\n\n\tfunction getTroveOwnersCount() external view returns (uint256);\n\n\tfunction getTroveStake(address _borrower) external view returns (uint256);\n\n\tfunction getTroveStatus(address _borrower) external view returns (uint256);\n\n\tfunction hasPendingRewards(address _borrower) external view returns (bool);\n\n\tfunction lastCollateralError_Redistribution() external view returns (uint256);\n\n\tfunction lastDebtError_Redistribution() external view returns (uint256);\n\n\tfunction lastFeeOperationTime() external view returns (uint256);\n\n\tfunction liquidationManager() external view returns (address);\n\n\tfunction maxBorrowingFee() external view returns (uint256);\n\n\tfunction maxRedemptionFee() external view returns (uint256);\n\n\tfunction maxSystemDebt() external view returns (uint256);\n\n\tfunction minuteDecayFactor() external view returns (uint256);\n\n\tfunction paused() external view returns (bool);\n\n\tfunction redemptionFeeFloor() external view returns (uint256);\n\n\tfunction getRewardSnapshots(address) external view returns (RewardSnapshot memory);\n\n\tfunction priceFeed() external view returns (IPriceFeed);\n\n\tfunction sortedTroves() external view returns (ISortedTroves);\n\n\tfunction sunsetting() external view returns (bool);\n\n\tfunction surplusBalances(address) external view returns (uint256);\n\n\tfunction systemDeploymentTime() external view returns (uint256);\n\n\tfunction totalCollateralSnapshot() external view returns (uint256);\n\n\tfunction totalStakes() external view returns (uint256);\n\n\tfunction totalStakesSnapshot() external view returns (uint256);\n}\n"
    },
    "contracts/interfaces/IWETH.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"../interfaces/IBlast.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IWETH is IERC20, IERC20Rebasing {\n\tfunction deposit() external payable;\n}\n"
    },
    "contracts/stake/EsPropelStaking.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\nimport \"@openzeppelin/contracts/utils/structs/EnumerableMap.sol\";\nimport \"./StakingBoost.sol\";\nimport \"../interfaces/IEsPropelStaking.sol\";\nimport \"../dependencies/BlastWrapperUpgradeable.sol\";\n\ncontract EsPropelStaking is IEsPropelStaking, StakingBoost, BlastWrapperUpgradeable {\n\tusing EnumerableMap for EnumerableMap.AddressToUintMap;\n\tuint256 public immutable PRECISION = 1e18;\n\tIEsPropel public override esPropel;\n\tuint256 public override totalStakes;\n\tEnumerableMap.AddressToUintMap internal tokens;\n\n\tmapping(address => uint256) public F_Tokens; // token => tokenPerUnitStake\n\tmapping(address => mapping(address => mapping(uint256 => uint256))) public snapshots; // user => token => id => shares\n\tmapping(address => mapping(uint256 => uint256)) public stakes; // user => id => stake\n\n\tfunction initialize(IPropelCore _core, address _esPropel) external initializer {\n\t\t__Init_Blast(_core);\n\t\tinitLockSettings();\n\t\tesPropel = IEsPropel(_esPropel);\n\t}\n\n\tfunction tokensLength() public view override returns (uint256) {\n\t\treturn tokens.length();\n\t}\n\n\tfunction tokenAt(uint256 i) public view override returns (address, uint256) {\n\t\treturn tokens.at(i);\n\t}\n\n\tfunction addToken(address _token) external onlyOwner {\n\t\ttokens.set(_token, tokensLength());\n\t\temit TokenUpdated(_token);\n\t}\n\n\tfunction removeToken(address _token) external onlyOwner {\n\t\ttokens.remove(_token);\n\t\temit TokenUpdated(_token);\n\t}\n\n\tfunction stakeWithLock(uint256 amount, uint256 lockIndex) external {\n\t\tesPropel.sendToken(msg.sender, amount);\n\t\tuint256 id = currentId[msg.sender]++;\n\t\t_updateSnapshot(msg.sender, id, stakes[msg.sender][id]);\n\t\tstakes[msg.sender][id] += amount;\n\t\tstakeSharesByTokenAmountWithLock(msg.sender, id, lockIndex, amount);\n\t\ttotalStakes += amount;\n\t\temit StakedWithLock(msg.sender, id, lockIndex, amount);\n\t}\n\n\tfunction stakeWithoutLock(uint256 amount) external {\n\t\tuint256 id = _MaxId;\n\t\t_updateSnapshot(msg.sender, _MaxId, stakes[msg.sender][id]);\n\t\tesPropel.sendToken(msg.sender, amount);\n\t\tstakes[msg.sender][id] += amount;\n\t\tstakeSharesByTokenAmountWithoutLock(msg.sender, id, amount);\n\t\ttotalStakes += amount;\n\t\temit StakedWithoutLock(msg.sender, id, amount);\n\t}\n\n\tfunction unstake(uint256 id) external {\n\t\tif (id != _MaxId) {\n\t\t\trequire(block.timestamp > unlockTime(msg.sender, id), \"EsPropelStaking: token is in lock period\");\n\t\t}\n\t\tuint256 amount = stakeOf(msg.sender, id);\n\t\trequire(amount > 0, \"EsPropelStaking: zero stakes\");\n\t\t_updateSnapshot(msg.sender, id, stakes[msg.sender][id]);\n\t\tburnSharesByTokenAmount(msg.sender, id, amount);\n\t\tstakes[msg.sender][id] -= amount;\n\t\ttotalStakes -= amount;\n\t\tesPropel.transfer(msg.sender, amount);\n\t\temit Withdrawn(msg.sender, id, amount);\n\t}\n\n\tfunction stakeOf(address user, uint256 id) public view override returns (uint256) {\n\t\treturn stakes[user][id];\n\t}\n\n\tfunction claim(uint256 id) external {\n\t\t_updateSnapshot(msg.sender, id, stakes[msg.sender][id]);\n\t}\n\n\tfunction totalEarned(address account, address[] memory _tokens, uint256[] memory ids) public view returns (uint256[] memory totals) {\n\t\ttotals = new uint256[](_tokens.length);\n\t\tfor (uint256 i = 0; i < _tokens.length; i++) {\n\t\t\taddress token = _tokens[i];\n\t\t\trequire(tokenExists(token), \"EsPropelStaking: nonexistent token\");\n\t\t\tfor (uint256 j = 0; j < ids.length; j++) {\n\t\t\t\ttotals[i] += earned(account, token, ids[j]);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction batchEarned(address account, address[] memory _tokens, uint256[] memory ids) public view returns (uint256[][] memory earneds) {\n\t\tearneds = new uint256[][](_tokens.length);\n\t\tfor (uint256 i = 0; i < _tokens.length; i++) {\n\t\t\taddress token = _tokens[i];\n\t\t\trequire(tokenExists(token), \"EsPropelStaking: nonexistent token\");\n\t\t\tearneds[i] = new uint256[](ids.length);\n\t\t\tfor (uint256 j = 0; j < ids.length; j++) {\n\t\t\t\tearneds[i][j] = earned(account, token, ids[j]);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction earned(address user, address token, uint256 id) public view override returns (uint256) {\n\t\treturn (shareOf(user, id) * (F_Tokens[token] - snapshots[user][token][id])) / PRECISION;\n\t}\n\n\tfunction _updateSnapshot(address user, uint256 id, uint256 currentStakes) internal {\n\t\tfor (uint256 i = 0; i < tokensLength(); i++) {\n\t\t\t(address token, ) = tokenAt(i);\n\t\t\tif (currentStakes > 0) {\n\t\t\t\tuint256 amount = earned(user, token, id);\n\t\t\t\tif (amount > 0) {\n\t\t\t\t\tIERC20(token).transfer(user, amount);\n\t\t\t\t\temit Claimed(user, id, amount);\n\t\t\t\t}\n\t\t\t}\n\t\t\tsnapshots[user][token][id] = F_Tokens[token];\n\t\t}\n\t}\n\n\tfunction submit(address token, uint256 amount) external override {\n\t\trequire(amount > 0, \"EsPropelStaking: zero amount\");\n\t\trequire(totalShares() > 0, \"EsPropelStaking: zero stakes\");\n\t\trequire(tokenExists(token), \"EsPropelStaking: nonexistent token\");\n\t\tIERC20(token).transferFrom(msg.sender, address(this), amount);\n\t\tF_Tokens[token] += (amount * PRECISION) / totalShares();\n\t\temit FeeIncreased(token, amount);\n\t}\n\n\tfunction tokenExists(address _token) public view override returns (bool) {\n\t\treturn tokens.contains(_token);\n\t}\n}\n"
    },
    "contracts/stake/ILPStakingPool.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\ninterface ILPStakingPool {\n\tfunction stakeWithLock(address account, uint256 amount, uint256 lockIndex) external;\n\n\tfunction stakeWithoutLock(address account, uint256 amount) external;\n\n\tfunction LPToken() external view returns(address);\n\n}"
    },
    "contracts/stake/LPStakingPool.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"./LPTokenWrapper.sol\";\nimport \"./StakingBoost.sol\";\nimport \"./ILPStakingPool.sol\";\nimport \"../interfaces/IEsPropel.sol\";\nimport \"../dependencies/PropelMath.sol\";\nimport \"../dependencies/BlastWrapperUpgradeable.sol\";\n\ncontract LPStakingPool is ILPStakingPool, LPTokenWrapper, StakingBoost, BlastWrapperUpgradeable {\n\tuint256 public constant PRECISION = 1e18;\n\tIEsPropel public esPropel;\n\tuint256 public lastUpdateTime;\n\tuint256 public rewardPerSec;\n\tuint256 public rewardEndTime;\n\tuint256 public duration;\n\tuint256 public accRewardPerShare;\n\n\tmapping(address => mapping(uint256 => int256)) public rewardDebt;\n\tmapping(address => mapping(uint256 => uint256)) public rewards;\n\n\tevent RewardPerSecUpdated(uint256 rewardPerSec);\n\tevent RewardEndTimeUpdated(uint256 rewardEndTime);\n\tevent StakedWithLock(address user, uint256 id, uint256 lockIndex, uint256 amount);\n\tevent StakedWithoutLock(address user, uint256 id, uint256 amount);\n\tevent Withdrawn(address user, uint256 id, uint256 amount);\n\tevent RewardPaid(address user, uint256 id, uint256 reward);\n\n\tmodifier onlyInitialized() {\n\t\trequire(address(lpToken) != address(0), \"Liquidity Pool Token has not been set yet\");\n\t\t_;\n\t}\n\n\t// Returns current timestamp if the rewards program has not finished yet, end time otherwise\n\tfunction lastTimeRewardApplicable() public view returns (uint256) {\n\t\treturn PropelMath._min(block.timestamp, rewardEndTime);\n\t}\n\n\tfunction setRewardPerSec(uint256 _rewardPerSec) external onlyOwner {\n\t\tupdatePool();\n\t\trewardPerSec = _rewardPerSec;\n\t\temit RewardPerSecUpdated(_rewardPerSec);\n\t}\n\n\tfunction setRewardEndTime(uint256 _rewardEndTime) external onlyOwner {\n\t\trequire(block.timestamp >= rewardEndTime, \"must be after last reward end time\");\n\t\trequire(_rewardEndTime > block.timestamp, \"invalid rewardEndTime\");\n\t\tupdatePool();\n\t\trewardEndTime = _rewardEndTime;\n\t\temit RewardEndTimeUpdated(_rewardEndTime);\n\t}\n\n\tfunction updatePool() internal {\n\t\tif (lastUpdateTime == 0) {\n\t\t\tlastUpdateTime = block.timestamp;\n\t\t\trewardEndTime = block.timestamp + duration;\n\t\t}\n\t\tif (totalShares() == 0) {\n\t\t\treturn;\n\t\t}\n\t\tif (lastTimeRewardApplicable() == lastUpdateTime) {\n\t\t\treturn;\n\t\t}\n\t\tif (lastTimeRewardApplicable() > lastUpdateTime) {\n\t\t\tuint256 pending = (lastTimeRewardApplicable() - lastUpdateTime) * rewardPerSec;\n\t\t\taccRewardPerShare += (pending * PRECISION) / totalShares();\n\t\t\tlastUpdateTime = lastTimeRewardApplicable();\n\t\t}\n\t}\n\n\tfunction totalEarned(address account, uint256[] memory ids) public view returns (uint256 total) {\n\t\tfor (uint256 i = 0; i < ids.length; i++) {\n\t\t\ttotal += earned(account, ids[i]);\n\t\t}\n\t}\n\n\tfunction batchEarned(address account, uint256[] memory ids) public view returns (uint256[] memory earneds) {\n\t\tearneds = new uint256[](ids.length);\n\t\tfor (uint256 i = 0; i < ids.length; i++) {\n\t\t\tearneds[i] = earned(account, ids[i]);\n\t\t}\n\t}\n\n\t// Returns the amount that an account can claim\n\tfunction earned(address account, uint256 id) public view returns (uint256) {\n\t\tif (totalShares() == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tuint256 pending = (lastTimeRewardApplicable() - lastUpdateTime) * rewardPerSec;\n\t\tuint256 newAccRewardPerShare = accRewardPerShare + (pending * PRECISION) / totalShares();\n\t\treturn uint256(int256(shareOf(account, id) * newAccRewardPerShare) - rewardDebt[account][id]) / PRECISION;\n\t}\n\n\tfunction stakeWithLock(address account, uint256 amount, uint256 lockIndex) external override onlyInitialized {\n\t\trequire(amount > 0, \"Cannot stake 0\");\n\t\tupdatePool();\n\t\tuint256 id = currentId[account]++;\n\t\tsuper.stake(amount, id);\n\t\tstakeSharesByTokenAmountWithLock(account, id, lockIndex, amount);\n\t\trewardDebt[account][id] = int256(shareOf(account, id) * accRewardPerShare);\n\t\temit StakedWithLock(account, id, lockIndex, amount);\n\t}\n\n\tfunction stakeWithoutLock(address account, uint256 amount) external override onlyInitialized {\n\t\trequire(amount > 0, \"Cannot stake 0\");\n\t\tupdatePool();\n\t\tuint256 id = _MaxId;\n\t\tsuper.stake(amount, id);\n\t\tuint256 reward = uint256(int256(shareOf(msg.sender, id) * accRewardPerShare) - rewardDebt[msg.sender][id]) / PRECISION;\n\t\tstakeSharesByTokenAmountWithoutLock(account, id, amount);\n\t\trewardDebt[msg.sender][id] = int256(shareOf(msg.sender, id) * accRewardPerShare);\n\t\tif (reward > 0) {\n\t\t\tesPropel.transfer(msg.sender, reward);\n\t\t\temit RewardPaid(msg.sender, id, reward);\n\t\t}\n\t\temit StakedWithoutLock(account, id, amount);\n\t}\n\n\tfunction stakeOf(address user, uint256 id) public view override returns (uint256) {\n\t\treturn balanceOf(user, id);\n\t}\n\n\t// Shortcut to be able to unstake tokens and claim rewards in one transaction\n\tfunction withdrawAndClaim(uint256 id) external onlyInitialized {\n\t\tuint256 amount = balanceOf(msg.sender, id);\n\t\tif (id != _MaxId) {\n\t\t\trequire(id < currentId[msg.sender], \"nonexistent id\");\n\t\t\trequire(block.timestamp > unlockTime(msg.sender, id), \"Liquidity Pool Token has been locked\");\n\t\t}\n\t\tupdatePool();\n\t\tuint256 burnt = burnSharesByTokenAmount(msg.sender, id, amount);\n\t\trewardDebt[msg.sender][id] -= int256(accRewardPerShare * burnt);\n\t\tuint256 reward = uint256(int256(shareOf(msg.sender, id) * accRewardPerShare) - rewardDebt[msg.sender][id]) / PRECISION;\n\t\trewardDebt[msg.sender][id] = int256(shareOf(msg.sender, id) * accRewardPerShare);\n\t\tif (reward > 0) {\n\t\t\tesPropel.transfer(msg.sender, reward);\n\t\t\temit RewardPaid(msg.sender, id, reward);\n\t\t}\n\t\tsuper.withdraw(amount, id);\n\t\temit Withdrawn(msg.sender, id, amount);\n\t}\n\n\tfunction claimReward(uint256 id) public onlyInitialized {\n\t\tif (id != _MaxId) {\n\t\t\trequire(id < currentId[msg.sender], \"nonexistent id\");\n\t\t}\n\t\tupdatePool();\n\t\tuint256 reward = uint256(int256(shareOf(msg.sender, id) * accRewardPerShare) - rewardDebt[msg.sender][id]) / PRECISION;\n\t\trewardDebt[msg.sender][id] = int256(shareOf(msg.sender, id) * accRewardPerShare);\n\t\trequire(reward > 0, \"Nothing to claim\");\n\t\tesPropel.transfer(msg.sender, reward);\n\t\temit RewardPaid(msg.sender, id, reward);\n\t}\n\n\tfunction LPToken() external view override returns (address) {\n\t\treturn address(lpToken);\n\t}\n}\n"
    },
    "contracts/stake/LPTokenWrapper.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nabstract contract LPTokenWrapper {\n\tIERC20 public lpToken;\n\n\tuint256 private _totalSupply;\n\tmapping(address => mapping(uint256 => uint256)) private _balances;\n\n\tfunction totalSupply() public view returns (uint256) {\n\t\treturn _totalSupply;\n\t}\n\n\tfunction balanceOf(address account, uint256 id) public view returns (uint256) {\n\t\treturn _balances[account][id];\n\t}\n\n\tfunction stake(uint256 amount, uint256 id) internal virtual {\n\t\t_totalSupply += amount;\n\t\t_balances[msg.sender][id] += amount;\n\t\tlpToken.transferFrom(msg.sender, address(this), amount);\n\t}\n\n\tfunction withdraw(uint256 amount, uint256 id) internal virtual {\n\t\t_totalSupply -= amount;\n\t\t_balances[msg.sender][id] -= amount;\n\t\tlpToken.transfer(msg.sender, amount);\n\t}\n}"
    },
    "contracts/stake/PropelQETHPool.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"./LPStakingPool.sol\";\n\ncontract PropelQETHPool is LPStakingPool {\n\tfunction initialize(IPropelCore _core, address _lpToken, address _esPropel, uint256 _rewardPerSec, uint256 _duration) external initializer {\n\t\t__Init_Blast(_core);\n\t\tinitLockSettings();\n\t\tlpToken = IERC20(_lpToken);\n\t\tesPropel = IEsPropel(_esPropel);\n\t\tduration = _duration;\n\t\trewardPerSec = _rewardPerSec;\n\t}\n}\n"
    },
    "contracts/stake/PropelUSDQUSDCPool.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\nimport \"./LPStakingPool.sol\";\n\ncontract PropelUSDQUSDCPool is LPStakingPool {\n\tfunction initialize(IPropelCore _core, address _lpToken, address _esPropel, uint256 _rewardPerSec, uint256 _duration) external initializer {\n\t\t__Init_Blast(_core);\n\t\tinitLockSettings();\n\t\tlpToken = IERC20(_lpToken);\n\t\tesPropel = IEsPropel(_esPropel);\n\t\tduration = _duration;\n\t\trewardPerSec = _rewardPerSec;\n\t}\n}\n"
    },
    "contracts/stake/StakingBoost.sol": {
      "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.19;\n\n/// @notice boost for esPropel\nabstract contract StakingBoost {\n\tstruct LockSetting {\n\t\tuint256 duration;\n\t\tuint256 miningBoost;\n\t}\n\n\tstruct UserBoostState {\n\t\tuint256 shares;\n\t\tuint256 unlockTime;\n\t\tuint256 duration;\n\t\tuint256 miningBoost;\n\t}\n\n\tmapping(address => mapping(uint256 => UserBoostState)) public states;\n\tmapping(address => uint256) public currentId;\n\tLockSetting[] public LockSettings;\n\n\tuint256 internal _totalShares;\n\tuint256 internal _MaxId;\n\n\tfunction initLockSettings() internal {\n\t\t_MaxId = type(uint256).max;\n\t\tLockSettings.push(LockSetting(30 days, 10));\n\t\tLockSettings.push(LockSetting(90 days, 20));\n\t\tLockSettings.push(LockSetting(183 days, 50));\n\t\tLockSettings.push(LockSetting(365 days, 100));\n\t}\n\n\t/// @dev total shares in the pool\n\tfunction totalShares() public view returns (uint256) {\n\t\treturn _totalShares;\n\t}\n\n\t/// @dev user's share\n\tfunction shareOf(address user, uint256 id) public view returns (uint256) {\n\t\treturn states[user][id].shares;\n\t}\n\n\tfunction stakeSharesByTokenAmountWithLock(address user, uint256 id, uint256 lockIndex, uint256 amount) internal {\n\t\trequire(lockIndex < 4, \"StakingBoost: index out of range\");\n\t\tuint256 share = shareStaked(id, lockIndex, amount);\n\t\tLockSetting memory setting = LockSettings[lockIndex];\n\t\tstates[user][id] = UserBoostState({ shares: share, unlockTime: block.timestamp + setting.duration, duration: setting.duration, miningBoost: setting.miningBoost });\n\t\t_totalShares += share;\n\t}\n\n\tfunction stakeSharesByTokenAmountWithoutLock(address user, uint256 id, uint256 amount) internal {\n\t\tuint256 oldShare = shareOf(user, id);\n\t\tuint256 newShare = oldShare + shareStaked(id, 0, amount);\n\t\tstates[user][id] = UserBoostState({ shares: newShare, unlockTime: block.timestamp, duration: 0, miningBoost: 0 });\n\t\t_totalShares = _totalShares + newShare - oldShare;\n\t}\n\n\tfunction burnSharesByTokenAmount(address user, uint256 id, uint256 amount) internal returns (uint256) {\n\t\tuint256 share = shareBurnt(user, id, amount, stakeOf(user, id));\n\t\tstates[user][id].shares -= share;\n\t\t_totalShares -= share;\n\t\treturn share;\n\t}\n\n\t/// @dev get user's share for staking\n\tfunction shareStaked(uint256 id, uint256 index, uint256 amount) public view returns (uint256) {\n\t\treturn (amount * getBoost(id, index)) / 100;\n\t}\n\n\t/// @dev get user's burning share\n\tfunction shareBurnt(address user, uint256 id, uint256 amount, uint256 stakes) public view returns (uint256) {\n\t\tif (stakes == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tuint256 unit = (amount * shareOf(user, id)) / stakes;\n\t\tuint256 loss = (amount * shareOf(user, id)) - (unit * stakes);\n\t\treturn unit + loss;\n\t}\n\n\tfunction unlockTime(address user, uint256 id) public view returns (uint256) {\n\t\treturn states[user][id].unlockTime;\n\t}\n\n\t/// @dev get user's boost\n\tfunction getBoost(uint256 id, uint256 index) public view returns (uint256) {\n\t\tif (id == _MaxId) {\n\t\t\treturn 100;\n\t\t}\n\t\treturn (100 + LockSettings[index].miningBoost);\n\t}\n\n\tfunction stakeOf(address user, uint256 id) public view virtual returns (uint256);\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 2000
    },
    "outputSelection": {
      "*": {
        "*": [
          "storageLayout",
          "abi",
          "evm.bytecode",
          "evm.deployedBytecode",
          "evm.methodIdentifiers",
          "metadata",
          "devdoc",
          "userdoc",
          "evm.gasEstimates",
          "storageLayout"
        ],
        "": [
          "ast"
        ]
      }
    },
    "metadata": {
      "useLiteralContent": true
    }
  }
}