creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/VaultConfigurator.sol": {
        "content": "// SPDX-License-Identifier: BSL-1.1\npragma solidity 0.8.25;\n\nimport \"./interfaces/IVaultConfigurator.sol\";\n\nimport \"./utils/DefaultAccessControl.sol\";\n\ncontract VaultConfigurator is IVaultConfigurator, ReentrancyGuard {\n    /// @inheritdoc IVaultConfigurator\n    uint256 public constant MAX_DELAY = 365 days;\n    /// @inheritdoc IVaultConfigurator\n    uint256 public constant MAX_WITHDRAWAL_FEE = 5e7; // 5%\n    /// @inheritdoc IVaultConfigurator\n    address public immutable vault;\n\n    Data private _baseDelay;\n\n    Data private _depositCallbackDelay;\n    Data private _withdrawalCallbackDelay;\n    Data private _withdrawalFeeD9Delay;\n    Data private _maximalTotalSupplyDelay;\n    Data private _isDepositLockedDelay;\n    Data private _areTransfersLockedDelay;\n    Data private _isDelegateModuleApprovedDelay;\n    Data private _ratiosOracleDelay;\n    Data private _priceOracleDelay;\n    Data private _validatorDelay;\n    Data private _emergencyWithdrawalDelay;\n\n    Data private _depositCallback;\n    Data private _withdrawalCallback;\n    Data private _withdrawalFeeD9;\n    Data private _maximalTotalSupply;\n    Data private _isDepositLocked;\n    Data private _areTransfersLocked;\n    Data private _ratiosOracle;\n    Data private _priceOracle;\n    Data private _validator;\n\n    mapping(address => Data) private _isDelegateModuleApproved;\n\n    constructor() {\n        vault = msg.sender;\n    }\n\n    modifier onlyAdmin() {\n        IDefaultAccessControl(vault).requireAdmin(msg.sender);\n        _;\n    }\n\n    modifier atLeastOperator() {\n        IDefaultAccessControl(vault).requireAtLeastOperator(msg.sender);\n        _;\n    }\n\n    function _stage(Data storage s, uint256 value) private {\n        s.stageTimestamp = block.timestamp;\n        s.stagedValue = value;\n        bytes32 slot;\n        assembly {\n            slot := s.slot\n        }\n        emit Stage(slot, s, value, block.timestamp);\n    }\n\n    function _commit(Data storage s, Data storage delay) private {\n        uint256 timestamp = s.stageTimestamp;\n        if (timestamp == 0) revert InvalidTimestamp();\n        if (block.timestamp - timestamp < delay.value)\n            revert InvalidTimestamp();\n        bytes32 slot;\n        assembly {\n            slot := s.slot\n        }\n        emit Commit(slot, s, block.timestamp);\n        s.value = s.stagedValue;\n        delete s.stageTimestamp;\n        delete s.stagedValue;\n    }\n\n    function _rollback(Data storage s) private {\n        bytes32 slot;\n        assembly {\n            slot := s.slot\n        }\n        emit Rollback(slot, s, block.timestamp);\n        delete s.stageTimestamp;\n        delete s.stagedValue;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function isDelegateModuleApproved(\n        address module\n    ) external view returns (bool) {\n        return _isDelegateModuleApproved[module].value != 0;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function isDepositLocked() external view returns (bool) {\n        return _isDepositLocked.value != 0;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function areTransfersLocked() external view returns (bool) {\n        return _areTransfersLocked.value != 0;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function maximalTotalSupply() external view returns (uint256) {\n        return _maximalTotalSupply.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function depositCallback() external view returns (address) {\n        return address(uint160(_depositCallback.value));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function withdrawalCallback() external view returns (address) {\n        return address(uint160(_withdrawalCallback.value));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function withdrawalFeeD9() external view returns (uint256) {\n        return _withdrawalFeeD9.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageDelegateModuleApproval(\n        address module\n    ) external onlyAdmin nonReentrant {\n        if (module == address(0)) revert AddressZero();\n        _stage(_isDelegateModuleApproved[module], 1);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitDelegateModuleApproval(\n        address module\n    ) external onlyAdmin nonReentrant {\n        _commit(\n            _isDelegateModuleApproved[module],\n            _isDelegateModuleApprovedDelay\n        );\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedDelegateModuleApproval(\n        address module\n    ) external onlyAdmin nonReentrant {\n        _rollback(_isDelegateModuleApproved[module]);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function revokeDelegateModuleApproval(\n        address module\n    ) external onlyAdmin nonReentrant {\n        _isDelegateModuleApproved[module].value = 0;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageDepositsLock() external atLeastOperator nonReentrant {\n        _stage(_isDepositLocked, 1);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitDepositsLock() external atLeastOperator nonReentrant {\n        _commit(_isDepositLocked, _isDepositLockedDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedDepositsLock()\n        external\n        atLeastOperator\n        nonReentrant\n    {\n        _rollback(_isDepositLocked);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function revokeDepositsLock() external atLeastOperator nonReentrant {\n        _isDepositLocked.value = 0;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageTransfersLock(bool flag) external onlyAdmin nonReentrant {\n        _stage(_areTransfersLocked, flag ? 1 : 0);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitTransfersLock() external onlyAdmin nonReentrant {\n        _commit(_areTransfersLocked, _areTransfersLockedDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedTransfersLock() external onlyAdmin nonReentrant {\n        _rollback(_areTransfersLocked);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageMaximalTotalSupply(\n        uint256 maximalTotalSupply_\n    ) external onlyAdmin nonReentrant {\n        if (maximalTotalSupply_ < IVault(vault).totalSupply())\n            revert InvalidTotalSupply();\n        _stage(_maximalTotalSupply, maximalTotalSupply_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitMaximalTotalSupply() external onlyAdmin nonReentrant {\n        _commit(_maximalTotalSupply, _maximalTotalSupplyDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedMaximalTotalSupply()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_maximalTotalSupply);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageDepositCallback(\n        address callback\n    ) external onlyAdmin nonReentrant {\n        _stage(_depositCallback, uint160(callback));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitDepositCallback() external onlyAdmin nonReentrant {\n        _commit(_depositCallback, _depositCallbackDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedDepositCallback() external onlyAdmin nonReentrant {\n        _rollback(_depositCallback);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageWithdrawalCallback(\n        address callback\n    ) external onlyAdmin nonReentrant {\n        _stage(_withdrawalCallback, uint160(callback));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitWithdrawalCallback() external onlyAdmin nonReentrant {\n        _commit(_withdrawalCallback, _withdrawalCallbackDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedWithdrawalCallback()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_withdrawalCallback);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageWithdrawalFeeD9(\n        uint256 feeD9\n    ) external onlyAdmin nonReentrant {\n        if (feeD9 > MAX_WITHDRAWAL_FEE) revert InvalidWithdrawalFee();\n        _stage(_withdrawalFeeD9, feeD9);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitWithdrawalFeeD9() external onlyAdmin nonReentrant {\n        _commit(_withdrawalFeeD9, _withdrawalFeeD9Delay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedWithdrawalFeeD9() external onlyAdmin nonReentrant {\n        _rollback(_withdrawalFeeD9);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function baseDelay() external view returns (uint256) {\n        return _baseDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageBaseDelay(uint256 delay_) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_baseDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitBaseDelay() external onlyAdmin nonReentrant {\n        _commit(_baseDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedBaseDelay() external onlyAdmin nonReentrant {\n        _rollback(_baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function depositCallbackDelay() external view returns (uint256) {\n        return _depositCallbackDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageDepositCallbackDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_depositCallbackDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitDepositCallbackDelay() external onlyAdmin nonReentrant {\n        _commit(_depositCallbackDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedDepositCallbackDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_depositCallbackDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function withdrawalCallbackDelay() external view returns (uint256) {\n        return _withdrawalCallbackDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageWithdrawalCallbackDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_withdrawalCallbackDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitWithdrawalCallbackDelay() external onlyAdmin nonReentrant {\n        _commit(_withdrawalCallbackDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedWithdrawalCallbackDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_withdrawalCallbackDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function withdrawalFeeD9Delay() external view returns (uint256) {\n        return _withdrawalFeeD9Delay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageWithdrawalFeeD9Delay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_withdrawalFeeD9Delay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitWithdrawalFeeD9Delay() external onlyAdmin nonReentrant {\n        _commit(_withdrawalFeeD9Delay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedWithdrawalFeeD9Delay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_withdrawalFeeD9Delay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function isDepositLockedDelay() external view returns (uint256) {\n        return _isDepositLockedDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageDepositsLockedDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_isDepositLockedDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitDepositsLockedDelay() external onlyAdmin nonReentrant {\n        _commit(_isDepositLockedDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedDepositsLockedDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_isDepositLockedDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function areTransfersLockedDelay() external view returns (uint256) {\n        return _areTransfersLockedDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageTransfersLockedDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_areTransfersLockedDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitTransfersLockedDelay() external onlyAdmin nonReentrant {\n        _commit(_areTransfersLockedDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedTransfersLockedDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_areTransfersLockedDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function delegateModuleApprovalDelay() external view returns (uint256) {\n        return _isDelegateModuleApprovedDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageDelegateModuleApprovalDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_isDelegateModuleApprovedDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitDelegateModuleApprovalDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _commit(_isDelegateModuleApprovedDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedDelegateModuleApprovalDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_isDelegateModuleApprovedDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function maximalTotalSupplyDelay() external view returns (uint256) {\n        return _maximalTotalSupplyDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageMaximalTotalSupplyDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_maximalTotalSupplyDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitMaximalTotalSupplyDelay() external onlyAdmin nonReentrant {\n        _commit(_maximalTotalSupplyDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedMaximalTotalSupplyDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_maximalTotalSupplyDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function ratiosOracle() external view returns (address) {\n        return address(uint160(_ratiosOracle.value));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function priceOracle() external view returns (address) {\n        return address(uint160(_priceOracle.value));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function validator() external view returns (address) {\n        return address(uint160(_validator.value));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageRatiosOracle(address oracle) external onlyAdmin nonReentrant {\n        if (oracle == address(0)) revert AddressZero();\n        _stage(_ratiosOracle, uint160(oracle));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitRatiosOracle() external onlyAdmin nonReentrant {\n        _commit(_ratiosOracle, _ratiosOracleDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedRatiosOracle() external onlyAdmin nonReentrant {\n        _rollback(_ratiosOracle);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stagePriceOracle(address oracle) external onlyAdmin nonReentrant {\n        if (oracle == address(0)) revert AddressZero();\n        _stage(_priceOracle, uint160(oracle));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitPriceOracle() external onlyAdmin nonReentrant {\n        _commit(_priceOracle, _priceOracleDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedPriceOracle() external onlyAdmin nonReentrant {\n        _rollback(_priceOracle);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageValidator(\n        address validator_\n    ) external onlyAdmin nonReentrant {\n        if (validator_ == address(0)) revert AddressZero();\n        _stage(_validator, uint160(validator_));\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitValidator() external onlyAdmin nonReentrant {\n        _commit(_validator, _validatorDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedValidator() external onlyAdmin nonReentrant {\n        _rollback(_validator);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function priceOracleDelay() external view returns (uint256) {\n        return _priceOracleDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function ratiosOracleDelay() external view returns (uint256) {\n        return _ratiosOracleDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function validatorDelay() external view returns (uint256) {\n        return _validatorDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageValidatorDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_validatorDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitValidatorDelay() external onlyAdmin nonReentrant {\n        _commit(_validatorDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedValidatorDelay() external onlyAdmin nonReentrant {\n        _rollback(_validatorDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stagePriceOracleDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_priceOracleDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitPriceOracleDelay() external onlyAdmin nonReentrant {\n        _commit(_priceOracleDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedPriceOracleDelay() external onlyAdmin nonReentrant {\n        _rollback(_priceOracleDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageRatiosOracleDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_ratiosOracleDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitRatiosOracleDelay() external onlyAdmin nonReentrant {\n        _commit(_ratiosOracleDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedRatiosOracleDelay() external onlyAdmin nonReentrant {\n        _rollback(_ratiosOracleDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function emergencyWithdrawalDelay() external view returns (uint256) {\n        return _emergencyWithdrawalDelay.value;\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function stageEmergencyWithdrawalDelay(\n        uint256 delay_\n    ) external onlyAdmin nonReentrant {\n        if (delay_ > MAX_DELAY) revert InvalidDelay();\n        _stage(_emergencyWithdrawalDelay, delay_);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function commitEmergencyWithdrawalDelay() external onlyAdmin nonReentrant {\n        _commit(_emergencyWithdrawalDelay, _baseDelay);\n    }\n\n    /// @inheritdoc IVaultConfigurator\n    function rollbackStagedEmergencyWithdrawalDelay()\n        external\n        onlyAdmin\n        nonReentrant\n    {\n        _rollback(_emergencyWithdrawalDelay);\n    }\n}\n"
      },
      "src/interfaces/IVaultConfigurator.sol": {
        "content": "// SPDX-License-Identifier: BSL-1.1\npragma solidity 0.8.25;\n\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport \"./IVault.sol\";\n\n/**\n * @title IVaultConfigurator\n * @notice Contract defining the configuration and access control for a vault system.\n *         This interface specifies the parameters for the primary Vault contract,\n *         facilitating secure configuration updates through a two-stage process: staging and committing, with each parameter update subject to a specified delay.\n *         The stage function sets the new value and timestamp for the parameter, while the commit function finalizes the update\n *\n *         The delay parameter is expressed in seconds and is defined for each parameter of this contract as follows:\n *            - baseDelay: the base delay for stage/commit operations\n *            - depositCallbackDelay: delay for changing the deposit callback contract address\n *            - withdrawalCallbackDelay: delay for changing the withdrawal callback contract address\n *            - withdrawalFeeD9Delay: delay for changing the withdrawal fee\n *            - isDepositLockedDelay: delay for locking deposits\n *            - areTransfersLockedDelay: delay for locking LP token transfers\n *            - delegateModuleApprovalDelay: delay for approving delegated modules\n *            - maximalTotalSupplyDelay: delay for changing the maximum total supply\n *            - ratiosOracleDelay: delay for changing the ratios oracle address\n *            - priceOracleDelay: delay for changing the price oracle address\n *            - validatorDelay: delay for changing the validator address\n *            - emergencyWithdrawalDelay: delay for withdrawing funds after calling registerWithdrawal\n *\n *         Each of the above parameters has a pair of functions, stage/commit, through which their updates occur. The delay for all these parameters is set to baseDelay.\n *\n *         With the exception of functions for isDepositLocked parameter, all mutable functions of the contract can only be called by the vault's admin.\n *         Function for isDepositLocked parameter can be called by either the operator or the vault's admin\n *         to enable faster deposit locking if deemed necessary from the operator/strategy standpoint.\n */\ninterface IVaultConfigurator {\n    /// @dev Errors\n    error AddressZero();\n    error InvalidDelay();\n    error InvalidTimestamp();\n    error InvalidWithdrawalFee();\n    error InvalidTotalSupply();\n\n    /// @notice Struct to represent a staged data change with a delay period.\n    struct Data {\n        uint256 value; // Current value\n        uint256 stagedValue; // Staged value waiting to be committed\n        uint256 stageTimestamp; // Timestamp of staging\n    }\n\n    /// @notice Returns the maximum allowed delay for any staged data.\n    /// @return uint256 The constant `MAX_DELAY` indicating the maximum delay period (365 days).\n    function MAX_DELAY() external pure returns (uint256);\n\n    /// @notice Returns the maximum withdrawal fee allowed.\n    /// @return uint256 The constant `MAX_WITHDRAWAL_FEE` indicating the maximum withdrawal fee (5%).\n    function MAX_WITHDRAWAL_FEE() external pure returns (uint256);\n\n    /// @notice Returns the address of the vault associated with this configurator.\n    /// @return address of the vault contract.\n    function vault() external view returns (address);\n\n    ///@notice Stages an approval for the specified delegate module.\n    /// @param module The address of the module to approve.\n    function stageDelegateModuleApproval(address module) external;\n\n    /// @notice Commits the previously staged delegate module approval after the delay period.\n    /// @param module The address of the module to approve.\n    function commitDelegateModuleApproval(address module) external;\n\n    /// @notice Rolls back any staged delegate module approval.\n    /// @param module The address of the module to roll back.\n    function rollbackStagedDelegateModuleApproval(address module) external;\n\n    /// @notice @notice Revokes the approval of the specified delegate module.\n    /// @param module The address of the module to revoke approval from.\n    function revokeDelegateModuleApproval(address module) external;\n\n    /// @notice Returns the base delay value for all staging operations.\n    /// @return uint256 The base delay value in seconds.\n    function baseDelay() external view returns (uint256);\n\n    /// @notice Checks if the specified delegate module is approved for use.\n    /// @param module The address of the module to check.\n    /// @return bool `true` if the module is approved, otherwise `false`.\n    function isDelegateModuleApproved(\n        address module\n    ) external view returns (bool);\n\n    /// @notice Returns whether deposits are currently locked.\n    /// @notice operator owned parameter.\n    /// @return bool `true` if deposits are locked, otherwise `false`.\n    function isDepositLocked() external view returns (bool);\n\n    /// @notice Returns whether LP token transfers are currently locked.\n    /// @notice admin owned parameter.\n    /// @return bool `true` if transfers are locked, otherwise `false`.\n    function areTransfersLocked() external view returns (bool);\n\n    /// @notice Returns the maximum total supply of LP tokens allowed.\n    /// @return uint256 The maximum total supply of LP tokens.\n    function maximalTotalSupply() external view returns (uint256);\n\n    /// @notice Returns the address of the deposit callback contract.\n    /// @return address The address of the deposit callback contract.\n    function depositCallback() external view returns (address);\n\n    /// @notice Returns the address of the withdrawal callback contract.\n    /// @return address The address of the withdrawal callback contract.\n    function withdrawalCallback() external view returns (address);\n\n    /// @notice Returns the current withdrawal fee in D9 format.\n    /// @return uint256 The withdrawal fee, represented as an integer with 9 decimal places.\n    function withdrawalFeeD9() external view returns (uint256);\n\n    /// @notice Returns the delay for committing deposit callback changes.\n    /// @return uint256 The delay in seconds.\n    function depositCallbackDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing withdrawal callback changes.\n    /// @return uint256 The delay in seconds.\n    function withdrawalCallbackDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing withdrawal fee changes.\n    /// @return uint256 The delay in seconds.\n    function withdrawalFeeD9Delay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing deposit locks.\n    /// @return uint256 The delay in seconds.\n    function isDepositLockedDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing transfers locks.\n    /// @return uint256 The delay in seconds.\n    function areTransfersLockedDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing delegate module approvals.\n    /// @return uint256 The delay in seconds.\n    function delegateModuleApprovalDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing maximum total supply changes.\n    /// @return uint256 The delay in seconds.\n    function maximalTotalSupplyDelay() external view returns (uint256);\n\n    /// @notice Returns the address of the ratios oracle.\n    /// @return address The address of the ratios oracle.\n    function ratiosOracle() external view returns (address);\n\n    /// @notice Returns the address of the price oracle.\n    /// @return address The address of the price oracle.\n    function priceOracle() external view returns (address);\n\n    /// @notice Returns the address of the validator.\n    /// @return address The address of the validator.\n    function validator() external view returns (address);\n\n    /// @notice Returns the delay for committing validator changes.\n    /// @return uint256 The delay in seconds.\n    function validatorDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing price oracle changes.\n    /// @return uint256 The delay in seconds.\n    function priceOracleDelay() external view returns (uint256);\n\n    /// @notice Returns the delay for committing ratios oracle changes.\n    /// @return uint256 The delay in seconds.\n    function ratiosOracleDelay() external view returns (uint256);\n\n    /// @notice Returns the delay required between calling `registerWithdrawal` and being able to perform an emergency withdrawal for that request.\n    /// @return uint256 The minimum delay time, in seconds, that a user must wait after calling `registerWithdrawal` before executing an emergency withdrawal.\n    function emergencyWithdrawalDelay() external view returns (uint256);\n\n    /// @notice Stages the deposits lock by setting a staged value and timestamp.\n    function stageDepositsLock() external;\n\n    /// @notice Commits the previously staged deposits lock after the delay period.\n    function commitDepositsLock() external;\n\n    /// @notice Rolls back any staged deposits lock.\n    function rollbackStagedDepositsLock() external;\n\n    /// @notice Revokes the current deposits lock, unlocking deposits.\n    function revokeDepositsLock() external;\n\n    /// @notice Stages the transfers lock by setting a staged value and timestamp.\n    /// @param flag The new value to stage.\n    function stageTransfersLock(bool flag) external;\n\n    /// @notice Commits the previously staged transfers lock after the delay period.\n    function commitTransfersLock() external;\n\n    /// @notice Rolls back any staged transfers lock.\n    function rollbackStagedTransfersLock() external;\n\n    /// @notice Stages the maximum total supply with a staged value and timestamp.\n    /// @param maximalTotalSupply_ The maximum total supply to stage.\n    function stageMaximalTotalSupply(uint256 maximalTotalSupply_) external;\n\n    /// @notice Commits the previously staged maximum total supply after the delay period.\n    function commitMaximalTotalSupply() external;\n\n    /// @notice Rolls back any staged maximum total supply changes.\n    function rollbackStagedMaximalTotalSupply() external;\n\n    /// @notice Stages a new deposit callback address.\n    /// @param callback The address of the new deposit callback contract.\n    function stageDepositCallback(address callback) external;\n\n    /// @notice Commits the previously staged deposit callback address after the delay period.\n    function commitDepositCallback() external;\n\n    /// @notice Rolls back any staged deposit callback changes.\n    function rollbackStagedDepositCallback() external;\n\n    /// @notice Stages a new withdrawal callback address.\n    /// @param callback The address of the new withdrawal callback contract.\n    function stageWithdrawalCallback(address callback) external;\n\n    /// @notice Commits the previously staged withdrawal callback address after the delay period.\n    function commitWithdrawalCallback() external;\n\n    /// @notice Rolls back any staged withdrawal callback changes.\n    function rollbackStagedWithdrawalCallback() external;\n\n    /// @notice Stages a new withdrawal fee in D9 format.\n    /// @param feeD9 The new withdrawal fee in D9 format.\n    function stageWithdrawalFeeD9(uint256 feeD9) external;\n\n    /// @notice Commits the previously staged withdrawal fee after the delay period.\n    function commitWithdrawalFeeD9() external;\n\n    /// @notice Rolls back any staged withdrawal fee changes.\n    function rollbackStagedWithdrawalFeeD9() external;\n\n    /// @notice Stages a base delay value.\n    /// @param delay_ The base delay value to stage.\n    function stageBaseDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged base delay after the delay period.\n    function commitBaseDelay() external;\n\n    /// @notice Rolls back any staged base delay changes.\n    function rollbackStagedBaseDelay() external;\n\n    /// @notice Stages a delay value for the deposit callback.\n    /// @param delay_ The delay value to stage.\n    function stageDepositCallbackDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged deposit callback delay after the delay period.\n    function commitDepositCallbackDelay() external;\n\n    /// @notice Rolls back any staged deposit callback delay changes.\n    function rollbackStagedDepositCallbackDelay() external;\n\n    /// @notice Stages a delay value for the withdrawal callback.\n    /// @param delay_ The delay value to stage.\n    function stageWithdrawalCallbackDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged withdrawal callback delay after the delay period.\n    function commitWithdrawalCallbackDelay() external;\n\n    /// @notice Rolls back any staged withdrawal callback delay changes.\n    function rollbackStagedWithdrawalCallbackDelay() external;\n\n    /// @notice Stages a delay value for the withdrawal fee in D9 format.\n    /// @param delay_ The delay value to stage.\n    function stageWithdrawalFeeD9Delay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged withdrawal fee delay after the delay period.\n    function commitWithdrawalFeeD9Delay() external;\n\n    /// @notice Rolls back any staged withdrawal fee delay changes.\n    function rollbackStagedWithdrawalFeeD9Delay() external;\n\n    /// @notice Stages a delay value for locking deposits.\n    /// @param delay_ The delay value to stage.\n    function stageDepositsLockedDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged deposits lock delay after the delay period.\n    function commitDepositsLockedDelay() external;\n\n    /// @notice Rolls back any staged deposits lock delay changes.\n    function rollbackStagedDepositsLockedDelay() external;\n\n    /// @notice Stages a delay value for locking transfers.\n    /// @param delay_ The delay value to stage.\n    function stageTransfersLockedDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged transfers lock delay after the delay period.\n    function commitTransfersLockedDelay() external;\n\n    /// @notice Rolls back any staged transfers lock delay changes.\n    function rollbackStagedTransfersLockedDelay() external;\n\n    /// @notice Stages a delay value for the delegate module approval.\n    /// @param delay_ The delay value to stage.\n    function stageDelegateModuleApprovalDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged delegate module approval delay after the delay period.\n    function commitDelegateModuleApprovalDelay() external;\n\n    /// @notice Rolls back any staged delegate module approval delay changes.\n    function rollbackStagedDelegateModuleApprovalDelay() external;\n\n    /// @notice Stages a delay value for the maximum total supply.\n    /// @param delay_ The delay value to stage.\n    function stageMaximalTotalSupplyDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged maximum total supply delay after the delay period.\n    function commitMaximalTotalSupplyDelay() external;\n\n    /// @notice Rolls back any staged maximum total supply delay changes.\n    function rollbackStagedMaximalTotalSupplyDelay() external;\n\n    /// @notice Stages a ratios oracle address.\n    /// @param oracle The address of the new ratios oracle.\n    function stageRatiosOracle(address oracle) external;\n\n    /// @notice Commits the previously staged ratios oracle after the delay period.\n    function commitRatiosOracle() external;\n\n    /// @notice Rolls back any staged ratios oracle changes.\n    function rollbackStagedRatiosOracle() external;\n\n    /// @notice Stages a price oracle address.\n    /// @param oracle The address of the new price oracle.\n    function stagePriceOracle(address oracle) external;\n\n    /// @notice Commits the previously staged price oracle after the delay period.\n    function commitPriceOracle() external;\n\n    /// @notice Rolls back any staged price oracle changes.\n    function rollbackStagedPriceOracle() external;\n\n    /// @notice Stages a validator address.\n    /// @param validator_ The address of the new validator.\n    function stageValidator(address validator_) external;\n\n    /// @notice Commits the previously staged validator after the delay period.\n    function commitValidator() external;\n\n    /// @notice Rolls back any staged validator changes.\n    function rollbackStagedValidator() external;\n\n    /// @notice Stages a delay value for the validator.\n    /// @param delay_ The delay value to stage.\n    function stageValidatorDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged validator delay after the delay period.\n    function commitValidatorDelay() external;\n\n    /// @notice Rolls back any staged validator delay changes.\n    function rollbackStagedValidatorDelay() external;\n\n    /// @notice Stages a delay value for the price oracle.\n    /// @param delay_ The delay value to stage.\n    function stagePriceOracleDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged price oracle delay after the delay period.\n    function commitPriceOracleDelay() external;\n\n    /// @notice Rolls back any staged price oracle delay changes.\n    function rollbackStagedPriceOracleDelay() external;\n\n    /// @notice Stages a delay value for the ratios oracle.\n    /// @param delay_ The delay value to stage.\n    function stageRatiosOracleDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged ratios oracle delay after the delay period.\n    function commitRatiosOracleDelay() external;\n\n    /// @notice Rolls back any staged ratios oracle delay changes.\n    function rollbackStagedRatiosOracleDelay() external;\n\n    /// @notice Stages a delay value for emergency withdrawals.\n    /// @param delay_ The delay value to stage.\n    function stageEmergencyWithdrawalDelay(uint256 delay_) external;\n\n    /// @notice Commits the previously staged emergency withdrawal delay.\n    function commitEmergencyWithdrawalDelay() external;\n\n    /// @notice Rolls back any staged emergency withdrawal delay changes.\n    function rollbackStagedEmergencyWithdrawalDelay() external;\n\n    /// @dev Emitted when a value is staged for future commitment for given slot.\n    event Stage(\n        bytes32 indexed slot,\n        Data indexed data,\n        uint256 value,\n        uint256 timestamp\n    );\n\n    /// @dev Emitted when a staged value is committed and updated for given slot.\n    event Commit(bytes32 indexed slot, Data indexed data, uint256 timestamp);\n\n    /// @dev Emitted when a staged value is rolled back without commitment for given slot.\n    event Rollback(bytes32 indexed slot, Data indexed data, uint256 timestamp);\n}\n"
      },
      "src/utils/DefaultAccessControl.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.25;\n\nimport \"@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\";\nimport \"../interfaces/utils/IDefaultAccessControl.sol\";\n\ncontract DefaultAccessControl is\n    IDefaultAccessControl,\n    AccessControlEnumerable\n{\n    bytes32 public constant OPERATOR = keccak256(\"operator\");\n    bytes32 public constant ADMIN_ROLE = keccak256(\"admin\");\n    bytes32 public constant ADMIN_DELEGATE_ROLE = keccak256(\"admin_delegate\");\n\n    /// @notice Creates a new contract.\n    /// @param admin Admin of the contract\n    constructor(address admin) {\n        if (admin == address(0)) revert AddressZero();\n\n        _grantRole(OPERATOR, admin);\n        _grantRole(ADMIN_ROLE, admin);\n\n        _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);\n        _setRoleAdmin(ADMIN_DELEGATE_ROLE, ADMIN_ROLE);\n        _setRoleAdmin(OPERATOR, ADMIN_DELEGATE_ROLE);\n    }\n\n    /// @inheritdoc IDefaultAccessControl\n    function isAdmin(address sender) public view returns (bool) {\n        return\n            hasRole(ADMIN_ROLE, sender) || hasRole(ADMIN_DELEGATE_ROLE, sender);\n    }\n\n    /// @inheritdoc IDefaultAccessControl\n    function isOperator(address sender) public view returns (bool) {\n        return hasRole(OPERATOR, sender);\n    }\n\n    /// @inheritdoc IDefaultAccessControl\n    function requireAdmin(address sender) external view override {\n        _requireAdmin(sender);\n    }\n\n    /// @inheritdoc IDefaultAccessControl\n    function requireAtLeastOperator(address sender) external view override {\n        _requireAtLeastOperator(sender);\n    }\n\n    function _requireAdmin(address sender) internal view {\n        if (!isAdmin(sender)) revert Forbidden();\n    }\n\n    function _requireAtLeastOperator(address sender) internal view {\n        if (!isAdmin(sender) && !isOperator(sender)) revert Forbidden();\n    }\n\n    function _requireAdmin() internal view {\n        _requireAdmin(msg.sender);\n    }\n\n    function _requireAtLeastOperator() internal view {\n        _requireAtLeastOperator(msg.sender);\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      },
      "src/interfaces/IVault.sol": {
        "content": "// SPDX-License-Identifier: BSL-1.1\npragma solidity 0.8.25;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/utils/Arrays.sol\";\n\nimport \"./modules/ITvlModule.sol\";\nimport \"./validators/IValidator.sol\";\n\nimport \"./oracles/IPriceOracle.sol\";\nimport \"./oracles/IRatiosOracle.sol\";\n\nimport \"./utils/IDepositCallback.sol\";\nimport \"./utils/IWithdrawalCallback.sol\";\n\nimport \"./IVaultConfigurator.sol\";\n\n/**\n * @title IVault\n * @notice Interface defining core methods, constants, and errors for vault contracts.\n * Includes events, data structures, functions, and permissions required for managing the vault.\n * @dev Main contract of the system managing interactions between users, administrators, and operators.\n *      System parameters are set within the corresponding contract - VaultConfigurator.\n *      Upon deposit, LP tokens are issued to users based on asset valuation by oracles.\n *      Deposits are made through the deposit function, where a deposit can only be made in underlyingTokens and\n *      only at the specified ratiosOracle ratio. Deposits can be paused by setting the isDepositLocked flag.\n *\n *      Withdrawals can occur through two scenarios:\n *          - Regular withdrawal via the registerWithdrawal function and emergency withdrawal via the emergencyWithdraw function.\n *          In a regular withdrawal, the user registers a withdrawal request, after which the operator must perform a series of operations\n *          to ensure there are enough underlyingTokens on the vault's balance to fulfill the user's request. Subsequently, the operator must call\n *          the processWithdrawals function. If a user's request is not processed within the emergencyWithdrawalDelay period, the user can perform an emergency withdrawal.\n *          Note! In this case, the user may receive less funds than entitled by the system, as this function only handles ERC20 tokens in the system.\n *          Therefore, if the system has a base asset that is not represented as an ERC20 token, the corresponding portion of the funds will be lost by the user.\n *\n *      It is assumed that the main system management will occur through calls to delegateModules via delegateCalls on behalf of the operator.\n *      For this to be possible, certain conditions must be met:\n *          - From the validator's perspective, two conditions must be met:\n *              1. The caller must have the right to call the delegateCall function with the corresponding data parameter.\n *              2. The contract itself must be able to call the function on the delegateModule with the specified data.\n *          - From the configurator's perspective, the called module must have the appropriate approval - isDelegateModuleApproved.\n *\n *      If external calls need to be made, the externalCall function is used, for the execution of which a similar set of properties exists:\n *          - From the validator's perspective, two conditions must be met:\n *              1. The caller must have the right to call the externalCall function with the corresponding data parameter.\n *              2. The contract itself must be able to call the function on the external contract with the specified data.\n *          - From the configurator's perspective, the called contract must NOT have isDelegateModuleApproved permission.\n *\n *      Vault also has the functionality of adding and removing underlyingTokens, as well as tvlModules.\n *      For this purpose, the following functions are available, which can only be called by the vault's admin:\n *          - addToken\n *          - removeToken\n *          - addTvlModule\n *          - removeTvlModule\n *      Upon calling removeToken, it is checked that the underlyingTvl function for the specified token returns a zero value. Otherwise, the function reverts with a NonZeroValue error.\n *      It is important to note that there is no such check when calling removeTvlModule, so when updating parameters, sequential execution of a transaction to remove the old and add the new tvlModule is implied.\n */\ninterface IVault is IERC20 {\n    /// @dev Errors\n    error Deadline();\n    error InvalidState();\n    error InvalidLength();\n    error InvalidToken();\n    error NonZeroValue();\n    error ValueZero();\n    error InsufficientLpAmount();\n    error InsufficientAmount();\n    error LimitOverflow();\n    error AlreadyAdded();\n\n    /// @notice Struct representing a user's withdrawal request.\n    struct WithdrawalRequest {\n        address to;\n        uint256 lpAmount;\n        bytes32 tokensHash; // keccak256 hash of the tokens array at the moment of request\n        uint256[] minAmounts;\n        uint256 deadline;\n        uint256 timestamp;\n    }\n\n    /// @notice Struct representing the current state used for processing withdrawals.\n    struct ProcessWithdrawalsStack {\n        address[] tokens;\n        uint128[] ratiosX96;\n        uint256[] erc20Balances;\n        uint256 totalSupply;\n        uint256 totalValue;\n        uint256 ratiosX96Value;\n        uint256 timestamp;\n        uint256 feeD9;\n        bytes32 tokensHash; // keccak256 hash of the tokens array at the moment of the call\n    }\n\n    /// @notice 2^96, used for fixed-point arithmetic\n    function Q96() external view returns (uint256);\n\n    /// @notice Multiplier of 1e9\n    function D9() external view returns (uint256);\n\n    /// @notice Returns the vault's configurator, which handles permissions and configuration settings.\n    /// @return IVaultConfigurator The address of the configurator contract.\n    function configurator() external view returns (IVaultConfigurator);\n\n    /// @notice Returns the withdrawal request of a given user.\n    /// @param user The address of the user.\n    /// @return request The withdrawal request associated with the user.\n    function withdrawalRequest(\n        address user\n    ) external view returns (WithdrawalRequest memory request);\n\n    /// @return count The number of users with pending withdrawal requests.\n    function pendingWithdrawersCount() external view returns (uint256 count);\n\n    /// @notice Returns an array of addresses with pending withdrawal requests.\n    /// @return users An array of addresses with pending withdrawal requests.\n    function pendingWithdrawers()\n        external\n        view\n        returns (address[] memory users);\n\n    /// @notice Returns an array of addresses with pending withdrawal requests.\n    /// @param limit The maximum number of users to return.\n    /// @param offset The number of users to skip before returning.\n    /// @return users An array of addresses with pending withdrawal requests.\n    function pendingWithdrawers(\n        uint256 limit,\n        uint256 offset\n    ) external view returns (address[] memory users);\n\n    /// @notice Returns an array of underlying tokens of the vault.\n    /// @return underlyinigTokens_ An array of underlying token addresses.\n    function underlyingTokens()\n        external\n        view\n        returns (address[] memory underlyinigTokens_);\n\n    /// @notice Checks if a token is an underlying token of the vault.\n    /// @return isUnderlyingToken_ true if the token is an underlying token of the vault.\n    function isUnderlyingToken(\n        address token\n    ) external view returns (bool isUnderlyingToken_);\n\n    /// @notice Returns an array of addresses of all TVL modules.\n    /// @return tvlModules_ An array of TVL module addresses.\n    function tvlModules() external view returns (address[] memory tvlModules_);\n\n    /// @notice Calculates and returns the total value locked (TVL) of the underlying tokens.\n    /// @return tokens An array of underlying token addresses.\n    /// @return amounts An array of the amounts of each underlying token in the TVL.\n    function underlyingTvl()\n        external\n        view\n        returns (address[] memory tokens, uint256[] memory amounts);\n\n    /// @notice Calculates and returns the base TVL (Total Value Locked) across all tokens in the vault.\n    /// @return tokens An array of token addresses.\n    /// @return amounts An array of the amounts of each token in the base TVL.\n    function baseTvl()\n        external\n        view\n        returns (address[] memory tokens, uint256[] memory amounts);\n\n    /// @notice Adds a new token to the list of underlying tokens in the vault.\n    /// @dev Only accessible by an admin.\n    /// @param token The address of the token to add.\n    function addToken(address token) external;\n\n    /// @notice Removes a token from the list of underlying tokens in the vault.\n    /// @dev Only accessible by an admin.\n    /// @param token The address of the token to remove.\n    function removeToken(address token) external;\n\n    /// @notice Adds a new TVL module to the vault.\n    /// @dev Only accessible by an admin.\n    /// @param module The address of the TVL module to add.\n    function addTvlModule(address module) external;\n\n    /// @notice Removes an existing TVL module from the vault.\n    /// @dev Only accessible by an admin.\n    /// @param module The address of the TVL module to remove.\n    function removeTvlModule(address module) external;\n\n    /// @notice Performs an external call to a given address with specified data.\n    /// @dev Only operators or admins should call this function. Checks access permissions.\n    /// @param to The address to which the call will be made.\n    /// @param data The calldata to use for the external call.\n    /// @return success Indicates if the call was successful.\n    /// @return response The response data from the external call.\n    /// @dev Checks permissions using the validator from the configurator.\n    function externalCall(\n        address to,\n        bytes calldata data\n    ) external returns (bool success, bytes memory response);\n\n    /// @notice Executes a delegate call to a specified address with given data.\n    /// @dev Only operators or admins should call this function. Checks access permissions.\n    /// @param to The address to which the delegate call will be made.\n    /// @param data The calldata to use for the delegate call.\n    /// @return success Indicates if the delegate call was successful.\n    /// @return response The response data from the delegate call.\n    /// @dev Checks permissions using the validator from the configurator.\n    function delegateCall(\n        address to,\n        bytes calldata data\n    ) external returns (bool success, bytes memory response);\n\n    /// @notice Deposits specified amounts of tokens into the vault in exchange for LP tokens.\n    /// @dev Only accessible when deposits are unlocked.\n    /// @param to The address to receive LP tokens.\n    /// @param amounts An array specifying the amounts for each underlying token.\n    /// @param minLpAmount The minimum amount of LP tokens to mint.\n    /// @param deadline The time before which the operation must be completed.\n    /// @return actualAmounts The actual amounts deposited for each underlying token.\n    /// @return lpAmount The amount of LP tokens minted.\n    function deposit(\n        address to,\n        uint256[] memory amounts,\n        uint256 minLpAmount,\n        uint256 deadline\n    ) external returns (uint256[] memory actualAmounts, uint256 lpAmount);\n\n    /// @notice Handles emergency withdrawals, proportionally withdrawing all tokens in the system (not just the underlying).\n    /// @dev Transfers tokens based on the user's share of lpAmount / totalSupply.\n    /// @param minAmounts An array of minimum amounts expected for each underlying token.\n    /// @param deadline The time before which the operation must be completed.\n    /// @return actualAmounts The actual amounts withdrawn for each token.\n    function emergencyWithdraw(\n        uint256[] memory minAmounts,\n        uint256 deadline\n    ) external returns (uint256[] memory actualAmounts);\n\n    /// @notice Cancels a pending withdrawal request.\n    function cancelWithdrawalRequest() external;\n\n    /// @notice Registers a new withdrawal request, optionally closing previous requests.\n    /// @param to The address to receive the withdrawn tokens.\n    /// @param lpAmount The amount of LP tokens to withdraw.\n    /// @param minAmounts An array specifying minimum amounts for each token.\n    /// @param deadline The time before which the operation must be completed.\n    /// @param requestDeadline The deadline before which the request should be fulfilled.\n    /// @param closePrevious Whether to close a previous request if it exists.\n    function registerWithdrawal(\n        address to,\n        uint256 lpAmount,\n        uint256[] memory minAmounts,\n        uint256 deadline,\n        uint256 requestDeadline,\n        bool closePrevious\n    ) external;\n\n    /// @notice Analyzes a withdrawal request based on the current vault state.\n    /// @param s The current state stack to use for analysis.\n    /// @param request The withdrawal request to analyze.\n    /// @return processingPossible Whether processing is possible based on current vault state.\n    /// @return withdrawalPossible Whether the withdrawal can be fulfilled.\n    /// @return expectedAmounts The expected amounts to be withdrawn for each token.\n    function analyzeRequest(\n        ProcessWithdrawalsStack memory s,\n        WithdrawalRequest memory request\n    )\n        external\n        pure\n        returns (\n            bool processingPossible,\n            bool withdrawalPossible,\n            uint256[] memory expectedAmounts\n        );\n\n    /// @notice Calculates and returns the state stack required for processing withdrawal requests.\n    /// @return s The state stack with current vault balances and data.\n    function calculateStack()\n        external\n        view\n        returns (ProcessWithdrawalsStack memory s);\n\n    /// @notice Processes multiple withdrawal requests by fulfilling eligible withdrawals.\n    /// @param users An array of user addresses whose withdrawal requests should be processed.\n    /// @return statuses An array indicating the status of each user's withdrawal request.\n    function processWithdrawals(\n        address[] memory users\n    ) external returns (bool[] memory statuses);\n\n    /**\n     * @notice Emitted when a token is added to the vault.\n     * @param token The address of the token added.\n     */\n    event TokenAdded(address token);\n\n    /**\n     * @notice Emitted when a token is removed from the vault.\n     * @param token The address of the token removed.\n     */\n    event TokenRemoved(address token);\n\n    /**\n     * @notice Emitted when a TVL module is added to the vault.\n     * @param module The address of the TVL module added.\n     */\n    event TvlModuleAdded(address module);\n\n    /**\n     * @notice Emitted when a TVL module is removed from the vault.\n     * @param module The address of the TVL module removed.\n     */\n    event TvlModuleRemoved(address module);\n\n    /**\n     * @notice Emitted when an external call is made.\n     * @param to The address of the contract called.\n     * @param data The calldata of the call.\n     * @param success The success status of the call.\n     * @param response The response data of the call.\n     */\n    event ExternalCall(\n        address indexed to,\n        bytes data,\n        bool success,\n        bytes response\n    );\n\n    /**\n     * @notice Emitted when a delegate call is made.\n     * @param to The address of the contract called.\n     * @param data The calldata of the call.\n     * @param success The success status of the call.\n     * @param response The response data of the call.\n     */\n    event DelegateCall(\n        address indexed to,\n        bytes data,\n        bool success,\n        bytes response\n    );\n\n    /**\n     * @notice Emitted when a deposit occurs.\n     * @param to The address where LP tokens are deposited.\n     * @param amounts The amounts of tokens deposited.\n     * @param lpAmount The amount of LP tokens minted.\n     */\n    event Deposit(address indexed to, uint256[] amounts, uint256 lpAmount);\n\n    /**\n     * @notice Emitted when a deposit callback occurs.\n     * @param callback The address of the deposit callback contract.\n     * @param amounts The amounts of tokens deposited.\n     * @param lpAmount The amount of LP tokens minted.\n     */\n    event DepositCallback(\n        address indexed callback,\n        uint256[] amounts,\n        uint256 lpAmount\n    );\n\n    /**\n     * @notice Emitted when a withdrawal request is made.\n     * @param from The address of the user making the request.\n     * @param request The details of the withdrawal request.\n     */\n    event WithdrawalRequested(address indexed from, WithdrawalRequest request);\n\n    /**\n     * @notice Emitted when a withdrawal request is canceled.\n     * @param user The address of the user canceling the request.\n     * @param origin The origin of the cancellation.\n     */\n    event WithdrawalRequestCanceled(address indexed user, address origin);\n\n    /**\n     * @notice Emitted when an emergency withdrawal occurs.\n     * @param from The address of the user initiating the emergency withdrawal.\n     * @param request The details of the withdrawal request.\n     * @param amounts The actual amounts withdrawn.\n     */\n    event EmergencyWithdrawal(\n        address indexed from,\n        WithdrawalRequest request,\n        uint256[] amounts\n    );\n\n    /**\n     * @notice Emitted when withdrawals are processed.\n     * @param users The addresses of the users whose withdrawals are processed.\n     * @param statuses The statuses of the withdrawal processing.\n     */\n    event WithdrawalsProcessed(address[] users, bool[] statuses);\n\n    /**\n     * @notice Emitted when a withdrawal callback occurs.\n     * @param callback The address of the withdrawal callback contract.\n     */\n    event WithdrawCallback(address indexed callback);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControlEnumerable} from \"./IAccessControlEnumerable.sol\";\nimport {AccessControl} from \"../AccessControl.sol\";\nimport {EnumerableSet} from \"../../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 role => 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 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 returns (uint256) {\n        return _roleMembers[role].length();\n    }\n\n    /**\n     * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n     */\n    function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n        bool granted = super._grantRole(role, account);\n        if (granted) {\n            _roleMembers[role].add(account);\n        }\n        return granted;\n    }\n\n    /**\n     * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n        bool revoked = super._revokeRole(role, account);\n        if (revoked) {\n            _roleMembers[role].remove(account);\n        }\n        return revoked;\n    }\n}\n"
      },
      "src/interfaces/utils/IDefaultAccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\nimport \"@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\";\n\n/// @notice This is a default access control with 3 roles:\n///\n/// - ADMIN: allowed to do anything\n/// - ADMIN_DELEGATE: allowed to do anything except assigning ADMIN and ADMIN_DELEGATE roles\n/// - OPERATOR: low-privileged role, generally keeper or some other bot\ninterface IDefaultAccessControl is IAccessControlEnumerable {\n    error Forbidden();\n    error AddressZero();\n\n    function OPERATOR() external view returns (bytes32);\n\n    function ADMIN_ROLE() external view returns (bytes32);\n\n    function ADMIN_DELEGATE_ROLE() external view returns (bytes32);\n\n    /// @notice Checks that the address is contract admin.\n    /// @param who Address to check\n    /// @return `true` if who is admin, `false` otherwise\n    function isAdmin(address who) external view returns (bool);\n\n    /// @notice Checks that the address is contract admin.\n    /// @param who Address to check\n    /// @return `true` if who is operator, `false` otherwise\n    function isOperator(address who) external view returns (bool);\n\n    /// @notice Checks that the address is contract admin.\n    /// @param who Address to check\n    /// @dev throws Forbbiden() if the sender does not have the admin or admin_delegate role\n    function requireAdmin(address who) external view;\n\n    /// @notice Checks that the address is contract admin.\n    /// @param who Address to check\n    /// @dev throws Forbbiden() if the sender has no roles\n    function requireAtLeastOperator(address who) external view;\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     * ```\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Arrays.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\nimport {Math} from \"./math/Math.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary Arrays {\n    using StorageSlot for bytes32;\n\n    /**\n     * @dev Searches a sorted `array` and returns the first index that contains\n     * a value greater or equal to `element`. If no such index exists (i.e. all\n     * values in the array are strictly less than `element`), the array length is\n     * returned. Time complexity O(log n).\n     *\n     * `array` is expected to be sorted in ascending order, and to contain no\n     * repeated elements.\n     */\n    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n        uint256 low = 0;\n        uint256 high = array.length;\n\n        if (high == 0) {\n            return 0;\n        }\n\n        while (low < high) {\n            uint256 mid = Math.average(low, high);\n\n            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n            // because Math.average rounds towards zero (it does integer division with truncation).\n            if (unsafeAccess(array, mid).value > element) {\n                high = mid;\n            } else {\n                low = mid + 1;\n            }\n        }\n\n        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n        if (low > 0 && unsafeAccess(array, low - 1).value == element) {\n            return low - 1;\n        } else {\n            return low;\n        }\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {\n        bytes32 slot;\n        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`\n        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0, arr.slot)\n            slot := add(keccak256(0, 0x20), pos)\n        }\n        return slot.getAddressSlot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {\n        bytes32 slot;\n        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`\n        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0, arr.slot)\n            slot := add(keccak256(0, 0x20), pos)\n        }\n        return slot.getBytes32Slot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {\n        bytes32 slot;\n        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`\n        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0, arr.slot)\n            slot := add(keccak256(0, 0x20), pos)\n        }\n        return slot.getUint256Slot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n}\n"
      },
      "src/interfaces/modules/ITvlModule.sol": {
        "content": "// SPDX-License-Identifier: BSL-1.1\npragma solidity 0.8.25;\n\n/**\n * @title ITvlModule\n * @notice Interface for a Total Value Locked (TVL) module, providing information about token balances.\n */\ninterface ITvlModule {\n    // Structure representing TVL data for a token\n    struct Data {\n        address token; // Address of the token\n        address underlyingToken; // Address of the underlying token\n        uint256 amount; // Current amount of the token\n        uint256 underlyingAmount; // Current amount of the underlying token\n        bool isDebt; // Flag indicating if the token represents debt\n    }\n\n    /**\n     * @notice Returns Total Value Locked (TVL) data for a specific user.\n     * @param user The address of the user.\n     * @return data An array of TVL data for each token held by the user.\n     */\n    function tvl(address user) external view returns (Data[] memory data);\n}\n"
      },
      "src/interfaces/validators/IValidator.sol": {
        "content": "// SPDX-License-Identifier: BSL-1.1\npragma solidity 0.8.25;\n\n/**\n * @title IValidator\n * @notice Interface defining a generic validator for transaction data.\n */\ninterface IValidator {\n    /**\n     * @notice Validates a transaction involving two addresses based on the provided calldata.\n     * @param from The address initiating the transaction.\n     * @param to The target address of the transaction.\n     * @param data The transaction data containing the function selector and any necessary parameters.\n     * @dev Implementers should validate that the transaction is authorized, properly formatted, and adheres to the required business logic.\n     *      Reverts if the transaction is invalid.\n     */\n    function validate(\n        address from,\n        address to,\n        bytes calldata data\n    ) external view;\n}\n"
      },
      "src/interfaces/oracles/IPriceOracle.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.25;\n\n/**\n * @title IPriceOracle\n * @notice Interface defining a standard price oracle that provides token prices in 96-bit precision.\n */\ninterface IPriceOracle {\n    /**\n     * @notice Returns the price of a specific token relative to the base token of the given vault, expressed in 96-bit precision.\n     * @param vault The address of the vault requesting the price.\n     * @param token The address of the token to calculate the price for.\n     * @return priceX96_ The price of the token relative to the base token, using 96-bit precision.\n     * @dev Implementations should ensure prices are accurate and may involve external oracle data.\n     *      Reverts with an appropriate error if the price cannot be provided.\n     */\n    function priceX96(\n        address vault,\n        address token\n    ) external view returns (uint256 priceX96_);\n}\n"
      },
      "src/interfaces/oracles/IRatiosOracle.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.25;\n\n/**\n * @title IRatiosOracle\n * @notice Interface for a ratios oracle, providing the target allocation ratios for a vault.\n */\ninterface IRatiosOracle {\n    /**\n     * @notice Retrieves the target allocation ratios (using 96-bit precision) for a specific vault's tokens.\n     * @param vault The address of the vault requesting the ratios.\n     * @param isDeposit A boolean indicating whether the ratios are for a deposit or a withdrawal.\n     * @return ratiosX96 An array representing the target ratios for each token, expressed in 96-bit precision.\n     * @dev The array of ratios should align with the underlying tokens associated with the vault.\n     *      Reverts if the ratios cannot be provided due to missing or mismatched data.\n     */\n    function getTargetRatiosX96(\n        address vault,\n        bool isDeposit\n    ) external view returns (uint128[] memory ratiosX96);\n}\n"
      },
      "src/interfaces/utils/IDepositCallback.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\n/**\n * @title IDepositCallback\n * @notice Interface defining a callback function to handle deposit results.\n */\ninterface IDepositCallback {\n    /**\n     * @notice Handles the callback after a deposit operation has been executed.\n     * @param actualAmounts An array representing the actual amounts of each token that were deposited.\n     * @param lpAmount The total amount of LP tokens that were issued as a result of the deposit.\n     * @dev This function is intended to be implemented by contracts that need to take further action following a deposit.\n     */\n    function depositCallback(\n        uint256[] memory actualAmounts,\n        uint256 lpAmount\n    ) external;\n}\n"
      },
      "src/interfaces/utils/IWithdrawalCallback.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\n/**\n * @title IWithdrawalCallback\n * @notice Interface defining a callback function to handle post-withdrawal actions in processWithdrawals function.\n */\ninterface IWithdrawalCallback {\n    /**\n     * @notice Handles the callback after a withdrawal operation has been executed.\n     * @dev This function should be implemented to carry out any additional actions required after the withdrawal.\n     *      It does not take any parameters and will be invoked once the withdrawal process is complete.\n     */\n    function withdrawalCallback() external;\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"../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"
      },
      "lib/openzeppelin-contracts/contracts/access/AccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"./IAccessControl.sol\";\nimport {Context} from \"../utils/Context.sol\";\nimport {ERC165} from \"../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 account => bool) hasRole;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 role => 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 an {AccessControlUnauthorizedAccount} error including the required role.\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 returns (bool) {\n        return _roles[role].hasRole[account];\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n     * is missing `role`.\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert AccessControlUnauthorizedAccount(account, role);\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 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 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 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 `callerConfirmation`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n        if (callerConfirmation != _msgSender()) {\n            revert AccessControlBadConfirmation();\n        }\n\n        _revokeRole(role, callerConfirmation);\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 Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (!hasRole(role, account)) {\n            _roles[role].hasRole[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (hasRole(role, account)) {\n            _roles[role].hasRole[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.20;\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 is the index of the value in the `values` array plus 1.\n        // Position 0 is used to mean a value is not in the set.\n        mapping(bytes32 value => uint256) _positions;\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._positions[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 cache the value's position to prevent multiple reads from the same storage slot\n        uint256 position = set._positions[value];\n\n        if (position != 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 valueIndex = position - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (valueIndex != lastIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the lastValue to the index where the value to delete is\n                set._values[valueIndex] = lastValue;\n                // Update the tracked position of the lastValue (that was just moved)\n                set._positions[lastValue] = position;\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the tracked position for the deleted slot\n            delete set._positions[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._positions[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"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert FailedInnerCall();\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(newImplementation.code.length > 0);\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Muldiv operation overflow.\n     */\n    error MathOverflowedMulDiv();\n\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            return a / b;\n        }\n\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0 = x * y; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                revert MathOverflowedMulDiv();\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/access/IAccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev The `account` is missing a role.\n     */\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n    /**\n     * @dev The caller of a function is not the expected one.\n     *\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n     */\n    error AccessControlBadConfirmation();\n\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    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 `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "forge-std/=lib/forge-std/src/",
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "@symbiotic/=lib/core/src/contracts/",
        "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200,
        "details": {
          "yul": true,
          "yulDetails": {
            "stackAllocation": true
          }
        }
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}