creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@maverick/v2-common/contracts/base/IMulticall.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n// As the copyright holder of this work, Ubiquity Labs retains\n// the right to distribute, use, and modify this code under any license of\n// their choosing, in addition to the terms of the GPL-v2 or later.\npragma solidity ^0.8.25;\n\ninterface IMulticall {\n    function multicall(bytes[] calldata data) external returns (bytes[] memory results);\n}\n"
      },
      "@maverick/v2-common/contracts/base/Multicall.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n// As the copyright holder of this work, Ubiquity Labs retains\n// the right to distribute, use, and modify this code under any license of\n// their choosing, in addition to the terms of the GPL-v2 or later.\npragma solidity ^0.8.25;\nimport {IMulticall} from \"./IMulticall.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\n\n// Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/6ba452dea4258afe77726293435f10baf2bed265/contracts/utils/Multicall.sol\n\n/*\n * @notice Multicall\n */\nabstract contract Multicall is IMulticall {\n    /**\n     * @notice This function allows multiple calls to different contract functions\n     * in a single transaction.\n     * @param data An array of encoded function call data.\n     * @return results An array of the results of the function calls.\n     */\n    function multicall(bytes[] calldata data) external returns (bytes[] memory results) {\n        results = new bytes[](data.length);\n        for (uint256 i = 0; i < data.length; i++) {\n            results[i] = Address.functionDelegateCall(address(this), data[i]);\n        }\n    }\n}\n"
      },
      "@maverick/v2-common/contracts/libraries/Constants.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n// As the copyright holder of this work, Ubiquity Labs retains\n// the right to distribute, use, and modify this code under any license of\n// their choosing, in addition to the terms of the GPL-v2 or later.\npragma solidity ^0.8.25;\n\n// factory contraints on pools\nuint8 constant MAX_PROTOCOL_FEE_RATIO_D3 = 0.25e3; // 25%\nuint256 constant MAX_PROTOCOL_LENDING_FEE_RATE_D18 = 0.02e18; // 2%\nuint64 constant MAX_POOL_FEE_D18 = 0.9e18; // 90%\nuint64 constant MIN_LOOKBACK = 1 seconds;\nuint64 constant MAX_TICK_SPACING = 10_000;\n\n// pool constraints\nuint8 constant NUMBER_OF_KINDS = 4;\nint32 constant NUMBER_OF_KINDS_32 = int32(int8(NUMBER_OF_KINDS));\nuint256 constant MAX_TICK = 322_378; // max price 1e14 in D18 scale\nint32 constant MAX_TICK_32 = int32(int256(MAX_TICK));\nint32 constant MIN_TICK_32 = int32(-int256(MAX_TICK));\nuint256 constant MAX_BINS_TO_MERGE = 3;\nuint128 constant MINIMUM_LIQUIDITY = 1e8;\n\n// accessor named constants\nuint8 constant ALL_KINDS_MASK = 0xF; // 0b1111\nuint8 constant PERMISSIONED_LIQUIDITY_MASK = 0x10; // 0b010000\nuint8 constant PERMISSIONED_SWAP_MASK = 0x20; // 0b100000\nuint8 constant OPTIONS_MASK = ALL_KINDS_MASK | PERMISSIONED_LIQUIDITY_MASK | PERMISSIONED_SWAP_MASK; // 0b111111\n\n// named values\naddress constant MERGED_LP_BALANCE_ADDRESS = address(0);\nuint256 constant MERGED_LP_BALANCE_SUBACCOUNT = 0;\nuint128 constant ONE = 1e18;\nuint128 constant ONE_SQUARED = 1e36;\nint256 constant INT256_ONE = 1e18;\nuint256 constant ONE_D8 = 1e8;\nuint256 constant ONE_D3 = 1e3;\nint40 constant INT_ONE_D8 = 1e8;\nint40 constant HALF_TICK_D8 = 0.5e8;\nuint8 constant DEFAULT_DECIMALS = 18;\nuint256 constant DEFAULT_SCALE = 1;\nbytes constant EMPTY_PRICE_BREAKS = hex\"010000000000000000000000\";\n"
      },
      "@maverick/v2-common/contracts/libraries/Math.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n// As the copyright holder of this work, Ubiquity Labs retains\n// the right to distribute, use, and modify this code under any license of\n// their choosing, in addition to the terms of the GPL-v2 or later.\npragma solidity ^0.8.25;\n\nimport {Math as OzMath} from \"@openzeppelin/contracts/utils/math/Math.sol\";\n\nimport {ONE, DEFAULT_SCALE, DEFAULT_DECIMALS, INT_ONE_D8, ONE_SQUARED} from \"./Constants.sol\";\n\n/**\n * @notice Math functions.\n */\nlibrary Math {\n    /**\n     * @notice Returns the lesser of two values.\n     * @param x First uint256 value.\n     * @param y Second uint256 value.\n     */\n    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        assembly (\"memory-safe\") {\n            z := xor(x, mul(xor(x, y), lt(y, x)))\n        }\n    }\n\n    /**\n     * @notice Returns the lesser of two uint128 values.\n     * @param x First uint128 value.\n     * @param y Second uint128 value.\n     */\n    function min128(uint128 x, uint128 y) internal pure returns (uint128 z) {\n        assembly (\"memory-safe\") {\n            z := xor(x, mul(xor(x, y), lt(y, x)))\n        }\n    }\n\n    /**\n     * @notice Returns the lesser of two int256 values.\n     * @param x First int256 value.\n     * @param y Second int256 value.\n     */\n    function min(int256 x, int256 y) internal pure returns (int256 z) {\n        assembly (\"memory-safe\") {\n            z := xor(x, mul(xor(x, y), slt(y, x)))\n        }\n    }\n\n    /**\n     * @notice Returns the greater of two uint256 values.\n     * @param x First uint256 value.\n     * @param y Second uint256 value.\n     */\n    function max(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        assembly (\"memory-safe\") {\n            z := xor(x, mul(xor(x, y), gt(y, x)))\n        }\n    }\n\n    /**\n     * @notice Returns the greater of two int256 values.\n     * @param x First int256 value.\n     * @param y Second int256 value.\n     */\n    function max(int256 x, int256 y) internal pure returns (int256 z) {\n        assembly (\"memory-safe\") {\n            z := xor(x, mul(xor(x, y), sgt(y, x)))\n        }\n    }\n\n    /**\n     * @notice Returns the greater of two uint128 values.\n     * @param x First uint128 value.\n     * @param y Second uint128 value.\n     */\n    function max128(uint128 x, uint128 y) internal pure returns (uint128 z) {\n        assembly (\"memory-safe\") {\n            z := xor(x, mul(xor(x, y), gt(y, x)))\n        }\n    }\n\n    /**\n     * @notice Thresholds a value to be within the specified bounds.\n     * @param value The value to bound.\n     * @param lowerLimit The minimum allowable value.\n     * @param upperLimit The maximum allowable value.\n     */\n    function boundValue(\n        uint256 value,\n        uint256 lowerLimit,\n        uint256 upperLimit\n    ) internal pure returns (uint256 outputValue) {\n        outputValue = min(max(value, lowerLimit), upperLimit);\n    }\n\n    /**\n     * @notice Returns the difference between two uint128 values or zero if the result would be negative.\n     * @param x The minuend.\n     * @param y The subtrahend.\n     */\n    function clip128(uint128 x, uint128 y) internal pure returns (uint128) {\n        unchecked {\n            return x < y ? 0 : x - y;\n        }\n    }\n\n    /**\n     * @notice Returns the difference between two uint256 values or zero if the result would be negative.\n     * @param x The minuend.\n     * @param y The subtrahend.\n     */\n    function clip(uint256 x, uint256 y) internal pure returns (uint256) {\n        unchecked {\n            return x < y ? 0 : x - y;\n        }\n    }\n\n    /**\n     * @notice Divides one uint256 by another, rounding down to the nearest\n     * integer.\n     * @param x The dividend.\n     * @param y The divisor.\n     */\n    function divFloor(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivFloor(x, ONE, y);\n    }\n\n    /**\n     * @notice Divides one uint256 by another, rounding up to the nearest integer.\n     * @param x The dividend.\n     * @param y The divisor.\n     */\n    function divCeil(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivCeil(x, ONE, y);\n    }\n\n    /**\n     * @notice Multiplies two uint256 values and then divides by ONE, rounding down.\n     * @param x The multiplicand.\n     * @param y The multiplier.\n     */\n    function mulFloor(uint256 x, uint256 y) internal pure returns (uint256) {\n        return OzMath.mulDiv(x, y, ONE);\n    }\n\n    /**\n     * @notice Multiplies two uint256 values and then divides by ONE, rounding up.\n     * @param x The multiplicand.\n     * @param y The multiplier.\n     */\n    function mulCeil(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivCeil(x, y, ONE);\n    }\n\n    /**\n     * @notice Calculates the multiplicative inverse of a uint256, rounding down.\n     * @param x The value to invert.\n     */\n    function invFloor(uint256 x) internal pure returns (uint256) {\n        unchecked {\n            return ONE_SQUARED / x;\n        }\n    }\n\n    /**\n     * @notice Calculates the multiplicative inverse of a uint256, rounding up.\n     * @param denominator The value to invert.\n     */\n    function invCeil(uint256 denominator) internal pure returns (uint256 z) {\n        assembly (\"memory-safe\") {\n            // divide z - 1 by the denominator and add 1.\n            z := add(div(sub(ONE_SQUARED, 1), denominator), 1)\n        }\n    }\n\n    /**\n     * @notice Multiplies two uint256 values and divides by a third, rounding down.\n     * @param x The multiplicand.\n     * @param y The multiplier.\n     * @param k The divisor.\n     */\n    function mulDivFloor(uint256 x, uint256 y, uint256 k) internal pure returns (uint256 result) {\n        result = OzMath.mulDiv(x, y, max(1, k));\n    }\n\n    /**\n     * @notice Multiplies two uint256 values and divides by a third, rounding up if there's a remainder.\n     * @param x The multiplicand.\n     * @param y The multiplier.\n     * @param k The divisor.\n     */\n    function mulDivCeil(uint256 x, uint256 y, uint256 k) internal pure returns (uint256 result) {\n        result = mulDivFloor(x, y, k);\n        if (mulmod(x, y, max(1, k)) != 0) result = result + 1;\n    }\n\n    /**\n     * @notice Multiplies two uint256 values and divides by a third, rounding\n     * down. Will revert if `x * y` is larger than `type(uint256).max`.\n     * @param x The first operand for multiplication.\n     * @param y The second operand for multiplication.\n     * @param denominator The divisor after multiplication.\n     */\n    function mulDivDown(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 z) {\n        assembly (\"memory-safe\") {\n            // Store x * y in z for now.\n            z := mul(x, y)\n            if iszero(denominator) {\n                denominator := 1\n            }\n\n            if iszero(or(iszero(x), eq(div(z, x), y))) {\n                revert(0, 0)\n            }\n\n            // Divide z by the denominator.\n            z := div(z, denominator)\n        }\n    }\n\n    /**\n     * @notice Multiplies two uint256 values and divides by a third, rounding\n     * up. Will revert if `x * y` is larger than `type(uint256).max`.\n     * @param x The first operand for multiplication.\n     * @param y The second operand for multiplication.\n     * @param denominator The divisor after multiplication.\n     */\n    function mulDivUp(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 z) {\n        assembly (\"memory-safe\") {\n            // Store x * y in z for now.\n            z := mul(x, y)\n            if iszero(denominator) {\n                denominator := 1\n            }\n\n            if iszero(or(iszero(x), eq(div(z, x), y))) {\n                revert(0, 0)\n            }\n\n            // First, divide z - 1 by the denominator and add 1.\n            // We allow z - 1 to underflow if z is 0, because we multiply the\n            // end result by 0 if z is zero, ensuring we return 0 if z is zero.\n            z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\n        }\n    }\n\n    /**\n     * @notice Multiplies a uint256 by another and divides by a constant,\n     * rounding down. Will revert if `x * y` is larger than\n     * `type(uint256).max`.\n     * @param x The multiplicand.\n     * @param y The multiplier.\n     */\n    function mulDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, y, ONE);\n    }\n\n    /**\n     * @notice Divides a uint256 by another, rounding down the result. Will\n     * revert if `x * 1e18` is larger than `type(uint256).max`.\n     * @param x The dividend.\n     * @param y The divisor.\n     */\n    function divDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, ONE, y);\n    }\n\n    /**\n     * @notice Divides a uint256 by another, rounding up the result. Will\n     * revert if `x * 1e18` is larger than `type(uint256).max`.\n     * @param x The dividend.\n     * @param y The divisor.\n     */\n    function divUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, ONE, y);\n    }\n\n    /**\n     * @notice Scales a number based on a difference in decimals from a default.\n     * @param decimals The new decimal precision.\n     */\n    function scale(uint8 decimals) internal pure returns (uint256) {\n        unchecked {\n            if (decimals == DEFAULT_DECIMALS) {\n                return DEFAULT_SCALE;\n            } else {\n                return 10 ** (DEFAULT_DECIMALS - decimals);\n            }\n        }\n    }\n\n    /**\n     * @notice Adjusts a scaled amount to the token decimal scale.\n     * @param amount The scaled amount.\n     * @param scaleFactor The scaling factor to adjust by.\n     * @param ceil Whether to round up (true) or down (false).\n     */\n    function ammScaleToTokenScale(uint256 amount, uint256 scaleFactor, bool ceil) internal pure returns (uint256 z) {\n        unchecked {\n            if (scaleFactor == DEFAULT_SCALE || amount == 0) {\n                return amount;\n            } else {\n                if (!ceil) return amount / scaleFactor;\n                assembly (\"memory-safe\") {\n                    z := add(div(sub(amount, 1), scaleFactor), 1)\n                }\n            }\n        }\n    }\n\n    /**\n     * @notice Adjusts a token amount to the D18 AMM scale.\n     * @param amount The amount in token scale.\n     * @param scaleFactor The scale factor for adjustment.\n     */\n    function tokenScaleToAmmScale(uint256 amount, uint256 scaleFactor) internal pure returns (uint256) {\n        if (scaleFactor == DEFAULT_SCALE) {\n            return amount;\n        } else {\n            return amount * scaleFactor;\n        }\n    }\n\n    /**\n     * @notice Returns the absolute value of a signed 32-bit integer.\n     * @param x The integer to take the absolute value of.\n     */\n    function abs32(int32 x) internal pure returns (uint32) {\n        unchecked {\n            return uint32(x < 0 ? -x : x);\n        }\n    }\n\n    /**\n     * @notice Returns the absolute value of a signed 256-bit integer.\n     * @param x The integer to take the absolute value of.\n     */\n    function abs(int256 x) internal pure returns (uint256) {\n        unchecked {\n            return uint256(x < 0 ? -x : x);\n        }\n    }\n\n    /**\n     * @notice Calculates the integer square root of a uint256 rounded down.\n     * @param x The number to take the square root of.\n     */\n    function sqrt(uint256 x) internal pure returns (uint256 z) {\n        // from https://github.com/transmissions11/solmate/blob/e8f96f25d48fe702117ce76c79228ca4f20206cb/src/utils/FixedPointMathLib.sol\n        assembly (\"memory-safe\") {\n            let y := x\n            z := 181\n\n            if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n                y := shr(128, y)\n                z := shl(64, z)\n            }\n            if iszero(lt(y, 0x1000000000000000000)) {\n                y := shr(64, y)\n                z := shl(32, z)\n            }\n            if iszero(lt(y, 0x10000000000)) {\n                y := shr(32, y)\n                z := shl(16, z)\n            }\n            if iszero(lt(y, 0x1000000)) {\n                y := shr(16, y)\n                z := shl(8, z)\n            }\n\n            z := shr(18, mul(z, add(y, 65536)))\n\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n\n            z := sub(z, lt(div(x, z), z))\n        }\n    }\n\n    /**\n     * @notice Computes the floor of a D8-scaled number as an int32, ignoring\n     * potential overflow in the cast.\n     * @param val The D8-scaled number.\n     */\n    function floorD8Unchecked(int256 val) internal pure returns (int32) {\n        int32 val32;\n        bool check;\n        unchecked {\n            val32 = int32(val / INT_ONE_D8);\n            check = (val < 0 && val % INT_ONE_D8 != 0);\n        }\n        return check ? val32 - 1 : val32;\n    }\n}\n"
      },
      "@maverick/v2-rewards/contracts/interfaces/IMaverickV2Reward.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport {INft} from \"@maverick/v2-supplemental/contracts/positionbase/INft.sol\";\nimport {IMulticall} from \"@maverick/v2-common/contracts/base/IMulticall.sol\";\n\nimport {IMaverickV2VotingEscrow} from \"./IMaverickV2VotingEscrow.sol\";\nimport {IMaverickV2RewardVault} from \"./IMaverickV2RewardVault.sol\";\nimport {IRewardAccounting} from \"../rewardbase/IRewardAccounting.sol\";\n\ninterface IMaverickV2Reward is INft, IMulticall, IRewardAccounting {\n    event NotifyRewardAmount(\n        address sender,\n        IERC20 rewardTokenAddress,\n        uint256 amount,\n        uint256 duration,\n        uint256 rewardRate\n    );\n    event GetReward(\n        address sender,\n        uint256 tokenId,\n        address recipient,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration,\n        IERC20 rewardTokenAddress,\n        RewardOutput rewardOutput,\n        uint256 lockupId\n    );\n    event UnStake(\n        address sender,\n        uint256 tokenId,\n        uint256 amount,\n        address recipient,\n        uint256 userBalance,\n        uint256 totalSupply\n    );\n    event Stake(\n        address sender,\n        address supplier,\n        uint256 amount,\n        uint256 tokenId,\n        uint256 userBalance,\n        uint256 totalSupply\n    );\n    event AddRewardToken(IERC20 rewardTokenAddress, uint8 rewardTokenIndex);\n    event RemoveRewardToken(IERC20 rewardTokenAddress, uint8 rewardTokenIndex);\n    event ApproveRewardGetter(uint256 tokenId, address getter);\n\n    error RewardDurationOutOfBounds(uint256 duration, uint256 minDuration, uint256 maxDuration);\n    error RewardZeroAmount();\n    error RewardNotValidRewardToken(IERC20 rewardTokenAddress);\n    error RewardNotValidIndex(uint8 index);\n    error RewardTokenCannotBeStakingToken(IERC20 stakingToken);\n    error RewardTransferNotSupported();\n    error RewardNotApprovedGetter(uint256 tokenId, address approved, address getter);\n    error RewardUnboostedTimePeriodNotMet(uint256 timestamp, uint256 minTimestamp);\n\n    struct RewardInfo {\n        // Timestamp of when the rewards finish\n        uint256 finishAt;\n        // Minimum of last updated time and reward finish time\n        uint256 updatedAt;\n        // Reward to be paid out per second\n        uint256 rewardRate;\n        // Escrowed rewards\n        uint256 escrowedReward;\n        // Sum of (reward rate * dt * 1e18 / total supply)\n        uint256 rewardPerTokenStored;\n        // Reward Token to be emitted\n        IERC20 rewardToken;\n        // ve locking contract\n        IMaverickV2VotingEscrow veRewardToken;\n        // amount available to push to ve as incentive\n        uint128 unboostedAmount;\n        // timestamp of unboosted push\n        uint256 lastUnboostedPushTimestamp;\n    }\n\n    struct ContractInfo {\n        // Reward Name\n        string name;\n        // Reward Symbol\n        string symbol;\n        // total supply staked\n        uint256 totalSupply;\n        // staking token\n        IERC20 stakingToken;\n    }\n\n    struct EarnedInfo {\n        // earned\n        uint256 earned;\n        // reward token\n        IERC20 rewardToken;\n    }\n\n    struct RewardOutput {\n        uint256 amount;\n        bool asVe;\n        IMaverickV2VotingEscrow veContract;\n    }\n\n    // solhint-disable-next-line func-name-mixedcase\n    function MAX_DURATION() external view returns (uint256);\n\n    // solhint-disable-next-line func-name-mixedcase\n    function MIN_DURATION() external view returns (uint256);\n\n    /**\n     * @notice This function retrieves the minimum time gap in seconds that\n     * must have elasped between calls to `pushUnboostedToVe()`.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function UNBOOSTED_MIN_TIME_GAP() external view returns (uint256);\n\n    /**\n     * @notice This function retrieves the address of the token used for\n     * staking in this reward contract.\n     * @return The address of the staking token (IERC20).\n     */\n    function stakingToken() external view returns (IERC20);\n\n    /**\n     * @notice This function retrieves the address of the MaverickV2RewardVault\n     * contract associated with this reward contract.\n     * @return The address of the IMaverickV2RewardVault contract.\n     */\n    function vault() external view returns (IMaverickV2RewardVault);\n\n    /**\n     * @notice This function retrieves information about all available reward tokens for this reward contract.\n     * @return info An array of RewardInfo structs containing details about each reward token.\n     */\n    function rewardInfo() external view returns (RewardInfo[] memory info);\n\n    /**\n     * @notice This function retrieves information about all available reward\n     * tokens and overall contract details for this reward contract.\n     * @return info An array of RewardInfo structs containing details about each reward token.\n     * @return _contractInfo A ContractInfo struct containing overall contract details.\n     */\n    function contractInfo() external view returns (RewardInfo[] memory info, ContractInfo memory _contractInfo);\n\n    /**\n     * @notice This function calculates the total amount of all earned rewards\n     * for a specific tokenId across all reward tokens.\n     * @param tokenId The address of the tokenId for which to calculate earned rewards.\n     * @return earnedInfo An array of EarnedInfo structs containing details about earned rewards for each supported token.\n     */\n    function earned(uint256 tokenId) external view returns (EarnedInfo[] memory earnedInfo);\n\n    /**\n     * @notice This function calculates the total amount of earned rewards for\n     * a specific tokenId for a particular reward token.\n     * @param tokenId The address of the tokenId for which to calculate earned rewards.\n     * @param rewardTokenAddress The address of the specific reward token.\n     * @return amount The total amount of earned rewards for the specified token.\n     */\n    function earned(uint256 tokenId, IERC20 rewardTokenAddress) external view returns (uint256);\n\n    /**\n     * @notice This function retrieves the internal index associated with a specific reward token address.\n     * @param  rewardToken The address of the reward token to get the index for.\n     * @return rewardTokenIndex The internal index of the token within the reward contract (uint8).\n     */\n    function tokenIndex(IERC20 rewardToken) external view returns (uint8 rewardTokenIndex);\n\n    /**\n     * @notice This function retrieves the total number of supported reward tokens in this reward contract.\n     * @return count The total number of reward tokens (uint256).\n     */\n    function rewardTokenCount() external view returns (uint256);\n\n    /**\n     * @notice This function transfers a specified amount of reward tokens from\n     * the caller to distribute them over a defined duration. The caller will\n     * need to approve this rewards contract to make the transfer on the\n     * caller's behalf. See `notifyRewardAmount` for details of how the\n     * duration is set by the rewards contract.\n     * @param rewardToken The address of the reward token to transfer.\n     * @param duration The duration (in seconds) over which to distribute the rewards.\n     * @param amount The amount of reward tokens to transfer.\n     * @return _duration The duration in seconds that the incentives will be distributed over.\n     */\n    function transferAndNotifyRewardAmount(\n        IERC20 rewardToken,\n        uint256 duration,\n        uint256 amount\n    ) external returns (uint256 _duration);\n\n    /**\n     * @notice This function notifies the vault to distribute a previously\n     * transferred amount of reward tokens over a defined duration. (Assumes\n     * tokens are already in the contract).\n     * @dev The duration of the distribution may not be the same as the input\n     * duration.  If this notify amount is less than the amount already pending\n     * disbursement, then this new amount will be distributed as the same rate\n     * as the existing rate and that will dictate the duration.  Alternatively,\n     * if the amount is more than the pending disbursement, then the input\n     * duration will be honored and all pending disbursement tokens will also be\n     * distributed at this newly set rate.\n     * @param rewardToken The address of the reward token to distribute.\n     * @param duration The duration (in seconds) over which to distribute the rewards.\n     * @return _duration The duration in seconds that the incentives will be distributed over.\n     */\n    function notifyRewardAmount(IERC20 rewardToken, uint256 duration) external returns (uint256 _duration);\n\n    /**\n     * @notice This function transfers a specified amount of staking tokens\n     * from the caller to the staking `vault()` and stakes them on the\n     * recipient's behalf.  The user has to approve this reward contract to\n     * transfer the staking token on their behalf for this function not to\n     * revert.\n     * @param tokenId Nft tokenId to stake for the staked tokens.\n     * @param _amount The amount of staking tokens to transfer and stake.\n     * @return amount The amount of staking tokens staked.  May differ from\n     * input if there were unstaked tokens in the vault prior to this call.\n     * @return stakedTokenId TokenId where liquidity was staked to.  This may\n     * differ from the input tokenIf if the input `tokenId=0`.\n     */\n    function transferAndStake(\n        uint256 tokenId,\n        uint256 _amount\n    ) external returns (uint256 amount, uint256 stakedTokenId);\n\n    /**\n     * @notice This function stakes the staking tokens to the specified\n     * tokenId. If `tokenId=0` is passed in, then this function will look up\n     * the caller's tokenIds and stake to the zero-index tokenId.  If the user\n     * does not yet have a staking NFT tokenId, this function will mint one for\n     * the sender and stake to that newly-minted tokenId.\n     *\n     * @dev The amount staked is derived by looking at the new balance on\n     * the `vault()`. So, for staking to yield a non-zero balance, the user\n     * will need to have transfered the `stakingToken()` to the `vault()` prior\n     * to calling `stake`.  Note, tokens sent to the reward contract instead\n     * of the vault will not be stakable and instead will be eligible to be\n     * disbursed as rewards to stakers.  This is an advanced usage function.\n     * If in doubt about the mechanics of staking, use `transferAndStake()`\n     * instead.\n     * @param tokenId The address of the tokenId whose tokens to stake.\n     * @return amount The amount of staking tokens staked (uint256).\n     * @return stakedTokenId TokenId where liquidity was staked to.  This may\n     * differ from the input tokenIf if the input `tokenId=0`.\n     */\n    function stake(uint256 tokenId) external returns (uint256 amount, uint256 stakedTokenId);\n\n    /**\n     * @notice This function initiates unstaking of a specified amount of\n     * staking tokens for the caller and sends them to a recipient.\n     * @param tokenId The address of the tokenId whose tokens to unstake.\n     * @param amount The amount of staking tokens to unstake (uint256).\n     */\n    function unstakeToOwner(uint256 tokenId, uint256 amount) external;\n\n    /**\n     * @notice This function initiates unstaking of a specified amount of\n     * staking tokens on behalf of a specific tokenId and sends them to a recipient.\n     * @dev To unstakeFrom, the caller must have an approval allowance of at\n     * least `amount`.  Approvals follow the ERC-721 approval interface.\n     * @param tokenId The address of the tokenId whose tokens to unstake.\n     * @param recipient The address to which the unstaked tokens will be sent.\n     * @param amount The amount of staking tokens to unstake (uint256).\n     */\n    function unstake(uint256 tokenId, address recipient, uint256 amount) external;\n\n    /**\n     * @notice This function retrieves the claimable reward for a specific\n     * reward token and stake duration for the caller.\n     * @param tokenId The address of the tokenId whose reward to claim.\n     * @param rewardTokenIndex The internal index of the reward token.\n     * @param stakeDuration The duration (in seconds) for which the rewards were staked.\n     * @return rewardOutput A RewardOutput struct containing details about the claimable reward.\n     */\n    function getRewardToOwner(\n        uint256 tokenId,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration\n    ) external returns (RewardOutput memory rewardOutput);\n\n    /**\n     * @notice This function retrieves the claimable reward for a specific\n     * reward token, stake duration, and lockup ID for the caller.\n     * @param tokenId The address of the tokenId whose reward to claim.\n     * @param rewardTokenIndex The internal index of the reward token.\n     * @param stakeDuration The duration (in seconds) for which the rewards were staked.\n     * @param lockupId The unique identifier for the specific lockup (optional).\n     * @return rewardOutput A RewardOutput struct containing details about the claimable reward.\n     */\n    function getRewardToOwnerForExistingVeLockup(\n        uint256 tokenId,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration,\n        uint256 lockupId\n    ) external returns (RewardOutput memory);\n\n    /**\n     * @notice This function retrieves the claimable reward for a specific\n     * reward token and stake duration for a specified tokenId and sends it to\n     * a recipient.  If the reward is staked in the corresponding veToken, a\n     * new lockup in the ve token will be created.\n     * @param tokenId The address of the tokenId whose reward to claim.\n     * @param recipient The address to which the claimed reward will be sent.\n     * @param rewardTokenIndex The internal index of the reward token.\n     * @param stakeDuration The duration (in seconds) for which the rewards\n     * will be staked in the ve contract.\n     * @return rewardOutput A RewardOutput struct containing details about the claimable reward.\n     */\n    function getReward(\n        uint256 tokenId,\n        address recipient,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration\n    ) external returns (RewardOutput memory);\n\n    /**\n     * @notice This function retrieves a list of all supported tokens in the reward contract.\n     * @param includeStakingToken A flag indicating whether to include the staking token in the list.\n     * @return tokens An array of IERC20 token addresses.\n     */\n    function tokenList(bool includeStakingToken) external view returns (IERC20[] memory tokens);\n\n    /**\n     * @notice This function retrieves the veToken contract associated with a\n     * specific index within the reward contract.\n     * @param index The index of the veToken to retrieve.\n     * @return output The IMaverickV2VotingEscrow contract associated with the index.\n     */\n    function veTokenByIndex(uint8 index) external view returns (IMaverickV2VotingEscrow output);\n\n    /**\n     * @notice This function retrieves the reward token contract associated\n     * with a specific index within the reward contract.\n     * @param index The index of the reward token to retrieve.\n     * @return output The IERC20 contract associated with the index.\n     */\n    function rewardTokenByIndex(uint8 index) external view returns (IERC20 output);\n\n    /**\n     * @notice This function calculates the boosted amount an tokenId would\n     * receive based on their veToken balance and stake duration.\n     * @param tokenId The address of the tokenId for which to calculate the boosted amount.\n     * @param veToken The IMaverickV2VotingEscrow contract representing the veToken used for boosting.\n     * @param rawAmount The raw (unboosted) amount.\n     * @param stakeDuration The duration (in seconds) for which the rewards would be staked.\n     * @return earnedAmount The boosted amount the tokenId would receive (uint256).\n     * @return asVe A boolean indicating whether the boosted amount is\n     * staked in the veToken (true) or is disbursed without ve staking required (false).\n     */\n    function boostedAmount(\n        uint256 tokenId,\n        IMaverickV2VotingEscrow veToken,\n        uint256 rawAmount,\n        uint256 stakeDuration\n    ) external view returns (uint256 earnedAmount, bool asVe);\n\n    /**\n     * @notice This function is used to push unboosted rewards to the veToken\n     * contract.  This unboosted reward amount is then distributed to the\n     * veToken holders. This function will revert if less than\n     * `UNBOOSTED_MIN_TIME_GAP()` seconds have passed since the last call.\n     * @param rewardTokenIndex The internal index of the reward token.\n     * @return amount The amount of unboosted rewards pushed (uint128).\n     * @return timepoint The timestamp associated with the pushed rewards (uint48).\n     * @return batchIndex The batch index for the pushed rewards (uint256).\n     */\n    function pushUnboostedToVe(\n        uint8 rewardTokenIndex\n    ) external returns (uint128 amount, uint48 timepoint, uint256 batchIndex);\n\n    /**\n     * @notice Mints an NFT stake to a user.  This NFT will not possesses any\n     * assets until a user `stake`s asset to the NFT tokenId as part of a\n     * separate call.\n     * @param recipient The address that owns the output NFT\n     */\n    function mint(address recipient) external returns (uint256 tokenId);\n\n    /**\n     * @notice Mints an NFT stake to caller.  This NFT will not possesses any\n     * assets until a user `stake`s asset to the NFT tokenId as part of a\n     * separate call.\n     */\n    function mintToSender() external returns (uint256 tokenId);\n}\n"
      },
      "@maverick/v2-rewards/contracts/interfaces/IMaverickV2RewardVault.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IMaverickV2RewardVault {\n    error RewardVaultUnauthorizedAccount(address caller, address owner);\n\n    /**\n     * @notice This function allows the owner of the reward vault to withdraw a\n     * specified amount of staking tokens to a recipient address.  If non-owner\n     * calls this function, it will revert.\n     * @param recipient The address to which the withdrawn staking tokens will be sent.\n     * @param amount The amount of staking tokens to withdraw.\n     */\n    function withdraw(address recipient, uint256 amount) external;\n\n    /**\n     * @notice This function retrieves the address of the owner of the reward\n     * vault contract.\n     */\n    function owner() external view returns (address);\n\n    /**\n     * @notice This function retrieves the address of the ERC20 token used for\n     * staking within the reward vault.\n     */\n    function stakingToken() external view returns (IERC20);\n}\n"
      },
      "@maverick/v2-rewards/contracts/interfaces/IMaverickV2VotingEscrow.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {IVotes} from \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {IERC6372} from \"@openzeppelin/contracts/interfaces/IERC6372.sol\";\n\nimport {IHistoricalBalance} from \"../votingescrowbase/IHistoricalBalance.sol\";\n\ninterface IMaverickV2VotingEscrowBase is IVotes, IHistoricalBalance {\n    error VotingEscrowTransferNotSupported();\n    error VotingEscrowInvalidAddress(address);\n    error VotingEscrowInvalidAmount(uint256);\n    error VotingEscrowInvalidDuration(uint256 duration, uint256 minDuration, uint256 maxDuration);\n    error VotingEscrowInvalidEndTime(uint256 newEnd, uint256 oldEnd);\n    error VotingEscrowStakeStillLocked(uint256 currentTime, uint256 endTime);\n    error VotingEscrowStakeAlreadyRedeemed();\n    error VotingEscrowNotApprovedExtender(address account, address extender, uint256 lockupId);\n    error VotingEscrowIncentiveAlreadyClaimed(address account, uint256 batchIndex);\n    error VotingEscrowNoIncentivesToClaim(address account, uint256 batchIndex);\n    error VotingEscrowInvalidExtendIncentiveToken(IERC20 incentiveToken);\n    error VotingEscrowNoSupplyAtTimepoint();\n    error VotingEscrowIncentiveTimepointInFuture(uint256 timestamp, uint256 claimTimepoint);\n\n    event Stake(address indexed user, uint256 lockupId, Lockup);\n    event Unstake(address indexed user, uint256 lockupId, Lockup);\n    event ExtenderApproval(address staker, address extender, uint256 lockupId, bool newState);\n    event ClaimIncentiveBatch(uint256 batchIndex, address account, uint256 claimAmount);\n    event CreateNewIncentiveBatch(\n        address user,\n        uint256 amount,\n        uint256 timepoint,\n        uint256 stakeDuration,\n        IERC20 incentiveToken\n    );\n\n    struct Lockup {\n        uint128 amount;\n        uint128 end;\n        uint256 votes;\n    }\n\n    struct ClaimInformation {\n        bool timepointInPast;\n        bool hasClaimed;\n        uint128 claimAmount;\n    }\n\n    struct BatchInformation {\n        uint128 totalIncentives;\n        uint128 stakeDuration;\n        uint48 claimTimepoint;\n        IERC20 incentiveToken;\n    }\n\n    struct TokenIncentiveTotals {\n        uint128 totalIncentives;\n        uint128 claimedIncentives;\n    }\n\n    // solhint-disable-next-line func-name-mixedcase\n    function MIN_STAKE_DURATION() external returns (uint256 duration);\n\n    // solhint-disable-next-line func-name-mixedcase\n    function MAX_STAKE_DURATION() external returns (uint256 duration);\n\n    // solhint-disable-next-line func-name-mixedcase\n    function YEAR_BASE() external returns (uint256);\n\n    /**\n     * @notice This function retrieves the address of the ERC20 token used as the base token for staking and rewards.\n     * @return baseToken The address of the IERC20 base token contract.\n     */\n    function baseToken() external returns (IERC20);\n\n    /**\n     * @notice This function retrieves the starting timestamp. This may be used\n     * for reward calculations or other time-based logic.\n     */\n    function startTimestamp() external returns (uint256 timestamp);\n\n    /**\n     * @notice This function retrieves the details of a specific lockup for a given staker and lockup index.\n     * @param staker The address of the staker for which to retrieve the lockup details.\n     * @param index The index of the lockup within the staker's lockup history.\n     * @return lockup A Lockup struct containing details about the lockup (see struct definition for details).\n     */\n    function getLockup(address staker, uint256 index) external view returns (Lockup memory lockup);\n\n    /**\n     * @notice This function retrieves the total number of lockups associated with a specific staker.\n     * @param staker The address of the staker for which to retrieve the lockup count.\n     * @return count The total number of lockups for the staker.\n     */\n    function lockupCount(address staker) external view returns (uint256 count);\n\n    /**\n     * @notice This function simulates a lockup scenario, providing details about the resulting lockup structure for a specified amount and duration.\n     * @param amount The amount of tokens to be locked.\n     * @param duration The duration of the lockup period.\n     * @return lockup A Lockup struct containing details about the simulated lockup (see struct definition for details).\n     */\n    function previewVotes(uint128 amount, uint256 duration) external view returns (Lockup memory lockup);\n\n    /**\n     * @notice This function grants approval for a designated extender contract to manage a specific lockup on behalf of the staker.\n     * @param extender The address of the extender contract to be approved.\n     * @param lockupId The ID of the lockup for which to grant approval.\n     */\n    function approveExtender(address extender, uint256 lockupId) external;\n\n    /**\n     * @notice This function revokes approval previously granted to an extender contract for managing a specific lockup.\n     * @param extender The address of the extender contract whose approval is being revoked.\n     * @param lockupId The ID of the lockup for which to revoke approval.\n     */\n    function revokeExtender(address extender, uint256 lockupId) external;\n\n    /**\n     * @notice This function checks whether a specific account has been approved by a staker to manage a particular lockup through an extender contract.\n     * @param account The address of the account to check for approval (may be the extender or another account).\n     * @param extender The address of the extender contract for which to check approval.\n     * @param lockupId The ID of the lockup to verify approval for.\n     * @return isApproved True if the account is approved for the lockup, False otherwise (bool).\n     */\n    function isApprovedExtender(address account, address extender, uint256 lockupId) external view returns (bool);\n\n    /**\n     * @notice This function extends the lockup period for the caller (msg.sender) for a specified lockup ID, adding a new duration and amount.\n     * @param lockupId The ID of the lockup to be extended.\n     * @param duration The additional duration to extend the lockup by.\n     * @param amount The additional amount of tokens to be locked.\n     * @return newLockup A Lockup struct containing details about the newly extended lockup (see struct definition for details).\n     */\n    function extendForSender(\n        uint256 lockupId,\n        uint256 duration,\n        uint128 amount\n    ) external returns (Lockup memory newLockup);\n\n    /**\n     * @notice This function extends the lockup period for a specified account, adding a new duration and amount. The caller (msg.sender) must be authorized to manage the lockup through an extender contract.\n     * @param account The address of the account whose lockup is being extended.\n     * @param lockupId The ID of the lockup to be extended.\n     * @param duration The additional duration to extend the lockup by.\n     * @param amount The additional amount of tokens to be locked.\n     * @return newLockup A Lockup struct containing details about the newly extended lockup (see struct definition for details).\n     */\n    function extendForAccount(\n        address account,\n        uint256 lockupId,\n        uint256 duration,\n        uint128 amount\n    ) external returns (Lockup memory newLockup);\n\n    /**\n     * @notice This function merges multiple lockups associated with the caller\n     * (msg.sender) into a single new lockup.\n     * @param lockupIds An array containing the IDs of the lockups to be merged.\n     * @return newLockup A Lockup struct containing details about the newly merged lockup (see struct definition for details).\n     */\n    function merge(uint256[] memory lockupIds) external returns (Lockup memory newLockup);\n\n    /**\n     * @notice This function unstakes the specified lockup ID for the caller (msg.sender), returning the details of the unstaked lockup.\n     * @param lockupId The ID of the lockup to be unstaked.\n     * @param to The address to which the unstaked tokens should be sent (optional, defaults to msg.sender).\n     * @return lockup A Lockup struct containing details about the unstaked lockup (see struct definition for details).\n     */\n    function unstake(uint256 lockupId, address to) external returns (Lockup memory lockup);\n\n    /**\n     * @notice This function is a simplified version of `unstake` that automatically sends the unstaked tokens to the caller (msg.sender).\n     * @param lockupId The ID of the lockup to be unstaked.\n     * @return lockup A Lockup struct containing details about the unstaked lockup (see struct definition for details).\n     */\n    function unstakeToSender(uint256 lockupId) external returns (Lockup memory lockup);\n\n    /**\n     * @notice This function stakes a specified amount of tokens for the caller\n     * (msg.sender) for a defined duration.\n     * @param amount The amount of tokens to be staked.\n     * @param duration The duration of the lockup period.\n     * @return lockup A Lockup struct containing details about the newly\n     * created lockup (see struct definition for details).\n     */\n    function stakeToSender(uint128 amount, uint256 duration) external returns (Lockup memory lockup);\n\n    /**\n     * @notice This function stakes a specified amount of tokens for a defined\n     * duration, allowing the caller (msg.sender) to specify an optional\n     * recipient for the staked tokens.\n     * @param amount The amount of tokens to be staked.\n     * @param duration The duration of the lockup period.\n     * @param to The address to which the staked tokens will be credited (optional, defaults to msg.sender).\n     * @return lockup A Lockup struct containing details about the newly\n     * created lockup (see struct definition for details).\n     */\n    function stake(uint128 amount, uint256 duration, address to) external returns (Lockup memory);\n\n    /**\n     * @notice This function retrieves the total incentive information for a specific ERC-20 token.\n     * @param token The address of the ERC20 token for which to retrieve incentive totals.\n     * @return totals A TokenIncentiveTotals struct containing details about\n     * the token's incentives (see struct definition for details).\n     */\n    function incentiveTotals(IERC20 token) external view returns (TokenIncentiveTotals memory);\n\n    /**\n     * @notice This function retrieves the total number of created incentive batches.\n     * @return count The total number of incentive batches.\n     */\n    function incentiveBatchCount() external view returns (uint256);\n\n    /**\n     * @notice This function retrieves claim information for a specific account and incentive batch index.\n     * @param account The address of the account for which to retrieve claim information.\n     * @param batchIndex The index of the incentive batch for which to retrieve\n     * claim information.\n     * @return claimInformation A ClaimInformation struct containing details about the\n     * account's claims for the specified batch (see struct definition for\n     * details).\n     * @return batchInformation A BatchInformation struct containing details about the\n     * specified batch (see struct definition for details).\n     */\n    function claimAndBatchInformation(\n        address account,\n        uint256 batchIndex\n    ) external view returns (ClaimInformation memory claimInformation, BatchInformation memory batchInformation);\n\n    /**\n     * @notice This function retrieves batch information for a incentive batch index.\n     * @param batchIndex The index of the incentive batch for which to retrieve\n     * claim information.\n     * @return info A BatchInformation struct containing details about the\n     * specified batch (see struct definition for details).\n     */\n    function incentiveBatchInformation(uint256 batchIndex) external view returns (BatchInformation memory info);\n\n    /**\n     * @notice This function allows claiming rewards from a specific incentive\n     * batch while simultaneously extending a lockup with the claimed tokens.\n     * @param batchIndex The index of the incentive batch from which to claim rewards.\n     * @param lockupId The ID of the lockup to be extended with the claimed tokens.\n     * @return lockup A Lockup struct containing details about the updated\n     * lockup after extension (see struct definition for details).\n     * @return claimAmount The amount of tokens claimed from the incentive batch.\n     */\n    function claimFromIncentiveBatchAndExtend(\n        uint256 batchIndex,\n        uint256 lockupId\n    ) external returns (Lockup memory lockup, uint128 claimAmount);\n\n    /**\n     * @notice This function allows claiming rewards from a specific incentive\n     * batch, without extending any lockups.\n     * @param batchIndex The index of the incentive batch from which to claim rewards.\n     * @return lockup A Lockup struct containing details about the user's\n     * lockup that might have been affected by the claim (see struct definition\n     * for details).\n     * @return claimAmount The amount of tokens claimed from the incentive batch.\n     */\n    function claimFromIncentiveBatch(uint256 batchIndex) external returns (Lockup memory lockup, uint128 claimAmount);\n\n    /**\n     * @notice This function creates a new incentive batch for a specified amount\n     * of incentive tokens, timepoint, stake duration, and associated ERC-20\n     * token. An incentive batch is a reward of incentives put up by the\n     * caller at a certain timepoint.  The incentive batch is claimable by ve\n     * holders after the timepoint has passed.  The ve holders will receive\n     * their incentive pro rata of their vote balance (`pastbalanceOf`) at that\n     * timepoint.  The incentivizer can specify that users have to stake the\n     * resulting incentive for a given `stakeDuration` number of seconds.\n     * `stakeDuration` can either be zero, meaning that no staking is required\n     * on redemption, or can be a number between `MIN_STAKE_DURATION()` and\n     * `MAX_STAKE_DURATION()`.\n     * @param amount The total amount of incentive tokens to be distributed in the batch.\n     * @param timepoint The timepoint at which the incentive batch starts accruing rewards.\n     * @param stakeDuration The duration of the lockup period required to be\n     * eligible for the incentive batch rewards.\n     * @param incentiveToken The address of the ERC20 token used for the incentive rewards.\n     * @return index The index of the newly created incentive batch.\n     */\n    function createIncentiveBatch(\n        uint128 amount,\n        uint48 timepoint,\n        uint128 stakeDuration,\n        IERC20 incentiveToken\n    ) external returns (uint256 index);\n}\n\ninterface IMaverickV2VotingEscrow is IMaverickV2VotingEscrowBase, IERC20Metadata, IERC6372 {}\n"
      },
      "@maverick/v2-rewards/contracts/MaverickV2Reward.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport {Time} from \"@openzeppelin/contracts/utils/types/Time.sol\";\nimport {SafeCast as Cast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nimport {ONE} from \"@maverick/v2-common/contracts/libraries/Constants.sol\";\nimport {Math} from \"@maverick/v2-common/contracts/libraries/Math.sol\";\nimport {Multicall} from \"@maverick/v2-common/contracts/base/Multicall.sol\";\nimport {Nft} from \"@maverick/v2-supplemental/contracts/positionbase/Nft.sol\";\nimport {INft} from \"@maverick/v2-supplemental/contracts/positionbase/INft.sol\";\n\nimport {IMaverickV2Reward} from \"./interfaces/IMaverickV2Reward.sol\";\nimport {RewardAccounting} from \"./rewardbase/RewardAccounting.sol\";\nimport {MaverickV2RewardVault, IMaverickV2RewardVault} from \"./MaverickV2RewardVault.sol\";\nimport {IMaverickV2VotingEscrow} from \"./interfaces/IMaverickV2VotingEscrow.sol\";\n\n/**\n * @notice This reward contract is used to reward users who stake their\n * `stakingToken` in this contract. The `stakingToken` can be any token with an\n * ERC-20 interface including BoostedPosition LP tokens.\n *\n * @notice Incentive providers can permissionlessly add incentives to this\n * contract that will be disbursed to stakers pro rata over a given duration that\n * the incentive provider specifies as they add incentives.\n *\n * Incentives can be denominated in one of 5 possible reward tokens that the\n * reward contract creator specifies on contract creation.\n *\n * @notice The contract creator also has the option of specifying veTokens\n * associated with each of the up-to-5 reward tokens.  When incentivizing a\n * rewardToken that has a veToken specified, the staking users will receive a\n * boost to their rewards depending on 1) how much ve tokens they own and 2) how\n * long they stake their rewards disbursement.\n */\ncontract MaverickV2Reward is Nft, RewardAccounting, IMaverickV2Reward, Multicall, ReentrancyGuard {\n    using SafeERC20 for IERC20;\n    using Cast for uint256;\n\n    uint256 internal constant FOUR_YEARS = 1460 days;\n    uint256 internal constant BASE_STAKING_FACTOR = 0.2e18;\n    uint256 internal constant STAKING_FACTOR_SLOPE = 0.8e18;\n    uint256 internal constant BASE_PRORATA_FACTOR = 0.75e18;\n    uint256 internal constant PRORATA_FACTOR_SLOPE = 0.25e18;\n\n    /// @inheritdoc IMaverickV2Reward\n    uint256 public constant UNBOOSTED_MIN_TIME_GAP = 13 weeks;\n\n    /// @inheritdoc IMaverickV2Reward\n    IERC20 public immutable stakingToken;\n\n    IERC20 private immutable rewardToken0;\n    IERC20 private immutable rewardToken1;\n    IERC20 private immutable rewardToken2;\n    IERC20 private immutable rewardToken3;\n    IERC20 private immutable rewardToken4;\n    IMaverickV2VotingEscrow private immutable veToken0;\n    IMaverickV2VotingEscrow private immutable veToken1;\n    IMaverickV2VotingEscrow private immutable veToken2;\n    IMaverickV2VotingEscrow private immutable veToken3;\n    IMaverickV2VotingEscrow private immutable veToken4;\n\n    /// @inheritdoc IMaverickV2Reward\n    uint256 public constant MAX_DURATION = 40 days;\n    /// @inheritdoc IMaverickV2Reward\n    uint256 public constant MIN_DURATION = 3 days;\n\n    struct RewardData {\n        // Timestamp of when the rewards finish\n        uint64 finishAt;\n        // Minimum of last updated time and reward finish time\n        uint64 updatedAt;\n        // Reward to be paid out per second\n        uint128 rewardRate;\n        // Reward amount escrowed for staked users up to current time. this\n        // value is incremented on each action as by the amount of reward\n        // globally accumulated since the last action.  when a user collects\n        // reward, this amount is decremented.\n        uint128 escrowedReward;\n        // Accumulator of the amount of this reward token not taken as part of\n        // getReward boosting.  this amount gets pushed to the associated ve\n        // contract as an incentive for the ve holders.\n        uint128 unboostedAmount;\n        // Timestamp of last time unboosted reward was pushed to ve contract as\n        // incentive\n        uint256 lastUnboostedPushTimestamp;\n        // Sum of (reward rate * dt * 1e18 / total supply)\n        uint256 rewardPerTokenStored;\n        // User tokenId => rewardPerTokenStored\n        mapping(uint256 tokenId => uint256) userRewardPerTokenPaid;\n        // User tokenId => rewards to be claimed\n        mapping(uint256 tokenId => uint128) rewards;\n    }\n    RewardData[5] public rewardData;\n\n    uint256 public immutable rewardTokenCount;\n    IMaverickV2RewardVault public immutable vault;\n\n    constructor(\n        string memory name_,\n        string memory symbol_,\n        IERC20 _stakingToken,\n        IERC20[] memory rewardTokens,\n        IMaverickV2VotingEscrow[] memory veTokens\n    ) Nft(name_, symbol_) {\n        stakingToken = _stakingToken;\n        vault = new MaverickV2RewardVault(_stakingToken);\n        rewardTokenCount = rewardTokens.length;\n        if (rewardTokenCount > 0) {\n            rewardToken0 = rewardTokens[0];\n            veToken0 = veTokens[0];\n        }\n        if (rewardTokenCount > 1) {\n            rewardToken1 = rewardTokens[1];\n            veToken1 = veTokens[1];\n        }\n        if (rewardTokenCount > 2) {\n            rewardToken2 = rewardTokens[2];\n            veToken2 = veTokens[2];\n        }\n        if (rewardTokenCount > 3) {\n            rewardToken3 = rewardTokens[3];\n            veToken3 = veTokens[3];\n        }\n        if (rewardTokenCount > 4) {\n            rewardToken4 = rewardTokens[4];\n            veToken4 = veTokens[4];\n        }\n    }\n\n    modifier checkAmount(uint256 amount) {\n        if (amount == 0) revert RewardZeroAmount();\n        _;\n    }\n\n    /////////////////////////////////////\n    /// Stake Management Functions\n    /////////////////////////////////////\n\n    /// @inheritdoc IMaverickV2Reward\n    function mint(address recipient) public returns (uint256 tokenId) {\n        tokenId = _mint(recipient);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function mintToSender() public returns (uint256 tokenId) {\n        tokenId = _mint(msg.sender);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function stake(uint256 tokenId) public returns (uint256 amount, uint256 stakedTokenId) {\n        // reverts if token is not owned\n        stakedTokenId = tokenId;\n        if (stakedTokenId == 0) {\n            if (tokenOfOwnerByIndexExists(msg.sender, 0)) {\n                stakedTokenId = tokenOfOwnerByIndex(msg.sender, 0);\n            } else {\n                stakedTokenId = mint(msg.sender);\n            }\n        }\n        amount = _stake(stakedTokenId);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function transferAndStake(uint256 tokenId, uint256 _amount) public returns (uint256 amount, uint256 stakedTokenId) {\n        stakingToken.safeTransferFrom(msg.sender, address(vault), _amount);\n        return stake(tokenId);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function unstakeToOwner(uint256 tokenId, uint256 amount) public onlyTokenIdAuthorizedUser(tokenId) {\n        address owner = ownerOf(tokenId);\n        _unstake(tokenId, owner, amount);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function unstake(uint256 tokenId, address recipient, uint256 amount) public onlyTokenIdAuthorizedUser(tokenId) {\n        _unstake(tokenId, recipient, amount);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function getRewardToOwner(\n        uint256 tokenId,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration\n    ) external onlyTokenIdAuthorizedUser(tokenId) returns (RewardOutput memory) {\n        address owner = ownerOf(tokenId);\n        return _getReward(tokenId, owner, rewardTokenIndex, stakeDuration, type(uint256).max);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function getRewardToOwnerForExistingVeLockup(\n        uint256 tokenId,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration,\n        uint256 lockupId\n    ) external onlyTokenIdAuthorizedUser(tokenId) returns (RewardOutput memory) {\n        address owner = ownerOf(tokenId);\n        return _getReward(tokenId, owner, rewardTokenIndex, stakeDuration, lockupId);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function getReward(\n        uint256 tokenId,\n        address recipient,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration\n    ) external onlyTokenIdAuthorizedUser(tokenId) returns (RewardOutput memory) {\n        return _getReward(tokenId, recipient, rewardTokenIndex, stakeDuration, type(uint256).max);\n    }\n\n    /////////////////////////////////////\n    /// Admin Functions\n    /////////////////////////////////////\n\n    /// @inheritdoc IMaverickV2Reward\n    function pushUnboostedToVe(\n        uint8 rewardTokenIndex\n    ) public returns (uint128 amount, uint48 timepoint, uint256 batchIndex) {\n        IMaverickV2VotingEscrow ve = veTokenByIndex(rewardTokenIndex);\n        IERC20 token = rewardTokenByIndex(rewardTokenIndex);\n        RewardData storage data = rewardData[rewardTokenIndex];\n        amount = data.unboostedAmount;\n        if (amount == 0) revert RewardZeroAmount();\n        if (block.timestamp <= data.lastUnboostedPushTimestamp + UNBOOSTED_MIN_TIME_GAP) {\n            // revert if not enough time has passed; will not revert if this is\n            // the first call and last timestamp is zero.\n            revert RewardUnboostedTimePeriodNotMet(\n                block.timestamp,\n                data.lastUnboostedPushTimestamp + UNBOOSTED_MIN_TIME_GAP\n            );\n        }\n\n        data.unboostedAmount = 0;\n        data.lastUnboostedPushTimestamp = block.timestamp;\n\n        token.forceApprove(address(ve), amount);\n\n        timepoint = Time.timestamp();\n        batchIndex = ve.createIncentiveBatch(amount, timepoint, ve.MAX_STAKE_DURATION().toUint128(), token);\n    }\n\n    /////////////////////////////////////\n    /// View Functions\n    /////////////////////////////////////\n\n    /// @inheritdoc IMaverickV2Reward\n    function rewardInfo() public view returns (RewardInfo[] memory info) {\n        uint256 length = rewardTokenCount;\n        info = new RewardInfo[](length);\n        for (uint8 i; i < length; i++) {\n            RewardData storage data = rewardData[i];\n            info[i] = RewardInfo({\n                finishAt: data.finishAt,\n                updatedAt: data.updatedAt,\n                rewardRate: data.rewardRate,\n                rewardPerTokenStored: data.rewardPerTokenStored,\n                rewardToken: rewardTokenByIndex(i),\n                veRewardToken: veTokenByIndex(i),\n                unboostedAmount: data.unboostedAmount,\n                escrowedReward: data.escrowedReward,\n                lastUnboostedPushTimestamp: data.lastUnboostedPushTimestamp\n            });\n        }\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function contractInfo() external view returns (RewardInfo[] memory info, ContractInfo memory _contractInfo) {\n        info = rewardInfo();\n        _contractInfo.name = name();\n        _contractInfo.symbol = symbol();\n        _contractInfo.totalSupply = stakeTotalSupply();\n        _contractInfo.stakingToken = stakingToken;\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function earned(uint256 tokenId) public view returns (EarnedInfo[] memory earnedInfo) {\n        uint256 length = rewardTokenCount;\n        earnedInfo = new EarnedInfo[](length);\n        for (uint8 i; i < length; i++) {\n            RewardData storage data = rewardData[i];\n            earnedInfo[i] = EarnedInfo({earned: _earned(tokenId, data), rewardToken: rewardTokenByIndex(i)});\n        }\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function earned(uint256 tokenId, IERC20 rewardTokenAddress) public view returns (uint256) {\n        uint256 rewardTokenIndex = tokenIndex(rewardTokenAddress);\n        RewardData storage data = rewardData[rewardTokenIndex];\n        return _earned(tokenId, data);\n    }\n\n    function _earned(uint256 tokenId, RewardData storage data) internal view returns (uint256) {\n        return\n            data.rewards[tokenId] +\n            Math.mulFloor(\n                stakeBalanceOf(tokenId),\n                Math.clip(data.rewardPerTokenStored + _deltaRewardPerToken(data), data.userRewardPerTokenPaid[tokenId])\n            );\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function tokenIndex(IERC20 rewardToken) public view returns (uint8 rewardTokenIndex) {\n        if (rewardToken == rewardToken0) return 0;\n        if (rewardToken == rewardToken1) return 1;\n        if (rewardToken == rewardToken2) return 2;\n        if (rewardToken == rewardToken3) return 3;\n        if (rewardToken == rewardToken4) return 4;\n        revert RewardNotValidRewardToken(rewardToken);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function rewardTokenByIndex(uint8 index) public view returns (IERC20 output) {\n        if (index >= rewardTokenCount) revert RewardNotValidIndex(index);\n        if (index == 0) return rewardToken0;\n        if (index == 1) return rewardToken1;\n        if (index == 2) return rewardToken2;\n        if (index == 3) return rewardToken3;\n        return rewardToken4;\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function veTokenByIndex(uint8 index) public view returns (IMaverickV2VotingEscrow output) {\n        if (index >= rewardTokenCount) revert RewardNotValidIndex(index);\n        if (index == 0) return veToken0;\n        if (index == 1) return veToken1;\n        if (index == 2) return veToken2;\n        if (index == 3) return veToken3;\n        return veToken4;\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function tokenList(bool includeStakingToken) public view returns (IERC20[] memory tokens) {\n        uint256 length = includeStakingToken ? rewardTokenCount + 1 : rewardTokenCount;\n        tokens = new IERC20[](length);\n        if (rewardTokenCount > 0) tokens[0] = rewardToken0;\n        if (rewardTokenCount > 1) tokens[1] = rewardToken1;\n        if (rewardTokenCount > 2) tokens[2] = rewardToken2;\n        if (rewardTokenCount > 3) tokens[3] = rewardToken3;\n        if (rewardTokenCount > 4) tokens[4] = rewardToken4;\n        if (includeStakingToken) tokens[rewardTokenCount] = stakingToken;\n    }\n\n    /**\n     * @notice Updates the global reward state for a given reward token.\n     * @dev Each time a user stakes or unstakes or a incentivizer adds\n     * incentives, this function must be called in order to checkpoint the\n     * rewards state before the new stake/unstake/notify occurs.\n     */\n    function _updateGlobalReward(RewardData storage data) internal {\n        uint256 reward = _deltaRewardPerToken(data);\n        if (reward != 0) {\n            data.rewardPerTokenStored += reward;\n            // round up to ensure enough reward is set aside\n            data.escrowedReward += Math.mulCeil(reward, stakeTotalSupply()).toUint128();\n        }\n        data.updatedAt = _lastTimeRewardApplicable(data.finishAt).toUint64();\n    }\n\n    /**\n     * @notice Updates the reward state associated with an tokenId.  Also\n     * updates the global reward state.\n     * @dev This function checkpoints the data for a user before they\n     * stake/unstake.\n     */\n    function _updateReward(uint256 tokenId, RewardData storage data) internal {\n        _updateGlobalReward(data);\n        uint256 reward = _deltaEarned(tokenId, data);\n        if (reward != 0) data.rewards[tokenId] += reward.toUint128();\n        data.userRewardPerTokenPaid[tokenId] = data.rewardPerTokenStored;\n    }\n\n    /**\n     * @notice Amount an tokenId has earned since that tokenId last did a\n     * stake/unstake.\n     * @dev `deltaEarned = balance * (rewardPerToken - userRewardPerTokenPaid)`\n     */\n    function _deltaEarned(uint256 tokenId, RewardData storage data) internal view returns (uint256) {\n        return\n            Math.mulFloor(\n                stakeBalanceOf(tokenId),\n                Math.clip(data.rewardPerTokenStored, data.userRewardPerTokenPaid[tokenId])\n            );\n    }\n\n    /**\n     * @notice Amount of new rewards accrued to tokens since last checkpoint.\n     */\n    function _deltaRewardPerToken(RewardData storage data) internal view returns (uint256) {\n        uint256 timeDiff = Math.clip(_lastTimeRewardApplicable(data.finishAt), data.updatedAt);\n        if (timeDiff == 0 || stakeTotalSupply() == 0 || data.rewardRate == 0) {\n            return 0;\n        }\n        return Math.mulDivFloor(data.rewardRate, timeDiff * ONE, stakeTotalSupply());\n    }\n\n    /**\n     * @notice The smaller of: 1) time of end of reward period and 2) current\n     * block timestamp.\n     */\n    function _lastTimeRewardApplicable(uint256 dataFinishAt) internal view returns (uint256) {\n        return Math.min(dataFinishAt, block.timestamp);\n    }\n\n    /**\n     * @notice Update all rewards.\n     */\n    function _updateAllRewards(uint256 tokenId) internal {\n        for (uint8 i; i < rewardTokenCount; i++) {\n            RewardData storage data = rewardData[i];\n\n            _updateReward(tokenId, data);\n        }\n    }\n\n    /////////////////////////////////////\n    /// Internal User Functions\n    /////////////////////////////////////\n\n    function _stake(uint256 tokenId) internal nonReentrant returns (uint256 amount) {\n        _requireOwned(tokenId);\n        _updateAllRewards(tokenId);\n        amount = Math.clip(stakingToken.balanceOf(address(vault)), stakeTotalSupply());\n        if (amount != 0) _mintStake(tokenId, amount);\n    }\n\n    /**\n     * @notice Functions using this function must check that sender has access\n     * to the tokenId for this to be / safely called.\n     */\n    function _unstake(uint256 tokenId, address recipient, uint256 amount) internal nonReentrant checkAmount(amount) {\n        _updateAllRewards(tokenId);\n        _burnStake(tokenId, amount);\n        vault.withdraw(recipient, amount);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function boostedAmount(\n        uint256 tokenId,\n        IMaverickV2VotingEscrow veToken,\n        uint256 rawAmount,\n        uint256 stakeDuration\n    ) public view returns (uint256 earnedAmount, bool asVe) {\n        if (address(veToken) != address(0)) {\n            address owner = ownerOf(tokenId);\n            uint256 userVeProRata = Math.divFloor(veToken.balanceOf(owner), veToken.totalSupply());\n            uint256 userRewardProRata = Math.divFloor(stakeBalanceOf(tokenId), stakeTotalSupply());\n            // pro rata ratio can be bigger than one: need min operation\n            uint256 proRataFactor = Math.min(\n                ONE,\n                BASE_PRORATA_FACTOR + Math.mulDivFloor(PRORATA_FACTOR_SLOPE, userVeProRata, userRewardProRata)\n            );\n            uint256 stakeFactor = Math.min(\n                ONE,\n                BASE_STAKING_FACTOR + Math.mulDivFloor(STAKING_FACTOR_SLOPE, stakeDuration, FOUR_YEARS)\n            );\n\n            earnedAmount = Math.mulFloor(Math.mulFloor(rawAmount, stakeFactor), proRataFactor);\n            // if duration is non-zero, this reward is collected as ve\n            asVe = stakeDuration > 0;\n        } else {\n            earnedAmount = rawAmount;\n        }\n    }\n\n    /**\n     * @notice Internal function for computing the boost and then\n     * transferring/staking the resulting rewards.  Can not be safely called\n     * without checking that the caller has permissions to access the tokenId.\n     */\n    function _boostAndPay(\n        uint256 tokenId,\n        address recipient,\n        IERC20 rewardToken,\n        IMaverickV2VotingEscrow veToken,\n        uint256 rawAmount,\n        uint256 stakeDuration,\n        uint256 lockupId\n    ) internal returns (RewardOutput memory rewardOutput) {\n        (rewardOutput.amount, rewardOutput.asVe) = boostedAmount(tokenId, veToken, rawAmount, stakeDuration);\n        if (rewardOutput.asVe) {\n            rewardToken.forceApprove(address(veToken), rewardOutput.amount);\n            rewardOutput.veContract = veToken;\n            if (lockupId == type(uint256).max) {\n                veToken.stake(rewardOutput.amount.toUint128(), stakeDuration, recipient);\n            } else {\n                veToken.extendForAccount(recipient, lockupId, stakeDuration, rewardOutput.amount.toUint128());\n            }\n        } else {\n            rewardToken.safeTransfer(recipient, rewardOutput.amount);\n        }\n    }\n\n    /**\n     * @notice Internal getReward function.  Can not be safely called without\n     * checking that the caller has permissions to access the account.\n     */\n    function _getReward(\n        uint256 tokenId,\n        address recipient,\n        uint8 rewardTokenIndex,\n        uint256 stakeDuration,\n        uint256 lockupId\n    ) internal nonReentrant returns (RewardOutput memory rewardOutput) {\n        RewardData storage data = rewardData[rewardTokenIndex];\n        _updateReward(tokenId, data);\n        uint128 reward = data.rewards[tokenId];\n        if (reward != 0) {\n            data.rewards[tokenId] = 0;\n            data.escrowedReward -= reward;\n            rewardOutput = _boostAndPay(\n                tokenId,\n                recipient,\n                rewardTokenByIndex(rewardTokenIndex),\n                veTokenByIndex(rewardTokenIndex),\n                reward,\n                stakeDuration,\n                lockupId\n            );\n            if (reward > rewardOutput.amount) {\n                // set aside unboosted amount; unsafe cast is okay given conditional\n                data.unboostedAmount += uint128(reward - rewardOutput.amount);\n            }\n            emit GetReward(\n                msg.sender,\n                tokenId,\n                recipient,\n                rewardTokenIndex,\n                stakeDuration,\n                rewardTokenByIndex(rewardTokenIndex),\n                rewardOutput,\n                lockupId\n            );\n        }\n    }\n\n    /////////////////////////////////////\n    /// Add Reward\n    /////////////////////////////////////\n\n    /// @inheritdoc IMaverickV2Reward\n    function notifyRewardAmount(IERC20 rewardToken, uint256 duration) public nonReentrant returns (uint256) {\n        if (duration < MIN_DURATION) revert RewardDurationOutOfBounds(duration, MIN_DURATION, MAX_DURATION);\n        if (duration > MAX_DURATION) revert RewardDurationOutOfBounds(duration, MIN_DURATION, MAX_DURATION);\n        return _notifyRewardAmount(rewardToken, duration);\n    }\n\n    /// @inheritdoc IMaverickV2Reward\n    function transferAndNotifyRewardAmount(\n        IERC20 rewardToken,\n        uint256 duration,\n        uint256 amount\n    ) public returns (uint256) {\n        rewardToken.safeTransferFrom(msg.sender, address(this), amount);\n        return notifyRewardAmount(rewardToken, duration);\n    }\n\n    /**\n     * @notice Called by reward depositor to recompute the reward rate.  If\n     * notifier sends more than remaining amount, then notifier sets the rate.\n     * Else, we extend the duration at the current rate.\n     */\n    function _notifyRewardAmount(IERC20 rewardToken, uint256 duration) internal returns (uint256) {\n        uint8 rewardTokenIndex = tokenIndex(rewardToken);\n        RewardData storage data = rewardData[rewardTokenIndex];\n        _updateGlobalReward(data);\n        uint256 remainingRewards = Math.clip(\n            rewardTokenByIndex(rewardTokenIndex).balanceOf(address(this)),\n            data.escrowedReward\n        );\n        uint256 timeRemaining = Math.clip(data.finishAt, block.timestamp);\n\n        // timeRemaining * data.rewardRate is the amount of rewards on the\n        // contract before the new amount was added. we are checking to see if\n        // the reamaining rewards is bigger than twice this value.  in this\n        // case, the new notifier has brought more rewards than were already on\n        // contract and they get to set the new rewards rate.\n        if (remainingRewards > timeRemaining * data.rewardRate * 2 || data.rewardRate == 0) {\n            // if notifying new amount is bigger than, notifier gets to set the rate\n            data.rewardRate = (remainingRewards / duration).toUint128();\n        } else {\n            // if notifier doesn't bring enough, we extend the duration at the\n            // same rate\n            duration = remainingRewards / data.rewardRate;\n        }\n\n        data.finishAt = (block.timestamp + duration).toUint64();\n        // unsafe case is ok given safe cast in previous statement\n        data.updatedAt = uint64(block.timestamp);\n        emit NotifyRewardAmount(msg.sender, rewardToken, remainingRewards, duration, data.rewardRate);\n        return duration;\n    }\n\n    /////////////////////////////////////\n    /// Required Overrides\n    /////////////////////////////////////\n\n    function tokenURI(uint256 tokenId) public view virtual override(Nft, INft) returns (string memory) {\n        return super.tokenURI(tokenId);\n    }\n\n    function name() public view override(INft, Nft) returns (string memory) {\n        return super.name();\n    }\n\n    function symbol() public view override(INft, Nft) returns (string memory) {\n        return super.symbol();\n    }\n}\n"
      },
      "@maverick/v2-rewards/contracts/MaverickV2RewardVault.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IMaverickV2RewardVault} from \"./interfaces/IMaverickV2RewardVault.sol\";\n\n/**\n * @notice Vault contract with owner-only withdraw function.  Used by the\n * Reward contract to segregate staking funds from incentive rewards funds.\n */\ncontract MaverickV2RewardVault is IMaverickV2RewardVault {\n    using SafeERC20 for IERC20;\n\n    /// @inheritdoc IMaverickV2RewardVault\n    address public immutable owner;\n\n    /// @inheritdoc IMaverickV2RewardVault\n    IERC20 public immutable stakingToken;\n\n    constructor(IERC20 _stakingToken) {\n        owner = msg.sender;\n        stakingToken = _stakingToken;\n    }\n\n    /// @inheritdoc IMaverickV2RewardVault\n    function withdraw(address recipient, uint256 amount) public {\n        if (owner != msg.sender) {\n            revert RewardVaultUnauthorizedAccount(msg.sender, owner);\n        }\n        stakingToken.safeTransfer(recipient, amount);\n    }\n}\n"
      },
      "@maverick/v2-rewards/contracts/rewardbase/IRewardAccounting.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\ninterface IRewardAccounting {\n    error InsufficientBalance(uint256 tokenId, uint256 currentBalance, uint256 value);\n\n    /**\n     * @notice Balance of stake for a given `tokenId` account.\n     */\n    function stakeBalanceOf(uint256 tokenId) external view returns (uint256 balance);\n\n    /**\n     * @notice Sum of all balances across all tokenIds.\n     */\n    function stakeTotalSupply() external view returns (uint256 supply);\n}\n"
      },
      "@maverick/v2-rewards/contracts/rewardbase/RewardAccounting.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {IRewardAccounting} from \"./IRewardAccounting.sol\";\n\n/**\n * @notice Provides ERC20-like functions for minting, burning, balance tracking\n * and total supply.  Tracking is based on a tokenId user index instead of an\n * address.\n */\nabstract contract RewardAccounting is IRewardAccounting {\n    mapping(uint256 account => uint256) private _stakeBalances;\n\n    uint256 private _stakeTotalSupply;\n\n    /// @inheritdoc IRewardAccounting\n    function stakeBalanceOf(uint256 tokenId) public view returns (uint256 balance) {\n        balance = _stakeBalances[tokenId];\n    }\n\n    /// @inheritdoc IRewardAccounting\n    function stakeTotalSupply() public view returns (uint256 supply) {\n        supply = _stakeTotalSupply;\n    }\n\n    /**\n     * @notice Mint to staking account for a tokenId account.\n     */\n    function _mintStake(uint256 tokenId, uint256 value) internal {\n        // checked; will revert if supply overflows.\n        _stakeTotalSupply += value;\n        unchecked {\n            // unchecked; totalsupply will overflow before balance for a given\n            // account does.\n            _stakeBalances[tokenId] += value;\n        }\n    }\n\n    /**\n     * @notice Burn from staking account for a tokenId account.\n     */\n    function _burnStake(uint256 tokenId, uint256 value) internal {\n        uint256 currentBalance = _stakeBalances[tokenId];\n        if (value > currentBalance) revert InsufficientBalance(tokenId, currentBalance, value);\n        unchecked {\n            _stakeTotalSupply -= value;\n            _stakeBalances[tokenId] = currentBalance - value;\n        }\n    }\n}\n"
      },
      "@maverick/v2-rewards/contracts/votingescrowbase/IHistoricalBalance.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\ninterface IHistoricalBalance {\n    /**\n     * @notice This function retrieves the historical balance of an account at\n     * a specific point in time.\n     * @param account The address of the account for which to retrieve the\n     * historical balance.\n     * @param timepoint The timepoint (block number or timestamp depending on\n     * implementation) at which to query the balance (uint256).\n     * @return balance The balance of the account at the specified timepoint.\n     */\n    function getPastBalanceOf(address account, uint256 timepoint) external view returns (uint256 balance);\n}\n"
      },
      "@maverick/v2-supplemental/contracts/positionbase/INft.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {IERC721Enumerable} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol\";\n\ninterface INft is IERC721Enumerable {\n    /**\n     * @notice Check if an NFT exists for a given owner and index.\n     */\n    function tokenOfOwnerByIndexExists(address owner, uint256 index) external view returns (bool);\n\n    /**\n     * @notice Return Id of the next token minted.\n     */\n    function nextTokenId() external view returns (uint256 nextTokenId_);\n\n    /**\n     * @notice Check if the caller has access to a specific NFT by tokenId.\n     */\n    function checkAuthorized(address spender, uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @notice List of tokenIds by owner.\n     */\n    function tokenIdsOfOwner(address owner) external view returns (uint256[] memory tokenIds);\n\n    /**\n     * @notice Get the token URI for a given tokenId.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n\n    function name() external view returns (string memory);\n    function symbol() external view returns (string memory);\n}\n"
      },
      "@maverick/v2-supplemental/contracts/positionbase/Nft.sol": {
        "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.25;\n\nimport {ERC721, IERC165} from \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\nimport {ERC721Enumerable} from \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol\";\n\nimport {INft} from \"./INft.sol\";\n\n/**\n * @notice Extensions to ECR-721 to support an image contract and owner\n * enumeration.\n */\nabstract contract Nft is ERC721Enumerable, INft {\n    uint256 private _nextTokenId = 1;\n\n    constructor(string memory __name, string memory __symbol) ERC721(__name, __symbol) {}\n\n    /**\n     * @notice Internal function to mint a new NFT and assign it to the\n     * specified address.\n     * @param to The address to which the NFT will be minted.\n     * @return tokenId The ID of the newly minted NFT.\n     */\n    function _mint(address to) internal returns (uint256 tokenId) {\n        super._mint(to, _nextTokenId);\n        tokenId = _nextTokenId++;\n    }\n\n    /**\n     * @notice Modifier to restrict access to functions to the owner of a\n     * specific NFT by its tokenId.\n     */\n    modifier onlyTokenIdAuthorizedUser(uint256 tokenId) {\n        checkAuthorized(msg.sender, tokenId);\n        _;\n    }\n\n    /// @inheritdoc INft\n    function nextTokenId() public view returns (uint256 nextTokenId_) {\n        return _nextTokenId;\n    }\n\n    /// @inheritdoc INft\n    function tokenOfOwnerByIndexExists(address ownerToCheck, uint256 index) public view returns (bool exists) {\n        return index < balanceOf(ownerToCheck);\n    }\n\n    /// @inheritdoc INft\n    function tokenIdsOfOwner(address owner) public view returns (uint256[] memory tokenIds) {\n        uint256 tokenCount = balanceOf(owner);\n        tokenIds = new uint256[](tokenCount);\n        for (uint256 k; k < tokenCount; k++) {\n            tokenIds[k] = tokenOfOwnerByIndex(owner, k);\n        }\n    }\n\n    /// @inheritdoc INft\n    function checkAuthorized(address spender, uint256 tokenId) public view returns (address owner) {\n        owner = ownerOf(tokenId);\n        _checkAuthorized(owner, spender, tokenId);\n    }\n\n    // ************************************************************\n    // The following functions are overrides required by Solidity.\n\n    function _update(address to, uint256 tokenId, address auth) internal override(ERC721Enumerable) returns (address) {\n        return super._update(to, tokenId, auth);\n    }\n\n    function _increaseBalance(address account, uint128 value) internal override(ERC721Enumerable) {\n        super._increaseBalance(account, value);\n    }\n\n    function name() public view virtual override(INft, ERC721) returns (string memory) {\n        return super.name();\n    }\n\n    function symbol() public view virtual override(INft, ERC721) returns (string memory) {\n        return super.symbol();\n    }\n\n    function supportsInterface(bytes4 interfaceId) public view override(ERC721Enumerable, IERC165) returns (bool) {\n        return super.supportsInterface(interfaceId);\n    }\n\n    function tokenURI(uint256 tokenId) public view virtual override(INft, ERC721) returns (string memory) {\n        return super.tokenURI(tokenId);\n    }\n}\n"
      },
      "@openzeppelin/contracts/governance/utils/IVotes.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n */\ninterface IVotes {\n    /**\n     * @dev The signature used has expired.\n     */\n    error VotesExpiredSignature(uint256 expiry);\n\n    /**\n     * @dev Emitted when an account changes their delegate.\n     */\n    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n    /**\n     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of voting units.\n     */\n    event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);\n\n    /**\n     * @dev Returns the current amount of votes that `account` has.\n     */\n    function getVotes(address account) external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is\n     * configured to use block numbers, this will return the value at the end of the corresponding block.\n     */\n    function getPastVotes(address account, uint256 timepoint) external view returns (uint256);\n\n    /**\n     * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is\n     * configured to use block numbers, this will return the value at the end of the corresponding block.\n     *\n     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n     * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n     * vote.\n     */\n    function getPastTotalSupply(uint256 timepoint) external view returns (uint256);\n\n    /**\n     * @dev Returns the delegate that `account` has chosen.\n     */\n    function delegates(address account) external view returns (address);\n\n    /**\n     * @dev Delegates votes from the sender to `delegatee`.\n     */\n    function delegate(address delegatee) external;\n\n    /**\n     * @dev Delegates votes from signer to `delegatee`.\n     */\n    function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;\n}\n"
      },
      "@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
      },
      "@openzeppelin/contracts/interfaces/IERC6372.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC6372.sol)\n\npragma solidity ^0.8.20;\n\ninterface IERC6372 {\n    /**\n     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n     */\n    function clock() external view returns (uint48);\n\n    /**\n     * @dev Description of the clock\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function CLOCK_MODE() external view returns (string memory);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/ERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"./IERC721.sol\";\nimport {IERC721Receiver} from \"./IERC721Receiver.sol\";\nimport {IERC721Metadata} from \"./extensions/IERC721Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {Strings} from \"../../utils/Strings.sol\";\nimport {IERC165, ERC165} from \"../../utils/introspection/ERC165.sol\";\nimport {IERC721Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\nabstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {\n    using Strings for uint256;\n\n    // Token name\n    string private _name;\n\n    // Token symbol\n    string private _symbol;\n\n    mapping(uint256 tokenId => address) private _owners;\n\n    mapping(address owner => uint256) private _balances;\n\n    mapping(uint256 tokenId => address) private _tokenApprovals;\n\n    mapping(address owner => mapping(address operator => bool)) private _operatorApprovals;\n\n    /**\n     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return\n            interfaceId == type(IERC721).interfaceId ||\n            interfaceId == type(IERC721Metadata).interfaceId ||\n            super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev See {IERC721-balanceOf}.\n     */\n    function balanceOf(address owner) public view virtual returns (uint256) {\n        if (owner == address(0)) {\n            revert ERC721InvalidOwner(address(0));\n        }\n        return _balances[owner];\n    }\n\n    /**\n     * @dev See {IERC721-ownerOf}.\n     */\n    function ownerOf(uint256 tokenId) public view virtual returns (address) {\n        return _requireOwned(tokenId);\n    }\n\n    /**\n     * @dev See {IERC721Metadata-name}.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-symbol}.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev See {IERC721Metadata-tokenURI}.\n     */\n    function tokenURI(uint256 tokenId) public view virtual returns (string memory) {\n        _requireOwned(tokenId);\n\n        string memory baseURI = _baseURI();\n        return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : \"\";\n    }\n\n    /**\n     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n     * by default, can be overridden in child contracts.\n     */\n    function _baseURI() internal view virtual returns (string memory) {\n        return \"\";\n    }\n\n    /**\n     * @dev See {IERC721-approve}.\n     */\n    function approve(address to, uint256 tokenId) public virtual {\n        _approve(to, tokenId, _msgSender());\n    }\n\n    /**\n     * @dev See {IERC721-getApproved}.\n     */\n    function getApproved(uint256 tokenId) public view virtual returns (address) {\n        _requireOwned(tokenId);\n\n        return _getApproved(tokenId);\n    }\n\n    /**\n     * @dev See {IERC721-setApprovalForAll}.\n     */\n    function setApprovalForAll(address operator, bool approved) public virtual {\n        _setApprovalForAll(_msgSender(), operator, approved);\n    }\n\n    /**\n     * @dev See {IERC721-isApprovedForAll}.\n     */\n    function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {\n        return _operatorApprovals[owner][operator];\n    }\n\n    /**\n     * @dev See {IERC721-transferFrom}.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) public virtual {\n        if (to == address(0)) {\n            revert ERC721InvalidReceiver(address(0));\n        }\n        // Setting an \"auth\" arguments enables the `_isAuthorized` check which verifies that the token exists\n        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.\n        address previousOwner = _update(to, tokenId, _msgSender());\n        if (previousOwner != from) {\n            revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n        }\n    }\n\n    /**\n     * @dev See {IERC721-safeTransferFrom}.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) public {\n        safeTransferFrom(from, to, tokenId, \"\");\n    }\n\n    /**\n     * @dev See {IERC721-safeTransferFrom}.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {\n        transferFrom(from, to, tokenId);\n        _checkOnERC721Received(from, to, tokenId, data);\n    }\n\n    /**\n     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n     *\n     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the\n     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances\n     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by\n     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.\n     */\n    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n        return _owners[tokenId];\n    }\n\n    /**\n     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.\n     */\n    function _getApproved(uint256 tokenId) internal view virtual returns (address) {\n        return _tokenApprovals[tokenId];\n    }\n\n    /**\n     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in\n     * particular (ignoring whether it is owned by `owner`).\n     *\n     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this\n     * assumption.\n     */\n    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {\n        return\n            spender != address(0) &&\n            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);\n    }\n\n    /**\n     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.\n     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets\n     * the `spender` for the specific `tokenId`.\n     *\n     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this\n     * assumption.\n     */\n    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {\n        if (!_isAuthorized(owner, spender, tokenId)) {\n            if (owner == address(0)) {\n                revert ERC721NonexistentToken(tokenId);\n            } else {\n                revert ERC721InsufficientApproval(spender, tokenId);\n            }\n        }\n    }\n\n    /**\n     * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n     *\n     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that\n     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.\n     *\n     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the\n     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership\n     * remain consistent with one another.\n     */\n    function _increaseBalance(address account, uint128 value) internal virtual {\n        unchecked {\n            _balances[account] += value;\n        }\n    }\n\n    /**\n     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner\n     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.\n     *\n     * The `auth` argument is optional. If the value passed is non 0, then this function will check that\n     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.\n     */\n    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {\n        address from = _ownerOf(tokenId);\n\n        // Perform (optional) operator check\n        if (auth != address(0)) {\n            _checkAuthorized(from, auth, tokenId);\n        }\n\n        // Execute the update\n        if (from != address(0)) {\n            // Clear approval. No need to re-authorize or emit the Approval event\n            _approve(address(0), tokenId, address(0), false);\n\n            unchecked {\n                _balances[from] -= 1;\n            }\n        }\n\n        if (to != address(0)) {\n            unchecked {\n                _balances[to] += 1;\n            }\n        }\n\n        _owners[tokenId] = to;\n\n        emit Transfer(from, to, tokenId);\n\n        return from;\n    }\n\n    /**\n     * @dev Mints `tokenId` and transfers it to `to`.\n     *\n     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n     *\n     * Requirements:\n     *\n     * - `tokenId` must not exist.\n     * - `to` cannot be the zero address.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _mint(address to, uint256 tokenId) internal {\n        if (to == address(0)) {\n            revert ERC721InvalidReceiver(address(0));\n        }\n        address previousOwner = _update(to, tokenId, address(0));\n        if (previousOwner != address(0)) {\n            revert ERC721InvalidSender(address(0));\n        }\n    }\n\n    /**\n     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must not exist.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _safeMint(address to, uint256 tokenId) internal {\n        _safeMint(to, tokenId, \"\");\n    }\n\n    /**\n     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n     */\n    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {\n        _mint(to, tokenId);\n        _checkOnERC721Received(address(0), to, tokenId, data);\n    }\n\n    /**\n     * @dev Destroys `tokenId`.\n     * The approval is cleared when the token is burned.\n     * This is an internal function that does not check if the sender is authorized to operate on the token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _burn(uint256 tokenId) internal {\n        address previousOwner = _update(address(0), tokenId, address(0));\n        if (previousOwner == address(0)) {\n            revert ERC721NonexistentToken(tokenId);\n        }\n    }\n\n    /**\n     * @dev Transfers `tokenId` from `from` to `to`.\n     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _transfer(address from, address to, uint256 tokenId) internal {\n        if (to == address(0)) {\n            revert ERC721InvalidReceiver(address(0));\n        }\n        address previousOwner = _update(to, tokenId, address(0));\n        if (previousOwner == address(0)) {\n            revert ERC721NonexistentToken(tokenId);\n        } else if (previousOwner != from) {\n            revert ERC721IncorrectOwner(from, tokenId, previousOwner);\n        }\n    }\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients\n     * are aware of the ERC721 standard to prevent tokens from being forever locked.\n     *\n     * `data` is additional data, it has no specified format and it is sent in call to `to`.\n     *\n     * This internal function is like {safeTransferFrom} in the sense that it invokes\n     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.\n     * implement alternative mechanisms to perform token transfer, such as signature-based.\n     *\n     * Requirements:\n     *\n     * - `tokenId` token must exist and be owned by `from`.\n     * - `to` cannot be the zero address.\n     * - `from` cannot be the zero address.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _safeTransfer(address from, address to, uint256 tokenId) internal {\n        _safeTransfer(from, to, tokenId, \"\");\n    }\n\n    /**\n     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is\n     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n     */\n    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {\n        _transfer(from, to, tokenId);\n        _checkOnERC721Received(from, to, tokenId, data);\n    }\n\n    /**\n     * @dev Approve `to` to operate on `tokenId`\n     *\n     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is\n     * either the owner of the token, or approved to operate on all tokens held by this owner.\n     *\n     * Emits an {Approval} event.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address to, uint256 tokenId, address auth) internal {\n        _approve(to, tokenId, auth, true);\n    }\n\n    /**\n     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not\n     * emitted in the context of transfers.\n     */\n    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {\n        // Avoid reading the owner unless necessary\n        if (emitEvent || auth != address(0)) {\n            address owner = _requireOwned(tokenId);\n\n            // We do not use _isAuthorized because single-token approvals should not be able to call approve\n            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {\n                revert ERC721InvalidApprover(auth);\n            }\n\n            if (emitEvent) {\n                emit Approval(owner, to, tokenId);\n            }\n        }\n\n        _tokenApprovals[tokenId] = to;\n    }\n\n    /**\n     * @dev Approve `operator` to operate on all of `owner` tokens\n     *\n     * Requirements:\n     * - operator can't be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {\n        if (operator == address(0)) {\n            revert ERC721InvalidOperator(operator);\n        }\n        _operatorApprovals[owner][operator] = approved;\n        emit ApprovalForAll(owner, operator, approved);\n    }\n\n    /**\n     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).\n     * Returns the owner.\n     *\n     * Overrides to ownership logic should be done to {_ownerOf}.\n     */\n    function _requireOwned(uint256 tokenId) internal view returns (address) {\n        address owner = _ownerOf(tokenId);\n        if (owner == address(0)) {\n            revert ERC721NonexistentToken(tokenId);\n        }\n        return owner;\n    }\n\n    /**\n     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the\n     * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.\n     *\n     * @param from address representing the previous owner of the given token ID\n     * @param to target address that will receive the tokens\n     * @param tokenId uint256 ID of the token to be transferred\n     * @param data bytes optional data to send along with the call\n     */\n    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {\n        if (to.code.length > 0) {\n            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n                if (retval != IERC721Receiver.onERC721Received.selector) {\n                    revert ERC721InvalidReceiver(to);\n                }\n            } catch (bytes memory reason) {\n                if (reason.length == 0) {\n                    revert ERC721InvalidReceiver(to);\n                } else {\n                    /// @solidity memory-safe-assembly\n                    assembly {\n                        revert(add(32, reason), mload(reason))\n                    }\n                }\n            }\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ERC721} from \"../ERC721.sol\";\nimport {IERC721Enumerable} from \"./IERC721Enumerable.sol\";\nimport {IERC165} from \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds enumerability\n * of all the token ids in the contract as well as all token ids owned by each account.\n *\n * CAUTION: `ERC721` extensions that implement custom `balanceOf` logic, such as `ERC721Consecutive`,\n * interfere with enumerability and should not be used together with `ERC721Enumerable`.\n */\nabstract contract ERC721Enumerable is ERC721, IERC721Enumerable {\n    mapping(address owner => mapping(uint256 index => uint256)) private _ownedTokens;\n    mapping(uint256 tokenId => uint256) private _ownedTokensIndex;\n\n    uint256[] private _allTokens;\n    mapping(uint256 tokenId => uint256) private _allTokensIndex;\n\n    /**\n     * @dev An `owner`'s token query was out of bounds for `index`.\n     *\n     * NOTE: The owner being `address(0)` indicates a global out of bounds index.\n     */\n    error ERC721OutOfBoundsIndex(address owner, uint256 index);\n\n    /**\n     * @dev Batch mint is not allowed.\n     */\n    error ERC721EnumerableForbiddenBatchMint();\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {\n        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n     */\n    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {\n        if (index >= balanceOf(owner)) {\n            revert ERC721OutOfBoundsIndex(owner, index);\n        }\n        return _ownedTokens[owner][index];\n    }\n\n    /**\n     * @dev See {IERC721Enumerable-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _allTokens.length;\n    }\n\n    /**\n     * @dev See {IERC721Enumerable-tokenByIndex}.\n     */\n    function tokenByIndex(uint256 index) public view virtual returns (uint256) {\n        if (index >= totalSupply()) {\n            revert ERC721OutOfBoundsIndex(address(0), index);\n        }\n        return _allTokens[index];\n    }\n\n    /**\n     * @dev See {ERC721-_update}.\n     */\n    function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {\n        address previousOwner = super._update(to, tokenId, auth);\n\n        if (previousOwner == address(0)) {\n            _addTokenToAllTokensEnumeration(tokenId);\n        } else if (previousOwner != to) {\n            _removeTokenFromOwnerEnumeration(previousOwner, tokenId);\n        }\n        if (to == address(0)) {\n            _removeTokenFromAllTokensEnumeration(tokenId);\n        } else if (previousOwner != to) {\n            _addTokenToOwnerEnumeration(to, tokenId);\n        }\n\n        return previousOwner;\n    }\n\n    /**\n     * @dev Private function to add a token to this extension's ownership-tracking data structures.\n     * @param to address representing the new owner of the given token ID\n     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n     */\n    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n        uint256 length = balanceOf(to) - 1;\n        _ownedTokens[to][length] = tokenId;\n        _ownedTokensIndex[tokenId] = length;\n    }\n\n    /**\n     * @dev Private function to add a token to this extension's token tracking data structures.\n     * @param tokenId uint256 ID of the token to be added to the tokens list\n     */\n    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n        _allTokensIndex[tokenId] = _allTokens.length;\n        _allTokens.push(tokenId);\n    }\n\n    /**\n     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n     * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n     * @param from address representing the previous owner of the given token ID\n     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n     */\n    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n        // then delete the last slot (swap and pop).\n\n        uint256 lastTokenIndex = balanceOf(from);\n        uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n        // When the token to delete is the last token, the swap operation is unnecessary\n        if (tokenIndex != lastTokenIndex) {\n            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n        }\n\n        // This also deletes the contents at the last position of the array\n        delete _ownedTokensIndex[tokenId];\n        delete _ownedTokens[from][lastTokenIndex];\n    }\n\n    /**\n     * @dev Private function to remove a token from this extension's token tracking data structures.\n     * This has O(1) time complexity, but alters the order of the _allTokens array.\n     * @param tokenId uint256 ID of the token to be removed from the tokens list\n     */\n    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n        // then delete the last slot (swap and pop).\n\n        uint256 lastTokenIndex = _allTokens.length - 1;\n        uint256 tokenIndex = _allTokensIndex[tokenId];\n\n        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n        uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n        // This also deletes the contents at the last position of the array\n        delete _allTokensIndex[tokenId];\n        _allTokens.pop();\n    }\n\n    /**\n     * See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch\n     */\n    function _increaseBalance(address account, uint128 amount) internal virtual override {\n        if (amount > 0) {\n            revert ERC721EnumerableForbiddenBatchMint();\n        }\n        super._increaseBalance(account, amount);\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n    /**\n     * @dev Returns the total amount of tokens stored by the contract.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n     */\n    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n     * Use along with {totalSupply} to enumerate all tokens.\n     */\n    function tokenByIndex(uint256 index) external view returns (uint256);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n     *   {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n     * reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert FailedInnerCall();\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Muldiv operation overflow.\n     */\n    error MathOverflowedMulDiv();\n\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            return a / b;\n        }\n\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0 = x * y; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                revert MathOverflowedMulDiv();\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/SafeCast.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev An uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/types/Time.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/types/Time.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"../math/Math.sol\";\nimport {SafeCast} from \"../math/SafeCast.sol\";\n\n/**\n * @dev This library provides helpers for manipulating time-related objects.\n *\n * It uses the following types:\n * - `uint48` for timepoints\n * - `uint32` for durations\n *\n * While the library doesn't provide specific types for timepoints and duration, it does provide:\n * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point\n * - additional helper functions\n */\nlibrary Time {\n    using Time for *;\n\n    /**\n     * @dev Get the block timestamp as a Timepoint.\n     */\n    function timestamp() internal view returns (uint48) {\n        return SafeCast.toUint48(block.timestamp);\n    }\n\n    /**\n     * @dev Get the block number as a Timepoint.\n     */\n    function blockNumber() internal view returns (uint48) {\n        return SafeCast.toUint48(block.number);\n    }\n\n    // ==================================================== Delay =====================================================\n    /**\n     * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the\n     * future. The \"effect\" timepoint describes when the transitions happens from the \"old\" value to the \"new\" value.\n     * This allows updating the delay applied to some operation while keeping some guarantees.\n     *\n     * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for\n     * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set\n     * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should\n     * still apply for some time.\n     *\n     *\n     * The `Delay` type is 112 bits long, and packs the following:\n     *\n     * ```\n     *   | [uint48]: effect date (timepoint)\n     *   |           | [uint32]: value before (duration)\n     *   ↓           ↓       ↓ [uint32]: value after (duration)\n     * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC\n     * ```\n     *\n     * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently\n     * supported.\n     */\n    type Delay is uint112;\n\n    /**\n     * @dev Wrap a duration into a Delay to add the one-step \"update in the future\" feature\n     */\n    function toDelay(uint32 duration) internal pure returns (Delay) {\n        return Delay.wrap(duration);\n    }\n\n    /**\n     * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled\n     * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.\n     */\n    function _getFullAt(Delay self, uint48 timepoint) private pure returns (uint32, uint32, uint48) {\n        (uint32 valueBefore, uint32 valueAfter, uint48 effect) = self.unpack();\n        return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);\n    }\n\n    /**\n     * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the\n     * effect timepoint is 0, then the pending value should not be considered.\n     */\n    function getFull(Delay self) internal view returns (uint32, uint32, uint48) {\n        return _getFullAt(self, timestamp());\n    }\n\n    /**\n     * @dev Get the current value.\n     */\n    function get(Delay self) internal view returns (uint32) {\n        (uint32 delay, , ) = self.getFull();\n        return delay;\n    }\n\n    /**\n     * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to\n     * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the\n     * new delay becomes effective.\n     */\n    function withUpdate(\n        Delay self,\n        uint32 newValue,\n        uint32 minSetback\n    ) internal view returns (Delay updatedDelay, uint48 effect) {\n        uint32 value = self.get();\n        uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));\n        effect = timestamp() + setback;\n        return (pack(value, newValue, effect), effect);\n    }\n\n    /**\n     * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).\n     */\n    function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\n        uint112 raw = Delay.unwrap(self);\n\n        valueAfter = uint32(raw);\n        valueBefore = uint32(raw >> 32);\n        effect = uint48(raw >> 64);\n\n        return (valueBefore, valueAfter, effect);\n    }\n\n    /**\n     * @dev pack the components into a Delay object.\n     */\n    function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {\n        return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 5500
      },
      "viaIR": true,
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}