{"file_path":"contracts/automated-buybacks/BuybackAllocator.sol","creation_status":"success","source_code":"// SPDX-FileCopyrightText: 2026 Lido <info@lido.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.23;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {EnumerableSet} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport {Math} from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {ERC165Checker} from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\n\nimport {AssetRecovererACL} from \"./AssetRecovererACL.sol\";\nimport {IStETH} from \"../interfaces/IStETH.sol\";\nimport {IOracleRouter} from \"../interfaces/IOracleRouter.sol\";\nimport {IRevenueSource} from \"../interfaces/IRevenueSource.sol\";\nimport {IBuybackAllocator} from \"../interfaces/IBuybackAllocator.sol\";\nimport {IBuybackExecutor} from \"../interfaces/IBuybackExecutor.sol\";\nimport {MathHelpers} from \"../lib/MathHelpers.sol\";\n\n/**\n * @title  BuybackAllocator\n * @notice Holds stETH and releases it to a receiver for buybacks, funded by a share of the\n *         protocol revenue that registered sources report. Anyone can trigger a release.\n */\ncontract BuybackAllocator is IBuybackAllocator, AssetRecovererACL {\n    using SafeERC20 for IERC20;\n    using SafeCast for uint256;\n    using MathHelpers for uint256;\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    /*//////////////////////////////////////////////////////////////\n                                 TYPES\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Daily or yearly spend window.\n    struct SpendWindow {\n        // When the current window ends and the spent total resets\n        uint64 endTS;\n        // USD spent within the current window\n        uint192 spentUSD;\n    }\n\n    /// @notice Constructor inputs.\n    struct ConstructorParams {\n        // Initial admin role holder\n        address admin;\n        // Destination for recovered assets\n        address treasury;\n        // The stETH token\n        address stEth;\n        // Prices stETH in USD\n        address oracleRouter;\n        // Receives allocations\n        address executor;\n        // Maximum USD per day\n        uint128 dailyCapUSD;\n        // Maximum USD per year\n        uint128 yearlyCapUSD;\n        // USD reserved for the protocol each day\n        uint128 reserveDailyRateUSD;\n        // Lowest stETH price accepted\n        uint128 minStEthPriceUSD;\n        // Smallest allocation allowed\n        uint128 minSpendPerCallUSD;\n        // Share of the revenue surplus spendable, in basis points\n        uint16 surplusShareBP;\n        // Sources registered at deployment\n        address[] revenueSources;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTANTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice 100% in basis points.\n    uint256 public constant MAX_BASIS_POINTS = 10_000;\n\n    /// @notice Maximum number of revenue sources.\n    uint256 public constant MAX_REVENUE_SOURCES = 50;\n\n    uint256 internal constant ONE_DAY = 1 days;\n    uint256 internal constant ONE_YEAR = 365 days;\n\n    /*//////////////////////////////////////////////////////////////\n                              IMMUTABLES\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice The stETH token.\n    IStETH public immutable STETH;\n\n    /// @notice Oracle that prices stETH in USD.\n    IOracleRouter public immutable ORACLE_ROUTER;\n\n    /// @dev Oracle price unit, used to convert between USD and stETH.\n    uint256 internal immutable PRICE_UNIT;\n\n    /*//////////////////////////////////////////////////////////////\n                          CONFIGURABLE STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Maximum USD spendable per day.\n    uint128 public dailyCapUSD;\n\n    /// @notice Maximum USD spendable per year.\n    uint128 public yearlyCapUSD;\n\n    /// @notice USD reserved for the protocol each day. Only the surplus above it is spendable.\n    uint128 public reserveDailyRateUSD;\n\n    /// @notice Lowest stETH price accepted.\n    uint128 public minStEthPriceUSD;\n\n    /// @notice Smallest allocation allowed.\n    uint128 public minSpendPerCallUSD;\n\n    /// @notice Share of the revenue surplus spendable on buybacks, in basis points.\n    uint16 public surplusShareBP;\n\n    /// @notice Address that receives allocations.\n    address public executor;\n\n    /// @notice Midnight UTC of the day the contract was activated. Zero before activation.\n    uint256 public activationTS;\n\n    /// @notice Total revenue reported by all sources as of the last budget update. Later revenue is\n    ///         measured against this baseline.\n    uint256 public lastTotalRevenueUSD;\n\n    /// @notice USD available for buybacks. Can go below zero when revenue lags behind the reserve.\n    ///         A release then treats it as zero.\n    int256 public budgetUSD;\n\n    /// @notice Start of the day from which the current reserve builds up.\n    uint256 public reserveAnchorTS;\n\n    /// @notice Current day spend window: when it ends and the USD spent in it so far.\n    SpendWindow public daily;\n\n    /// @notice Current year spend window: when it ends and the USD spent in it so far.\n    SpendWindow public yearly;\n\n    /// @dev Registered revenue sources.\n    EnumerableSet.AddressSet internal _revenueSources;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event Activated(uint256 activationTS, uint256 lastTotalRevenueUSD);\n    event Allocated(\n        address indexed triggeredBy,\n        address indexed executor,\n        uint256 spendUSD,\n        uint256 spendStEth\n    );\n    event AllocationSkipped(address indexed caller, AllocationStatus reason);\n    event Checkpoint(\n        uint256 lastTotalRevenueUSD,\n        uint256 reserveUSD,\n        int256 budgetDeltaUSD,\n        int256 budgetUSD\n    );\n    event WindowRolled(uint256 windowDurationSeconds, uint256 newEndTS, uint256 previousSpentUSD);\n    event ReserveAnchored(uint256 anchorTS);\n    event ExecutorSet(address indexed executor);\n    event DailyCapUSDSet(uint256 dailyCapUSD);\n    event YearlyCapUSDSet(uint256 yearlyCapUSD);\n    event ReserveDailyRateUSDSet(uint256 reserveDailyRateUSD);\n    event MinStEthPriceUSDSet(uint256 minStEthPriceUSD);\n    event MinSpendPerCallUSDSet(uint256 minSpendPerCallUSD);\n    event SurplusShareBPSet(uint256 surplusShareBP);\n    event RevenueSourceAdded(address indexed source);\n    event RevenueSourceRemoved(address indexed source);\n\n    /*//////////////////////////////////////////////////////////////\n                                ERRORS\n    //////////////////////////////////////////////////////////////*/\n\n    error StEthZeroAddress();\n    error OracleRouterZeroAddress();\n    error ExecutorZeroAddress();\n    error AlreadyActivated();\n    error NotActivated();\n    error SurplusShareBPInvalid();\n    error DailyCapUSDZero();\n    error YearlyCapUSDZero();\n    error MinSpendPerCallUSDZero();\n    error DailyCapExceedsYearlyCap();\n    error MinSpendPerCallExceedsDailyCap();\n    error RevenueSourceZeroAddress();\n    error RevenueSourceUnsupported(address source);\n    error RevenueSourceAlreadyRegistered();\n    error RevenueSourceNotRegistered();\n    error RevenueSourceLimitReached(uint256 maxSources);\n\n    /*//////////////////////////////////////////////////////////////\n                               MODIFIERS\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Reverts until the contract is activated.\n     * @dev    Guards every function that runs `_checkpoint`, whose math reads activation-derived\n     *         state. Plain setters stay callable before activation.\n     */\n    modifier whenActivated() {\n        if (activationTS == 0) {\n            revert NotActivated();\n        }\n        _;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                              CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Sets dependencies, limits, and the initial revenue sources.\n     * @dev    Activation is a separate step that must run before the first release.\n     * @param  initParams_ See `ConstructorParams`.\n     */\n    constructor(\n        ConstructorParams memory initParams_\n    ) AssetRecovererACL(initParams_.admin, initParams_.treasury) {\n        if (initParams_.stEth == address(0)) {\n            revert StEthZeroAddress();\n        }\n        if (initParams_.oracleRouter == address(0)) {\n            revert OracleRouterZeroAddress();\n        }\n\n        STETH = IStETH(initParams_.stEth);\n        ORACLE_ROUTER = IOracleRouter(initParams_.oracleRouter);\n\n        // The USD<->stETH conversions scale by the oracle's own price unit.\n        PRICE_UNIT = ORACLE_ROUTER.PRICE_UNIT();\n\n        _setExecutor(initParams_.executor);\n        _setYearlyCapUSD(initParams_.yearlyCapUSD);\n        _setDailyCapUSD(initParams_.dailyCapUSD);\n        _setMinSpendPerCallUSD(initParams_.minSpendPerCallUSD);\n        _setSurplusShareBP(initParams_.surplusShareBP);\n        _setMinStEthPriceUSD(initParams_.minStEthPriceUSD);\n        _setReserveDailyRateUSD(initParams_.reserveDailyRateUSD);\n\n        address[] memory sources = initParams_.revenueSources;\n        for (uint256 i; i < sources.length; ++i) {\n            _addRevenueSource(sources[i]);\n        }\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                           EXTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Activates the contract once. Records current total revenue as the baseline, so only\n     *         later revenue funds the budget, and starts the daily reserve accruing.\n     * @dev    Reverts if any registered source cannot be reached. The baseline captures each\n     *         source's cumulative now, so pending unconverted revenue settled after activation\n     *         surfaces as new surplus above the baseline. Settle each source before activating.\n     */\n    function activate() external onlyRole(DEFAULT_ADMIN_ROLE) {\n        if (activationTS != 0) {\n            revert AlreadyActivated();\n        }\n\n        uint256 alignedTS = _todayStartTS();\n        activationTS = alignedTS;\n\n        lastTotalRevenueUSD = _revenueSumUSD();\n\n        // Anchor the reserve to the activation day itself, so the activation day's reserve is charged\n        // rather than forgiven (unlike the post-checkpoint re-anchor to the next day).\n        reserveAnchorTS = alignedTS;\n        emit ReserveAnchored(reserveAnchorTS);\n\n        _rollWindow(daily, ONE_DAY, 0);\n        _rollWindow(yearly, ONE_YEAR, 0);\n\n        emit Activated(alignedTS, lastTotalRevenueUSD);\n    }\n\n    /**\n     * @notice Updates the budget, then sends the amount available now to the receiver. When nothing\n     *         is eligible it emits a skip event and returns. The budget update still applies, so any\n     *         caller advances the accounting even when no transfer happens.\n     */\n    function allocate() external nonReentrant whenActivated {\n        _checkpoint();\n\n        // Budget is current after the checkpoint above. Spend only its non-negative part.\n        uint256 availableUSD = _clampBudget(budgetUSD);\n        (AllocationStatus status, uint256 spendUSD, uint256 spendStEth) = _spendable(availableUSD);\n\n        if (status != AllocationStatus.Eligible) {\n            emit AllocationSkipped(msg.sender, status);\n            return;\n        }\n\n        budgetUSD -= int256(spendUSD);\n\n        _rollWindow(yearly, ONE_YEAR, spendUSD);\n        _rollWindow(daily, ONE_DAY, spendUSD);\n\n        IERC20(address(STETH)).safeTransfer(executor, spendStEth);\n\n        emit Allocated(msg.sender, executor, spendUSD, spendStEth);\n\n        IBuybackExecutor(executor).onStEthAllocated();\n    }\n\n    /**\n     * @notice Sets the share of the revenue surplus spendable on buybacks, in basis points.\n     * @dev    Updates the budget at the current share first, so the new share applies only to\n     *         revenue earned after this call. Budget already accrued is unaffected.\n     * @param  surplusShareBP_ New surplus share in basis points.\n     */\n    function setSurplusShareBP(\n        uint256 surplusShareBP_\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) whenActivated {\n        _checkpoint();\n        _setSurplusShareBP(surplusShareBP_.toUint16());\n    }\n\n    /**\n     * @notice Sets the daily reserve rate.\n     * @dev    Updates the budget at the current rate first, so the new rate applies only to days\n     *         after this call.\n     * @param  reserveDailyRateUSD_ New daily reserve rate in USD.\n     */\n    function setReserveDailyRateUSD(\n        uint256 reserveDailyRateUSD_\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) whenActivated {\n        _checkpoint();\n        _setReserveDailyRateUSD(reserveDailyRateUSD_.toUint128());\n    }\n\n    /**\n     * @notice Sets the per-day spending cap. Applies to the window in progress.\n     * @dev    The daily cap is enforced over a fixed window from midnight to midnight UTC. The window\n     *         resets at midnight, so a caller can spend the full cap just before midnight and the full\n     *         cap again in the next block, close to twice the daily cap within seconds. The yearly cap\n     *         and the remaining budget still bound the total.\n     * @param  dailyCapUSD_ New per-day spending cap in USD.\n     */\n    function setDailyCapUSD(uint256 dailyCapUSD_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        _setDailyCapUSD(dailyCapUSD_.toUint128());\n    }\n\n    /**\n     * @notice Sets the per-year spending cap. Applies to the window in progress.\n     * @param  yearlyCapUSD_ New per-year spending cap in USD.\n     */\n    function setYearlyCapUSD(uint256 yearlyCapUSD_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        _setYearlyCapUSD(yearlyCapUSD_.toUint128());\n    }\n\n    /**\n     * @notice Sets the minimum stETH price. A lower price skips the release.\n     * @param  minStEthPriceUSD_ New minimum stETH price in USD.\n     */\n    function setMinStEthPriceUSD(uint256 minStEthPriceUSD_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        _setMinStEthPriceUSD(minStEthPriceUSD_.toUint128());\n    }\n\n    /**\n     * @notice Sets the smallest allocation allowed. Smaller amounts are skipped.\n     * @param  minSpendPerCallUSD_ New smallest allocation in USD.\n     */\n    function setMinSpendPerCallUSD(\n        uint256 minSpendPerCallUSD_\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        _setMinSpendPerCallUSD(minSpendPerCallUSD_.toUint128());\n    }\n\n    /**\n     * @notice Redirects all future allocations to a new receiver.\n     * @param  newExecutor_ New receiver address.\n     */\n    function setExecutor(address newExecutor_) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        _setExecutor(newExecutor_);\n    }\n\n    /**\n     * @notice Registers a revenue source. Its current total is added to the baseline, so only its\n     *         later earnings fund the budget.\n     * @dev    Updates the budget first, banking revenue earned up to now, then adds the source's\n     *         current total to the baseline. The baseline captures only converted cumulative revenue,\n     *         so settle the source's pending revenue before registering, or that pre-baseline amount\n     *         later banks as surplus. Sources are trusted to report accurate USD totals (18 decimals)\n     *         that only go up. Reverts if the source does not support the required interface, or if it\n     *         or any registered source cannot be reached.\n     * @param  source_ Revenue source to register.\n     */\n    function addRevenueSource(address source_) external onlyRole(DEFAULT_ADMIN_ROLE) whenActivated {\n        _checkpoint();\n        _addRevenueSource(source_);\n    }\n\n    /**\n     * @notice Unregisters a revenue source. Budget already accrued from it stays.\n     * @dev    Updates the budget first, capturing the source's surplus up to now, then subtracts its\n     *         current total from the baseline so the remaining sources stay measured correctly.\n     *         Reverts if any registered source cannot be reached, including the one being removed.\n     *         Sources are trusted to always respond with a sane value. In an unlikely scenario where\n     *         a source ever stops responding, buybacks are paused and the allocator is redeployed.\n     * @param  source_ Revenue source to unregister.\n     */\n    function removeRevenueSource(\n        address source_\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) whenActivated {\n        _checkpoint();\n        _removeRevenueSource(source_);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                         EXTERNAL VIEW FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Previews a release at the current moment, including revenue earned since the last\n     *         budget update. Stays accurate however long ago that update was, so it is safe for\n     *         off-chain monitoring.\n     * @dev    Applies the same budget math and limits as a release, without changing state, so a\n     *         release reproduces this result. Reverts before activation, or when any registered\n     *         source cannot be reached.\n     * @return status Whether a release proceeds, or why it is skipped.\n     * @return spendableUSD USD a release spends now.\n     * @return spendableStEth stETH a release transfers now.\n     */\n    function spendable()\n        external\n        view\n        whenActivated\n        returns (AllocationStatus status, uint256 spendableUSD, uint256 spendableStEth)\n    {\n        (int256 budgetDeltaUSD, , ) = _budgetable();\n        return _spendable(_clampBudget(budgetUSD + budgetDeltaUSD));\n    }\n\n    /**\n     * @notice Registered revenue sources.\n     */\n    function revenueSources() external view returns (address[] memory) {\n        return _revenueSources.values();\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                           INTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Banks the surplus share of new revenue, less the accrued reserve, into the signed\n     *         budget, then records the new revenue baseline and restarts the reserve.\n     * @dev    Runs even with no new revenue, so the budget can fall below zero.\n     */\n    function _checkpoint() internal {\n        (int256 budgetDeltaUSD, uint256 totalRevenueUSD, uint256 reserveUSD) = _budgetable();\n\n        budgetUSD += budgetDeltaUSD;\n        lastTotalRevenueUSD = totalRevenueUSD;\n        // Move the reserve cursor to the next day.\n        reserveAnchorTS = _nextDayStartTS();\n        emit ReserveAnchored(reserveAnchorTS);\n\n        emit Checkpoint(lastTotalRevenueUSD, reserveUSD, budgetDeltaUSD, budgetUSD);\n    }\n\n    /**\n     * @notice Rolls an ended window forward to the next activation-aligned boundary and resets its\n     *         spent total, then adds this spend.\n     * @param  window_ Spend window to update.\n     * @param  windowDuration_ Window length in seconds.\n     * @param  spendUSD_ USD spent to add to the window.\n     */\n    function _rollWindow(\n        SpendWindow storage window_,\n        uint256 windowDuration_,\n        uint256 spendUSD_\n    ) internal {\n        uint192 spent = window_.spentUSD;\n        if (block.timestamp >= window_.endTS) {\n            uint64 newEndTS = uint64(\n                activationTS +\n                    ((block.timestamp - activationTS) / windowDuration_ + 1) *\n                    windowDuration_\n            );\n\n            window_.endTS = newEndTS;\n\n            emit WindowRolled(windowDuration_, newEndTS, spent);\n\n            spent = 0;\n        }\n        window_.spentUSD = spent + uint192(spendUSD_);\n    }\n\n    /**\n     * @notice Validates and registers a revenue source, adding its current total to the baseline.\n     * @param  source_ Revenue source to register.\n     */\n    function _addRevenueSource(address source_) internal {\n        if (source_ == address(0)) {\n            revert RevenueSourceZeroAddress();\n        }\n        if (!ERC165Checker.supportsInterface(source_, type(IRevenueSource).interfaceId)) {\n            revert RevenueSourceUnsupported(source_);\n        }\n        if (_revenueSources.length() >= MAX_REVENUE_SOURCES) {\n            revert RevenueSourceLimitReached(MAX_REVENUE_SOURCES);\n        }\n        if (!_revenueSources.add(source_)) {\n            revert RevenueSourceAlreadyRegistered();\n        }\n\n        lastTotalRevenueUSD += IRevenueSource(source_).getCumulativeRevenueUSD();\n\n        emit RevenueSourceAdded(source_);\n    }\n\n    /**\n     * @notice Removes a revenue source and subtracts its current total from the baseline, so only\n     *         the remaining sources' later growth counts.\n     * @dev    Must run after a budget update, which captures this source's surplus up to now.\n     *         Subtracting the same total keeps the remaining baseline exact and cannot underflow.\n     * @param  source_ Revenue source to unregister.\n     */\n    function _removeRevenueSource(address source_) internal {\n        if (!_revenueSources.remove(source_)) {\n            revert RevenueSourceNotRegistered();\n        }\n\n        // removeRevenueSource() checkpoints first, so lastTotalRevenueUSD already includes this\n        // source's current total — the subtraction is therefore exact and cannot underflow.\n        lastTotalRevenueUSD -= IRevenueSource(source_).getCumulativeRevenueUSD();\n\n        emit RevenueSourceRemoved(source_);\n    }\n\n    /**\n     * @notice Validates and sets the receiver.\n     * @param  executor_ New receiver address.\n     */\n    function _setExecutor(address executor_) internal {\n        if (executor_ == address(0)) {\n            revert ExecutorZeroAddress();\n        }\n\n        executor = executor_;\n\n        emit ExecutorSet(executor_);\n    }\n\n    /**\n     * @notice Validates and sets the yearly cap against the current daily cap.\n     * @param  yearlyCapUSD_ New per-year spending cap in USD.\n     */\n    function _setYearlyCapUSD(uint128 yearlyCapUSD_) internal {\n        if (yearlyCapUSD_ == 0) {\n            revert YearlyCapUSDZero();\n        }\n        if (dailyCapUSD > yearlyCapUSD_) {\n            revert DailyCapExceedsYearlyCap();\n        }\n\n        yearlyCapUSD = yearlyCapUSD_;\n\n        emit YearlyCapUSDSet(yearlyCapUSD_);\n    }\n\n    /**\n     * @notice Validates and sets the daily cap against the yearly cap and the minimum allocation.\n     * @param  dailyCapUSD_ New per-day spending cap in USD.\n     */\n    function _setDailyCapUSD(uint128 dailyCapUSD_) internal {\n        if (dailyCapUSD_ == 0) {\n            revert DailyCapUSDZero();\n        }\n        if (dailyCapUSD_ > yearlyCapUSD) {\n            revert DailyCapExceedsYearlyCap();\n        }\n        if (minSpendPerCallUSD > dailyCapUSD_) {\n            revert MinSpendPerCallExceedsDailyCap();\n        }\n\n        dailyCapUSD = dailyCapUSD_;\n\n        emit DailyCapUSDSet(dailyCapUSD_);\n    }\n\n    /**\n     * @notice Validates and sets the minimum allocation per call against the daily cap.\n     * @param  minSpendPerCallUSD_ New smallest allocation in USD.\n     */\n    function _setMinSpendPerCallUSD(uint128 minSpendPerCallUSD_) internal {\n        if (minSpendPerCallUSD_ == 0) {\n            revert MinSpendPerCallUSDZero();\n        }\n        if (minSpendPerCallUSD_ > dailyCapUSD) {\n            revert MinSpendPerCallExceedsDailyCap();\n        }\n\n        minSpendPerCallUSD = minSpendPerCallUSD_;\n\n        emit MinSpendPerCallUSDSet(minSpendPerCallUSD_);\n    }\n\n    /**\n     * @notice Validates and sets the surplus share.\n     * @param  surplusShareBP_ New surplus share in basis points.\n     */\n    function _setSurplusShareBP(uint16 surplusShareBP_) internal {\n        if (surplusShareBP_ == 0 || surplusShareBP_ > MAX_BASIS_POINTS) {\n            revert SurplusShareBPInvalid();\n        }\n\n        surplusShareBP = surplusShareBP_;\n\n        emit SurplusShareBPSet(surplusShareBP_);\n    }\n\n    /**\n     * @notice Sets the daily reserve rate.\n     * @param  reserveDailyRateUSD_ New daily reserve rate in USD.\n     */\n    function _setReserveDailyRateUSD(uint128 reserveDailyRateUSD_) internal {\n        reserveDailyRateUSD = reserveDailyRateUSD_;\n\n        emit ReserveDailyRateUSDSet(reserveDailyRateUSD_);\n    }\n\n    /**\n     * @notice Sets the minimum stETH price.\n     * @param  minStEthPriceUSD_ New minimum stETH price in USD.\n     */\n    function _setMinStEthPriceUSD(uint128 minStEthPriceUSD_) internal {\n        minStEthPriceUSD = minStEthPriceUSD_;\n\n        emit MinStEthPriceUSDSet(minStEthPriceUSD_);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                         INTERNAL VIEW FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Eligibility and the amounts a release produces from a given available amount, after the\n     *         year cap, the day cap, the stETH balance, and the smallest allowed allocation.\n     * @dev    Shared by the release path and the preview.\n     * @param  availableUSD_ Spendable budget in USD.\n     * @return status Whether a release proceeds, or why it is skipped.\n     * @return spendableUSD USD a release spends.\n     * @return spendableStEth stETH a release transfers.\n     */\n    function _spendable(\n        uint256 availableUSD_\n    )\n        internal\n        view\n        returns (AllocationStatus status, uint256 spendableUSD, uint256 spendableStEth)\n    {\n        if (availableUSD_ == 0) {\n            return (AllocationStatus.NoAvailableBudget, 0, 0);\n        }\n\n        // No usable price means no allocation.\n        uint256 stEthPriceUSD = _getStEthPriceUSD();\n\n        if (stEthPriceUSD == 0) {\n            return (AllocationStatus.QuoteUnavailable, 0, 0);\n        }\n\n        // A price below the floor pauses allocations.\n        if (stEthPriceUSD < minStEthPriceUSD) {\n            return (AllocationStatus.StEthPriceBelowMin, 0, 0);\n        }\n\n        // Limit to the amount remaining under the year cap, then the day cap.\n        spendableUSD = availableUSD_;\n        spendableUSD = Math.min(spendableUSD, _windowUnspent(yearly, yearlyCapUSD));\n        spendableUSD = Math.min(spendableUSD, _windowUnspent(daily, dailyCapUSD));\n        // Year and day caps leave nothing.\n        if (spendableUSD == 0) {\n            return (AllocationStatus.WindowCapReached, 0, 0);\n        }\n\n        // Convert to stETH, limit to the balance, then restate the USD actually transferable.\n        spendableStEth = Math.mulDiv(spendableUSD, PRICE_UNIT, stEthPriceUSD);\n        spendableStEth = Math.min(spendableStEth, STETH.balanceOf(address(this)));\n        spendableUSD = Math.mulDiv(spendableStEth, stEthPriceUSD, PRICE_UNIT);\n\n        // Skip an amount below the smallest allowed allocation.\n        if (spendableUSD < minSpendPerCallUSD) {\n            return (AllocationStatus.AllocationBelowMin, 0, 0);\n        }\n\n        status = AllocationStatus.Eligible;\n    }\n\n    /**\n     * @notice The signed budget change applied now, and the revenue total recorded as the new\n     *         baseline. Change is (total revenue - baseline - reserve) * surplus share, and can be\n     *         negative since the signed budget absorbs it.\n     * @dev    The reserve sits inside the share-weighted term, so only the surplus share of revenue\n     *         net of reserve is taken.\n     * @return budgetDeltaUSD Signed budget change in USD.\n     * @return totalRevenueUSD New revenue baseline in USD.\n     * @return reserveUSD Reserve accrued since the last update in USD.\n     */\n    function _budgetable()\n        internal\n        view\n        returns (int256 budgetDeltaUSD, uint256 totalRevenueUSD, uint256 reserveUSD)\n    {\n        totalRevenueUSD = _revenueSumUSD();\n        reserveUSD = _reserveCurrentUSD();\n        int256 surplusUSD = int256(totalRevenueUSD) -\n            int256(lastTotalRevenueUSD) -\n            int256(reserveUSD);\n        budgetDeltaUSD = (surplusUSD * int256(uint256(surplusShareBP))) / int256(MAX_BASIS_POINTS);\n    }\n\n    /**\n     * @notice Clamps the signed net budget to a non-negative spendable amount.\n     * @dev    A negative budget spends nothing but stays in storage, so later surplus must first\n     *         lift it back above zero.\n     * @param  budget_ Signed net budget.\n     * @return Non-negative spendable amount.\n     */\n    function _clampBudget(int256 budget_) internal pure returns (uint256) {\n        return budget_ > 0 ? uint256(budget_) : 0;\n    }\n\n    /**\n     * @notice USD spent in the current window. Counts as zero once the window has ended.\n     * @param  window_ Spend window to read.\n     * @return spent USD spent in the current window.\n     */\n    function _windowSpent(SpendWindow storage window_) internal view returns (uint256 spent) {\n        spent = block.timestamp >= window_.endTS ? 0 : uint256(window_.spentUSD);\n    }\n\n    /**\n     * @notice The amount remaining under the cap for the current window.\n     * @param  window_ Spend window to read.\n     * @param  cap_ Window spending cap in USD.\n     * @return unspent USD remaining under the cap.\n     */\n    function _windowUnspent(\n        SpendWindow storage window_,\n        uint256 cap_\n    ) internal view returns (uint256 unspent) {\n        unspent = cap_.saturatingSub(_windowSpent(window_));\n    }\n\n    /**\n     * @notice Reserve accrued since it last restarted.\n     * @dev    Zero until the next day begins, then one daily rate at the start of that day and one\n     *         more at the start of each day after.\n     * @return Reserve accrued in USD.\n     */\n    function _reserveCurrentUSD() internal view returns (uint256) {\n        if (block.timestamp < reserveAnchorTS) {\n            return 0;\n        }\n\n        uint256 daysSinceAnchor = (block.timestamp - reserveAnchorTS) / ONE_DAY;\n        uint256 reserveDaysCharged = daysSinceAnchor + 1; // Anchor day plus each full day since.\n        return uint256(reserveDailyRateUSD) * reserveDaysCharged;\n    }\n\n    /**\n     * @notice Sums revenue across all sources. Reverts if any cannot be reached.\n     * @dev    Sources are trusted, so a source that cannot be reached makes the read revert rather\n     *         than count as zero.\n     * @return revenueSumUSD Total revenue across all sources in USD.\n     */\n    function _revenueSumUSD() internal view returns (uint256 revenueSumUSD) {\n        address[] memory sources = _revenueSources.values();\n        for (uint256 i; i < sources.length; ++i) {\n            revenueSumUSD += IRevenueSource(sources[i]).getCumulativeRevenueUSD();\n        }\n    }\n\n    /**\n     * @notice Reads the stETH price in USD from the oracle.\n     * @dev    Returns zero if the oracle reverts, which a release treats as no quote.\n     * @return stEthPriceUSD stETH price in USD, or zero when unavailable.\n     */\n    function _getStEthPriceUSD() internal view returns (uint256 stEthPriceUSD) {\n        try ORACLE_ROUTER.getUsdPrices(address(STETH), address(STETH)) returns (\n            uint256 stEthPrice,\n            uint256\n        ) {\n            stEthPriceUSD = stEthPrice;\n        } catch {}\n    }\n\n    /**\n     * @notice Rounds the current block down to midnight UTC.\n     * @return Midnight UTC of the current day.\n     */\n    function _todayStartTS() internal view returns (uint256) {\n        return (block.timestamp / ONE_DAY) * ONE_DAY;\n    }\n\n    /**\n     * @notice Midnight UTC at the start of the day after the current block.\n     * @return Midnight UTC of the next day.\n     */\n    function _nextDayStartTS() internal view returns (uint256) {\n        return _todayStartTS() + ONE_DAY;\n    }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106102695760003560e01c806391d1485411610151578063d9c2d09a116100c3578063ee6d8e4111610087578063ee6d8e4114610602578063ee8ebbc314610615578063f14e3fcc1461062a578063f4ea93d81461063d578063f71b1b9c14610646578063fd8794fc1461064f57600080fd5b8063d9c2d09a14610577578063e00bfe501461058a578063e4c721f1146105b1578063e6f124c2146105c4578063ec87621c146105db57600080fd5b8063a715187111610115578063a7151871146104fd578063abaa991614610523578063c1f755b81461052b578063c34c08e51461053e578063ca15c87314610551578063d547741f1461056457600080fd5b806391d148541461048e57806391fcfd19146104a15780639e0f6bd6146104bb5780639ff3df39146104ce578063a217fddf146104f557600080fd5b80635352de64116101ea5780637f7c07f7116101ae5780637f7c07f71461040757806382621b471461042f57806385967736146104425780638980f11f146104555780638e25eb66146104685780639010d07c1461047b57600080fd5b80635352de64146103a857806360c02ae6146103b057806367a8215f146103b95780636d6f6bc2146103cc5780636f8ba4a2146103d557600080fd5b80632d2c5565116102315780632d2c5565146102ed5780632f2ff15d1461032c57806336568abe1461033f5780634528c6991461035257806352d8bfc2146103a057600080fd5b806301ffc9a71461026e57806304981b8c146102965780630f15f4c0146102ad5780631c3c0ea8146102b7578063248a9ca3146102ca575b600080fd5b61028161027c3660046126aa565b610662565b60405190151581526020015b60405180910390f35b61029f600a5481565b60405190815260200161028d565b6102b561068d565b005b6102b56102c53660046126f0565b61076f565b61029f6102d836600461270b565b60009081526020819052604090206001015490565b6103147f0000000000000000000000003e40d73eb977dc6a537af587d48316fee66e9c8c81565b6040516001600160a01b03909116815260200161028d565b6102b561033a366004612724565b610787565b6102b561034d366004612724565b6107b1565b600b546103789067ffffffffffffffff811690600160401b90046001600160c01b031682565b6040805167ffffffffffffffff90931683526001600160c01b0390911660208301520161028d565b6102b5610830565b61029f603281565b61029f60075481565b6102b56103c73660046126f0565b6108d8565b61029f60085481565b6004546103ef90600160801b90046001600160801b031681565b6040516001600160801b03909116815260200161028d565b60055461041c90600160801b900461ffff1681565b60405161ffff909116815260200161028d565b6102b561043d36600461270b565b610917565b6102b561045036600461270b565b61095e565b6102b5610463366004612750565b6109a5565b6004546103ef906001600160801b031681565b61031461048936600461277a565b610a59565b61028161049c366004612724565b610a78565b6003546103ef90600160801b90046001600160801b031681565b6102b56104c936600461270b565b610aa1565b6103147f00000000000000000000000079ef3a538200fe4981d67e7e886bfb36d4cb5a3181565b61029f600081565b600c546103789067ffffffffffffffff811690600160401b90046001600160c01b031682565b6102b5610abd565b6102b561053936600461270b565b610ca9565b600654610314906001600160a01b031681565b61029f61055f36600461270b565b610cc5565b6102b5610572366004612724565b610cdc565b6102b561058536600461270b565b610d01565b6103147f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b6003546103ef906001600160801b031681565b6105cc610d1d565b60405161028d939291906127d4565b61029f7f24bec1f1283f989ed510b4d89bc7ef5002f20db1b60c1b3192336791c868543e81565b6102b561061036600461270b565b610d7d565b61061d610d99565b60405161028d91906127f3565b6102b56106383660046126f0565b610daa565b61029f61271081565b61029f60095481565b6005546103ef906001600160801b031681565b60006001600160e01b03198216635a05180f60e01b1480610687575061068782610de9565b92915050565b600061069881610e1e565b600754156106b95760405163ef65161f60e01b815260040160405180910390fd5b60006106c3610e2b565b600781905590506106d2610e45565b600855600a8190556040518181527f8dbfe4300b2898be3cdca7abca8a5de1f3da211f3db9f9879f82b295a9543fe29060200160405180910390a161071d600b620151806000610ef4565b61072e600c6301e133806000610ef4565b6008546040805183815260208101929092527f4867887a5b0bebacccb6e4c9c656b3a6b2fe478e226ea1fa5230d9b4bdabc26e910160405180910390a15050565b600061077a81610e1e565b61078382610ff8565b5050565b6000828152602081905260409020600101546107a281610e1e565b6107ac8383611069565b505050565b6001600160a01b03811633146108265760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610783828261108b565b6108386110ad565b7f24bec1f1283f989ed510b4d89bc7ef5002f20db1b60c1b3192336791c868543e61086281610e1e565b60405147808252907fded9e5219cc8afc37a129b46dc375a8d1bfc8571d6ba63b3366509b687c234199060200160405180910390a16108ca6001600160a01b037f0000000000000000000000003e40d73eb977dc6a537af587d48316fee66e9c8c1682611104565b50506108d66001600255565b565b60006108e381610e1e565b6007546000036109065760405163037c597f60e01b815260040160405180910390fd5b61090e61121d565b610783826112dc565b600061092281610e1e565b6007546000036109455760405163037c597f60e01b815260040160405180910390fd5b61094d61121d565b61078361095983611440565b6114ad565b600061096981610e1e565b60075460000361098c5760405163037c597f60e01b815260040160405180910390fd5b61099461121d565b6107836109a083611502565b611565565b6109ad6110ad565b7f24bec1f1283f989ed510b4d89bc7ef5002f20db1b60c1b3192336791c868543e6109d781610e1e565b826001600160a01b03167f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799983604051610a1291815260200190565b60405180910390a2610a4e6001600160a01b0384167f0000000000000000000000003e40d73eb977dc6a537af587d48316fee66e9c8c846115e9565b506107836001600255565b6000828152600160205260408120610a71908361163b565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610aac81610e1e565b610783610ab883611440565b611647565b610ac56110ad565b600754600003610ae85760405163037c597f60e01b815260040160405180910390fd5b610af061121d565b6000610afd6009546116ef565b90506000806000610b0d846116ff565b919450925090506000836005811115610b2857610b2861279c565b14610b7757336001600160a01b03167f8b3528ced1aae669d757c3d31d4c989ff8610e078f104dc31c21d55be3cdd21084604051610b669190612840565b60405180910390a250505050610c9f565b8160096000828254610b899190612864565b90915550610b9f9050600c6301e1338084610ef4565b610bae600b6201518084610ef4565b600654610be8906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8481169116836115e9565b60065460408051848152602081018490526001600160a01b039092169133917f9781da678ddc7489bd088c5dae768340264a3f5b39b5e30043859b3d81111dec910160405180910390a3600660009054906101000a90046001600160a01b03166001600160a01b0316636bc5cd586040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610c8257600080fd5b505af1158015610c96573d6000803e3d6000fd5b50505050505050505b6108d66001600255565b6000610cb481610e1e565b610783610cc083611440565b6118f1565b600081815260016020526040812061068790611998565b600082815260208190526040902060010154610cf781610e1e565b6107ac838361108b565b6000610d0c81610e1e565b610783610d1883611440565b6119a2565b6000806000600754600003610d455760405163037c597f60e01b815260040160405180910390fd5b6000610d4f611a80565b50509050610d71610d6c82600954610d679190612884565b6116ef565b6116ff565b93509350935050909192565b6000610d8881610e1e565b610783610d9483611440565b611ae5565b6060610da5600d611b33565b905090565b6000610db581610e1e565b600754600003610dd85760405163037c597f60e01b815260040160405180910390fd5b610de061121d565b61078382611b40565b60006001600160e01b03198216637965db0b60e01b148061068757506301ffc9a760e01b6001600160e01b0319831614610687565b610e288133611c17565b50565b600062015180610e3b81426128c2565b610da591906128d6565b600080610e52600d611b33565b905060005b8151811015610eef57818181518110610e7257610e726128ed565b60200260200101516001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edb9190612903565b610ee5908461291c565b9250600101610e57565b505090565b82546001600160c01b03600160401b8204169067ffffffffffffffff164210610fc5576000838460075442610f29919061292f565b610f3391906128c2565b610f3e90600161291c565b610f4891906128d6565b600754610f55919061291c565b855467ffffffffffffffff191667ffffffffffffffff821690811787556040805187815260208101929092526001600160c01b038516908201529091507fe1274c8125aa46c7e28acbaf69d5bb7d2f27cf271fbc2fe53d286438ac6401419060600160405180910390a160009150505b610fcf8282612942565b84546001600160c01b0391909116600160401b0267ffffffffffffffff90911617909355505050565b6001600160a01b03811661101f5760405163d25b777560e01b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0383169081179091556040517f3e3c5e6d5b512eaa5d5a80669846cfbaf8bde70fc6f7a3be9828cffc9ba5f1db90600090a250565b6110738282611c70565b60008281526001602052604090206107ac9082611cf4565b6110958282611d09565b60008281526001602052604090206107ac9082611d6e565b60028054036110fe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161081d565b60028055565b804710156111545760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161081d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146111a1576040519150601f19603f3d011682016040523d82523d6000602084013e6111a6565b606091505b50509050806107ac5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161081d565b600080600061122a611a80565b92509250925082600960008282546112429190612884565b90915550506008829055611254611d83565b600a8190556040519081527f8dbfe4300b2898be3cdca7abca8a5de1f3da211f3db9f9879f82b295a9543fe29060200160405180910390a16008546009546040805192835260208301849052820185905260608201527f6aed3122eacb18006e771c73e321b4d07634867508779fa2239ababd0449ff199060800160405180910390a1505050565b6001600160a01b0381166113035760405163952498af60e01b815260040160405180910390fd5b611314816387c9243760e01b611d9b565b61133c57604051637c81971f60e11b81526001600160a01b038216600482015260240161081d565b6032611348600d611998565b1061136957604051633d42ca0760e21b81526032600482015260240161081d565b611374600d82611cf4565b61139157604051633b506d6360e11b815260040160405180910390fd5b806001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f39190612903565b60086000828254611404919061291c565b90915550506040516001600160a01b038216907f550499f95ca70ebc5c46b6a2b824d2e5cd7baeea5f3d9d42654bbfd8a0162db490600090a250565b60006001600160801b038211156114a95760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b606482015260840161081d565b5090565b600480546001600160801b0319166001600160801b0383169081179091556040519081527f592e5e4661ee4bc1f45851d6704bffb43068d15c675260c8bfca36a1ec85de99906020015b60405180910390a150565b600061ffff8211156114a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b606482015260840161081d565b61ffff8116158061157b57506127108161ffff16115b1561159957604051631450983360e21b815260040160405180910390fd5b6005805461ffff60801b1916600160801b61ffff8416908102919091179091556040519081527f5b3ab0c9f88fadb8a042a844307cfa8da21e1ae6329ec74c0c68dea627358ba1906020016114f7565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107ac908490611db7565b6000610a718383611e8c565b806001600160801b031660000361167157604051633aef258960e11b815260040160405180910390fd5b6003546001600160801b0390811690821611156116a157604051630ca94cbd60e31b815260040160405180910390fd5b600580546001600160801b0319166001600160801b0383169081179091556040519081527fb5547f889af8a66abd76764376d6e36b3f4b2dacc67228dae9dc23f772a7401c906020016114f7565b60008082136114a9576000610687565b60008060008360000361171b57506001915060009050806118ea565b6000611725611eb6565b905080600003611740576002600080935093509350506118ea565b600454600160801b90046001600160801b031681101561176b576003600080935093509350506118ea565b60035485935061179890849061179390600c90600160801b90046001600160801b0316611f6f565b611f87565b6003549093506117b990849061179390600b906001600160801b0316611f6f565b9250826000036117d4576005600080935093509350506118ea565b6117ff837f0000000000000000000000000000000000000000000000000de0b6b3a764000083611f9d565b6040516370a0823160e01b81523060048201529092506118909083906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a0823190602401602060405180830381865afa15801561186c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117939190612903565b91506118bd82827f0000000000000000000000000000000000000000000000000de0b6b3a7640000611f9d565b6005549093506001600160801b03168310156118e4576004600080935093509350506118ea565b60009350505b9193909250565b806001600160801b031660000361191b57604051634fc4f35760e01b815260040160405180910390fd5b6003546001600160801b038083169116111561194a5760405163057e005760e51b815260040160405180910390fd5b600380546001600160801b03908116600160801b918416918202179091556040519081527fdf6aa745a4aa67f53247f4ce1f93720b9acd076801da0f2855f644a7725b45bd906020016114f7565b6000610687825490565b806001600160801b03166000036119cc5760405163fdf0eb1f60e01b815260040160405180910390fd5b6003546001600160801b03600160801b90910481169082161115611a035760405163057e005760e51b815260040160405180910390fd5b6005546001600160801b0380831691161115611a3257604051630ca94cbd60e31b815260040160405180910390fd5b600380546001600160801b0319166001600160801b0383169081179091556040519081527fd65e48ae060eef39d401655d992e870dc03d5171192ad72d327686c263599e68906020016114f7565b6000806000611a8d610e45565b9150611a97612086565b905060008160085484611aaa9190612864565b611ab49190612864565b60055490915061271090611ad390600160801b900461ffff1683612962565b611add9190612992565b935050909192565b600480546001600160801b03908116600160801b918416918202179091556040519081527fcd060dcb47767ebd8697147a1ddbb57ccbc7095f1010240d5a4bdd10fcc5737a906020016114f7565b60606000610a71836120e6565b611b4b600d82611d6e565b611b685760405163335b87d960e11b815260040160405180910390fd5b806001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ba6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bca9190612903565b60086000828254611bdb919061292f565b90915550506040516001600160a01b038216907f021e849b46acadcb7e1f3a23baf2e1ec65ff20b673233504daacdd5a94cd7d2d90600090a250565b611c218282610a78565b61078357611c2e81612142565b611c39836020612154565b604051602001611c4a9291906129e4565b60408051601f198184030181529082905262461bcd60e51b825261081d91600401612a59565b611c7a8282610a78565b610783576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611cb03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610a71836001600160a01b0384166122f0565b611d138282610a78565b15610783576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610a71836001600160a01b03841661233f565b600062015180611d91610e2b565b610da5919061291c565b6000611da683612439565b8015610a715750610a71838361246c565b6000611e0c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124f59092919063ffffffff16565b9050805160001480611e2d575080806020019051810190611e2d9190612a8c565b6107ac5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161081d565b6000826000018281548110611ea357611ea36128ed565b9060005260206000200154905092915050565b60405163232bf5bf60e01b81526001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8481166004830181905260248301526000917f00000000000000000000000079ef3a538200fe4981d67e7e886bfb36d4cb5a319091169063232bf5bf906044016040805180830381865afa925050508015611f63575060408051601f3d908101601f19168201909252611f6091810190612aae565b60015b15611f6c575090505b90565b6000610a71611f7d8461250c565b8303838111150290565b6000818310611f965781610a71565b5090919050565b6000808060001985870985870292508281108382030391505080600003611fd757838281611fcd57611fcd6128ac565b0492505050610a71565b80841161201e5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b604482015260640161081d565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000600a544210156120985750600090565b600062015180600a54426120ac919061292f565b6120b691906128c2565b905060006120c582600161291c565b6004549091506120df9082906001600160801b03166128d6565b9250505090565b60608160000180548060200260200160405190810160405280929190818152602001828054801561213657602002820191906000526020600020905b815481526020019060010190808311612122575b50505050509050919050565b60606106876001600160a01b03831660145b606060006121638360026128d6565b61216e90600261291c565b67ffffffffffffffff81111561218657612186612ad2565b6040519080825280601f01601f1916602001820160405280156121b0576020820181803683370190505b509050600360fc1b816000815181106121cb576121cb6128ed565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106121fa576121fa6128ed565b60200101906001600160f81b031916908160001a905350600061221e8460026128d6565b61222990600161291c565b90505b60018111156122a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061225d5761225d6128ed565b1a60f81b828281518110612273576122736128ed565b60200101906001600160f81b031916908160001a90535060049490941c9361229a81612ae8565b905061222c565b508315610a715760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161081d565b600081815260018301602052604081205461233757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610687565b506000610687565b6000818152600183016020526040812054801561242857600061236360018361292f565b85549091506000906123779060019061292f565b90508181146123dc576000866000018281548110612397576123976128ed565b90600052602060002001549050808760000184815481106123ba576123ba6128ed565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806123ed576123ed612aff565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610687565b6000915050610687565b5092915050565b600061244c826301ffc9a760e01b61246c565b80156106875750612465826001600160e01b031961246c565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d915060005190508280156124de575060208210155b80156124ea5750600081115b979650505050505050565b60606125048484600085612541565b949350505050565b805460009067ffffffffffffffff16421015612539578154600160401b90046001600160c01b0316610687565b600092915050565b6060824710156125a25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161081d565b600080866001600160a01b031685876040516125be9190612b15565b60006040518083038185875af1925050503d80600081146125fb576040519150601f19603f3d011682016040523d82523d6000602084013e612600565b606091505b50915091506124ea878383876060831561267b578251600003612674576001600160a01b0385163b6126745760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161081d565b5081612504565b61250483838151156126905781518083602001fd5b8060405162461bcd60e51b815260040161081d9190612a59565b6000602082840312156126bc57600080fd5b81356001600160e01b031981168114610a7157600080fd5b80356001600160a01b03811681146126eb57600080fd5b919050565b60006020828403121561270257600080fd5b610a71826126d4565b60006020828403121561271d57600080fd5b5035919050565b6000806040838503121561273757600080fd5b82359150612747602084016126d4565b90509250929050565b6000806040838503121561276357600080fd5b61276c836126d4565b946020939093013593505050565b6000806040838503121561278d57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600681106127d057634e487b7160e01b600052602160045260246000fd5b9052565b606081016127e282866127b2565b602082019390935260400152919050565b6020808252825182820181905260009190848201906040850190845b818110156128345783516001600160a01b03168352928401929184019160010161280f565b50909695505050505050565b6020810161068782846127b2565b634e487b7160e01b600052601160045260246000fd5b81810360008312801583831316838312821617156124325761243261284e565b80820182811260008312801582168215821617156128a4576128a461284e565b505092915050565b634e487b7160e01b600052601260045260246000fd5b6000826128d1576128d16128ac565b500490565b80820281158282048414176106875761068761284e565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561291557600080fd5b5051919050565b808201808211156106875761068761284e565b818103818111156106875761068761284e565b6001600160c01b038181168382160190808211156124325761243261284e565b80820260008212600160ff1b8414161561297e5761297e61284e565b81810583148215176106875761068761284e565b6000826129a1576129a16128ac565b600160ff1b8214600019841416156129bb576129bb61284e565b500590565b60005b838110156129db5781810151838201526020016129c3565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a1c8160178501602088016129c0565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a4d8160288401602088016129c0565b01602801949350505050565b6020815260008251806020840152612a788160408501602087016129c0565b601f01601f19169190910160400192915050565b600060208284031215612a9e57600080fd5b81518015158114610a7157600080fd5b60008060408385031215612ac157600080fd5b505080516020909101519092909150565b634e487b7160e01b600052604160045260246000fd5b600081612af757612af761284e565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251612b278184602087016129c0565b919091019291505056fea26469706673582212205574090ba85923b21bb477c27bbc4682dcb230623c851c6f710ab89ee6f7491464736f6c63430008170033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"paris","libraries":{},"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}}},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":[[["0x2e59A20f205bB85a89C53f1936454680651E618e","0x3e40D73EB977Dc6a537aF587D48316feE66E9C8c","0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84","0x79ef3a538200Fe4981D67E7e886bfb36D4Cb5a31","0x6c213ca5A10Cc26548C742229569B4AeD2A9C9B7","50000000000000000000000","10000000000000000000000000","109589000000000000000000","0","1000000000000000000000","5000",["0x6220212a33a87Ed7Cc386B67eB2c393974F28C38"]],{"components":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"stEth","type":"address"},{"internalType":"address","name":"oracleRouter","type":"address"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint128","name":"dailyCapUSD","type":"uint128"},{"internalType":"uint128","name":"yearlyCapUSD","type":"uint128"},{"internalType":"uint128","name":"reserveDailyRateUSD","type":"uint128"},{"internalType":"uint128","name":"minStEthPriceUSD","type":"uint128"},{"internalType":"uint128","name":"minSpendPerCallUSD","type":"uint128"},{"internalType":"uint16","name":"surplusShareBP","type":"uint16"},{"internalType":"address[]","name":"revenueSources","type":"address[]"}],"internalType":"struct BuybackAllocator.ConstructorParams","name":"initParams_","type":"tuple"}]],"compiler_version":"v0.8.23+commit.f704f362","is_verified_via_verifier_alliance":false,"verified_at":"2026-07-28T16:04:22.813597Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x6101006040523480156200001257600080fd5b506040516200386738038062003867833981016040819052620000359162000af6565b8051602082015160016002556001600160a01b038216620000695760405163016ed19f60e21b815260040160405180910390fd5b6001600160a01b038116620000915760405163cfe2ea6360e01b815260040160405180910390fd5b6001600160a01b038116608052620000ab6000836200024d565b505060408101516001600160a01b0316620000d957604051633102e4df60e21b815260040160405180910390fd5b60608101516001600160a01b03166200010557604051637ed962f960e11b815260040160405180910390fd5b6040808201516001600160a01b0390811660a05260608301511660c08190528151631da86bcb60e31b81529151909163ed435e589160048083019260209291908290030181865afa1580156200015f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000185919062000c43565b60e0526080810151620001989062000278565b60c0810151620001a890620002ea565b60a0810151620001b8906200039a565b610120810151620001c9906200047c565b610140810151620001da9062000527565b610100810151620001eb90620005ae565b60e0810151620001fb90620005fd565b61016081015160005b815181101562000244576200023b82828151811062000227576200022762000c5d565b60200260200101516200064c60201b60201c565b60010162000204565b50505062000c95565b620002598282620007c5565b600082815260016020526040902062000273908262000866565b505050565b6001600160a01b038116620002a05760405163d25b777560e01b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0383169081179091556040517f3e3c5e6d5b512eaa5d5a80669846cfbaf8bde70fc6f7a3be9828cffc9ba5f1db90600090a250565b806001600160801b03166000036200031557604051634fc4f35760e01b815260040160405180910390fd5b6003546001600160801b0380831691161115620003455760405163057e005760e51b815260040160405180910390fd5b600380546001600160801b03908116600160801b918416918202179091556040519081527fdf6aa745a4aa67f53247f4ce1f93720b9acd076801da0f2855f644a7725b45bd906020015b60405180910390a150565b806001600160801b0316600003620003c55760405163fdf0eb1f60e01b815260040160405180910390fd5b6003546001600160801b03600160801b90910481169082161115620003fd5760405163057e005760e51b815260040160405180910390fd5b6005546001600160801b03808316911611156200042d57604051630ca94cbd60e31b815260040160405180910390fd5b600380546001600160801b0319166001600160801b0383169081179091556040519081527fd65e48ae060eef39d401655d992e870dc03d5171192ad72d327686c263599e68906020016200038f565b806001600160801b0316600003620004a757604051633aef258960e11b815260040160405180910390fd5b6003546001600160801b039081169082161115620004d857604051630ca94cbd60e31b815260040160405180910390fd5b600580546001600160801b0319166001600160801b0383169081179091556040519081527fb5547f889af8a66abd76764376d6e36b3f4b2dacc67228dae9dc23f772a7401c906020016200038f565b61ffff811615806200053e57506127108161ffff16115b156200055d57604051631450983360e21b815260040160405180910390fd5b6005805461ffff60801b1916600160801b61ffff8416908102919091179091556040519081527f5b3ab0c9f88fadb8a042a844307cfa8da21e1ae6329ec74c0c68dea627358ba1906020016200038f565b600480546001600160801b03908116600160801b918416918202179091556040519081527fcd060dcb47767ebd8697147a1ddbb57ccbc7095f1010240d5a4bdd10fcc5737a906020016200038f565b600480546001600160801b0319166001600160801b0383169081179091556040519081527f592e5e4661ee4bc1f45851d6704bffb43068d15c675260c8bfca36a1ec85de99906020016200038f565b6001600160a01b038116620006745760405163952498af60e01b815260040160405180910390fd5b62000687816387c9243760e01b62000886565b620006b557604051637c81971f60e11b81526001600160a01b03821660048201526024015b60405180910390fd5b6032620006c3600d620008a7565b10620006e657604051633d42ca0760e21b815260326004820152602401620006ac565b620006f3600d8262000866565b6200071157604051633b506d6360e11b815260040160405180910390fd5b806001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000750573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000776919062000c43565b6008600082825462000789919062000c73565b90915550506040516001600160a01b038216907f550499f95ca70ebc5c46b6a2b824d2e5cd7baeea5f3d9d42654bbfd8a0162db490600090a250565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000862576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620008213390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60006200087d836001600160a01b038416620008b2565b90505b92915050565b6000620008938362000904565b80156200087d57506200087d83836200093c565b600062000880825490565b6000818152600183016020526040812054620008fb5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000880565b50600062000880565b600062000919826301ffc9a760e01b6200093c565b801562000880575062000935826001600160e01b03196200093c565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d91506000519050828015620009af575060208210155b8015620009bc5750600081115b979650505050505050565b634e487b7160e01b600052604160045260246000fd5b60405161018081016001600160401b038111828210171562000a035762000a03620009c7565b60405290565b80516001600160a01b038116811462000a2157600080fd5b919050565b80516001600160801b038116811462000a2157600080fd5b805161ffff8116811462000a2157600080fd5b600082601f83011262000a6357600080fd5b815160206001600160401b038083111562000a825762000a82620009c7565b8260051b604051601f19603f8301168101818110848211171562000aaa5762000aaa620009c7565b604052938452602081870181019490810192508785111562000acb57600080fd5b6020870191505b84821015620009bc5762000ae68262000a09565b8352918301919083019062000ad2565b60006020828403121562000b0957600080fd5b81516001600160401b038082111562000b2157600080fd5b90830190610180828603121562000b3757600080fd5b62000b41620009dd565b62000b4c8362000a09565b815262000b5c6020840162000a09565b602082015262000b6f6040840162000a09565b604082015262000b826060840162000a09565b606082015262000b956080840162000a09565b608082015262000ba860a0840162000a26565b60a082015262000bbb60c0840162000a26565b60c082015262000bce60e0840162000a26565b60e082015261010062000be381850162000a26565b9082015261012062000bf784820162000a26565b9082015261014062000c0b84820162000a3e565b90820152610160838101518381111562000c2457600080fd5b62000c328882870162000a51565b918301919091525095945050505050565b60006020828403121562000c5657600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b808201808211156200088057634e487b7160e01b600052601160045260246000fd5b60805160a05160c05160e051612b6762000d00600039600081816117da01526118990152600081816104d30152611eff01526000818161058f01528181610bbf015281816118250152611ecd0152600081816102f2015281816108a40152610a290152612b676000f3fe608060405234801561001057600080fd5b50600436106102695760003560e01c806391d1485411610151578063d9c2d09a116100c3578063ee6d8e4111610087578063ee6d8e4114610602578063ee8ebbc314610615578063f14e3fcc1461062a578063f4ea93d81461063d578063f71b1b9c14610646578063fd8794fc1461064f57600080fd5b8063d9c2d09a14610577578063e00bfe501461058a578063e4c721f1146105b1578063e6f124c2146105c4578063ec87621c146105db57600080fd5b8063a715187111610115578063a7151871146104fd578063abaa991614610523578063c1f755b81461052b578063c34c08e51461053e578063ca15c87314610551578063d547741f1461056457600080fd5b806391d148541461048e57806391fcfd19146104a15780639e0f6bd6146104bb5780639ff3df39146104ce578063a217fddf146104f557600080fd5b80635352de64116101ea5780637f7c07f7116101ae5780637f7c07f71461040757806382621b471461042f57806385967736146104425780638980f11f146104555780638e25eb66146104685780639010d07c1461047b57600080fd5b80635352de64146103a857806360c02ae6146103b057806367a8215f146103b95780636d6f6bc2146103cc5780636f8ba4a2146103d557600080fd5b80632d2c5565116102315780632d2c5565146102ed5780632f2ff15d1461032c57806336568abe1461033f5780634528c6991461035257806352d8bfc2146103a057600080fd5b806301ffc9a71461026e57806304981b8c146102965780630f15f4c0146102ad5780631c3c0ea8146102b7578063248a9ca3146102ca575b600080fd5b61028161027c3660046126aa565b610662565b60405190151581526020015b60405180910390f35b61029f600a5481565b60405190815260200161028d565b6102b561068d565b005b6102b56102c53660046126f0565b61076f565b61029f6102d836600461270b565b60009081526020819052604090206001015490565b6103147f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161028d565b6102b561033a366004612724565b610787565b6102b561034d366004612724565b6107b1565b600b546103789067ffffffffffffffff811690600160401b90046001600160c01b031682565b6040805167ffffffffffffffff90931683526001600160c01b0390911660208301520161028d565b6102b5610830565b61029f603281565b61029f60075481565b6102b56103c73660046126f0565b6108d8565b61029f60085481565b6004546103ef90600160801b90046001600160801b031681565b6040516001600160801b03909116815260200161028d565b60055461041c90600160801b900461ffff1681565b60405161ffff909116815260200161028d565b6102b561043d36600461270b565b610917565b6102b561045036600461270b565b61095e565b6102b5610463366004612750565b6109a5565b6004546103ef906001600160801b031681565b61031461048936600461277a565b610a59565b61028161049c366004612724565b610a78565b6003546103ef90600160801b90046001600160801b031681565b6102b56104c936600461270b565b610aa1565b6103147f000000000000000000000000000000000000000000000000000000000000000081565b61029f600081565b600c546103789067ffffffffffffffff811690600160401b90046001600160c01b031682565b6102b5610abd565b6102b561053936600461270b565b610ca9565b600654610314906001600160a01b031681565b61029f61055f36600461270b565b610cc5565b6102b5610572366004612724565b610cdc565b6102b561058536600461270b565b610d01565b6103147f000000000000000000000000000000000000000000000000000000000000000081565b6003546103ef906001600160801b031681565b6105cc610d1d565b60405161028d939291906127d4565b61029f7f24bec1f1283f989ed510b4d89bc7ef5002f20db1b60c1b3192336791c868543e81565b6102b561061036600461270b565b610d7d565b61061d610d99565b60405161028d91906127f3565b6102b56106383660046126f0565b610daa565b61029f61271081565b61029f60095481565b6005546103ef906001600160801b031681565b60006001600160e01b03198216635a05180f60e01b1480610687575061068782610de9565b92915050565b600061069881610e1e565b600754156106b95760405163ef65161f60e01b815260040160405180910390fd5b60006106c3610e2b565b600781905590506106d2610e45565b600855600a8190556040518181527f8dbfe4300b2898be3cdca7abca8a5de1f3da211f3db9f9879f82b295a9543fe29060200160405180910390a161071d600b620151806000610ef4565b61072e600c6301e133806000610ef4565b6008546040805183815260208101929092527f4867887a5b0bebacccb6e4c9c656b3a6b2fe478e226ea1fa5230d9b4bdabc26e910160405180910390a15050565b600061077a81610e1e565b61078382610ff8565b5050565b6000828152602081905260409020600101546107a281610e1e565b6107ac8383611069565b505050565b6001600160a01b03811633146108265760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610783828261108b565b6108386110ad565b7f24bec1f1283f989ed510b4d89bc7ef5002f20db1b60c1b3192336791c868543e61086281610e1e565b60405147808252907fded9e5219cc8afc37a129b46dc375a8d1bfc8571d6ba63b3366509b687c234199060200160405180910390a16108ca6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001682611104565b50506108d66001600255565b565b60006108e381610e1e565b6007546000036109065760405163037c597f60e01b815260040160405180910390fd5b61090e61121d565b610783826112dc565b600061092281610e1e565b6007546000036109455760405163037c597f60e01b815260040160405180910390fd5b61094d61121d565b61078361095983611440565b6114ad565b600061096981610e1e565b60075460000361098c5760405163037c597f60e01b815260040160405180910390fd5b61099461121d565b6107836109a083611502565b611565565b6109ad6110ad565b7f24bec1f1283f989ed510b4d89bc7ef5002f20db1b60c1b3192336791c868543e6109d781610e1e565b826001600160a01b03167f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799983604051610a1291815260200190565b60405180910390a2610a4e6001600160a01b0384167f0000000000000000000000000000000000000000000000000000000000000000846115e9565b506107836001600255565b6000828152600160205260408120610a71908361163b565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610aac81610e1e565b610783610ab883611440565b611647565b610ac56110ad565b600754600003610ae85760405163037c597f60e01b815260040160405180910390fd5b610af061121d565b6000610afd6009546116ef565b90506000806000610b0d846116ff565b919450925090506000836005811115610b2857610b2861279c565b14610b7757336001600160a01b03167f8b3528ced1aae669d757c3d31d4c989ff8610e078f104dc31c21d55be3cdd21084604051610b669190612840565b60405180910390a250505050610c9f565b8160096000828254610b899190612864565b90915550610b9f9050600c6301e1338084610ef4565b610bae600b6201518084610ef4565b600654610be8906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169116836115e9565b60065460408051848152602081018490526001600160a01b039092169133917f9781da678ddc7489bd088c5dae768340264a3f5b39b5e30043859b3d81111dec910160405180910390a3600660009054906101000a90046001600160a01b03166001600160a01b0316636bc5cd586040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610c8257600080fd5b505af1158015610c96573d6000803e3d6000fd5b50505050505050505b6108d66001600255565b6000610cb481610e1e565b610783610cc083611440565b6118f1565b600081815260016020526040812061068790611998565b600082815260208190526040902060010154610cf781610e1e565b6107ac838361108b565b6000610d0c81610e1e565b610783610d1883611440565b6119a2565b6000806000600754600003610d455760405163037c597f60e01b815260040160405180910390fd5b6000610d4f611a80565b50509050610d71610d6c82600954610d679190612884565b6116ef565b6116ff565b93509350935050909192565b6000610d8881610e1e565b610783610d9483611440565b611ae5565b6060610da5600d611b33565b905090565b6000610db581610e1e565b600754600003610dd85760405163037c597f60e01b815260040160405180910390fd5b610de061121d565b61078382611b40565b60006001600160e01b03198216637965db0b60e01b148061068757506301ffc9a760e01b6001600160e01b0319831614610687565b610e288133611c17565b50565b600062015180610e3b81426128c2565b610da591906128d6565b600080610e52600d611b33565b905060005b8151811015610eef57818181518110610e7257610e726128ed565b60200260200101516001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edb9190612903565b610ee5908461291c565b9250600101610e57565b505090565b82546001600160c01b03600160401b8204169067ffffffffffffffff164210610fc5576000838460075442610f29919061292f565b610f3391906128c2565b610f3e90600161291c565b610f4891906128d6565b600754610f55919061291c565b855467ffffffffffffffff191667ffffffffffffffff821690811787556040805187815260208101929092526001600160c01b038516908201529091507fe1274c8125aa46c7e28acbaf69d5bb7d2f27cf271fbc2fe53d286438ac6401419060600160405180910390a160009150505b610fcf8282612942565b84546001600160c01b0391909116600160401b0267ffffffffffffffff90911617909355505050565b6001600160a01b03811661101f5760405163d25b777560e01b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0383169081179091556040517f3e3c5e6d5b512eaa5d5a80669846cfbaf8bde70fc6f7a3be9828cffc9ba5f1db90600090a250565b6110738282611c70565b60008281526001602052604090206107ac9082611cf4565b6110958282611d09565b60008281526001602052604090206107ac9082611d6e565b60028054036110fe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161081d565b60028055565b804710156111545760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161081d565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146111a1576040519150601f19603f3d011682016040523d82523d6000602084013e6111a6565b606091505b50509050806107ac5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161081d565b600080600061122a611a80565b92509250925082600960008282546112429190612884565b90915550506008829055611254611d83565b600a8190556040519081527f8dbfe4300b2898be3cdca7abca8a5de1f3da211f3db9f9879f82b295a9543fe29060200160405180910390a16008546009546040805192835260208301849052820185905260608201527f6aed3122eacb18006e771c73e321b4d07634867508779fa2239ababd0449ff199060800160405180910390a1505050565b6001600160a01b0381166113035760405163952498af60e01b815260040160405180910390fd5b611314816387c9243760e01b611d9b565b61133c57604051637c81971f60e11b81526001600160a01b038216600482015260240161081d565b6032611348600d611998565b1061136957604051633d42ca0760e21b81526032600482015260240161081d565b611374600d82611cf4565b61139157604051633b506d6360e11b815260040160405180910390fd5b806001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f39190612903565b60086000828254611404919061291c565b90915550506040516001600160a01b038216907f550499f95ca70ebc5c46b6a2b824d2e5cd7baeea5f3d9d42654bbfd8a0162db490600090a250565b60006001600160801b038211156114a95760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b606482015260840161081d565b5090565b600480546001600160801b0319166001600160801b0383169081179091556040519081527f592e5e4661ee4bc1f45851d6704bffb43068d15c675260c8bfca36a1ec85de99906020015b60405180910390a150565b600061ffff8211156114a95760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b606482015260840161081d565b61ffff8116158061157b57506127108161ffff16115b1561159957604051631450983360e21b815260040160405180910390fd5b6005805461ffff60801b1916600160801b61ffff8416908102919091179091556040519081527f5b3ab0c9f88fadb8a042a844307cfa8da21e1ae6329ec74c0c68dea627358ba1906020016114f7565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107ac908490611db7565b6000610a718383611e8c565b806001600160801b031660000361167157604051633aef258960e11b815260040160405180910390fd5b6003546001600160801b0390811690821611156116a157604051630ca94cbd60e31b815260040160405180910390fd5b600580546001600160801b0319166001600160801b0383169081179091556040519081527fb5547f889af8a66abd76764376d6e36b3f4b2dacc67228dae9dc23f772a7401c906020016114f7565b60008082136114a9576000610687565b60008060008360000361171b57506001915060009050806118ea565b6000611725611eb6565b905080600003611740576002600080935093509350506118ea565b600454600160801b90046001600160801b031681101561176b576003600080935093509350506118ea565b60035485935061179890849061179390600c90600160801b90046001600160801b0316611f6f565b611f87565b6003549093506117b990849061179390600b906001600160801b0316611f6f565b9250826000036117d4576005600080935093509350506118ea565b6117ff837f000000000000000000000000000000000000000000000000000000000000000083611f9d565b6040516370a0823160e01b81523060048201529092506118909083906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561186c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117939190612903565b91506118bd82827f0000000000000000000000000000000000000000000000000000000000000000611f9d565b6005549093506001600160801b03168310156118e4576004600080935093509350506118ea565b60009350505b9193909250565b806001600160801b031660000361191b57604051634fc4f35760e01b815260040160405180910390fd5b6003546001600160801b038083169116111561194a5760405163057e005760e51b815260040160405180910390fd5b600380546001600160801b03908116600160801b918416918202179091556040519081527fdf6aa745a4aa67f53247f4ce1f93720b9acd076801da0f2855f644a7725b45bd906020016114f7565b6000610687825490565b806001600160801b03166000036119cc5760405163fdf0eb1f60e01b815260040160405180910390fd5b6003546001600160801b03600160801b90910481169082161115611a035760405163057e005760e51b815260040160405180910390fd5b6005546001600160801b0380831691161115611a3257604051630ca94cbd60e31b815260040160405180910390fd5b600380546001600160801b0319166001600160801b0383169081179091556040519081527fd65e48ae060eef39d401655d992e870dc03d5171192ad72d327686c263599e68906020016114f7565b6000806000611a8d610e45565b9150611a97612086565b905060008160085484611aaa9190612864565b611ab49190612864565b60055490915061271090611ad390600160801b900461ffff1683612962565b611add9190612992565b935050909192565b600480546001600160801b03908116600160801b918416918202179091556040519081527fcd060dcb47767ebd8697147a1ddbb57ccbc7095f1010240d5a4bdd10fcc5737a906020016114f7565b60606000610a71836120e6565b611b4b600d82611d6e565b611b685760405163335b87d960e11b815260040160405180910390fd5b806001600160a01b03166387c924376040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ba6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bca9190612903565b60086000828254611bdb919061292f565b90915550506040516001600160a01b038216907f021e849b46acadcb7e1f3a23baf2e1ec65ff20b673233504daacdd5a94cd7d2d90600090a250565b611c218282610a78565b61078357611c2e81612142565b611c39836020612154565b604051602001611c4a9291906129e4565b60408051601f198184030181529082905262461bcd60e51b825261081d91600401612a59565b611c7a8282610a78565b610783576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611cb03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610a71836001600160a01b0384166122f0565b611d138282610a78565b15610783576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610a71836001600160a01b03841661233f565b600062015180611d91610e2b565b610da5919061291c565b6000611da683612439565b8015610a715750610a71838361246c565b6000611e0c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124f59092919063ffffffff16565b9050805160001480611e2d575080806020019051810190611e2d9190612a8c565b6107ac5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161081d565b6000826000018281548110611ea357611ea36128ed565b9060005260206000200154905092915050565b60405163232bf5bf60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830181905260248301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063232bf5bf906044016040805180830381865afa925050508015611f63575060408051601f3d908101601f19168201909252611f6091810190612aae565b60015b15611f6c575090505b90565b6000610a71611f7d8461250c565b8303838111150290565b6000818310611f965781610a71565b5090919050565b6000808060001985870985870292508281108382030391505080600003611fd757838281611fcd57611fcd6128ac565b0492505050610a71565b80841161201e5760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b604482015260640161081d565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000600a544210156120985750600090565b600062015180600a54426120ac919061292f565b6120b691906128c2565b905060006120c582600161291c565b6004549091506120df9082906001600160801b03166128d6565b9250505090565b60608160000180548060200260200160405190810160405280929190818152602001828054801561213657602002820191906000526020600020905b815481526020019060010190808311612122575b50505050509050919050565b60606106876001600160a01b03831660145b606060006121638360026128d6565b61216e90600261291c565b67ffffffffffffffff81111561218657612186612ad2565b6040519080825280601f01601f1916602001820160405280156121b0576020820181803683370190505b509050600360fc1b816000815181106121cb576121cb6128ed565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106121fa576121fa6128ed565b60200101906001600160f81b031916908160001a905350600061221e8460026128d6565b61222990600161291c565b90505b60018111156122a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061225d5761225d6128ed565b1a60f81b828281518110612273576122736128ed565b60200101906001600160f81b031916908160001a90535060049490941c9361229a81612ae8565b905061222c565b508315610a715760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161081d565b600081815260018301602052604081205461233757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610687565b506000610687565b6000818152600183016020526040812054801561242857600061236360018361292f565b85549091506000906123779060019061292f565b90508181146123dc576000866000018281548110612397576123976128ed565b90600052602060002001549050808760000184815481106123ba576123ba6128ed565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806123ed576123ed612aff565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610687565b6000915050610687565b5092915050565b600061244c826301ffc9a760e01b61246c565b80156106875750612465826001600160e01b031961246c565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d915060005190508280156124de575060208210155b80156124ea5750600081115b979650505050505050565b60606125048484600085612541565b949350505050565b805460009067ffffffffffffffff16421015612539578154600160401b90046001600160c01b0316610687565b600092915050565b6060824710156125a25760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161081d565b600080866001600160a01b031685876040516125be9190612b15565b60006040518083038185875af1925050503d80600081146125fb576040519150601f19603f3d011682016040523d82523d6000602084013e612600565b606091505b50915091506124ea878383876060831561267b578251600003612674576001600160a01b0385163b6126745760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161081d565b5081612504565b61250483838151156126905781518083602001fd5b8060405162461bcd60e51b815260040161081d9190612a59565b6000602082840312156126bc57600080fd5b81356001600160e01b031981168114610a7157600080fd5b80356001600160a01b03811681146126eb57600080fd5b919050565b60006020828403121561270257600080fd5b610a71826126d4565b60006020828403121561271d57600080fd5b5035919050565b6000806040838503121561273757600080fd5b82359150612747602084016126d4565b90509250929050565b6000806040838503121561276357600080fd5b61276c836126d4565b946020939093013593505050565b6000806040838503121561278d57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600681106127d057634e487b7160e01b600052602160045260246000fd5b9052565b606081016127e282866127b2565b602082019390935260400152919050565b6020808252825182820181905260009190848201906040850190845b818110156128345783516001600160a01b03168352928401929184019160010161280f565b50909695505050505050565b6020810161068782846127b2565b634e487b7160e01b600052601160045260246000fd5b81810360008312801583831316838312821617156124325761243261284e565b80820182811260008312801582168215821617156128a4576128a461284e565b505092915050565b634e487b7160e01b600052601260045260246000fd5b6000826128d1576128d16128ac565b500490565b80820281158282048414176106875761068761284e565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561291557600080fd5b5051919050565b808201808211156106875761068761284e565b818103818111156106875761068761284e565b6001600160c01b038181168382160190808211156124325761243261284e565b80820260008212600160ff1b8414161561297e5761297e61284e565b81810583148215176106875761068761284e565b6000826129a1576129a16128ac565b600160ff1b8214600019841416156129bb576129bb61284e565b500590565b60005b838110156129db5781810151838201526020016129c3565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612a1c8160178501602088016129c0565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612a4d8160288401602088016129c0565b01602801949350505050565b6020815260008251806020840152612a788160408501602087016129c0565b601f01601f19169190910160400192915050565b600060208284031215612a9e57600080fd5b81518015158114610a7157600080fd5b60008060408385031215612ac157600080fd5b505080516020909101519092909150565b634e487b7160e01b600052604160045260246000fd5b600081612af757612af761284e565b506000190190565b634e487b7160e01b600052603160045260246000fd5b60008251612b278184602087016129c0565b919091019291505056fea26469706673582212205574090ba85923b21bb477c27bbc4682dcb230623c851c6f710ab89ee6f7491464736f6c6343000817003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000002e59a20f205bb85a89c53f1936454680651e618e0000000000000000000000003e40d73eb977dc6a537af587d48316fee66e9c8c000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8400000000000000000000000079ef3a538200fe4981d67e7e886bfb36d4cb5a310000000000000000000000006c213ca5a10cc26548c742229569b4aed2a9c9b7000000000000000000000000000000000000000000000a968163f0a57b400000000000000000000000000000000000000000000000084595161401484a000000000000000000000000000000000000000000000000001734d4e35897eb340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000001388000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006220212a33a87ed7cc386b67eb2c393974f28c38","name":"BuybackAllocator","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":false,"language":"solidity","evm_version":"paris","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"@openzeppelin/contracts/access/AccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with a standardized message including the required role.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     *\n     * _Available since v4.1._\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n        return _roles[role].members[account];\n    }\n\n    /**\n     * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n     * Overriding this function changes the behavior of the {onlyRole} modifier.\n     *\n     * Format of the revert message is described in {_checkRole}.\n     *\n     * _Available since v4.6._\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Revert with a standard message if `account` is missing `role`.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        Strings.toHexString(account),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * May emit a {RoleGranted} event.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     *\n     * NOTE: This function is deprecated in favor of {_grantRole}.\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual {\n        if (!hasRole(role, account)) {\n            _roles[role].members[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual {\n        if (hasRole(role, account)) {\n            _roles[role].members[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"},{"file_path":"contracts/lib/MathHelpers.sol","source_code":"// SPDX-FileCopyrightText: 2026 Lido <info@lido.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.23;\n\n/**\n * @title MathHelpers\n * @author swissarmytowel <info@lido.fi>\n * @notice Small math helpers shared across buyback contracts.\n */\nlibrary MathHelpers {\n    /**\n     * @dev Unsigned saturating subtraction, bounds to zero on underflow.\n     */\n    function saturatingSub(uint256 a_, uint256 b_) internal pure returns (uint256) {\n        unchecked {\n            uint256 c = a_ - b_;\n            bool success = c <= a_;\n            uint256 result = c * _toUint(success);\n\n            return result;\n        }\n    }\n\n    /**\n     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n     */\n    function _toUint(bool b_) internal pure returns (uint256 u) {\n        assembly (\"memory-safe\") {\n            u := iszero(iszero(b_))\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/AccessControlEnumerable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n        return _roleMembers[role].at(index);\n    }\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n        return _roleMembers[role].length();\n    }\n\n    /**\n     * @dev Overload {_grantRole} to track enumerable memberships\n     */\n    function _grantRole(bytes32 role, address account) internal virtual override {\n        super._grantRole(role, account);\n        _roleMembers[role].add(account);\n    }\n\n    /**\n     * @dev Overload {_revokeRole} to track enumerable memberships\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual override {\n        super._revokeRole(role, account);\n        _roleMembers[role].remove(account);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/IAccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"},{"file_path":"@openzeppelin/contracts/access/IAccessControlEnumerable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n"},{"file_path":"@openzeppelin/contracts/security/ReentrancyGuard.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\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    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        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\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"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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    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"},{"file_path":"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/IERC20Permit.sol\";\nimport \"../../../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 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n    }\n\n    /**\n     * @dev Decrease 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 safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\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.encodeWithSelector(token.approve.selector, spender, value);\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n     * Revert on invalid signature.\n     */\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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, \"SafeERC20: low-level call failed\");\n        require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\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\n            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Address.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\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"},{"file_path":"@openzeppelin/contracts/utils/Strings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\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), _SYMBOLS))\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 toString(int256 value) internal pure returns (string memory) {\n        return string(abi.encodePacked(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        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] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\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 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 keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./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 *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n    // As per the EIP-165 spec, no interface should ever match 0xffffffff\n    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n    /**\n     * @dev Returns true if `account` supports the {IERC165} interface.\n     */\n    function supportsERC165(address account) internal view returns (bool) {\n        // Any contract that implements ERC165 must explicitly indicate support of\n        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n        return\n            supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n            !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n    }\n\n    /**\n     * @dev Returns true if `account` supports the interface defined by\n     * `interfaceId`. Support for {IERC165} itself is queried automatically.\n     *\n     * See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n        // query support of both ERC165 as per the spec and support of _interfaceId\n        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n    }\n\n    /**\n     * @dev Returns a boolean array where each value corresponds to the\n     * interfaces passed in and whether they're supported or not. This allows\n     * you to batch check interfaces for a contract where your expectation\n     * is that some interfaces may not be supported.\n     *\n     * See {IERC165-supportsInterface}.\n     *\n     * _Available since v3.4._\n     */\n    function getSupportedInterfaces(\n        address account,\n        bytes4[] memory interfaceIds\n    ) internal view returns (bool[] memory) {\n        // an array of booleans corresponding to interfaceIds and whether they're supported or not\n        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n        // query support of ERC165 itself\n        if (supportsERC165(account)) {\n            // query support of each interface in interfaceIds\n            for (uint256 i = 0; i < interfaceIds.length; i++) {\n                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n            }\n        }\n\n        return interfaceIdsSupported;\n    }\n\n    /**\n     * @dev Returns true if `account` supports all the interfaces defined in\n     * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n     *\n     * Batch-querying can lead to gas savings by skipping repeated checks for\n     * {IERC165} support.\n     *\n     * See {IERC165-supportsInterface}.\n     */\n    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n        // query support of ERC165 itself\n        if (!supportsERC165(account)) {\n            return false;\n        }\n\n        // query support of each interface in interfaceIds\n        for (uint256 i = 0; i < interfaceIds.length; i++) {\n            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n                return false;\n            }\n        }\n\n        // all interfaces supported\n        return true;\n    }\n\n    /**\n     * @notice Query if a contract implements an interface, does not check ERC165 support\n     * @param account The address of the contract to query for support of an interface\n     * @param interfaceId The interface identifier, as specified in ERC-165\n     * @return true if the contract at account indicates support of the interface with\n     * identifier interfaceId, false otherwise\n     * @dev Assumes that account contains a contract that supports ERC165, otherwise\n     * the behavior of this method is undefined. This precondition can be checked\n     * with {supportsERC165}.\n     *\n     * Some precompiled contracts will falsely indicate support for a given interface, so caution\n     * should be exercised when using this function.\n     *\n     * Interface identification is specified in ERC-165.\n     */\n    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n        // prepare call\n        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n        // perform static call\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly {\n            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0x00)\n        }\n\n        return success && returnSize >= 0x20 && returnValue > 0;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\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"},{"file_path":"@openzeppelin/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\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 up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\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 denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by 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; // 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                prod0 := mul(x, y)\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            require(denominator > prod1, \"Math: mulDiv overflow\");\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. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\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 works\n            // 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 (rounding == Rounding.Up && 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 down.\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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\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 *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\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     * _Available since v4.7._\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\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     * _Available since v4.7._\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\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     * _Available since v4.7._\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\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     * _Available since v4.2._\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\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     * _Available since v4.7._\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\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     * _Available since v4.7._\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\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     * _Available since v4.7._\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\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     * _Available since v4.7._\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\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     * _Available since v4.7._\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\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     * _Available since v4.7._\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\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     * _Available since v4.7._\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\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     * _Available since v4.7._\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\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     * _Available since v4.7._\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\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     * _Available since v4.7._\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\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     * _Available since v4.7._\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\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     * _Available since v2.5._\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\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     * _Available since v4.7._\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\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     * _Available since v4.7._\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\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     * _Available since v4.7._\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\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     * _Available since v4.2._\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\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     * _Available since v4.7._\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\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     * _Available since v4.7._\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\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     * _Available since v4.7._\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\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     * _Available since v2.5._\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\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     * _Available since v4.7._\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\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     * _Available since v4.7._\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\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     * _Available since v4.7._\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\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     * _Available since v2.5._\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\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     * _Available since v4.7._\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\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     * _Available since v2.5._\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\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     * _Available since v2.5._\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\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     * _Available since v3.0._\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        require(value >= 0, \"SafeCast: value must be positive\");\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     * _Available since v4.7._\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\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     * _Available since v4.7._\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\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     * _Available since v4.7._\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\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     * _Available since v4.7._\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\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     * _Available since v4.7._\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\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     * _Available since v4.7._\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\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     * _Available since v4.7._\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\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     * _Available since v4.7._\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\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     * _Available since v4.7._\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\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     * _Available since v4.7._\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\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     * _Available since v4.7._\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\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     * _Available since v4.7._\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\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     * _Available since v4.7._\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\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     * _Available since v4.7._\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\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     * _Available since v4.7._\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\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     * _Available since v3.1._\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\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     * _Available since v4.7._\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\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     * _Available since v4.7._\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\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     * _Available since v4.7._\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\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     * _Available since v4.7._\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\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     * _Available since v4.7._\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\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     * _Available since v4.7._\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\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     * _Available since v4.7._\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\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     * _Available since v3.1._\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\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     * _Available since v4.7._\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\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     * _Available since v4.7._\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\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     * _Available since v4.7._\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\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     * _Available since v3.1._\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\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     * _Available since v4.7._\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\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     * _Available since v3.1._\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\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     * _Available since v3.1._\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\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     * _Available since v3.0._\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        require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n        return int256(value);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SignedMath.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\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"},{"file_path":"contracts/automated-buybacks/AssetRecovererACL.sol","source_code":"// SPDX-FileCopyrightText: 2026 Lido <info@lido.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.23;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {AccessControlEnumerable} from \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\n\n/**\n * @title AssetRecovererACL\n * @author swissarmytowel <info@lido.fi>\n * @notice Asset-recovery base for Buyback contracts with role-based access control.\n * @dev    All recovery flows send to the immutable `TREASURY` address.\n */\nabstract contract AssetRecovererACL is AccessControlEnumerable, ReentrancyGuard {\n    using Address for address payable;\n    using SafeERC20 for IERC20;\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTANTS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Gates asset recovery and operational actions.\n    bytes32 public constant MANAGER_ROLE = keccak256(\"Buybacks.MANAGER_ROLE\");\n\n    /*//////////////////////////////////////////////////////////////\n                              IMMUTABLES\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice Treasury address. All recovery flows send assets here.\n    address public immutable TREASURY;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event EtherRecovered(uint256 amount);\n    event ERC20Recovered(address indexed token, uint256 amount);\n\n    /*//////////////////////////////////////////////////////////////\n                                ERRORS\n    //////////////////////////////////////////////////////////////*/\n\n    error InvalidAdminAddress();\n    error InvalidTreasuryAddress();\n\n    /*//////////////////////////////////////////////////////////////\n                              CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Constructor. Grants `DEFAULT_ADMIN_ROLE` to `admin_`.\n     * @param  admin_ Initial role holder. Non-zero.\n     * @param  treasury_ Treasury address. Non-zero.\n     */\n    constructor(address admin_, address treasury_) {\n        if (admin_ == address(0)) {\n            revert InvalidAdminAddress();\n        }\n        if (treasury_ == address(0)) {\n            revert InvalidTreasuryAddress();\n        }\n\n        TREASURY = treasury_;\n\n        _grantRole(DEFAULT_ADMIN_ROLE, admin_);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                           EXTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Sweeps the contract's entire ETH balance to the treasury.\n     */\n    function recoverEther() external nonReentrant onlyRole(MANAGER_ROLE) {\n        uint256 amount = address(this).balance;\n\n        emit EtherRecovered(amount);\n\n        payable(TREASURY).sendValue(amount);\n    }\n\n    /**\n     * @notice Recovers an ERC-20 balance to the treasury.\n     * @param  token_ ERC-20 token to recover.\n     * @param  amount_ Token amount transferred to `TREASURY`.\n     */\n    function recoverERC20(\n        address token_,\n        uint256 amount_\n    ) external nonReentrant onlyRole(MANAGER_ROLE) {\n        emit ERC20Recovered(token_, amount_);\n\n        IERC20(token_).safeTransfer(TREASURY, amount_);\n    }\n}\n"},{"file_path":"contracts/interfaces/IBuybackAllocator.sol","source_code":"// SPDX-FileCopyrightText: 2026 Lido <info@lido.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.0;\n\nimport {IStETH} from \"./IStETH.sol\";\nimport {IOracleRouter} from \"./IOracleRouter.sol\";\n\n/**\n * @title IBuybackAllocator\n * @notice Public surface of the BuybackAllocator.\n */\ninterface IBuybackAllocator {\n    /// @notice Whether a release can proceed, or why it is skipped. Reported in the skip event.\n    enum AllocationStatus {\n        // The release can proceed\n        Eligible,\n        // No budget available to spend\n        NoAvailableBudget,\n        // The oracle returned no price\n        QuoteUnavailable,\n        // The price is below the floor\n        StEthPriceBelowMin,\n        // The spendable amount is below the smallest allowed\n        AllocationBelowMin,\n        // The daily or yearly cap leaves no room\n        WindowCapReached\n    }\n\n    function MAX_BASIS_POINTS() external view returns (uint256);\n\n    function MAX_REVENUE_SOURCES() external view returns (uint256);\n\n    function STETH() external view returns (IStETH);\n\n    function ORACLE_ROUTER() external view returns (IOracleRouter);\n\n    function dailyCapUSD() external view returns (uint128);\n\n    function yearlyCapUSD() external view returns (uint128);\n\n    function reserveDailyRateUSD() external view returns (uint128);\n\n    function minStEthPriceUSD() external view returns (uint128);\n\n    function minSpendPerCallUSD() external view returns (uint128);\n\n    function surplusShareBP() external view returns (uint16);\n\n    function executor() external view returns (address);\n\n    function activationTS() external view returns (uint256);\n\n    function lastTotalRevenueUSD() external view returns (uint256);\n\n    function budgetUSD() external view returns (int256);\n\n    function reserveAnchorTS() external view returns (uint256);\n\n    function daily() external view returns (uint64 endTS, uint192 spentUSD);\n\n    function yearly() external view returns (uint64 endTS, uint192 spentUSD);\n\n    function spendable()\n        external\n        view\n        returns (AllocationStatus status, uint256 spendableUSD, uint256 spendableStEth);\n\n    function revenueSources() external view returns (address[] memory);\n\n    function activate() external;\n\n    function allocate() external;\n\n    function setSurplusShareBP(uint256 surplusShareBP_) external;\n\n    function setReserveDailyRateUSD(uint256 reserveDailyRateUSD_) external;\n\n    function setDailyCapUSD(uint256 dailyCapUSD_) external;\n\n    function setYearlyCapUSD(uint256 yearlyCapUSD_) external;\n\n    function setMinStEthPriceUSD(uint256 minStEthPriceUSD_) external;\n\n    function setMinSpendPerCallUSD(uint256 minSpendPerCallUSD_) external;\n\n    function setExecutor(address newExecutor_) external;\n\n    function addRevenueSource(address source_) external;\n\n    function removeRevenueSource(address source_) external;\n}\n"},{"file_path":"contracts/interfaces/IBuybackExecutor.sol","source_code":"// SPDX-FileCopyrightText: 2026 Lido <info@lido.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.0;\n\n/**\n * @title IBuybackExecutor\n * @notice External surface of the BuybackExecutor consumed by the BuybackAllocator, keepers,\n *         and operators. Liquidity-side calls (`addLiquidity`, `removeLiquidityAndRecoverToTreasury`)\n *         are intentionally omitted.\n */\ninterface IBuybackExecutor {\n    /// @notice `getPlacementStatus` return, containing placement preconditions and the next sell sizing.\n    struct PlacementStatus {\n        bool canPlace;\n        uint256 sellAmount;\n        uint256 estimatedBuyAmount;\n        address activeOrder;\n        uint256 activeOrderValidTo;\n        bool isStonksCreationPaused;\n        bool isStonksKilled;\n    }\n\n    function onStEthAllocated() external;\n\n    function setStonks(address stonks_) external;\n\n    function placeOrder() external returns (address newOrder);\n\n    function pauseStonksCreation() external;\n\n    function unpauseStonksCreation() external;\n\n    function pauseStonksSignatures() external;\n\n    function unpauseStonksSignatures() external;\n\n    function getPlacementStatus() external view returns (PlacementStatus memory);\n}\n"},{"file_path":"contracts/interfaces/IOracleRouter.sol","source_code":"// SPDX-FileCopyrightText: 2024 Lido <info@lido.fi>\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IOracleRouter {\n    enum QuoteDenomination {\n        USD,\n        ETH\n    }\n\n    // Pricing reads\n    function getUsdPrices(\n        address baseToken_,\n        address quoteToken_\n    ) external view returns (uint256 baseUsdPrice, uint256 quoteUsdPrice);\n\n    function getPricesAndDecimals(\n        address baseToken_,\n        address quoteToken_,\n        QuoteDenomination quote_\n    )\n        external\n        view\n        returns (\n            uint256 basePrice,\n            uint256 quotePrice,\n            uint8 baseTokenDecimals,\n            uint8 quoteTokenDecimals\n        );\n\n    // Configuration (admin/manager)\n    function setEthUsdBridge(uint32 maxStalenessSeconds_) external;\n\n    function syncEthUsdBridge() external;\n\n    function setTokenFeed(\n        address token_,\n        QuoteDenomination primaryQuote_,\n        uint32 maxStalenessSeconds_,\n        bool isActive_\n    ) external;\n\n    function setTokenEthUsdStalenessOverride(address token_, uint32 overrideSeconds_) external;\n\n    function setTokenActive(address token_, bool isActive_) external;\n\n    function isBridgeInSync() external view returns (bool);\n\n    function isFeedInSync(address token_) external view returns (bool);\n\n    function syncTokenFeed(address token_) external;\n\n    function MAX_DECIMALS() external view returns (uint128);\n\n    function PRICE_UNIT() external view returns (uint256);\n}\n"},{"file_path":"contracts/interfaces/IRevenueSource.sol","source_code":"// SPDX-FileCopyrightText: 2026 Lido <info@lido.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.0;\n\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title IRevenueSource\n * @notice Read surface every revenue contributor exposes to the buyback revenue aggregator.\n *         Returns the source's monotonic cumulative revenue in USD; consumers diff successive\n *         reads to derive accrued revenue. Concrete sources extend the abstract `RevenueSource`,\n *         which implements this method.\n * @dev    Extends `IERC165` so the base `RevenueSource` carries the `supportsInterface`\n *         advertisement for `IRevenueSource`, and every concrete source inherits it. Consumers\n *         like `BuybackAllocator` gate registration on `supportsInterface(type(IRevenueSource))`.\n * @dev    Implementations must stay monotonic, always-live, and fully settled: the cumulative\n *         only grows, the read never reverts, and it reflects all revenue earned up to the read.\n */\ninterface IRevenueSource is IERC165 {\n    function getCumulativeRevenueUSD() external view returns (uint256);\n}\n"},{"file_path":"contracts/interfaces/IStETH.sol","source_code":"// SPDX-FileCopyrightText: 2025 Lido <info@lido.fi>\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IStETH is IERC20 {\n    function getPooledEthByShares(uint256 sharesAmount) external view returns (uint256);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"components":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"stEth","type":"address"},{"internalType":"address","name":"oracleRouter","type":"address"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"uint128","name":"dailyCapUSD","type":"uint128"},{"internalType":"uint128","name":"yearlyCapUSD","type":"uint128"},{"internalType":"uint128","name":"reserveDailyRateUSD","type":"uint128"},{"internalType":"uint128","name":"minStEthPriceUSD","type":"uint128"},{"internalType":"uint128","name":"minSpendPerCallUSD","type":"uint128"},{"internalType":"uint16","name":"surplusShareBP","type":"uint16"},{"internalType":"address[]","name":"revenueSources","type":"address[]"}],"internalType":"struct BuybackAllocator.ConstructorParams","name":"initParams_","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyActivated","type":"error"},{"inputs":[],"name":"DailyCapExceedsYearlyCap","type":"error"},{"inputs":[],"name":"DailyCapUSDZero","type":"error"},{"inputs":[],"name":"ExecutorZeroAddress","type":"error"},{"inputs":[],"name":"InvalidAdminAddress","type":"error"},{"inputs":[],"name":"InvalidTreasuryAddress","type":"error"},{"inputs":[],"name":"MinSpendPerCallExceedsDailyCap","type":"error"},{"inputs":[],"name":"MinSpendPerCallUSDZero","type":"error"},{"inputs":[],"name":"NotActivated","type":"error"},{"inputs":[],"name":"OracleRouterZeroAddress","type":"error"},{"inputs":[],"name":"RevenueSourceAlreadyRegistered","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxSources","type":"uint256"}],"name":"RevenueSourceLimitReached","type":"error"},{"inputs":[],"name":"RevenueSourceNotRegistered","type":"error"},{"inputs":[{"internalType":"address","name":"source","type":"address"}],"name":"RevenueSourceUnsupported","type":"error"},{"inputs":[],"name":"RevenueSourceZeroAddress","type":"error"},{"inputs":[],"name":"StEthZeroAddress","type":"error"},{"inputs":[],"name":"SurplusShareBPInvalid","type":"error"},{"inputs":[],"name":"YearlyCapUSDZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"activationTS","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastTotalRevenueUSD","type":"uint256"}],"name":"Activated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"triggeredBy","type":"address"},{"indexed":true,"internalType":"address","name":"executor","type":"address"},{"indexed":false,"internalType":"uint256","name":"spendUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"spendStEth","type":"uint256"}],"name":"Allocated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"enum IBuybackAllocator.AllocationStatus","name":"reason","type":"uint8"}],"name":"AllocationSkipped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lastTotalRevenueUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reserveUSD","type":"uint256"},{"indexed":false,"internalType":"int256","name":"budgetDeltaUSD","type":"int256"},{"indexed":false,"internalType":"int256","name":"budgetUSD","type":"int256"}],"name":"Checkpoint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"dailyCapUSD","type":"uint256"}],"name":"DailyCapUSDSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EtherRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"executor","type":"address"}],"name":"ExecutorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minSpendPerCallUSD","type":"uint256"}],"name":"MinSpendPerCallUSDSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minStEthPriceUSD","type":"uint256"}],"name":"MinStEthPriceUSDSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"anchorTS","type":"uint256"}],"name":"ReserveAnchored","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reserveDailyRateUSD","type":"uint256"}],"name":"ReserveDailyRateUSDSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"source","type":"address"}],"name":"RevenueSourceAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"source","type":"address"}],"name":"RevenueSourceRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"surplusShareBP","type":"uint256"}],"name":"SurplusShareBPSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"windowDurationSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newEndTS","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"previousSpentUSD","type":"uint256"}],"name":"WindowRolled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"yearlyCapUSD","type":"uint256"}],"name":"YearlyCapUSDSet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REVENUE_SOURCES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE_ROUTER","outputs":[{"internalType":"contract IOracleRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STETH","outputs":[{"internalType":"contract IStETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"activationTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"source_","type":"address"}],"name":"addRevenueSource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"budgetUSD","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"daily","outputs":[{"internalType":"uint64","name":"endTS","type":"uint64"},{"internalType":"uint192","name":"spentUSD","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dailyCapUSD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTotalRevenueUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minSpendPerCallUSD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStEthPriceUSD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"source_","type":"address"}],"name":"removeRevenueSource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveAnchorTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveDailyRateUSD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revenueSources","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dailyCapUSD_","type":"uint256"}],"name":"setDailyCapUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newExecutor_","type":"address"}],"name":"setExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minSpendPerCallUSD_","type":"uint256"}],"name":"setMinSpendPerCallUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minStEthPriceUSD_","type":"uint256"}],"name":"setMinStEthPriceUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"reserveDailyRateUSD_","type":"uint256"}],"name":"setReserveDailyRateUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"surplusShareBP_","type":"uint256"}],"name":"setSurplusShareBP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"yearlyCapUSD_","type":"uint256"}],"name":"setYearlyCapUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spendable","outputs":[{"internalType":"enum IBuybackAllocator.AllocationStatus","name":"status","type":"uint8"},{"internalType":"uint256","name":"spendableUSD","type":"uint256"},{"internalType":"uint256","name":"spendableStEth","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"surplusShareBP","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yearly","outputs":[{"internalType":"uint64","name":"endTS","type":"uint64"},{"internalType":"uint192","name":"spentUSD","type":"uint192"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yearlyCapUSD","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000002e59a20f205bb85a89c53f1936454680651e618e0000000000000000000000003e40d73eb977dc6a537af587d48316fee66e9c8c000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8400000000000000000000000079ef3a538200fe4981d67e7e886bfb36d4cb5a310000000000000000000000006c213ca5a10cc26548c742229569b4aed2a9c9b7000000000000000000000000000000000000000000000a968163f0a57b400000000000000000000000000000000000000000000000084595161401484a000000000000000000000000000000000000000000000000001734d4e35897eb340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003635c9adc5dea000000000000000000000000000000000000000000000000000000000000000001388000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006220212a33a87ed7cc386b67eb2c393974f28c38"}