ETH Price: $2,497.00 (-0.04%)

Transaction Decoder

Block:
21176131 at Nov-13-2024 03:38:23 AM +UTC
Transaction Fee:
0.003668586266490131 ETH $9.16
Gas Used:
137,081 Gas / 26.762179051 Gwei

Emitted Events:

202 BeaconProxy.0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef( 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, 0x00000000000000000000000054e44dbb92dba848ace27f44c0cb4268981ef1cc, 0x0000000000000000000000000000000000000000000000000000000000000000, 00000000000000000000000000000000000000000000000014b7d4e7d6bc561f )
203 TransparentUpgradeableProxy.0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef( 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, 0x0000000000000000000000001b4d88f5f38988bea334c79f48aa69beeefe2e1e, 0x000000000000000000000000afc22395f57ec9347c3708d56516836a38017fad, 00000000000000000000000000000000000000000000000014b7d4e7d6bc561f )
204 BeaconProxy.0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db( 0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db, 0x00000000000000000000000054e44dbb92dba848ace27f44c0cb4268981ef1cc, 0x000000000000000000000000afc22395f57ec9347c3708d56516836a38017fad, 0x00000000000000000000000054e44dbb92dba848ace27f44c0cb4268981ef1cc, 00000000000000000000000000000000000000000000000014b7d4e7d6bc561f, 00000000000000000000000000000000000000000000000014b7d4e7d6bc561f )
205 0xafa904152e04abff56701223118be2832a4449e0.0x486508c3c40ef7985dcc1f7d43acb1e77e0059505d1f0e6064674ca655a0c82f( 0x486508c3c40ef7985dcc1f7d43acb1e77e0059505d1f0e6064674ca655a0c82f, 0x0000000000000000000000001b4d88f5f38988bea334c79f48aa69beeefe2e1e, 0x000000000000000000000000afc22395f57ec9347c3708d56516836a38017fad, 0x0000000000000000000000000000000000000000000000000000000000000000, 000000000000000000000000afc22395f57ec9347c3708d56516836a38017fad, 00000000000000000000000000000000000000000000000014b7d4e7d6bc561f, bd316f8af159a96b950d55cdc79f8247a1d0ecd27668dbeec699a8c53896efb5 )

Account State Difference:

  Address   Before After State Difference Code
0x1B4d88f5...EEeFE2e1e
(Titan Builder)
8.875146564429040825 Eth8.87544176218909799 Eth0.000295197760057165
0xAfa90415...32A4449E0
(Karak Network: Delegation Supervisor)
0xafc22395...a38017Fad
2.181682423170328967 Eth
Nonce: 284
2.178013836903838836 Eth
Nonce: 285
0.003668586266490131
0xFAe103DC...7b8aFa6c0

Execution Trace

Karak Network: Delegation Supervisor.86e9a1f7( )
  • DelegationSupervisor.finishWithdraw( startedWithdrawals= )
    • Karak Network: Vault Supervisor.51ffb74a( )
      • VaultSupervisor.redeemShares( staker=0xafc22395F57Ec9347c3708D56516836a38017Fad, vault=0x1B4d88f5f38988BEA334C79f48aa69BEEeFE2e1e, shares=1492895893701809695 )
        • BeaconProxy.ba087652( )
          • Karak Network: Vault Supervisor.STATICCALL( )
            • VaultSupervisor.DELEGATECALL( )
            • Vault.redeem( shares=1492895893701809695, to=0xafc22395F57Ec9347c3708D56516836a38017Fad, owner=0x54e44DbB92dBA848ACe27F44c0CB4268981eF1CC ) => ( assets=1492895893701809695 )
              • TransparentUpgradeableProxy.70a08231( )
              • TransparentUpgradeableProxy.a9059cbb( )
                File 1 of 5: BeaconProxy
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/BeaconProxy.sol)
                pragma solidity ^0.8.20;
                import {IBeacon} from "./IBeacon.sol";
                import {Proxy} from "../Proxy.sol";
                import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
                /**
                 * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
                 *
                 * The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an
                 * immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
                 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally.
                 *
                 * CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
                 * the beacon to not upgrade the implementation maliciously.
                 *
                 * IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in
                 * an inconsistent state where the beacon storage slot does not match the beacon address.
                 */
                contract BeaconProxy is Proxy {
                    // An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.
                    address private immutable _beacon;
                    /**
                     * @dev Initializes the proxy with `beacon`.
                     *
                     * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
                     * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
                     * constructor.
                     *
                     * Requirements:
                     *
                     * - `beacon` must be a contract with the interface {IBeacon}.
                     * - If `data` is empty, `msg.value` must be zero.
                     */
                    constructor(address beacon, bytes memory data) payable {
                        ERC1967Utils.upgradeBeaconToAndCall(beacon, data);
                        _beacon = beacon;
                    }
                    /**
                     * @dev Returns the current implementation address of the associated beacon.
                     */
                    function _implementation() internal view virtual override returns (address) {
                        return IBeacon(_getBeacon()).implementation();
                    }
                    /**
                     * @dev Returns the beacon.
                     */
                    function _getBeacon() internal view virtual returns (address) {
                        return _beacon;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This is the interface that {BeaconProxy} expects of its beacon.
                 */
                interface IBeacon {
                    /**
                     * @dev Must return an address that can be used as a delegate call target.
                     *
                     * {UpgradeableBeacon} will check that this address is a contract.
                     */
                    function implementation() external view returns (address);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
                 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
                 * be specified by overriding the virtual {_implementation} function.
                 *
                 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
                 * different contract through the {_delegate} function.
                 *
                 * The success and return data of the delegated call will be returned back to the caller of the proxy.
                 */
                abstract contract Proxy {
                    /**
                     * @dev Delegates the current call to `implementation`.
                     *
                     * This function does not return to its internal call site, it will return directly to the external caller.
                     */
                    function _delegate(address implementation) internal virtual {
                        assembly {
                            // Copy msg.data. We take full control of memory in this inline assembly
                            // block because it will not return to Solidity code. We overwrite the
                            // Solidity scratch pad at memory position 0.
                            calldatacopy(0, 0, calldatasize())
                            // Call the implementation.
                            // out and outsize are 0 because we don't know the size yet.
                            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
                            // Copy the returned data.
                            returndatacopy(0, 0, returndatasize())
                            switch result
                            // delegatecall returns 0 on error.
                            case 0 {
                                revert(0, returndatasize())
                            }
                            default {
                                return(0, returndatasize())
                            }
                        }
                    }
                    /**
                     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
                     * function and {_fallback} should delegate.
                     */
                    function _implementation() internal view virtual returns (address);
                    /**
                     * @dev Delegates the current call to the address returned by `_implementation()`.
                     *
                     * This function does not return to its internal call site, it will return directly to the external caller.
                     */
                    function _fallback() internal virtual {
                        _delegate(_implementation());
                    }
                    /**
                     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
                     * function in the contract matches the call data.
                     */
                    fallback() external payable virtual {
                        _fallback();
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)
                pragma solidity ^0.8.20;
                import {IBeacon} from "../beacon/IBeacon.sol";
                import {Address} from "../../utils/Address.sol";
                import {StorageSlot} from "../../utils/StorageSlot.sol";
                /**
                 * @dev This abstract contract provides getters and event emitting update functions for
                 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
                 */
                library ERC1967Utils {
                    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
                    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
                    /**
                     * @dev Emitted when the implementation is upgraded.
                     */
                    event Upgraded(address indexed implementation);
                    /**
                     * @dev Emitted when the admin account has changed.
                     */
                    event AdminChanged(address previousAdmin, address newAdmin);
                    /**
                     * @dev Emitted when the beacon is changed.
                     */
                    event BeaconUpgraded(address indexed beacon);
                    /**
                     * @dev Storage slot with the address of the current implementation.
                     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
                     */
                    // solhint-disable-next-line private-vars-leading-underscore
                    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                    /**
                     * @dev The `implementation` of the proxy is invalid.
                     */
                    error ERC1967InvalidImplementation(address implementation);
                    /**
                     * @dev The `admin` of the proxy is invalid.
                     */
                    error ERC1967InvalidAdmin(address admin);
                    /**
                     * @dev The `beacon` of the proxy is invalid.
                     */
                    error ERC1967InvalidBeacon(address beacon);
                    /**
                     * @dev An upgrade function sees `msg.value > 0` that may be lost.
                     */
                    error ERC1967NonPayable();
                    /**
                     * @dev Returns the current implementation address.
                     */
                    function getImplementation() internal view returns (address) {
                        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
                    }
                    /**
                     * @dev Stores a new address in the EIP1967 implementation slot.
                     */
                    function _setImplementation(address newImplementation) private {
                        if (newImplementation.code.length == 0) {
                            revert ERC1967InvalidImplementation(newImplementation);
                        }
                        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
                    }
                    /**
                     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
                     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
                     * to avoid stuck value in the contract.
                     *
                     * Emits an {IERC1967-Upgraded} event.
                     */
                    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
                        _setImplementation(newImplementation);
                        emit Upgraded(newImplementation);
                        if (data.length > 0) {
                            Address.functionDelegateCall(newImplementation, data);
                        } else {
                            _checkNonPayable();
                        }
                    }
                    /**
                     * @dev Storage slot with the admin of the contract.
                     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
                     */
                    // solhint-disable-next-line private-vars-leading-underscore
                    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
                    /**
                     * @dev Returns the current admin.
                     *
                     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
                     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
                     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
                     */
                    function getAdmin() internal view returns (address) {
                        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
                    }
                    /**
                     * @dev Stores a new address in the EIP1967 admin slot.
                     */
                    function _setAdmin(address newAdmin) private {
                        if (newAdmin == address(0)) {
                            revert ERC1967InvalidAdmin(address(0));
                        }
                        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
                    }
                    /**
                     * @dev Changes the admin of the proxy.
                     *
                     * Emits an {IERC1967-AdminChanged} event.
                     */
                    function changeAdmin(address newAdmin) internal {
                        emit AdminChanged(getAdmin(), newAdmin);
                        _setAdmin(newAdmin);
                    }
                    /**
                     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
                     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
                     */
                    // solhint-disable-next-line private-vars-leading-underscore
                    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
                    /**
                     * @dev Returns the current beacon.
                     */
                    function getBeacon() internal view returns (address) {
                        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
                    }
                    /**
                     * @dev Stores a new beacon in the EIP1967 beacon slot.
                     */
                    function _setBeacon(address newBeacon) private {
                        if (newBeacon.code.length == 0) {
                            revert ERC1967InvalidBeacon(newBeacon);
                        }
                        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;
                        address beaconImplementation = IBeacon(newBeacon).implementation();
                        if (beaconImplementation.code.length == 0) {
                            revert ERC1967InvalidImplementation(beaconImplementation);
                        }
                    }
                    /**
                     * @dev Change the beacon and trigger a setup call if data is nonempty.
                     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
                     * to avoid stuck value in the contract.
                     *
                     * Emits an {IERC1967-BeaconUpgraded} event.
                     *
                     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
                     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
                     * efficiency.
                     */
                    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
                        _setBeacon(newBeacon);
                        emit BeaconUpgraded(newBeacon);
                        if (data.length > 0) {
                            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
                        } else {
                            _checkNonPayable();
                        }
                    }
                    /**
                     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
                     * if an upgrade doesn't perform an initialization call.
                     */
                    function _checkNonPayable() private {
                        if (msg.value > 0) {
                            revert ERC1967NonPayable();
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Collection of functions related to the address type
                 */
                library Address {
                    /**
                     * @dev The ETH balance of the account is not enough to perform the operation.
                     */
                    error AddressInsufficientBalance(address account);
                    /**
                     * @dev There's no code at `target` (it is not a contract).
                     */
                    error AddressEmptyCode(address target);
                    /**
                     * @dev A call to an address target failed. The target may have reverted.
                     */
                    error FailedInnerCall();
                    /**
                     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                     * `recipient`, forwarding all available gas and reverting on errors.
                     *
                     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                     * of certain opcodes, possibly making contracts go over the 2300 gas limit
                     * imposed by `transfer`, making them unable to receive funds via
                     * `transfer`. {sendValue} removes this limitation.
                     *
                     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                     *
                     * IMPORTANT: because control is transferred to `recipient`, care must be
                     * taken to not create reentrancy vulnerabilities. Consider using
                     * {ReentrancyGuard} or the
                     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                     */
                    function sendValue(address payable recipient, uint256 amount) internal {
                        if (address(this).balance < amount) {
                            revert AddressInsufficientBalance(address(this));
                        }
                        (bool success, ) = recipient.call{value: amount}("");
                        if (!success) {
                            revert FailedInnerCall();
                        }
                    }
                    /**
                     * @dev Performs a Solidity function call using a low level `call`. A
                     * plain `call` is an unsafe replacement for a function call: use this
                     * function instead.
                     *
                     * If `target` reverts with a revert reason or custom error, it is bubbled
                     * up by this function (like regular Solidity function calls). However, if
                     * the call reverted with no returned reason, this function reverts with a
                     * {FailedInnerCall} error.
                     *
                     * Returns the raw returned data. To convert to the expected return value,
                     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
                     *
                     * Requirements:
                     *
                     * - `target` must be a contract.
                     * - calling `target` with `data` must not revert.
                     */
                    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
                        return functionCallWithValue(target, data, 0);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but also transferring `value` wei to `target`.
                     *
                     * Requirements:
                     *
                     * - the calling contract must have an ETH balance of at least `value`.
                     * - the called Solidity function must be `payable`.
                     */
                    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
                        if (address(this).balance < value) {
                            revert AddressInsufficientBalance(address(this));
                        }
                        (bool success, bytes memory returndata) = target.call{value: value}(data);
                        return verifyCallResultFromTarget(target, success, returndata);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but performing a static call.
                     */
                    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
                        (bool success, bytes memory returndata) = target.staticcall(data);
                        return verifyCallResultFromTarget(target, success, returndata);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but performing a delegate call.
                     */
                    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
                        (bool success, bytes memory returndata) = target.delegatecall(data);
                        return verifyCallResultFromTarget(target, success, returndata);
                    }
                    /**
                     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
                     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
                     * unsuccessful call.
                     */
                    function verifyCallResultFromTarget(
                        address target,
                        bool success,
                        bytes memory returndata
                    ) internal view returns (bytes memory) {
                        if (!success) {
                            _revert(returndata);
                        } else {
                            // only check if target is a contract if the call was successful and the return data is empty
                            // otherwise we already know that it was a contract
                            if (returndata.length == 0 && target.code.length == 0) {
                                revert AddressEmptyCode(target);
                            }
                            return returndata;
                        }
                    }
                    /**
                     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
                     * revert reason or with a default {FailedInnerCall} error.
                     */
                    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
                        if (!success) {
                            _revert(returndata);
                        } else {
                            return returndata;
                        }
                    }
                    /**
                     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
                     */
                    function _revert(bytes memory returndata) private pure {
                        // Look for revert reason and bubble it up if present
                        if (returndata.length > 0) {
                            // The easiest way to bubble the revert reason is using memory via assembly
                            /// @solidity memory-safe-assembly
                            assembly {
                                let returndata_size := mload(returndata)
                                revert(add(32, returndata), returndata_size)
                            }
                        } else {
                            revert FailedInnerCall();
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
                // This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
                pragma solidity ^0.8.20;
                /**
                 * @dev Library for reading and writing primitive types to specific storage slots.
                 *
                 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
                 * This library helps with reading and writing to such slots without the need for inline assembly.
                 *
                 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
                 *
                 * Example usage to set ERC1967 implementation slot:
                 * ```solidity
                 * contract ERC1967 {
                 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                 *
                 *     function _getImplementation() internal view returns (address) {
                 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
                 *     }
                 *
                 *     function _setImplementation(address newImplementation) internal {
                 *         require(newImplementation.code.length > 0);
                 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
                 *     }
                 * }
                 * ```
                 */
                library StorageSlot {
                    struct AddressSlot {
                        address value;
                    }
                    struct BooleanSlot {
                        bool value;
                    }
                    struct Bytes32Slot {
                        bytes32 value;
                    }
                    struct Uint256Slot {
                        uint256 value;
                    }
                    struct StringSlot {
                        string value;
                    }
                    struct BytesSlot {
                        bytes value;
                    }
                    /**
                     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
                     */
                    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
                     */
                    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
                     */
                    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
                     */
                    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `StringSlot` with member `value` located at `slot`.
                     */
                    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
                     */
                    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := store.slot
                        }
                    }
                    /**
                     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
                     */
                    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
                     */
                    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := store.slot
                        }
                    }
                }
                

                File 2 of 5: TransparentUpgradeableProxy
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
                import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
                import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
                import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
                import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
                // Kept for backwards compatibility with older versions of Hardhat and Truffle plugins.
                contract AdminUpgradeabilityProxy is TransparentUpgradeableProxy {
                    constructor(address logic, address admin, bytes memory data) payable TransparentUpgradeableProxy(logic, admin, data) {}
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "./IBeacon.sol";
                import "../Proxy.sol";
                import "../ERC1967/ERC1967Upgrade.sol";
                /**
                 * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}.
                 *
                 * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
                 * conflict with the storage layout of the implementation behind the proxy.
                 *
                 * _Available since v3.4._
                 */
                contract BeaconProxy is Proxy, ERC1967Upgrade {
                    /**
                     * @dev Initializes the proxy with `beacon`.
                     *
                     * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
                     * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity
                     * constructor.
                     *
                     * Requirements:
                     *
                     * - `beacon` must be a contract with the interface {IBeacon}.
                     */
                    constructor(address beacon, bytes memory data) payable {
                        assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1));
                        _upgradeBeaconToAndCall(beacon, data, false);
                    }
                    /**
                     * @dev Returns the current beacon address.
                     */
                    function _beacon() internal view virtual returns (address) {
                        return _getBeacon();
                    }
                    /**
                     * @dev Returns the current implementation address of the associated beacon.
                     */
                    function _implementation() internal view virtual override returns (address) {
                        return IBeacon(_getBeacon()).implementation();
                    }
                    /**
                     * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.
                     *
                     * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.
                     *
                     * Requirements:
                     *
                     * - `beacon` must be a contract.
                     * - The implementation returned by `beacon` must be a contract.
                     */
                    function _setBeacon(address beacon, bytes memory data) internal virtual {
                        _upgradeBeaconToAndCall(beacon, data, false);
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "./IBeacon.sol";
                import "../../access/Ownable.sol";
                import "../../utils/Address.sol";
                /**
                 * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their
                 * implementation contract, which is where they will delegate all function calls.
                 *
                 * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.
                 */
                contract UpgradeableBeacon is IBeacon, Ownable {
                    address private _implementation;
                    /**
                     * @dev Emitted when the implementation returned by the beacon is changed.
                     */
                    event Upgraded(address indexed implementation);
                    /**
                     * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the
                     * beacon.
                     */
                    constructor(address implementation_) {
                        _setImplementation(implementation_);
                    }
                    /**
                     * @dev Returns the current implementation address.
                     */
                    function implementation() public view virtual override returns (address) {
                        return _implementation;
                    }
                    /**
                     * @dev Upgrades the beacon to a new implementation.
                     *
                     * Emits an {Upgraded} event.
                     *
                     * Requirements:
                     *
                     * - msg.sender must be the owner of the contract.
                     * - `newImplementation` must be a contract.
                     */
                    function upgradeTo(address newImplementation) public virtual onlyOwner {
                        _setImplementation(newImplementation);
                        emit Upgraded(newImplementation);
                    }
                    /**
                     * @dev Sets the implementation contract address for this beacon
                     *
                     * Requirements:
                     *
                     * - `newImplementation` must be a contract.
                     */
                    function _setImplementation(address newImplementation) private {
                        require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract");
                        _implementation = newImplementation;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "../Proxy.sol";
                import "./ERC1967Upgrade.sol";
                /**
                 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
                 * implementation address that can be changed. This address is stored in storage in the location specified by
                 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
                 * implementation behind the proxy.
                 */
                contract ERC1967Proxy is Proxy, ERC1967Upgrade {
                    /**
                     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
                     *
                     * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
                     * function call, and allows initializating the storage of the proxy like a Solidity constructor.
                     */
                    constructor(address _logic, bytes memory _data) payable {
                        assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
                        _upgradeToAndCall(_logic, _data, false);
                    }
                    /**
                     * @dev Returns the current implementation address.
                     */
                    function _implementation() internal view virtual override returns (address impl) {
                        return ERC1967Upgrade._getImplementation();
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "../ERC1967/ERC1967Proxy.sol";
                /**
                 * @dev This contract implements a proxy that is upgradeable by an admin.
                 *
                 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
                 * clashing], which can potentially be used in an attack, this contract uses the
                 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
                 * things that go hand in hand:
                 *
                 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
                 * that call matches one of the admin functions exposed by the proxy itself.
                 * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
                 * implementation. If the admin tries to call a function on the implementation it will fail with an error that says
                 * "admin cannot fallback to proxy target".
                 *
                 * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
                 * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
                 * to sudden errors when trying to call a function from the proxy implementation.
                 *
                 * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
                 * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
                 */
                contract TransparentUpgradeableProxy is ERC1967Proxy {
                    /**
                     * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
                     * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.
                     */
                    constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
                        assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
                        _changeAdmin(admin_);
                    }
                    /**
                     * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
                     */
                    modifier ifAdmin() {
                        if (msg.sender == _getAdmin()) {
                            _;
                        } else {
                            _fallback();
                        }
                    }
                    /**
                     * @dev Returns the current admin.
                     *
                     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
                     *
                     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
                     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
                     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
                     */
                    function admin() external ifAdmin returns (address admin_) {
                        admin_ = _getAdmin();
                    }
                    /**
                     * @dev Returns the current implementation.
                     *
                     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
                     *
                     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
                     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
                     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
                     */
                    function implementation() external ifAdmin returns (address implementation_) {
                        implementation_ = _implementation();
                    }
                    /**
                     * @dev Changes the admin of the proxy.
                     *
                     * Emits an {AdminChanged} event.
                     *
                     * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
                     */
                    function changeAdmin(address newAdmin) external virtual ifAdmin {
                        _changeAdmin(newAdmin);
                    }
                    /**
                     * @dev Upgrade the implementation of the proxy.
                     *
                     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
                     */
                    function upgradeTo(address newImplementation) external ifAdmin {
                        _upgradeToAndCall(newImplementation, bytes(""), false);
                    }
                    /**
                     * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
                     * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
                     * proxied contract.
                     *
                     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
                     */
                    function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
                        _upgradeToAndCall(newImplementation, data, true);
                    }
                    /**
                     * @dev Returns the current admin.
                     */
                    function _admin() internal view virtual returns (address) {
                        return _getAdmin();
                    }
                    /**
                     * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
                     */
                    function _beforeFallback() internal virtual override {
                        require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
                        super._beforeFallback();
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "./TransparentUpgradeableProxy.sol";
                import "../../access/Ownable.sol";
                /**
                 * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
                 * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.
                 */
                contract ProxyAdmin is Ownable {
                    /**
                     * @dev Returns the current implementation of `proxy`.
                     *
                     * Requirements:
                     *
                     * - This contract must be the admin of `proxy`.
                     */
                    function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
                        // We need to manually run the static call since the getter cannot be flagged as view
                        // bytes4(keccak256("implementation()")) == 0x5c60da1b
                        (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b");
                        require(success);
                        return abi.decode(returndata, (address));
                    }
                    /**
                     * @dev Returns the current admin of `proxy`.
                     *
                     * Requirements:
                     *
                     * - This contract must be the admin of `proxy`.
                     */
                    function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {
                        // We need to manually run the static call since the getter cannot be flagged as view
                        // bytes4(keccak256("admin()")) == 0xf851a440
                        (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440");
                        require(success);
                        return abi.decode(returndata, (address));
                    }
                    /**
                     * @dev Changes the admin of `proxy` to `newAdmin`.
                     *
                     * Requirements:
                     *
                     * - This contract must be the current admin of `proxy`.
                     */
                    function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {
                        proxy.changeAdmin(newAdmin);
                    }
                    /**
                     * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.
                     *
                     * Requirements:
                     *
                     * - This contract must be the admin of `proxy`.
                     */
                    function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {
                        proxy.upgradeTo(implementation);
                    }
                    /**
                     * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See
                     * {TransparentUpgradeableProxy-upgradeToAndCall}.
                     *
                     * Requirements:
                     *
                     * - This contract must be the admin of `proxy`.
                     */
                    function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable virtual onlyOwner {
                        proxy.upgradeToAndCall{value: msg.value}(implementation, data);
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                /**
                 * @dev This is the interface that {BeaconProxy} expects of its beacon.
                 */
                interface IBeacon {
                    /**
                     * @dev Must return an address that can be used as a delegate call target.
                     *
                     * {BeaconProxy} will check that this address is a contract.
                     */
                    function implementation() external view returns (address);
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                /**
                 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
                 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
                 * be specified by overriding the virtual {_implementation} function.
                 *
                 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
                 * different contract through the {_delegate} function.
                 *
                 * The success and return data of the delegated call will be returned back to the caller of the proxy.
                 */
                abstract contract Proxy {
                    /**
                     * @dev Delegates the current call to `implementation`.
                     *
                     * This function does not return to its internall call site, it will return directly to the external caller.
                     */
                    function _delegate(address implementation) internal virtual {
                        // solhint-disable-next-line no-inline-assembly
                        assembly {
                            // Copy msg.data. We take full control of memory in this inline assembly
                            // block because it will not return to Solidity code. We overwrite the
                            // Solidity scratch pad at memory position 0.
                            calldatacopy(0, 0, calldatasize())
                            // Call the implementation.
                            // out and outsize are 0 because we don't know the size yet.
                            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
                            // Copy the returned data.
                            returndatacopy(0, 0, returndatasize())
                            switch result
                            // delegatecall returns 0 on error.
                            case 0 { revert(0, returndatasize()) }
                            default { return(0, returndatasize()) }
                        }
                    }
                    /**
                     * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
                     * and {_fallback} should delegate.
                     */
                    function _implementation() internal view virtual returns (address);
                    /**
                     * @dev Delegates the current call to the address returned by `_implementation()`.
                     *
                     * This function does not return to its internall call site, it will return directly to the external caller.
                     */
                    function _fallback() internal virtual {
                        _beforeFallback();
                        _delegate(_implementation());
                    }
                    /**
                     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
                     * function in the contract matches the call data.
                     */
                    fallback () external payable virtual {
                        _fallback();
                    }
                    /**
                     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
                     * is empty.
                     */
                    receive () external payable virtual {
                        _fallback();
                    }
                    /**
                     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
                     * call, or as part of the Solidity `fallback` or `receive` functions.
                     *
                     * If overriden should call `super._beforeFallback()`.
                     */
                    function _beforeFallback() internal virtual {
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.2;
                import "../beacon/IBeacon.sol";
                import "../../utils/Address.sol";
                import "../../utils/StorageSlot.sol";
                /**
                 * @dev This abstract contract provides getters and event emitting update functions for
                 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
                 *
                 * _Available since v4.1._
                 *
                 * @custom:oz-upgrades-unsafe-allow delegatecall
                 */
                abstract contract ERC1967Upgrade {
                    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
                    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
                    /**
                     * @dev Storage slot with the address of the current implementation.
                     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
                     * validated in the constructor.
                     */
                    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                    /**
                     * @dev Emitted when the implementation is upgraded.
                     */
                    event Upgraded(address indexed implementation);
                    /**
                     * @dev Returns the current implementation address.
                     */
                    function _getImplementation() internal view returns (address) {
                        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
                    }
                    /**
                     * @dev Stores a new address in the EIP1967 implementation slot.
                     */
                    function _setImplementation(address newImplementation) private {
                        require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
                        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
                    }
                    /**
                     * @dev Perform implementation upgrade
                     *
                     * Emits an {Upgraded} event.
                     */
                    function _upgradeTo(address newImplementation) internal {
                        _setImplementation(newImplementation);
                        emit Upgraded(newImplementation);
                    }
                    /**
                     * @dev Perform implementation upgrade with additional setup call.
                     *
                     * Emits an {Upgraded} event.
                     */
                    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
                        _setImplementation(newImplementation);
                        emit Upgraded(newImplementation);
                        if (data.length > 0 || forceCall) {
                            Address.functionDelegateCall(newImplementation, data);
                        }
                    }
                    /**
                     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
                     *
                     * Emits an {Upgraded} event.
                     */
                    function _upgradeToAndCallSecure(address newImplementation, bytes memory data, bool forceCall) internal {
                        address oldImplementation = _getImplementation();
                        // Initial upgrade and setup call
                        _setImplementation(newImplementation);
                        if (data.length > 0 || forceCall) {
                            Address.functionDelegateCall(newImplementation, data);
                        }
                        // Perform rollback test if not already in progress
                        StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);
                        if (!rollbackTesting.value) {
                            // Trigger rollback using upgradeTo from the new implementation
                            rollbackTesting.value = true;
                            Address.functionDelegateCall(
                                newImplementation,
                                abi.encodeWithSignature(
                                    "upgradeTo(address)",
                                    oldImplementation
                                )
                            );
                            rollbackTesting.value = false;
                            // Check rollback was effective
                            require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
                            // Finally reset to the new implementation and log the upgrade
                            _setImplementation(newImplementation);
                            emit Upgraded(newImplementation);
                        }
                    }
                    /**
                     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
                     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
                     *
                     * Emits a {BeaconUpgraded} event.
                     */
                    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
                        _setBeacon(newBeacon);
                        emit BeaconUpgraded(newBeacon);
                        if (data.length > 0 || forceCall) {
                            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
                        }
                    }
                    /**
                     * @dev Storage slot with the admin of the contract.
                     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
                     * validated in the constructor.
                     */
                    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
                    /**
                     * @dev Emitted when the admin account has changed.
                     */
                    event AdminChanged(address previousAdmin, address newAdmin);
                    /**
                     * @dev Returns the current admin.
                     */
                    function _getAdmin() internal view returns (address) {
                        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
                    }
                    /**
                     * @dev Stores a new address in the EIP1967 admin slot.
                     */
                    function _setAdmin(address newAdmin) private {
                        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
                        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
                    }
                    /**
                     * @dev Changes the admin of the proxy.
                     *
                     * Emits an {AdminChanged} event.
                     */
                    function _changeAdmin(address newAdmin) internal {
                        emit AdminChanged(_getAdmin(), newAdmin);
                        _setAdmin(newAdmin);
                    }
                    /**
                     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
                     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
                     */
                    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
                    /**
                     * @dev Emitted when the beacon is upgraded.
                     */
                    event BeaconUpgraded(address indexed beacon);
                    /**
                     * @dev Returns the current beacon.
                     */
                    function _getBeacon() internal view returns (address) {
                        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
                    }
                    /**
                     * @dev Stores a new beacon in the EIP1967 beacon slot.
                     */
                    function _setBeacon(address newBeacon) private {
                        require(
                            Address.isContract(newBeacon),
                            "ERC1967: new beacon is not a contract"
                        );
                        require(
                            Address.isContract(IBeacon(newBeacon).implementation()),
                            "ERC1967: beacon implementation is not a contract"
                        );
                        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                /**
                 * @dev Collection of functions related to the address type
                 */
                library Address {
                    /**
                     * @dev Returns true if `account` is a contract.
                     *
                     * [IMPORTANT]
                     * ====
                     * It is unsafe to assume that an address for which this function returns
                     * false is an externally-owned account (EOA) and not a contract.
                     *
                     * Among others, `isContract` will return false for the following
                     * types of addresses:
                     *
                     *  - an externally-owned account
                     *  - a contract in construction
                     *  - an address where a contract will be created
                     *  - an address where a contract lived, but was destroyed
                     * ====
                     */
                    function isContract(address account) internal view returns (bool) {
                        // This method relies on extcodesize, which returns 0 for contracts in
                        // construction, since the code is only stored at the end of the
                        // constructor execution.
                        uint256 size;
                        // solhint-disable-next-line no-inline-assembly
                        assembly { size := extcodesize(account) }
                        return size > 0;
                    }
                    /**
                     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                     * `recipient`, forwarding all available gas and reverting on errors.
                     *
                     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                     * of certain opcodes, possibly making contracts go over the 2300 gas limit
                     * imposed by `transfer`, making them unable to receive funds via
                     * `transfer`. {sendValue} removes this limitation.
                     *
                     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                     *
                     * IMPORTANT: because control is transferred to `recipient`, care must be
                     * taken to not create reentrancy vulnerabilities. Consider using
                     * {ReentrancyGuard} or the
                     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                     */
                    function sendValue(address payable recipient, uint256 amount) internal {
                        require(address(this).balance >= amount, "Address: insufficient balance");
                        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
                        (bool success, ) = recipient.call{ value: amount }("");
                        require(success, "Address: unable to send value, recipient may have reverted");
                    }
                    /**
                     * @dev Performs a Solidity function call using a low level `call`. A
                     * plain`call` is an unsafe replacement for a function call: use this
                     * function instead.
                     *
                     * If `target` reverts with a revert reason, it is bubbled up by this
                     * function (like regular Solidity function calls).
                     *
                     * Returns the raw returned data. To convert to the expected return value,
                     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
                     *
                     * Requirements:
                     *
                     * - `target` must be a contract.
                     * - calling `target` with `data` must not revert.
                     *
                     * _Available since v3.1._
                     */
                    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
                      return functionCall(target, data, "Address: low-level call failed");
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
                     * `errorMessage` as a fallback revert reason when `target` reverts.
                     *
                     * _Available since v3.1._
                     */
                    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
                        return functionCallWithValue(target, data, 0, errorMessage);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but also transferring `value` wei to `target`.
                     *
                     * Requirements:
                     *
                     * - the calling contract must have an ETH balance of at least `value`.
                     * - the called Solidity function must be `payable`.
                     *
                     * _Available since v3.1._
                     */
                    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
                        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
                    }
                    /**
                     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
                     * with `errorMessage` as a fallback revert reason when `target` reverts.
                     *
                     * _Available since v3.1._
                     */
                    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
                        require(address(this).balance >= value, "Address: insufficient balance for call");
                        require(isContract(target), "Address: call to non-contract");
                        // solhint-disable-next-line avoid-low-level-calls
                        (bool success, bytes memory returndata) = target.call{ value: value }(data);
                        return _verifyCallResult(success, returndata, errorMessage);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but performing a static call.
                     *
                     * _Available since v3.3._
                     */
                    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
                        return functionStaticCall(target, data, "Address: low-level static call failed");
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
                     * but performing a static call.
                     *
                     * _Available since v3.3._
                     */
                    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
                        require(isContract(target), "Address: static call to non-contract");
                        // solhint-disable-next-line avoid-low-level-calls
                        (bool success, bytes memory returndata) = target.staticcall(data);
                        return _verifyCallResult(success, returndata, errorMessage);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but performing a delegate call.
                     *
                     * _Available since v3.4._
                     */
                    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
                        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
                     * but performing a delegate call.
                     *
                     * _Available since v3.4._
                     */
                    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
                        require(isContract(target), "Address: delegate call to non-contract");
                        // solhint-disable-next-line avoid-low-level-calls
                        (bool success, bytes memory returndata) = target.delegatecall(data);
                        return _verifyCallResult(success, returndata, errorMessage);
                    }
                    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
                        if (success) {
                            return returndata;
                        } else {
                            // Look for revert reason and bubble it up if present
                            if (returndata.length > 0) {
                                // The easiest way to bubble the revert reason is using memory via assembly
                                // solhint-disable-next-line no-inline-assembly
                                assembly {
                                    let returndata_size := mload(returndata)
                                    revert(add(32, returndata), returndata_size)
                                }
                            } else {
                                revert(errorMessage);
                            }
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                /**
                 * @dev Library for reading and writing primitive types to specific storage slots.
                 *
                 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
                 * This library helps with reading and writing to such slots without the need for inline assembly.
                 *
                 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
                 *
                 * Example usage to set ERC1967 implementation slot:
                 * ```
                 * contract ERC1967 {
                 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                 *
                 *     function _getImplementation() internal view returns (address) {
                 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
                 *     }
                 *
                 *     function _setImplementation(address newImplementation) internal {
                 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
                 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
                 *     }
                 * }
                 * ```
                 *
                 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
                 */
                library StorageSlot {
                    struct AddressSlot {
                        address value;
                    }
                    struct BooleanSlot {
                        bool value;
                    }
                    struct Bytes32Slot {
                        bytes32 value;
                    }
                    struct Uint256Slot {
                        uint256 value;
                    }
                    /**
                     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
                     */
                    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
                     */
                    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
                     */
                    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
                     */
                    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
                        assembly {
                            r.slot := slot
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                import "../utils/Context.sol";
                /**
                 * @dev Contract module which provides a basic access control mechanism, where
                 * there is an account (an owner) that can be granted exclusive access to
                 * specific functions.
                 *
                 * By default, the owner account will be the one that deploys the contract. This
                 * can later be changed with {transferOwnership}.
                 *
                 * This module is used through inheritance. It will make available the modifier
                 * `onlyOwner`, which can be applied to your functions to restrict their use to
                 * the owner.
                 */
                abstract contract Ownable is Context {
                    address private _owner;
                    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
                    /**
                     * @dev Initializes the contract setting the deployer as the initial owner.
                     */
                    constructor () {
                        address msgSender = _msgSender();
                        _owner = msgSender;
                        emit OwnershipTransferred(address(0), msgSender);
                    }
                    /**
                     * @dev Returns the address of the current owner.
                     */
                    function owner() public view virtual returns (address) {
                        return _owner;
                    }
                    /**
                     * @dev Throws if called by any account other than the owner.
                     */
                    modifier onlyOwner() {
                        require(owner() == _msgSender(), "Ownable: caller is not the owner");
                        _;
                    }
                    /**
                     * @dev Leaves the contract without owner. It will not be possible to call
                     * `onlyOwner` functions anymore. Can only be called by the current owner.
                     *
                     * NOTE: Renouncing ownership will leave the contract without an owner,
                     * thereby removing any functionality that is only available to the owner.
                     */
                    function renounceOwnership() public virtual onlyOwner {
                        emit OwnershipTransferred(_owner, address(0));
                        _owner = address(0);
                    }
                    /**
                     * @dev Transfers ownership of the contract to a new account (`newOwner`).
                     * Can only be called by the current owner.
                     */
                    function transferOwnership(address newOwner) public virtual onlyOwner {
                        require(newOwner != address(0), "Ownable: new owner is the zero address");
                        emit OwnershipTransferred(_owner, newOwner);
                        _owner = newOwner;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.0;
                /*
                 * @dev Provides information about the current execution context, including the
                 * sender of the transaction and its data. While these are generally available
                 * via msg.sender and msg.data, they should not be accessed in such a direct
                 * manner, since when dealing with meta-transactions the account sending and
                 * paying for execution may not be the actual sender (as far as an application
                 * is concerned).
                 *
                 * This contract is only required for intermediate, library-like contracts.
                 */
                abstract contract Context {
                    function _msgSender() internal view virtual returns (address) {
                        return msg.sender;
                    }
                    function _msgData() internal view virtual returns (bytes calldata) {
                        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
                        return msg.data;
                    }
                }
                

                File 3 of 5: DelegationSupervisor
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {Initializable} from "@openzeppelin-upgradeable/proxy/utils/Initializable.sol";
                import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
                import {PausableUpgradeable} from "@openzeppelin-upgradeable/utils/PausableUpgradeable.sol";
                import {EIP712Upgradeable} from "@openzeppelin-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
                import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
                import {ReentrancyGuard} from "solady/src/utils/ReentrancyGuard.sol";
                import {UUPSUpgradeable} from "solady/src/utils/UUPSUpgradeable.sol";
                import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol";
                import "./entities/Withdraw.sol";
                import "./entities/DelegationSupervisorLib.sol";
                import "./entities/Staker.sol";
                import {Constants} from "./interfaces/Constants.sol";
                import {IVault} from "./interfaces/IVault.sol";
                import "./interfaces/IDelegationSupervisor.sol";
                import "./interfaces/Events.sol";
                contract DelegationSupervisor is
                    IDelegationSupervisor,
                    Initializable,
                    OwnableRoles,
                    ReentrancyGuard,
                    PausableUpgradeable,
                    UUPSUpgradeable,
                    EIP712Upgradeable
                {
                    using DelegationSupervisorLib for DelegationSupervisorLib.Storage;
                    using Withdraw for Withdraw.QueuedWithdrawal;
                    using Withdraw for Withdraw.WithdrawRequest[];
                    using Withdraw for Withdraw.WithdrawRequest;
                    // keccak256(abi.encode(uint256(keccak256("delegationsupervisor.storage")) - 1)) & ~bytes32(uint256(0xff));
                    bytes32 private constant STORAGE_SLOT = 0xb0b02f0ecb09a6e798b0f902b13ac86c2c157da412a7f4294fa1ae79336f7700;
                    /* ========== MUTATIVE FUNCTIONS ========== */
                    constructor() {
                        _disableInitializers();
                    }
                    function initialize(address vaultSupervisor, uint256 minWithdrawDelay, address manager) external initializer {
                        _initializeOwner(msg.sender);
                        __Pausable_init();
                        __EIP712_init("Karak_Delegation_Sup", "v1");
                        _grantRoles(manager, Constants.MANAGER_ROLE);
                        DelegationSupervisorLib.Storage storage self = _self();
                        self.initOrUpdate(vaultSupervisor, minWithdrawDelay);
                    }
                    function updateMinWithdrawDelay(uint256 delay) external onlyRolesOrOwner(Constants.MANAGER_ROLE) {
                        DelegationSupervisorLib.Storage storage self = _self();
                        self.updateMinWithdrawDelay(delay);
                    }
                    function startWithdraw(Withdraw.WithdrawRequest[] calldata withdrawalRequests)
                        external
                        nonReentrant
                        whenNotPaused
                        returns (bytes32[] memory withdrawalRoots, Withdraw.QueuedWithdrawal[] memory withdrawConfigs)
                    {
                        if (withdrawalRequests.length == 0) revert InvalidInput();
                        DelegationSupervisorLib.Storage storage self = _self();
                        withdrawalRoots = new bytes32[](withdrawalRequests.length);
                        withdrawConfigs = new Withdraw.QueuedWithdrawal[](withdrawalRequests.length);
                        address operator = self.stakers[msg.sender].delegatee;
                        for (uint256 i = 0; i < withdrawalRequests.length; i++) {
                            withdrawalRequests[i].validate();
                            // Remove shares from staker's strategies and place strategies/shares in queue.
                            (withdrawalRoots[i], withdrawConfigs[i]) = removeSharesAndStartWithdrawal({
                                staker: msg.sender,
                                operator: operator,
                                withdrawer: withdrawalRequests[i].withdrawer,
                                vaults: withdrawalRequests[i].vaults,
                                shares: withdrawalRequests[i].shares
                            });
                        }
                    }
                    function finishWithdraw(Withdraw.QueuedWithdrawal[] calldata startedWithdrawals)
                        external
                        nonReentrant
                        whenNotPaused
                    {
                        for (uint256 i = 0; i < startedWithdrawals.length; ++i) {
                            DelegationSupervisorLib.Storage storage self = _self();
                            startedWithdrawals[i].finishStartedWithdrawal(self);
                        }
                    }
                    function pause(bool toPause) external onlyRolesOrOwner(Constants.MANAGER_ROLE) {
                        if (toPause) _pause();
                        else _unpause();
                    }
                    /* ========== VIEW FUNCTIONS ========== */
                    function withdrawalDelay() external view override returns (uint256) {
                        DelegationSupervisorLib.Storage storage self = _self();
                        return self.withdrawalDelay;
                    }
                    function fetchQueuedWithdrawals(address staker)
                        external
                        view
                        returns (Withdraw.QueuedWithdrawal[] memory queuedWithdrawals)
                    {
                        DelegationSupervisorLib.Storage storage self = _self();
                        queuedWithdrawals = self.stakers[staker].queuedWithdrawals;
                    }
                    function isWithdrawPending(Withdraw.QueuedWithdrawal calldata withdrawal) external view returns (bool) {
                        DelegationSupervisorLib.Storage storage self = _self();
                        return self.pendingWithdrawals[withdrawal.calculateWithdrawalRoot()];
                    }
                    /* ========== MODIFIERS ========== */
                    modifier onlyVaultSupervisor() {
                        DelegationSupervisorLib.Storage storage self = _self();
                        if (msg.sender != address(self.vaultSupervisor)) {
                            revert NotVaultSupervisor();
                        }
                        _;
                    }
                    /* ========== INTERNAL FUNCTIONS ========== */
                    function _self() private pure returns (DelegationSupervisorLib.Storage storage $) {
                        assembly {
                            $.slot := STORAGE_SLOT
                        }
                    }
                    /**
                     * @notice
                     *     @param staker The staker who is withdrawing. NOTE assumes this is validated already
                     */
                    function removeSharesAndStartWithdrawal(
                        address staker,
                        address operator,
                        address withdrawer,
                        IVault[] memory vaults,
                        uint256[] memory shares
                    ) internal returns (bytes32 withdrawalRoot, Withdraw.QueuedWithdrawal memory withdrawal) {
                        DelegationSupervisorLib.Storage storage self = _self();
                        for (uint256 i = 0; i < vaults.length; i++) {
                            if (shares[i] == 0) revert ZeroShares();
                            //_decreaseOperatorShares(operator, vaults[i], shares[i]);
                            self.vaultSupervisor.removeShares(staker, vaults[i], shares[i]);
                            emit StartedWithdrawal(address(vaults[i]), staker, operator, withdrawer, shares[i]);
                        }
                        uint256 nonce = self.stakers[staker].totalWithdrawsQueued;
                        self.stakers[staker].totalWithdrawsQueued++;
                        withdrawal = Withdraw.QueuedWithdrawal({
                            staker: staker,
                            delegatedTo: operator,
                            nonce: nonce,
                            start: uint256(block.timestamp),
                            request: Withdraw.WithdrawRequest({vaults: vaults, shares: shares, withdrawer: withdrawer})
                        });
                        withdrawalRoot = withdrawal.calculateWithdrawalRoot();
                        self.pendingWithdrawals[withdrawalRoot] = true;
                        self.stakers[msg.sender].queuedWithdrawals.push(withdrawal);
                    }
                    function _authorizeUpgrade(address) internal override onlyOwner {}
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
                 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
                 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
                 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
                 *
                 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
                 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
                 * case an upgrade adds a module that needs to be initialized.
                 *
                 * For example:
                 *
                 * [.hljs-theme-light.nopadding]
                 * ```solidity
                 * contract MyToken is ERC20Upgradeable {
                 *     function initialize() initializer public {
                 *         __ERC20_init("MyToken", "MTK");
                 *     }
                 * }
                 *
                 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
                 *     function initializeV2() reinitializer(2) public {
                 *         __ERC20Permit_init("MyToken");
                 *     }
                 * }
                 * ```
                 *
                 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
                 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
                 *
                 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
                 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
                 *
                 * [CAUTION]
                 * ====
                 * Avoid leaving a contract uninitialized.
                 *
                 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
                 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
                 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
                 *
                 * [.hljs-theme-light.nopadding]
                 * ```
                 * /// @custom:oz-upgrades-unsafe-allow constructor
                 * constructor() {
                 *     _disableInitializers();
                 * }
                 * ```
                 * ====
                 */
                abstract contract Initializable {
                    /**
                     * @dev Storage of the initializable contract.
                     *
                     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
                     * when using with upgradeable contracts.
                     *
                     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
                     */
                    struct InitializableStorage {
                        /**
                         * @dev Indicates that the contract has been initialized.
                         */
                        uint64 _initialized;
                        /**
                         * @dev Indicates that the contract is in the process of being initialized.
                         */
                        bool _initializing;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
                    /**
                     * @dev The contract is already initialized.
                     */
                    error InvalidInitialization();
                    /**
                     * @dev The contract is not initializing.
                     */
                    error NotInitializing();
                    /**
                     * @dev Triggered when the contract has been initialized or reinitialized.
                     */
                    event Initialized(uint64 version);
                    /**
                     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
                     * `onlyInitializing` functions can be used to initialize parent contracts.
                     *
                     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
                     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
                     * production.
                     *
                     * Emits an {Initialized} event.
                     */
                    modifier initializer() {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        // Cache values to avoid duplicated sloads
                        bool isTopLevelCall = !$._initializing;
                        uint64 initialized = $._initialized;
                        // Allowed calls:
                        // - initialSetup: the contract is not in the initializing state and no previous version was
                        //                 initialized
                        // - construction: the contract is initialized at version 1 (no reininitialization) and the
                        //                 current contract is just being deployed
                        bool initialSetup = initialized == 0 && isTopLevelCall;
                        bool construction = initialized == 1 && address(this).code.length == 0;
                        if (!initialSetup && !construction) {
                            revert InvalidInitialization();
                        }
                        $._initialized = 1;
                        if (isTopLevelCall) {
                            $._initializing = true;
                        }
                        _;
                        if (isTopLevelCall) {
                            $._initializing = false;
                            emit Initialized(1);
                        }
                    }
                    /**
                     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
                     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
                     * used to initialize parent contracts.
                     *
                     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
                     * are added through upgrades and that require initialization.
                     *
                     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
                     * cannot be nested. If one is invoked in the context of another, execution will revert.
                     *
                     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
                     * a contract, executing them in the right order is up to the developer or operator.
                     *
                     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
                     *
                     * Emits an {Initialized} event.
                     */
                    modifier reinitializer(uint64 version) {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        if ($._initializing || $._initialized >= version) {
                            revert InvalidInitialization();
                        }
                        $._initialized = version;
                        $._initializing = true;
                        _;
                        $._initializing = false;
                        emit Initialized(version);
                    }
                    /**
                     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
                     * {initializer} and {reinitializer} modifiers, directly or indirectly.
                     */
                    modifier onlyInitializing() {
                        _checkInitializing();
                        _;
                    }
                    /**
                     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
                     */
                    function _checkInitializing() internal view virtual {
                        if (!_isInitializing()) {
                            revert NotInitializing();
                        }
                    }
                    /**
                     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
                     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
                     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
                     * through proxies.
                     *
                     * Emits an {Initialized} event the first time it is successfully executed.
                     */
                    function _disableInitializers() internal virtual {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        if ($._initializing) {
                            revert InvalidInitialization();
                        }
                        if ($._initialized != type(uint64).max) {
                            $._initialized = type(uint64).max;
                            emit Initialized(type(uint64).max);
                        }
                    }
                    /**
                     * @dev Returns the highest version that has been initialized. See {reinitializer}.
                     */
                    function _getInitializedVersion() internal view returns (uint64) {
                        return _getInitializableStorage()._initialized;
                    }
                    /**
                     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
                     */
                    function _isInitializing() internal view returns (bool) {
                        return _getInitializableStorage()._initializing;
                    }
                    /**
                     * @dev Returns a pointer to the storage namespace.
                     */
                    // solhint-disable-next-line var-name-mixedcase
                    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
                        assembly {
                            $.slot := INITIALIZABLE_STORAGE
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
                 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
                 *
                 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
                 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
                 * need to send a transaction, and thus is not required to hold Ether at all.
                 *
                 * ==== Security Considerations
                 *
                 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
                 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
                 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
                 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
                 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
                 * generally recommended is:
                 *
                 * ```solidity
                 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
                 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
                 *     doThing(..., value);
                 * }
                 *
                 * function doThing(..., uint256 value) public {
                 *     token.safeTransferFrom(msg.sender, address(this), value);
                 *     ...
                 * }
                 * ```
                 *
                 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
                 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
                 * {SafeERC20-safeTransferFrom}).
                 *
                 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
                 * contracts should have entry points that don't rely on permit.
                 */
                interface IERC20Permit {
                    /**
                     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
                     * given ``owner``'s signed approval.
                     *
                     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
                     * ordering also apply here.
                     *
                     * Emits an {Approval} event.
                     *
                     * Requirements:
                     *
                     * - `spender` cannot be the zero address.
                     * - `deadline` must be a timestamp in the future.
                     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
                     * over the EIP712-formatted function arguments.
                     * - the signature must use ``owner``'s current nonce (see {nonces}).
                     *
                     * For more information on the signature format, see the
                     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
                     * section].
                     *
                     * CAUTION: See Security Considerations above.
                     */
                    function permit(
                        address owner,
                        address spender,
                        uint256 value,
                        uint256 deadline,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) external;
                    /**
                     * @dev Returns the current nonce for `owner`. This value must be
                     * included whenever a signature is generated for {permit}.
                     *
                     * Every successful call to {permit} increases ``owner``'s nonce by one. This
                     * prevents a signature from being used multiple times.
                     */
                    function nonces(address owner) external view returns (uint256);
                    /**
                     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
                     */
                    // solhint-disable-next-line func-name-mixedcase
                    function DOMAIN_SEPARATOR() external view returns (bytes32);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
                pragma solidity ^0.8.20;
                import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
                import {Initializable} from "../proxy/utils/Initializable.sol";
                /**
                 * @dev Contract module which allows children to implement an emergency stop
                 * mechanism that can be triggered by an authorized account.
                 *
                 * This module is used through inheritance. It will make available the
                 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
                 * the functions of your contract. Note that they will not be pausable by
                 * simply including this module, only once the modifiers are put in place.
                 */
                abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
                    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
                    struct PausableStorage {
                        bool _paused;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;
                    function _getPausableStorage() private pure returns (PausableStorage storage $) {
                        assembly {
                            $.slot := PausableStorageLocation
                        }
                    }
                    /**
                     * @dev Emitted when the pause is triggered by `account`.
                     */
                    event Paused(address account);
                    /**
                     * @dev Emitted when the pause is lifted by `account`.
                     */
                    event Unpaused(address account);
                    /**
                     * @dev The operation failed because the contract is paused.
                     */
                    error EnforcedPause();
                    /**
                     * @dev The operation failed because the contract is not paused.
                     */
                    error ExpectedPause();
                    /**
                     * @dev Initializes the contract in unpaused state.
                     */
                    function __Pausable_init() internal onlyInitializing {
                        __Pausable_init_unchained();
                    }
                    function __Pausable_init_unchained() internal onlyInitializing {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = false;
                    }
                    /**
                     * @dev Modifier to make a function callable only when the contract is not paused.
                     *
                     * Requirements:
                     *
                     * - The contract must not be paused.
                     */
                    modifier whenNotPaused() {
                        _requireNotPaused();
                        _;
                    }
                    /**
                     * @dev Modifier to make a function callable only when the contract is paused.
                     *
                     * Requirements:
                     *
                     * - The contract must be paused.
                     */
                    modifier whenPaused() {
                        _requirePaused();
                        _;
                    }
                    /**
                     * @dev Returns true if the contract is paused, and false otherwise.
                     */
                    function paused() public view virtual returns (bool) {
                        PausableStorage storage $ = _getPausableStorage();
                        return $._paused;
                    }
                    /**
                     * @dev Throws if the contract is paused.
                     */
                    function _requireNotPaused() internal view virtual {
                        if (paused()) {
                            revert EnforcedPause();
                        }
                    }
                    /**
                     * @dev Throws if the contract is not paused.
                     */
                    function _requirePaused() internal view virtual {
                        if (!paused()) {
                            revert ExpectedPause();
                        }
                    }
                    /**
                     * @dev Triggers stopped state.
                     *
                     * Requirements:
                     *
                     * - The contract must not be paused.
                     */
                    function _pause() internal virtual whenNotPaused {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = true;
                        emit Paused(_msgSender());
                    }
                    /**
                     * @dev Returns to normal state.
                     *
                     * Requirements:
                     *
                     * - The contract must be paused.
                     */
                    function _unpause() internal virtual whenPaused {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = false;
                        emit Unpaused(_msgSender());
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
                pragma solidity ^0.8.20;
                import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
                import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol";
                import {Initializable} from "../../proxy/utils/Initializable.sol";
                /**
                 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
                 *
                 * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
                 * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
                 * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
                 * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
                 *
                 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
                 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
                 * ({_hashTypedDataV4}).
                 *
                 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
                 * the chain id to protect against replay attacks on an eventual fork of the chain.
                 *
                 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
                 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
                 *
                 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
                 * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
                 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
                 */
                abstract contract EIP712Upgradeable is Initializable, IERC5267 {
                    bytes32 private constant TYPE_HASH =
                        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
                    /// @custom:storage-location erc7201:openzeppelin.storage.EIP712
                    struct EIP712Storage {
                        /// @custom:oz-renamed-from _HASHED_NAME
                        bytes32 _hashedName;
                        /// @custom:oz-renamed-from _HASHED_VERSION
                        bytes32 _hashedVersion;
                        string _name;
                        string _version;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100;
                    function _getEIP712Storage() private pure returns (EIP712Storage storage $) {
                        assembly {
                            $.slot := EIP712StorageLocation
                        }
                    }
                    /**
                     * @dev Initializes the domain separator and parameter caches.
                     *
                     * The meaning of `name` and `version` is specified in
                     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
                     *
                     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
                     * - `version`: the current major version of the signing domain.
                     *
                     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
                     * contract upgrade].
                     */
                    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
                        __EIP712_init_unchained(name, version);
                    }
                    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {
                        EIP712Storage storage $ = _getEIP712Storage();
                        $._name = name;
                        $._version = version;
                        // Reset prior values in storage if upgrading
                        $._hashedName = 0;
                        $._hashedVersion = 0;
                    }
                    /**
                     * @dev Returns the domain separator for the current chain.
                     */
                    function _domainSeparatorV4() internal view returns (bytes32) {
                        return _buildDomainSeparator();
                    }
                    function _buildDomainSeparator() private view returns (bytes32) {
                        return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));
                    }
                    /**
                     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
                     * function returns the hash of the fully encoded EIP712 message for this domain.
                     *
                     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
                     *
                     * ```solidity
                     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
                     *     keccak256("Mail(address to,string contents)"),
                     *     mailTo,
                     *     keccak256(bytes(mailContents))
                     * )));
                     * address signer = ECDSA.recover(digest, signature);
                     * ```
                     */
                    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
                        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
                    }
                    /**
                     * @dev See {IERC-5267}.
                     */
                    function eip712Domain()
                        public
                        view
                        virtual
                        returns (
                            bytes1 fields,
                            string memory name,
                            string memory version,
                            uint256 chainId,
                            address verifyingContract,
                            bytes32 salt,
                            uint256[] memory extensions
                        )
                    {
                        EIP712Storage storage $ = _getEIP712Storage();
                        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized
                        // and the EIP712 domain is not reliable, as it will be missing name and version.
                        require($._hashedName == 0 && $._hashedVersion == 0, "EIP712: Uninitialized");
                        return (
                            hex"0f", // 01111
                            _EIP712Name(),
                            _EIP712Version(),
                            block.chainid,
                            address(this),
                            bytes32(0),
                            new uint256[](0)
                        );
                    }
                    /**
                     * @dev The name parameter for the EIP712 domain.
                     *
                     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
                     * are a concern.
                     */
                    function _EIP712Name() internal view virtual returns (string memory) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        return $._name;
                    }
                    /**
                     * @dev The version parameter for the EIP712 domain.
                     *
                     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
                     * are a concern.
                     */
                    function _EIP712Version() internal view virtual returns (string memory) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        return $._version;
                    }
                    /**
                     * @dev The hash of the name parameter for the EIP712 domain.
                     *
                     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.
                     */
                    function _EIP712NameHash() internal view returns (bytes32) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        string memory name = _EIP712Name();
                        if (bytes(name).length > 0) {
                            return keccak256(bytes(name));
                        } else {
                            // If the name is empty, the contract may have been upgraded without initializing the new storage.
                            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.
                            bytes32 hashedName = $._hashedName;
                            if (hashedName != 0) {
                                return hashedName;
                            } else {
                                return keccak256("");
                            }
                        }
                    }
                    /**
                     * @dev The hash of the version parameter for the EIP712 domain.
                     *
                     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.
                     */
                    function _EIP712VersionHash() internal view returns (bytes32) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        string memory version = _EIP712Version();
                        if (bytes(version).length > 0) {
                            return keccak256(bytes(version));
                        } else {
                            // If the version is empty, the contract may have been upgraded without initializing the new storage.
                            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.
                            bytes32 hashedVersion = $._hashedVersion;
                            if (hashedVersion != 0) {
                                return hashedVersion;
                            } else {
                                return keccak256("");
                            }
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/SignatureChecker.sol)
                pragma solidity ^0.8.20;
                import {ECDSA} from "./ECDSA.sol";
                import {IERC1271} from "../../interfaces/IERC1271.sol";
                /**
                 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
                 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
                 * Argent and Safe Wallet (previously Gnosis Safe).
                 */
                library SignatureChecker {
                    /**
                     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
                     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
                     *
                     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
                     * change through time. It could return true at block N and false at block N+1 (or the opposite).
                     */
                    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
                        (address recovered, ECDSA.RecoverError error, ) = ECDSA.tryRecover(hash, signature);
                        return
                            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
                            isValidERC1271SignatureNow(signer, hash, signature);
                    }
                    /**
                     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
                     * against the signer smart contract using ERC1271.
                     *
                     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
                     * change through time. It could return true at block N and false at block N+1 (or the opposite).
                     */
                    function isValidERC1271SignatureNow(
                        address signer,
                        bytes32 hash,
                        bytes memory signature
                    ) internal view returns (bool) {
                        (bool success, bytes memory result) = signer.staticcall(
                            abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
                        );
                        return (success &&
                            result.length >= 32 &&
                            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Reentrancy guard mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuard.sol)
                abstract contract ReentrancyGuard {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Unauthorized reentrant call.
                    error Reentrancy();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Equivalent to: `uint72(bytes9(keccak256("_REENTRANCY_GUARD_SLOT")))`.
                    /// 9 bytes is large enough to avoid collisions with lower slots,
                    /// but not too large to result in excessive bytecode bloat.
                    uint256 private constant _REENTRANCY_GUARD_SLOT = 0x929eee149b4bd21268;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      REENTRANCY GUARD                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Guards a function from reentrancy.
                    modifier nonReentrant() virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if eq(sload(_REENTRANCY_GUARD_SLOT), address()) {
                                mstore(0x00, 0xab143c06) // `Reentrancy()`.
                                revert(0x1c, 0x04)
                            }
                            sstore(_REENTRANCY_GUARD_SLOT, address())
                        }
                        _;
                        /// @solidity memory-safe-assembly
                        assembly {
                            sstore(_REENTRANCY_GUARD_SLOT, codesize())
                        }
                    }
                    /// @dev Guards a view function from read-only reentrancy.
                    modifier nonReadReentrant() virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if eq(sload(_REENTRANCY_GUARD_SLOT), address()) {
                                mstore(0x00, 0xab143c06) // `Reentrancy()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice UUPS proxy mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/UUPSUpgradeable.sol)
                /// @author Modified from OpenZeppelin
                /// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/UUPSUpgradeable.sol)
                ///
                /// Note:
                /// - This implementation is intended to be used with ERC1967 proxies.
                /// See: `LibClone.deployERC1967` and related functions.
                /// - This implementation is NOT compatible with legacy OpenZeppelin proxies
                /// which do not store the implementation at `_ERC1967_IMPLEMENTATION_SLOT`.
                abstract contract UUPSUpgradeable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The upgrade failed.
                    error UpgradeFailed();
                    /// @dev The call is from an unauthorized call context.
                    error UnauthorizedCallContext();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         IMMUTABLES                         */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev For checking if the context is a delegate call.
                    uint256 private immutable __self = uint256(uint160(address(this)));
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Emitted when the proxy's implementation is upgraded.
                    event Upgraded(address indexed implementation);
                    /// @dev `keccak256(bytes("Upgraded(address)"))`.
                    uint256 private constant _UPGRADED_EVENT_SIGNATURE =
                        0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The ERC-1967 storage slot for the implementation in the proxy.
                    /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`.
                    bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT =
                        0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      UUPS OPERATIONS                       */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Please override this function to check if `msg.sender` is authorized
                    /// to upgrade the proxy to `newImplementation`, reverting if not.
                    /// ```
                    ///     function _authorizeUpgrade(address) internal override onlyOwner {}
                    /// ```
                    function _authorizeUpgrade(address newImplementation) internal virtual;
                    /// @dev Returns the storage slot used by the implementation,
                    /// as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822).
                    ///
                    /// Note: The `notDelegated` modifier prevents accidental upgrades to
                    /// an implementation that is a proxy contract.
                    function proxiableUUID() public view virtual notDelegated returns (bytes32) {
                        // This function must always return `_ERC1967_IMPLEMENTATION_SLOT` to comply with ERC1967.
                        return _ERC1967_IMPLEMENTATION_SLOT;
                    }
                    /// @dev Upgrades the proxy's implementation to `newImplementation`.
                    /// Emits a {Upgraded} event.
                    ///
                    /// Note: Passing in empty `data` skips the delegatecall to `newImplementation`.
                    function upgradeToAndCall(address newImplementation, bytes calldata data)
                        public
                        payable
                        virtual
                        onlyProxy
                    {
                        _authorizeUpgrade(newImplementation);
                        /// @solidity memory-safe-assembly
                        assembly {
                            newImplementation := shr(96, shl(96, newImplementation)) // Clears upper 96 bits.
                            mstore(0x01, 0x52d1902d) // `proxiableUUID()`.
                            let s := _ERC1967_IMPLEMENTATION_SLOT
                            // Check if `newImplementation` implements `proxiableUUID` correctly.
                            if iszero(eq(mload(staticcall(gas(), newImplementation, 0x1d, 0x04, 0x01, 0x20)), s)) {
                                mstore(0x01, 0x55299b49) // `UpgradeFailed()`.
                                revert(0x1d, 0x04)
                            }
                            // Emit the {Upgraded} event.
                            log2(codesize(), 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation)
                            sstore(s, newImplementation) // Updates the implementation.
                            // Perform a delegatecall to `newImplementation` if `data` is non-empty.
                            if data.length {
                                // Forwards the `data` to `newImplementation` via delegatecall.
                                let m := mload(0x40)
                                calldatacopy(m, data.offset, data.length)
                                if iszero(delegatecall(gas(), newImplementation, m, data.length, codesize(), 0x00))
                                {
                                    // Bubble up the revert if the call reverts.
                                    returndatacopy(m, 0x00, returndatasize())
                                    revert(m, returndatasize())
                                }
                            }
                        }
                    }
                    /// @dev Requires that the execution is performed through a proxy.
                    modifier onlyProxy() {
                        uint256 s = __self;
                        /// @solidity memory-safe-assembly
                        assembly {
                            // To enable use cases with an immutable default implementation in the bytecode,
                            // (see: ERC6551Proxy), we don't require that the proxy address must match the
                            // value stored in the implementation slot, which may not be initialized.
                            if eq(s, address()) {
                                mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                    /// @dev Requires that the execution is NOT performed via delegatecall.
                    /// This is the opposite of `onlyProxy`.
                    modifier notDelegated() {
                        uint256 s = __self;
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(eq(s, address())) {
                                mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                import {Ownable} from "./Ownable.sol";
                /// @notice Simple single owner and multiroles authorization mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
                /// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173)
                /// for compatibility, the nomenclature for the 2-step ownership handover and roles
                /// may be unique to this codebase.
                abstract contract OwnableRoles is Ownable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The `user`'s roles is updated to `roles`.
                    /// Each bit of `roles` represents whether the role is set.
                    event RolesUpdated(address indexed user, uint256 indexed roles);
                    /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`.
                    uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
                        0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The role slot of `user` is given by:
                    /// ```
                    ///     mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED))
                    ///     let roleSlot := keccak256(0x00, 0x20)
                    /// ```
                    /// This automatically ignores the upper bits of the `user` in case
                    /// they are not clean, as well as keep the `keccak256` under 32-bytes.
                    ///
                    /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`.
                    uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     INTERNAL FUNCTIONS                     */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Overwrite the roles directly without authorization guard.
                    function _setRoles(address user, uint256 roles) internal virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, user)
                            // Store the new value.
                            sstore(keccak256(0x0c, 0x20), roles)
                            // Emit the {RolesUpdated} event.
                            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
                        }
                    }
                    /// @dev Updates the roles directly without authorization guard.
                    /// If `on` is true, each set bit of `roles` will be turned on,
                    /// otherwise, each set bit of `roles` will be turned off.
                    function _updateRoles(address user, uint256 roles, bool on) internal virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, user)
                            let roleSlot := keccak256(0x0c, 0x20)
                            // Load the current value.
                            let current := sload(roleSlot)
                            // Compute the updated roles if `on` is true.
                            let updated := or(current, roles)
                            // Compute the updated roles if `on` is false.
                            // Use `and` to compute the intersection of `current` and `roles`,
                            // `xor` it with `current` to flip the bits in the intersection.
                            if iszero(on) { updated := xor(current, and(current, roles)) }
                            // Then, store the new value.
                            sstore(roleSlot, updated)
                            // Emit the {RolesUpdated} event.
                            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated)
                        }
                    }
                    /// @dev Grants the roles directly without authorization guard.
                    /// Each bit of `roles` represents the role to turn on.
                    function _grantRoles(address user, uint256 roles) internal virtual {
                        _updateRoles(user, roles, true);
                    }
                    /// @dev Removes the roles directly without authorization guard.
                    /// Each bit of `roles` represents the role to turn off.
                    function _removeRoles(address user, uint256 roles) internal virtual {
                        _updateRoles(user, roles, false);
                    }
                    /// @dev Throws if the sender does not have any of the `roles`.
                    function _checkRoles(uint256 roles) internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the role slot.
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, caller())
                            // Load the stored value, and if the `and` intersection
                            // of the value and `roles` is zero, revert.
                            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Throws if the sender is not the owner,
                    /// and does not have any of the `roles`.
                    /// Checks for ownership first, then lazily checks for roles.
                    function _checkOwnerOrRoles(uint256 roles) internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // If the caller is not the stored owner.
                            // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
                            if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                                // Compute the role slot.
                                mstore(0x0c, _ROLE_SLOT_SEED)
                                mstore(0x00, caller())
                                // Load the stored value, and if the `and` intersection
                                // of the value and `roles` is zero, revert.
                                if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                                    mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                        }
                    }
                    /// @dev Throws if the sender does not have any of the `roles`,
                    /// and is not the owner.
                    /// Checks for roles first, then lazily checks for ownership.
                    function _checkRolesOrOwner(uint256 roles) internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the role slot.
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, caller())
                            // Load the stored value, and if the `and` intersection
                            // of the value and `roles` is zero, revert.
                            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                                // If the caller is not the stored owner.
                                // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
                                if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                                    mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                        }
                    }
                    /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`.
                    /// This is meant for frontends like Etherscan, and is therefore not fully optimized.
                    /// Not recommended to be called on-chain.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } {
                                // We don't need to mask the values of `ordinals`, as Solidity
                                // cleans dirty upper bits when storing variables into memory.
                                roles := or(shl(mload(add(ordinals, i)), 1), roles)
                            }
                        }
                    }
                    /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap.
                    /// This is meant for frontends like Etherscan, and is therefore not fully optimized.
                    /// Not recommended to be called on-chain.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Grab the pointer to the free memory.
                            ordinals := mload(0x40)
                            let ptr := add(ordinals, 0x20)
                            let o := 0
                            // The absence of lookup tables, De Bruijn, etc., here is intentional for
                            // smaller bytecode, as this function is not meant to be called on-chain.
                            for { let t := roles } 1 {} {
                                mstore(ptr, o)
                                // `shr` 5 is equivalent to multiplying by 0x20.
                                // Push back into the ordinals array if the bit is set.
                                ptr := add(ptr, shl(5, and(t, 1)))
                                o := add(o, 1)
                                t := shr(o, roles)
                                if iszero(t) { break }
                            }
                            // Store the length of `ordinals`.
                            mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20))))
                            // Allocate the memory.
                            mstore(0x40, ptr)
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  PUBLIC UPDATE FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Allows the owner to grant `user` `roles`.
                    /// If the `user` already has a role, then it will be an no-op for the role.
                    function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
                        _grantRoles(user, roles);
                    }
                    /// @dev Allows the owner to remove `user` `roles`.
                    /// If the `user` does not have a role, then it will be an no-op for the role.
                    function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
                        _removeRoles(user, roles);
                    }
                    /// @dev Allow the caller to remove their own roles.
                    /// If the caller does not have a role, then it will be an no-op for the role.
                    function renounceRoles(uint256 roles) public payable virtual {
                        _removeRoles(msg.sender, roles);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                   PUBLIC READ FUNCTIONS                    */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the roles of `user`.
                    function rolesOf(address user) public view virtual returns (uint256 roles) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the role slot.
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, user)
                            // Load the stored value.
                            roles := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /// @dev Returns whether `user` has any of `roles`.
                    function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) {
                        return rolesOf(user) & roles != 0;
                    }
                    /// @dev Returns whether `user` has all of `roles`.
                    function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) {
                        return rolesOf(user) & roles == roles;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         MODIFIERS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Marks a function as only callable by an account with `roles`.
                    modifier onlyRoles(uint256 roles) virtual {
                        _checkRoles(roles);
                        _;
                    }
                    /// @dev Marks a function as only callable by the owner or by an account
                    /// with `roles`. Checks for ownership first, then lazily checks for roles.
                    modifier onlyOwnerOrRoles(uint256 roles) virtual {
                        _checkOwnerOrRoles(roles);
                        _;
                    }
                    /// @dev Marks a function as only callable by an account with `roles`
                    /// or the owner. Checks for roles first, then lazily checks for ownership.
                    modifier onlyRolesOrOwner(uint256 roles) virtual {
                        _checkRolesOrOwner(roles);
                        _;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       ROLE CONSTANTS                       */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    // IYKYK
                    uint256 internal constant _ROLE_0 = 1 << 0;
                    uint256 internal constant _ROLE_1 = 1 << 1;
                    uint256 internal constant _ROLE_2 = 1 << 2;
                    uint256 internal constant _ROLE_3 = 1 << 3;
                    uint256 internal constant _ROLE_4 = 1 << 4;
                    uint256 internal constant _ROLE_5 = 1 << 5;
                    uint256 internal constant _ROLE_6 = 1 << 6;
                    uint256 internal constant _ROLE_7 = 1 << 7;
                    uint256 internal constant _ROLE_8 = 1 << 8;
                    uint256 internal constant _ROLE_9 = 1 << 9;
                    uint256 internal constant _ROLE_10 = 1 << 10;
                    uint256 internal constant _ROLE_11 = 1 << 11;
                    uint256 internal constant _ROLE_12 = 1 << 12;
                    uint256 internal constant _ROLE_13 = 1 << 13;
                    uint256 internal constant _ROLE_14 = 1 << 14;
                    uint256 internal constant _ROLE_15 = 1 << 15;
                    uint256 internal constant _ROLE_16 = 1 << 16;
                    uint256 internal constant _ROLE_17 = 1 << 17;
                    uint256 internal constant _ROLE_18 = 1 << 18;
                    uint256 internal constant _ROLE_19 = 1 << 19;
                    uint256 internal constant _ROLE_20 = 1 << 20;
                    uint256 internal constant _ROLE_21 = 1 << 21;
                    uint256 internal constant _ROLE_22 = 1 << 22;
                    uint256 internal constant _ROLE_23 = 1 << 23;
                    uint256 internal constant _ROLE_24 = 1 << 24;
                    uint256 internal constant _ROLE_25 = 1 << 25;
                    uint256 internal constant _ROLE_26 = 1 << 26;
                    uint256 internal constant _ROLE_27 = 1 << 27;
                    uint256 internal constant _ROLE_28 = 1 << 28;
                    uint256 internal constant _ROLE_29 = 1 << 29;
                    uint256 internal constant _ROLE_30 = 1 << 30;
                    uint256 internal constant _ROLE_31 = 1 << 31;
                    uint256 internal constant _ROLE_32 = 1 << 32;
                    uint256 internal constant _ROLE_33 = 1 << 33;
                    uint256 internal constant _ROLE_34 = 1 << 34;
                    uint256 internal constant _ROLE_35 = 1 << 35;
                    uint256 internal constant _ROLE_36 = 1 << 36;
                    uint256 internal constant _ROLE_37 = 1 << 37;
                    uint256 internal constant _ROLE_38 = 1 << 38;
                    uint256 internal constant _ROLE_39 = 1 << 39;
                    uint256 internal constant _ROLE_40 = 1 << 40;
                    uint256 internal constant _ROLE_41 = 1 << 41;
                    uint256 internal constant _ROLE_42 = 1 << 42;
                    uint256 internal constant _ROLE_43 = 1 << 43;
                    uint256 internal constant _ROLE_44 = 1 << 44;
                    uint256 internal constant _ROLE_45 = 1 << 45;
                    uint256 internal constant _ROLE_46 = 1 << 46;
                    uint256 internal constant _ROLE_47 = 1 << 47;
                    uint256 internal constant _ROLE_48 = 1 << 48;
                    uint256 internal constant _ROLE_49 = 1 << 49;
                    uint256 internal constant _ROLE_50 = 1 << 50;
                    uint256 internal constant _ROLE_51 = 1 << 51;
                    uint256 internal constant _ROLE_52 = 1 << 52;
                    uint256 internal constant _ROLE_53 = 1 << 53;
                    uint256 internal constant _ROLE_54 = 1 << 54;
                    uint256 internal constant _ROLE_55 = 1 << 55;
                    uint256 internal constant _ROLE_56 = 1 << 56;
                    uint256 internal constant _ROLE_57 = 1 << 57;
                    uint256 internal constant _ROLE_58 = 1 << 58;
                    uint256 internal constant _ROLE_59 = 1 << 59;
                    uint256 internal constant _ROLE_60 = 1 << 60;
                    uint256 internal constant _ROLE_61 = 1 << 61;
                    uint256 internal constant _ROLE_62 = 1 << 62;
                    uint256 internal constant _ROLE_63 = 1 << 63;
                    uint256 internal constant _ROLE_64 = 1 << 64;
                    uint256 internal constant _ROLE_65 = 1 << 65;
                    uint256 internal constant _ROLE_66 = 1 << 66;
                    uint256 internal constant _ROLE_67 = 1 << 67;
                    uint256 internal constant _ROLE_68 = 1 << 68;
                    uint256 internal constant _ROLE_69 = 1 << 69;
                    uint256 internal constant _ROLE_70 = 1 << 70;
                    uint256 internal constant _ROLE_71 = 1 << 71;
                    uint256 internal constant _ROLE_72 = 1 << 72;
                    uint256 internal constant _ROLE_73 = 1 << 73;
                    uint256 internal constant _ROLE_74 = 1 << 74;
                    uint256 internal constant _ROLE_75 = 1 << 75;
                    uint256 internal constant _ROLE_76 = 1 << 76;
                    uint256 internal constant _ROLE_77 = 1 << 77;
                    uint256 internal constant _ROLE_78 = 1 << 78;
                    uint256 internal constant _ROLE_79 = 1 << 79;
                    uint256 internal constant _ROLE_80 = 1 << 80;
                    uint256 internal constant _ROLE_81 = 1 << 81;
                    uint256 internal constant _ROLE_82 = 1 << 82;
                    uint256 internal constant _ROLE_83 = 1 << 83;
                    uint256 internal constant _ROLE_84 = 1 << 84;
                    uint256 internal constant _ROLE_85 = 1 << 85;
                    uint256 internal constant _ROLE_86 = 1 << 86;
                    uint256 internal constant _ROLE_87 = 1 << 87;
                    uint256 internal constant _ROLE_88 = 1 << 88;
                    uint256 internal constant _ROLE_89 = 1 << 89;
                    uint256 internal constant _ROLE_90 = 1 << 90;
                    uint256 internal constant _ROLE_91 = 1 << 91;
                    uint256 internal constant _ROLE_92 = 1 << 92;
                    uint256 internal constant _ROLE_93 = 1 << 93;
                    uint256 internal constant _ROLE_94 = 1 << 94;
                    uint256 internal constant _ROLE_95 = 1 << 95;
                    uint256 internal constant _ROLE_96 = 1 << 96;
                    uint256 internal constant _ROLE_97 = 1 << 97;
                    uint256 internal constant _ROLE_98 = 1 << 98;
                    uint256 internal constant _ROLE_99 = 1 << 99;
                    uint256 internal constant _ROLE_100 = 1 << 100;
                    uint256 internal constant _ROLE_101 = 1 << 101;
                    uint256 internal constant _ROLE_102 = 1 << 102;
                    uint256 internal constant _ROLE_103 = 1 << 103;
                    uint256 internal constant _ROLE_104 = 1 << 104;
                    uint256 internal constant _ROLE_105 = 1 << 105;
                    uint256 internal constant _ROLE_106 = 1 << 106;
                    uint256 internal constant _ROLE_107 = 1 << 107;
                    uint256 internal constant _ROLE_108 = 1 << 108;
                    uint256 internal constant _ROLE_109 = 1 << 109;
                    uint256 internal constant _ROLE_110 = 1 << 110;
                    uint256 internal constant _ROLE_111 = 1 << 111;
                    uint256 internal constant _ROLE_112 = 1 << 112;
                    uint256 internal constant _ROLE_113 = 1 << 113;
                    uint256 internal constant _ROLE_114 = 1 << 114;
                    uint256 internal constant _ROLE_115 = 1 << 115;
                    uint256 internal constant _ROLE_116 = 1 << 116;
                    uint256 internal constant _ROLE_117 = 1 << 117;
                    uint256 internal constant _ROLE_118 = 1 << 118;
                    uint256 internal constant _ROLE_119 = 1 << 119;
                    uint256 internal constant _ROLE_120 = 1 << 120;
                    uint256 internal constant _ROLE_121 = 1 << 121;
                    uint256 internal constant _ROLE_122 = 1 << 122;
                    uint256 internal constant _ROLE_123 = 1 << 123;
                    uint256 internal constant _ROLE_124 = 1 << 124;
                    uint256 internal constant _ROLE_125 = 1 << 125;
                    uint256 internal constant _ROLE_126 = 1 << 126;
                    uint256 internal constant _ROLE_127 = 1 << 127;
                    uint256 internal constant _ROLE_128 = 1 << 128;
                    uint256 internal constant _ROLE_129 = 1 << 129;
                    uint256 internal constant _ROLE_130 = 1 << 130;
                    uint256 internal constant _ROLE_131 = 1 << 131;
                    uint256 internal constant _ROLE_132 = 1 << 132;
                    uint256 internal constant _ROLE_133 = 1 << 133;
                    uint256 internal constant _ROLE_134 = 1 << 134;
                    uint256 internal constant _ROLE_135 = 1 << 135;
                    uint256 internal constant _ROLE_136 = 1 << 136;
                    uint256 internal constant _ROLE_137 = 1 << 137;
                    uint256 internal constant _ROLE_138 = 1 << 138;
                    uint256 internal constant _ROLE_139 = 1 << 139;
                    uint256 internal constant _ROLE_140 = 1 << 140;
                    uint256 internal constant _ROLE_141 = 1 << 141;
                    uint256 internal constant _ROLE_142 = 1 << 142;
                    uint256 internal constant _ROLE_143 = 1 << 143;
                    uint256 internal constant _ROLE_144 = 1 << 144;
                    uint256 internal constant _ROLE_145 = 1 << 145;
                    uint256 internal constant _ROLE_146 = 1 << 146;
                    uint256 internal constant _ROLE_147 = 1 << 147;
                    uint256 internal constant _ROLE_148 = 1 << 148;
                    uint256 internal constant _ROLE_149 = 1 << 149;
                    uint256 internal constant _ROLE_150 = 1 << 150;
                    uint256 internal constant _ROLE_151 = 1 << 151;
                    uint256 internal constant _ROLE_152 = 1 << 152;
                    uint256 internal constant _ROLE_153 = 1 << 153;
                    uint256 internal constant _ROLE_154 = 1 << 154;
                    uint256 internal constant _ROLE_155 = 1 << 155;
                    uint256 internal constant _ROLE_156 = 1 << 156;
                    uint256 internal constant _ROLE_157 = 1 << 157;
                    uint256 internal constant _ROLE_158 = 1 << 158;
                    uint256 internal constant _ROLE_159 = 1 << 159;
                    uint256 internal constant _ROLE_160 = 1 << 160;
                    uint256 internal constant _ROLE_161 = 1 << 161;
                    uint256 internal constant _ROLE_162 = 1 << 162;
                    uint256 internal constant _ROLE_163 = 1 << 163;
                    uint256 internal constant _ROLE_164 = 1 << 164;
                    uint256 internal constant _ROLE_165 = 1 << 165;
                    uint256 internal constant _ROLE_166 = 1 << 166;
                    uint256 internal constant _ROLE_167 = 1 << 167;
                    uint256 internal constant _ROLE_168 = 1 << 168;
                    uint256 internal constant _ROLE_169 = 1 << 169;
                    uint256 internal constant _ROLE_170 = 1 << 170;
                    uint256 internal constant _ROLE_171 = 1 << 171;
                    uint256 internal constant _ROLE_172 = 1 << 172;
                    uint256 internal constant _ROLE_173 = 1 << 173;
                    uint256 internal constant _ROLE_174 = 1 << 174;
                    uint256 internal constant _ROLE_175 = 1 << 175;
                    uint256 internal constant _ROLE_176 = 1 << 176;
                    uint256 internal constant _ROLE_177 = 1 << 177;
                    uint256 internal constant _ROLE_178 = 1 << 178;
                    uint256 internal constant _ROLE_179 = 1 << 179;
                    uint256 internal constant _ROLE_180 = 1 << 180;
                    uint256 internal constant _ROLE_181 = 1 << 181;
                    uint256 internal constant _ROLE_182 = 1 << 182;
                    uint256 internal constant _ROLE_183 = 1 << 183;
                    uint256 internal constant _ROLE_184 = 1 << 184;
                    uint256 internal constant _ROLE_185 = 1 << 185;
                    uint256 internal constant _ROLE_186 = 1 << 186;
                    uint256 internal constant _ROLE_187 = 1 << 187;
                    uint256 internal constant _ROLE_188 = 1 << 188;
                    uint256 internal constant _ROLE_189 = 1 << 189;
                    uint256 internal constant _ROLE_190 = 1 << 190;
                    uint256 internal constant _ROLE_191 = 1 << 191;
                    uint256 internal constant _ROLE_192 = 1 << 192;
                    uint256 internal constant _ROLE_193 = 1 << 193;
                    uint256 internal constant _ROLE_194 = 1 << 194;
                    uint256 internal constant _ROLE_195 = 1 << 195;
                    uint256 internal constant _ROLE_196 = 1 << 196;
                    uint256 internal constant _ROLE_197 = 1 << 197;
                    uint256 internal constant _ROLE_198 = 1 << 198;
                    uint256 internal constant _ROLE_199 = 1 << 199;
                    uint256 internal constant _ROLE_200 = 1 << 200;
                    uint256 internal constant _ROLE_201 = 1 << 201;
                    uint256 internal constant _ROLE_202 = 1 << 202;
                    uint256 internal constant _ROLE_203 = 1 << 203;
                    uint256 internal constant _ROLE_204 = 1 << 204;
                    uint256 internal constant _ROLE_205 = 1 << 205;
                    uint256 internal constant _ROLE_206 = 1 << 206;
                    uint256 internal constant _ROLE_207 = 1 << 207;
                    uint256 internal constant _ROLE_208 = 1 << 208;
                    uint256 internal constant _ROLE_209 = 1 << 209;
                    uint256 internal constant _ROLE_210 = 1 << 210;
                    uint256 internal constant _ROLE_211 = 1 << 211;
                    uint256 internal constant _ROLE_212 = 1 << 212;
                    uint256 internal constant _ROLE_213 = 1 << 213;
                    uint256 internal constant _ROLE_214 = 1 << 214;
                    uint256 internal constant _ROLE_215 = 1 << 215;
                    uint256 internal constant _ROLE_216 = 1 << 216;
                    uint256 internal constant _ROLE_217 = 1 << 217;
                    uint256 internal constant _ROLE_218 = 1 << 218;
                    uint256 internal constant _ROLE_219 = 1 << 219;
                    uint256 internal constant _ROLE_220 = 1 << 220;
                    uint256 internal constant _ROLE_221 = 1 << 221;
                    uint256 internal constant _ROLE_222 = 1 << 222;
                    uint256 internal constant _ROLE_223 = 1 << 223;
                    uint256 internal constant _ROLE_224 = 1 << 224;
                    uint256 internal constant _ROLE_225 = 1 << 225;
                    uint256 internal constant _ROLE_226 = 1 << 226;
                    uint256 internal constant _ROLE_227 = 1 << 227;
                    uint256 internal constant _ROLE_228 = 1 << 228;
                    uint256 internal constant _ROLE_229 = 1 << 229;
                    uint256 internal constant _ROLE_230 = 1 << 230;
                    uint256 internal constant _ROLE_231 = 1 << 231;
                    uint256 internal constant _ROLE_232 = 1 << 232;
                    uint256 internal constant _ROLE_233 = 1 << 233;
                    uint256 internal constant _ROLE_234 = 1 << 234;
                    uint256 internal constant _ROLE_235 = 1 << 235;
                    uint256 internal constant _ROLE_236 = 1 << 236;
                    uint256 internal constant _ROLE_237 = 1 << 237;
                    uint256 internal constant _ROLE_238 = 1 << 238;
                    uint256 internal constant _ROLE_239 = 1 << 239;
                    uint256 internal constant _ROLE_240 = 1 << 240;
                    uint256 internal constant _ROLE_241 = 1 << 241;
                    uint256 internal constant _ROLE_242 = 1 << 242;
                    uint256 internal constant _ROLE_243 = 1 << 243;
                    uint256 internal constant _ROLE_244 = 1 << 244;
                    uint256 internal constant _ROLE_245 = 1 << 245;
                    uint256 internal constant _ROLE_246 = 1 << 246;
                    uint256 internal constant _ROLE_247 = 1 << 247;
                    uint256 internal constant _ROLE_248 = 1 << 248;
                    uint256 internal constant _ROLE_249 = 1 << 249;
                    uint256 internal constant _ROLE_250 = 1 << 250;
                    uint256 internal constant _ROLE_251 = 1 << 251;
                    uint256 internal constant _ROLE_252 = 1 << 252;
                    uint256 internal constant _ROLE_253 = 1 << 253;
                    uint256 internal constant _ROLE_254 = 1 << 254;
                    uint256 internal constant _ROLE_255 = 1 << 255;
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./DelegationSupervisorLib.sol";
                import "../interfaces/IVault.sol";
                import "../interfaces/IVaultSupervisor.sol";
                import "../interfaces/Errors.sol";
                import "../interfaces/Events.sol";
                library Withdraw {
                    struct QueuedWithdrawal {
                        address staker;
                        address delegatedTo;
                        uint256 nonce;
                        uint256 start;
                        WithdrawRequest request;
                    }
                    struct WithdrawRequest {
                        IVault[] vaults;
                        uint256[] shares;
                        address withdrawer;
                    }
                    function finishStartedWithdrawal(
                        QueuedWithdrawal calldata withdrawal,
                        DelegationSupervisorLib.Storage storage delegationSupervisor
                    ) internal {
                        bytes32 withdrawalRoot = calculateWithdrawalRoot(withdrawal);
                        if (withdrawal.request.withdrawer != msg.sender) revert WithdrawerNotCaller();
                        if (withdrawal.start + delegationSupervisor.withdrawalDelay > block.timestamp) {
                            revert MinWithdrawDelayNotPassed();
                        }
                        if (!delegationSupervisor.pendingWithdrawals[withdrawalRoot]) revert WithdrawAlreadyCompleted();
                        delete delegationSupervisor.pendingWithdrawals[withdrawalRoot];
                        for (uint256 i = 0; i < withdrawal.request.vaults.length; i++) {
                            delegationSupervisor.vaultSupervisor.redeemShares(
                                msg.sender, withdrawal.request.vaults[i], withdrawal.request.shares[i]
                            );
                            emit FinishedWithdrawal(
                                address(withdrawal.request.vaults[i]),
                                withdrawal.staker,
                                withdrawal.delegatedTo,
                                withdrawal.request.withdrawer,
                                withdrawal.request.shares[i],
                                withdrawalRoot
                            );
                        }
                    }
                    function calculateWithdrawalRoot(QueuedWithdrawal memory withdrawal) internal pure returns (bytes32) {
                        return keccak256(abi.encode(withdrawal));
                    }
                    function validate(Withdraw.WithdrawRequest calldata withdrawalRequest) internal view {
                        // Length Checks
                        if (withdrawalRequest.shares.length == 0 || withdrawalRequest.vaults.length == 0) revert NoElementsInArray();
                        if (withdrawalRequest.shares.length != withdrawalRequest.vaults.length) revert ArrayLengthsNotEqual();
                        // ACL checks
                        if (withdrawalRequest.withdrawer != msg.sender) revert NotStaker();
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {Staker} from "./Staker.sol";
                import {IVault} from "../interfaces/IVault.sol";
                import {IVaultSupervisor} from "../interfaces/IVaultSupervisor.sol";
                import "../interfaces/Errors.sol";
                import "../interfaces/Constants.sol";
                library DelegationSupervisorLib {
                    /// @custom:storage-location erc7201:delegationsupervisor.storage
                    struct Storage {
                        mapping(bytes32 => bool) pendingWithdrawals;
                        mapping(address => mapping(bytes32 => bool)) delegationApproverSaltIsSpent;
                        mapping(address staker => Staker.StakerState state) stakers;
                        uint256 withdrawalDelay;
                        IVaultSupervisor vaultSupervisor;
                    }
                    function initOrUpdate(Storage storage self, address vaultSupervisor, uint256 withdrawDelay) internal {
                        if (withdrawDelay > Constants.MAX_WITHDRAWAL_DELAY) revert InvalidWithdrawalDelay();
                        self.withdrawalDelay = withdrawDelay;
                        self.vaultSupervisor = IVaultSupervisor(vaultSupervisor);
                    }
                    function updateMinWithdrawDelay(Storage storage self, uint256 withdrawDelay) internal {
                        if (withdrawDelay > Constants.MAX_WITHDRAWAL_DELAY) revert InvalidWithdrawalDelay();
                        self.withdrawalDelay = withdrawDelay;
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./Withdraw.sol";
                library Staker {
                    struct StakerState {
                        address delegatee; // staker this staker is delegating to
                        uint256 nonce;
                        uint256 totalWithdrawsQueued;
                        Withdraw.QueuedWithdrawal[] queuedWithdrawals;
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol";
                library Constants {
                    uint256 public constant MAX_WITHDRAWAL_DELAY = 30 days;
                    uint8 public constant MAX_VAULTS_PER_STAKER = 32;
                    bytes32 public constant SIGNED_DEPOSIT_TYPEHASH =
                        keccak256("Deposit(address vault, uint256 deadline, uint256 value, uint256 nonce)");
                    bytes32 constant DOMAIN_TYPEHASH =
                        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
                    address public constant DEFAULT_VAULT_IMPLEMENTATION_FLAG = address(1);
                    // Bit from solady/src/auth/OwnableRoles.sol
                    uint256 public constant MANAGER_ROLE = 1 << 0;
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import {IVaultSupervisor} from "./IVaultSupervisor.sol";
                interface IVault is IERC4626 {
                    enum AssetType {
                        NONE,
                        ETH,
                        STABLE,
                        BTC,
                        OTHER
                    }
                    function initialize(
                        address _owner,
                        IERC20 _depositToken,
                        string memory _name,
                        string memory _symbol,
                        AssetType _assetType
                    ) external;
                    function deposit(uint256 assets, address depositor) external returns (uint256);
                    function redeem(uint256 shares, address to, address owner) external returns (uint256 assets);
                    function setLimit(uint256 newLimit) external;
                    function assetLimit() external view returns (uint256);
                    function pause(bool toPause) external;
                    function owner() external view returns (address);
                    function transferOwnership(address newOwner) external;
                    function renounceOwnership() external;
                    function totalAssets() external view returns (uint256);
                    function decimals() external view returns (uint8);
                    function assetType() external view returns (AssetType);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./IVault.sol";
                import "../entities/Withdraw.sol";
                interface IDelegationSupervisor {
                    function withdrawalDelay() external view returns (uint256);
                    function initialize(address vaultSupervisor, uint256 minWithdrawDelay, address manager) external;
                    function startWithdraw(Withdraw.WithdrawRequest[] calldata withdrawRequest)
                        external
                        returns (bytes32[] memory withdrawalRoots, Withdraw.QueuedWithdrawal[] memory);
                    function finishWithdraw(Withdraw.QueuedWithdrawal[] calldata withdrawals) external;
                    function pause(bool toPause) external;
                    function fetchQueuedWithdrawals(address staker)
                        external
                        view
                        returns (Withdraw.QueuedWithdrawal[] memory queuedWithdrawals);
                    function isWithdrawPending(Withdraw.QueuedWithdrawal calldata withdrawal) external view returns (bool);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                event StartedWithdrawal(
                    address indexed vault, address indexed staker, address indexed operator, address withdrawer, uint256 shares
                );
                event FinishedWithdrawal(
                    address indexed vault,
                    address indexed staker,
                    address indexed operator,
                    address withdrawer,
                    uint256 shares,
                    bytes32 withdrawRoot
                );
                event NewVault(address indexed vault);
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
                pragma solidity ^0.8.20;
                import {Initializable} from "../proxy/utils/Initializable.sol";
                /**
                 * @dev Provides information about the current execution context, including the
                 * sender of the transaction and its data. While these are generally available
                 * via msg.sender and msg.data, they should not be accessed in such a direct
                 * manner, since when dealing with meta-transactions the account sending and
                 * paying for execution may not be the actual sender (as far as an application
                 * is concerned).
                 *
                 * This contract is only required for intermediate, library-like contracts.
                 */
                abstract contract ContextUpgradeable is Initializable {
                    function __Context_init() internal onlyInitializing {
                    }
                    function __Context_init_unchained() internal onlyInitializing {
                    }
                    function _msgSender() internal view virtual returns (address) {
                        return msg.sender;
                    }
                    function _msgData() internal view virtual returns (bytes calldata) {
                        return msg.data;
                    }
                    function _contextSuffixLength() internal view virtual returns (uint256) {
                        return 0;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)
                pragma solidity ^0.8.20;
                import {Strings} from "../Strings.sol";
                /**
                 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
                 *
                 * The library provides methods for generating a hash of a message that conforms to the
                 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
                 * specifications.
                 */
                library MessageHashUtils {
                    /**
                     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
                     * `0x45` (`personal_sign` messages).
                     *
                     * The digest is calculated by prefixing a bytes32 `messageHash` with
                     * `"\\x19Ethereum Signed Message:\
                32"` and hashing the result. It corresponds with the
                     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
                     *
                     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
                     * keccak256, although any bytes32 value can be safely used because the final digest will
                     * be re-hashed.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x00, "\\x19Ethereum Signed Message:\
                32") // 32 is the bytes-length of messageHash
                            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
                            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
                        }
                    }
                    /**
                     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
                     * `0x45` (`personal_sign` messages).
                     *
                     * The digest is calculated by prefixing an arbitrary `message` with
                     * `"\\x19Ethereum Signed Message:\
                " + len(message)` and hashing the result. It corresponds with the
                     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
                        return
                            keccak256(bytes.concat("\\x19Ethereum Signed Message:\
                ", bytes(Strings.toString(message.length)), message));
                    }
                    /**
                     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
                     * `0x00` (data with intended validator).
                     *
                     * The digest is calculated by prefixing an arbitrary `data` with `"\\x19\\x00"` and the intended
                     * `validator` address. Then hashing the result.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
                        return keccak256(abi.encodePacked(hex"19_00", validator, data));
                    }
                    /**
                     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
                     *
                     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
                     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the
                     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let ptr := mload(0x40)
                            mstore(ptr, hex"19_01")
                            mstore(add(ptr, 0x02), domainSeparator)
                            mstore(add(ptr, 0x22), structHash)
                            digest := keccak256(ptr, 0x42)
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)
                pragma solidity ^0.8.20;
                interface IERC5267 {
                    /**
                     * @dev MAY be emitted to signal that the domain could have changed.
                     */
                    event EIP712DomainChanged();
                    /**
                     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
                     * signature.
                     */
                    function eip712Domain()
                        external
                        view
                        returns (
                            bytes1 fields,
                            string memory name,
                            string memory version,
                            uint256 chainId,
                            address verifyingContract,
                            bytes32 salt,
                            uint256[] memory extensions
                        );
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
                 *
                 * These functions can be used to verify that a message was signed by the holder
                 * of the private keys of a given address.
                 */
                library ECDSA {
                    enum RecoverError {
                        NoError,
                        InvalidSignature,
                        InvalidSignatureLength,
                        InvalidSignatureS
                    }
                    /**
                     * @dev The signature derives the `address(0)`.
                     */
                    error ECDSAInvalidSignature();
                    /**
                     * @dev The signature has an invalid length.
                     */
                    error ECDSAInvalidSignatureLength(uint256 length);
                    /**
                     * @dev The signature has an S value that is in the upper half order.
                     */
                    error ECDSAInvalidSignatureS(bytes32 s);
                    /**
                     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
                     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
                     * and a bytes32 providing additional information about the error.
                     *
                     * If no error is returned, then the address can be used for verification purposes.
                     *
                     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
                     * this function rejects them by requiring the `s` value to be in the lower
                     * half order, and the `v` value to be either 27 or 28.
                     *
                     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
                     * verification to be secure: it is possible to craft signatures that
                     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
                     * this is by receiving a hash of the original message (which may otherwise
                     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
                     *
                     * Documentation for signature generation:
                     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
                     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
                     */
                    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
                        if (signature.length == 65) {
                            bytes32 r;
                            bytes32 s;
                            uint8 v;
                            // ecrecover takes the signature parameters, and the only way to get them
                            // currently is to use assembly.
                            /// @solidity memory-safe-assembly
                            assembly {
                                r := mload(add(signature, 0x20))
                                s := mload(add(signature, 0x40))
                                v := byte(0, mload(add(signature, 0x60)))
                            }
                            return tryRecover(hash, v, r, s);
                        } else {
                            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
                        }
                    }
                    /**
                     * @dev Returns the address that signed a hashed message (`hash`) with
                     * `signature`. This address can then be used for verification purposes.
                     *
                     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
                     * this function rejects them by requiring the `s` value to be in the lower
                     * half order, and the `v` value to be either 27 or 28.
                     *
                     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
                     * verification to be secure: it is possible to craft signatures that
                     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
                     * this is by receiving a hash of the original message (which may otherwise
                     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
                     */
                    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
                        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
                        _throwError(error, errorArg);
                        return recovered;
                    }
                    /**
                     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
                     *
                     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
                     */
                    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
                        unchecked {
                            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
                            // We do not check for an overflow here since the shift operation results in 0 or 1.
                            uint8 v = uint8((uint256(vs) >> 255) + 27);
                            return tryRecover(hash, v, r, s);
                        }
                    }
                    /**
                     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
                     */
                    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
                        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
                        _throwError(error, errorArg);
                        return recovered;
                    }
                    /**
                     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
                     * `r` and `s` signature fields separately.
                     */
                    function tryRecover(
                        bytes32 hash,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) internal pure returns (address, RecoverError, bytes32) {
                        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
                        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
                        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
                        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
                        //
                        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
                        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
                        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
                        // these malleable signatures as well.
                        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
                            return (address(0), RecoverError.InvalidSignatureS, s);
                        }
                        // If the signature is valid (and not malleable), return the signer address
                        address signer = ecrecover(hash, v, r, s);
                        if (signer == address(0)) {
                            return (address(0), RecoverError.InvalidSignature, bytes32(0));
                        }
                        return (signer, RecoverError.NoError, bytes32(0));
                    }
                    /**
                     * @dev Overload of {ECDSA-recover} that receives the `v`,
                     * `r` and `s` signature fields separately.
                     */
                    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
                        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
                        _throwError(error, errorArg);
                        return recovered;
                    }
                    /**
                     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
                     */
                    function _throwError(RecoverError error, bytes32 errorArg) private pure {
                        if (error == RecoverError.NoError) {
                            return; // no error: do nothing
                        } else if (error == RecoverError.InvalidSignature) {
                            revert ECDSAInvalidSignature();
                        } else if (error == RecoverError.InvalidSignatureLength) {
                            revert ECDSAInvalidSignatureLength(uint256(errorArg));
                        } else if (error == RecoverError.InvalidSignatureS) {
                            revert ECDSAInvalidSignatureS(errorArg);
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Interface of the ERC1271 standard signature validation method for
                 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
                 */
                interface IERC1271 {
                    /**
                     * @dev Should return whether the signature provided is valid for the provided data
                     * @param hash      Hash of the data to be signed
                     * @param signature Signature byte array associated with _data
                     */
                    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Simple single owner authorization mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
                ///
                /// @dev Note:
                /// This implementation does NOT auto-initialize the owner to `msg.sender`.
                /// You MUST call the `_initializeOwner` in the constructor / initializer.
                ///
                /// While the ownable portion follows
                /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
                /// the nomenclature for the 2-step ownership handover may be unique to this codebase.
                abstract contract Ownable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The caller is not authorized to call the function.
                    error Unauthorized();
                    /// @dev The `newOwner` cannot be the zero address.
                    error NewOwnerIsZeroAddress();
                    /// @dev The `pendingOwner` does not have a valid handover request.
                    error NoHandoverRequest();
                    /// @dev Cannot double-initialize.
                    error AlreadyInitialized();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
                    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
                    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
                    /// despite it not being as lightweight as a single argument event.
                    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
                    /// @dev An ownership handover to `pendingOwner` has been requested.
                    event OwnershipHandoverRequested(address indexed pendingOwner);
                    /// @dev The ownership handover to `pendingOwner` has been canceled.
                    event OwnershipHandoverCanceled(address indexed pendingOwner);
                    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
                    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
                        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
                    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
                    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
                        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;
                    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
                    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
                        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The owner slot is given by:
                    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
                    /// It is intentionally chosen to be a high value
                    /// to avoid collision with lower slots.
                    /// The choice of manual storage layout is to enable compatibility
                    /// with both regular and upgradeable contracts.
                    bytes32 internal constant _OWNER_SLOT =
                        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;
                    /// The ownership handover slot of `newOwner` is given by:
                    /// ```
                    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
                    ///     let handoverSlot := keccak256(0x00, 0x20)
                    /// ```
                    /// It stores the expiry timestamp of the two-step ownership handover.
                    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     INTERNAL FUNCTIONS                     */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
                    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}
                    /// @dev Initializes the owner directly without authorization guard.
                    /// This function must be called upon initialization,
                    /// regardless of whether the contract is upgradeable or not.
                    /// This is to enable generalization to both regular and upgradeable contracts,
                    /// and to save gas in case the initial owner is not the caller.
                    /// For performance reasons, this function will not check if there
                    /// is an existing owner.
                    function _initializeOwner(address newOwner) internal virtual {
                        if (_guardInitializeOwner()) {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                if sload(ownerSlot) {
                                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                                    revert(0x1c, 0x04)
                                }
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Store the new value.
                                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
                            }
                        } else {
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Store the new value.
                                sstore(_OWNER_SLOT, newOwner)
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
                            }
                        }
                    }
                    /// @dev Sets the owner directly without authorization guard.
                    function _setOwner(address newOwner) internal virtual {
                        if (_guardInitializeOwner()) {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                                // Store the new value.
                                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                            }
                        } else {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                                // Store the new value.
                                sstore(ownerSlot, newOwner)
                            }
                        }
                    }
                    /// @dev Throws if the sender is not the owner.
                    function _checkOwner() internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // If the caller is not the stored owner, revert.
                            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
                    /// Override to return a different value if needed.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
                        return 48 * 3600;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  PUBLIC UPDATE FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Allows the owner to transfer the ownership to `newOwner`.
                    function transferOwnership(address newOwner) public payable virtual onlyOwner {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(shl(96, newOwner)) {
                                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _setOwner(newOwner);
                    }
                    /// @dev Allows the owner to renounce their ownership.
                    function renounceOwnership() public payable virtual onlyOwner {
                        _setOwner(address(0));
                    }
                    /// @dev Request a two-step ownership handover to the caller.
                    /// The request will automatically expire in 48 hours (172800 seconds) by default.
                    function requestOwnershipHandover() public payable virtual {
                        unchecked {
                            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Compute and set the handover slot to `expires`.
                                mstore(0x0c, _HANDOVER_SLOT_SEED)
                                mstore(0x00, caller())
                                sstore(keccak256(0x0c, 0x20), expires)
                                // Emit the {OwnershipHandoverRequested} event.
                                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
                            }
                        }
                    }
                    /// @dev Cancels the two-step ownership handover to the caller, if any.
                    function cancelOwnershipHandover() public payable virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute and set the handover slot to 0.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, caller())
                            sstore(keccak256(0x0c, 0x20), 0)
                            // Emit the {OwnershipHandoverCanceled} event.
                            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
                        }
                    }
                    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
                    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
                    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute and set the handover slot to 0.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, pendingOwner)
                            let handoverSlot := keccak256(0x0c, 0x20)
                            // If the handover does not exist, or has expired.
                            if gt(timestamp(), sload(handoverSlot)) {
                                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                                revert(0x1c, 0x04)
                            }
                            // Set the handover slot to 0.
                            sstore(handoverSlot, 0)
                        }
                        _setOwner(pendingOwner);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                   PUBLIC READ FUNCTIONS                    */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the owner of the contract.
                    function owner() public view virtual returns (address result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            result := sload(_OWNER_SLOT)
                        }
                    }
                    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
                    function ownershipHandoverExpiresAt(address pendingOwner)
                        public
                        view
                        virtual
                        returns (uint256 result)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the handover slot.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, pendingOwner)
                            // Load the handover slot.
                            result := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         MODIFIERS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Marks a function as only callable by the owner.
                    modifier onlyOwner() virtual {
                        _checkOwner();
                        _;
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import "./IVault.sol";
                import "./ILimiter.sol";
                interface IVaultSupervisor {
                    struct Signature {
                        uint8 v;
                        bytes32 r;
                        bytes32 s;
                    }
                    function getDeposits(address staker)
                        external
                        view
                        returns (IVault[] memory vaults, IERC20[] memory tokens, uint256[] memory assets, uint256[] memory shares);
                    function initialize(address _delegationSupervisor, address _vaultImpl, ILimiter _limiter, address _manager)
                        external;
                    function redeemShares(address staker, IVault vault, uint256 shares) external;
                    function removeShares(address staker, IVault vault, uint256 shares) external;
                    function deposit(IVault vault, uint256 amount) external returns (uint256);
                    function deployVault(IERC20 depositToken, string memory name, string memory symbol, IVault.AssetType assetType)
                        external
                        returns (IVault);
                    function runAdminOperation(IVault vault, bytes calldata fn) external returns (bytes memory);
                    function depositWithSignature(
                        IVault vault,
                        address user,
                        uint256 value,
                        uint256 deadline,
                        Signature calldata permit,
                        Signature calldata vaultAllowance
                    ) external returns (uint256);
                    function SIGNED_DEPOSIT_TYPEHASH() external returns (bytes32);
                    function getUserNonce(address user) external returns (uint256);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                error InvalidInput();
                error InvalidWithdrawalDelay();
                error ZeroAddress();
                error NotVaultSupervisor();
                error NotStaker();
                error WithdrawAlreadyCompleted();
                error MinWithdrawDelayNotPassed();
                error WithdrawerNotCaller();
                error ZeroShares();
                error MaxStakerVault();
                error VaultNotAChildVault();
                error NotDelegationSupervisor();
                error NotPreviousNorCurrentDelegationSupervisor();
                error VaultNotFound();
                error NotEnoughShares();
                error InvalidVaultAdminFunction();
                error NotInitialized();
                error RoleNotGranted();
                // Vault.sol
                error NotSupervisor();
                error TokenNotEnabled();
                // Generic
                error NoElementsInArray();
                error ArrayLengthsNotEqual();
                error ZeroAmount();
                // VaultSupervisor.sol
                error PermitFailed();
                error ExpiredSign();
                error InvalidSignature();
                error CrossedDepositLimit();
                // Limiter.sol
                error UnsupportedAsset();
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../token/ERC20/IERC20.sol";
                import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
                /**
                 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
                 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
                 */
                interface IERC4626 is IERC20, IERC20Metadata {
                    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
                    event Withdraw(
                        address indexed sender,
                        address indexed receiver,
                        address indexed owner,
                        uint256 assets,
                        uint256 shares
                    );
                    /**
                     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
                     *
                     * - MUST be an ERC-20 token contract.
                     * - MUST NOT revert.
                     */
                    function asset() external view returns (address assetTokenAddress);
                    /**
                     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
                     *
                     * - SHOULD include any compounding that occurs from yield.
                     * - MUST be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT revert.
                     */
                    function totalAssets() external view returns (uint256 totalManagedAssets);
                    /**
                     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
                     * scenario where all the conditions are met.
                     *
                     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT show any variations depending on the caller.
                     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
                     * - MUST NOT revert.
                     *
                     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
                     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
                     * from.
                     */
                    function convertToShares(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
                     * scenario where all the conditions are met.
                     *
                     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT show any variations depending on the caller.
                     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
                     * - MUST NOT revert.
                     *
                     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
                     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
                     * from.
                     */
                    function convertToAssets(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
                     * through a deposit call.
                     *
                     * - MUST return a limited value if receiver is subject to some deposit limit.
                     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
                     * - MUST NOT revert.
                     */
                    function maxDeposit(address receiver) external view returns (uint256 maxAssets);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
                     * current on-chain conditions.
                     *
                     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
                     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
                     *   in the same transaction.
                     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
                     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
                     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
                     */
                    function previewDeposit(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
                     *
                     * - MUST emit the Deposit event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   deposit execution, and are accounted for during deposit.
                     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
                     *   approving enough underlying tokens to the Vault contract, etc).
                     *
                     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
                     */
                    function deposit(uint256 assets, address receiver) external returns (uint256 shares);
                    /**
                     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
                     * - MUST return a limited value if receiver is subject to some mint limit.
                     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
                     * - MUST NOT revert.
                     */
                    function maxMint(address receiver) external view returns (uint256 maxShares);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
                     * current on-chain conditions.
                     *
                     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
                     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
                     *   same transaction.
                     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
                     *   would be accepted, regardless if the user has enough tokens approved, etc.
                     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by minting.
                     */
                    function previewMint(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
                     *
                     * - MUST emit the Deposit event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
                     *   execution, and are accounted for during mint.
                     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
                     *   approving enough underlying tokens to the Vault contract, etc).
                     *
                     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
                     */
                    function mint(uint256 shares, address receiver) external returns (uint256 assets);
                    /**
                     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
                     * Vault, through a withdraw call.
                     *
                     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
                     * - MUST NOT revert.
                     */
                    function maxWithdraw(address owner) external view returns (uint256 maxAssets);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
                     * given current on-chain conditions.
                     *
                     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
                     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
                     *   called
                     *   in the same transaction.
                     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
                     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
                     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
                     */
                    function previewWithdraw(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
                     *
                     * - MUST emit the Withdraw event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   withdraw execution, and are accounted for during withdraw.
                     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
                     *   not having enough shares, etc).
                     *
                     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
                     * Those methods should be performed separately.
                     */
                    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
                    /**
                     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
                     * through a redeem call.
                     *
                     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
                     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
                     * - MUST NOT revert.
                     */
                    function maxRedeem(address owner) external view returns (uint256 maxShares);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
                     * given current on-chain conditions.
                     *
                     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
                     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
                     *   same transaction.
                     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
                     *   redemption would be accepted, regardless if the user has enough shares, etc.
                     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
                     */
                    function previewRedeem(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
                     *
                     * - MUST emit the Withdraw event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   redeem execution, and are accounted for during redeem.
                     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
                     *   not having enough shares, etc).
                     *
                     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
                     * Those methods should be performed separately.
                     */
                    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Interface of the ERC20 standard as defined in the EIP.
                 */
                interface IERC20 {
                    /**
                     * @dev Emitted when `value` tokens are moved from one account (`from`) to
                     * another (`to`).
                     *
                     * Note that `value` may be zero.
                     */
                    event Transfer(address indexed from, address indexed to, uint256 value);
                    /**
                     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
                     * a call to {approve}. `value` is the new allowance.
                     */
                    event Approval(address indexed owner, address indexed spender, uint256 value);
                    /**
                     * @dev Returns the value of tokens in existence.
                     */
                    function totalSupply() external view returns (uint256);
                    /**
                     * @dev Returns the value of tokens owned by `account`.
                     */
                    function balanceOf(address account) external view returns (uint256);
                    /**
                     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * Emits a {Transfer} event.
                     */
                    function transfer(address to, uint256 value) external returns (bool);
                    /**
                     * @dev Returns the remaining number of tokens that `spender` will be
                     * allowed to spend on behalf of `owner` through {transferFrom}. This is
                     * zero by default.
                     *
                     * This value changes when {approve} or {transferFrom} are called.
                     */
                    function allowance(address owner, address spender) external view returns (uint256);
                    /**
                     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
                     * caller's tokens.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * IMPORTANT: Beware that changing an allowance with this method brings the risk
                     * that someone may use both the old and the new allowance by unfortunate
                     * transaction ordering. One possible solution to mitigate this race
                     * condition is to first reduce the spender's allowance to 0 and set the
                     * desired value afterwards:
                     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                     *
                     * Emits an {Approval} event.
                     */
                    function approve(address spender, uint256 value) external returns (bool);
                    /**
                     * @dev Moves a `value` amount of tokens from `from` to `to` using the
                     * allowance mechanism. `value` is then deducted from the caller's
                     * allowance.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * Emits a {Transfer} event.
                     */
                    function transferFrom(address from, address to, uint256 value) external returns (bool);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
                pragma solidity ^0.8.20;
                import {Math} from "./math/Math.sol";
                import {SignedMath} from "./math/SignedMath.sol";
                /**
                 * @dev String operations.
                 */
                library Strings {
                    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
                    uint8 private constant ADDRESS_LENGTH = 20;
                    /**
                     * @dev The `value` string doesn't fit in the specified `length`.
                     */
                    error StringsInsufficientHexLength(uint256 value, uint256 length);
                    /**
                     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
                     */
                    function toString(uint256 value) internal pure returns (string memory) {
                        unchecked {
                            uint256 length = Math.log10(value) + 1;
                            string memory buffer = new string(length);
                            uint256 ptr;
                            /// @solidity memory-safe-assembly
                            assembly {
                                ptr := add(buffer, add(32, length))
                            }
                            while (true) {
                                ptr--;
                                /// @solidity memory-safe-assembly
                                assembly {
                                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                                }
                                value /= 10;
                                if (value == 0) break;
                            }
                            return buffer;
                        }
                    }
                    /**
                     * @dev Converts a `int256` to its ASCII `string` decimal representation.
                     */
                    function toStringSigned(int256 value) internal pure returns (string memory) {
                        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
                    }
                    /**
                     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
                     */
                    function toHexString(uint256 value) internal pure returns (string memory) {
                        unchecked {
                            return toHexString(value, Math.log256(value) + 1);
                        }
                    }
                    /**
                     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
                     */
                    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
                        uint256 localValue = value;
                        bytes memory buffer = new bytes(2 * length + 2);
                        buffer[0] = "0";
                        buffer[1] = "x";
                        for (uint256 i = 2 * length + 1; i > 1; --i) {
                            buffer[i] = HEX_DIGITS[localValue & 0xf];
                            localValue >>= 4;
                        }
                        if (localValue != 0) {
                            revert StringsInsufficientHexLength(value, length);
                        }
                        return string(buffer);
                    }
                    /**
                     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
                     * representation.
                     */
                    function toHexString(address addr) internal pure returns (string memory) {
                        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
                    }
                    /**
                     * @dev Returns true if the two strings are equal.
                     */
                    function equal(string memory a, string memory b) internal pure returns (bool) {
                        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./IVault.sol";
                interface ILimiter {
                    function globalUsdLimit() external view returns (uint256);
                    function usdPerEth() external view returns (uint256);
                    function isLimitBreached(IVault[] calldata vaults) external view returns (bool);
                    function remainingGlobalUsdLimit(IVault[] memory vaults) external view returns (uint256);
                    function computeGlobalDepositsInUsd(IVault[] memory vaults) external view returns (uint256);
                    function computeUserMaximumDeposit(
                        IVault[] memory vaults,
                        IVault vaultToDeposit,
                        address user,
                        uint256 walletBalance
                    ) external view returns (uint256);
                    function setGlobalUsdLimit(uint256 _limit) external;
                    function setUsdPerEth(uint256 _usdPerEth) external;
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../IERC20.sol";
                /**
                 * @dev Interface for the optional metadata functions from the ERC20 standard.
                 */
                interface IERC20Metadata is IERC20 {
                    /**
                     * @dev Returns the name of the token.
                     */
                    function name() external view returns (string memory);
                    /**
                     * @dev Returns the symbol of the token.
                     */
                    function symbol() external view returns (string memory);
                    /**
                     * @dev Returns the decimals places of the token.
                     */
                    function decimals() external view returns (uint8);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Standard math utilities missing in the Solidity language.
                 */
                library Math {
                    /**
                     * @dev Muldiv operation overflow.
                     */
                    error MathOverflowedMulDiv();
                    enum Rounding {
                        Floor, // Toward negative infinity
                        Ceil, // Toward positive infinity
                        Trunc, // Toward zero
                        Expand // Away from zero
                    }
                    /**
                     * @dev Returns the addition of two unsigned integers, with an overflow flag.
                     */
                    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            uint256 c = a + b;
                            if (c < a) return (false, 0);
                            return (true, c);
                        }
                    }
                    /**
                     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
                     */
                    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            if (b > a) return (false, 0);
                            return (true, a - b);
                        }
                    }
                    /**
                     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
                     */
                    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
                            // benefit is lost if 'b' is also tested.
                            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
                            if (a == 0) return (true, 0);
                            uint256 c = a * b;
                            if (c / a != b) return (false, 0);
                            return (true, c);
                        }
                    }
                    /**
                     * @dev Returns the division of two unsigned integers, with a division by zero flag.
                     */
                    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            if (b == 0) return (false, 0);
                            return (true, a / b);
                        }
                    }
                    /**
                     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
                     */
                    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            if (b == 0) return (false, 0);
                            return (true, a % b);
                        }
                    }
                    /**
                     * @dev Returns the largest of two numbers.
                     */
                    function max(uint256 a, uint256 b) internal pure returns (uint256) {
                        return a > b ? a : b;
                    }
                    /**
                     * @dev Returns the smallest of two numbers.
                     */
                    function min(uint256 a, uint256 b) internal pure returns (uint256) {
                        return a < b ? a : b;
                    }
                    /**
                     * @dev Returns the average of two numbers. The result is rounded towards
                     * zero.
                     */
                    function average(uint256 a, uint256 b) internal pure returns (uint256) {
                        // (a + b) / 2 can overflow.
                        return (a & b) + (a ^ b) / 2;
                    }
                    /**
                     * @dev Returns the ceiling of the division of two numbers.
                     *
                     * This differs from standard division with `/` in that it rounds towards infinity instead
                     * of rounding towards zero.
                     */
                    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
                        if (b == 0) {
                            // Guarantee the same behavior as in a regular Solidity division.
                            return a / b;
                        }
                        // (a + b - 1) / b can overflow on addition, so we distribute.
                        return a == 0 ? 0 : (a - 1) / b + 1;
                    }
                    /**
                     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
                     * denominator == 0.
                     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
                     * Uniswap Labs also under MIT license.
                     */
                    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
                        unchecked {
                            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
                            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
                            // variables such that product = prod1 * 2^256 + prod0.
                            uint256 prod0 = x * y; // Least significant 256 bits of the product
                            uint256 prod1; // Most significant 256 bits of the product
                            assembly {
                                let mm := mulmod(x, y, not(0))
                                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
                            }
                            // Handle non-overflow cases, 256 by 256 division.
                            if (prod1 == 0) {
                                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                                // The surrounding unchecked block does not change this fact.
                                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                                return prod0 / denominator;
                            }
                            // Make sure the result is less than 2^256. Also prevents denominator == 0.
                            if (denominator <= prod1) {
                                revert MathOverflowedMulDiv();
                            }
                            ///////////////////////////////////////////////
                            // 512 by 256 division.
                            ///////////////////////////////////////////////
                            // Make division exact by subtracting the remainder from [prod1 prod0].
                            uint256 remainder;
                            assembly {
                                // Compute remainder using mulmod.
                                remainder := mulmod(x, y, denominator)
                                // Subtract 256 bit number from 512 bit number.
                                prod1 := sub(prod1, gt(remainder, prod0))
                                prod0 := sub(prod0, remainder)
                            }
                            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
                            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
                            uint256 twos = denominator & (0 - denominator);
                            assembly {
                                // Divide denominator by twos.
                                denominator := div(denominator, twos)
                                // Divide [prod1 prod0] by twos.
                                prod0 := div(prod0, twos)
                                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                                twos := add(div(sub(0, twos), twos), 1)
                            }
                            // Shift in bits from prod1 into prod0.
                            prod0 |= prod1 * twos;
                            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
                            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
                            // four bits. That is, denominator * inv = 1 mod 2^4.
                            uint256 inverse = (3 * denominator) ^ 2;
                            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
                            // works in modular arithmetic, doubling the correct bits in each step.
                            inverse *= 2 - denominator * inverse; // inverse mod 2^8
                            inverse *= 2 - denominator * inverse; // inverse mod 2^16
                            inverse *= 2 - denominator * inverse; // inverse mod 2^32
                            inverse *= 2 - denominator * inverse; // inverse mod 2^64
                            inverse *= 2 - denominator * inverse; // inverse mod 2^128
                            inverse *= 2 - denominator * inverse; // inverse mod 2^256
                            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
                            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
                            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
                            // is no longer required.
                            result = prod0 * inverse;
                            return result;
                        }
                    }
                    /**
                     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
                     */
                    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
                        uint256 result = mulDiv(x, y, denominator);
                        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
                            result += 1;
                        }
                        return result;
                    }
                    /**
                     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
                     * towards zero.
                     *
                     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
                     */
                    function sqrt(uint256 a) internal pure returns (uint256) {
                        if (a == 0) {
                            return 0;
                        }
                        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
                        //
                        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
                        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
                        //
                        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
                        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
                        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
                        //
                        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
                        uint256 result = 1 << (log2(a) >> 1);
                        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
                        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
                        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
                        // into the expected uint128 result.
                        unchecked {
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            return min(result, a / result);
                        }
                    }
                    /**
                     * @notice Calculates sqrt(a), following the selected rounding direction.
                     */
                    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = sqrt(a);
                            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Return the log in base 2 of a positive value rounded towards zero.
                     * Returns 0 if given 0.
                     */
                    function log2(uint256 value) internal pure returns (uint256) {
                        uint256 result = 0;
                        unchecked {
                            if (value >> 128 > 0) {
                                value >>= 128;
                                result += 128;
                            }
                            if (value >> 64 > 0) {
                                value >>= 64;
                                result += 64;
                            }
                            if (value >> 32 > 0) {
                                value >>= 32;
                                result += 32;
                            }
                            if (value >> 16 > 0) {
                                value >>= 16;
                                result += 16;
                            }
                            if (value >> 8 > 0) {
                                value >>= 8;
                                result += 8;
                            }
                            if (value >> 4 > 0) {
                                value >>= 4;
                                result += 4;
                            }
                            if (value >> 2 > 0) {
                                value >>= 2;
                                result += 2;
                            }
                            if (value >> 1 > 0) {
                                result += 1;
                            }
                        }
                        return result;
                    }
                    /**
                     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
                     * Returns 0 if given 0.
                     */
                    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = log2(value);
                            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Return the log in base 10 of a positive value rounded towards zero.
                     * Returns 0 if given 0.
                     */
                    function log10(uint256 value) internal pure returns (uint256) {
                        uint256 result = 0;
                        unchecked {
                            if (value >= 10 ** 64) {
                                value /= 10 ** 64;
                                result += 64;
                            }
                            if (value >= 10 ** 32) {
                                value /= 10 ** 32;
                                result += 32;
                            }
                            if (value >= 10 ** 16) {
                                value /= 10 ** 16;
                                result += 16;
                            }
                            if (value >= 10 ** 8) {
                                value /= 10 ** 8;
                                result += 8;
                            }
                            if (value >= 10 ** 4) {
                                value /= 10 ** 4;
                                result += 4;
                            }
                            if (value >= 10 ** 2) {
                                value /= 10 ** 2;
                                result += 2;
                            }
                            if (value >= 10 ** 1) {
                                result += 1;
                            }
                        }
                        return result;
                    }
                    /**
                     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
                     * Returns 0 if given 0.
                     */
                    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = log10(value);
                            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Return the log in base 256 of a positive value rounded towards zero.
                     * Returns 0 if given 0.
                     *
                     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
                     */
                    function log256(uint256 value) internal pure returns (uint256) {
                        uint256 result = 0;
                        unchecked {
                            if (value >> 128 > 0) {
                                value >>= 128;
                                result += 16;
                            }
                            if (value >> 64 > 0) {
                                value >>= 64;
                                result += 8;
                            }
                            if (value >> 32 > 0) {
                                value >>= 32;
                                result += 4;
                            }
                            if (value >> 16 > 0) {
                                value >>= 16;
                                result += 2;
                            }
                            if (value >> 8 > 0) {
                                result += 1;
                            }
                        }
                        return result;
                    }
                    /**
                     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
                     * Returns 0 if given 0.
                     */
                    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = log256(value);
                            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
                     */
                    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
                        return uint8(rounding) % 2 == 1;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Standard signed math utilities missing in the Solidity language.
                 */
                library SignedMath {
                    /**
                     * @dev Returns the largest of two signed numbers.
                     */
                    function max(int256 a, int256 b) internal pure returns (int256) {
                        return a > b ? a : b;
                    }
                    /**
                     * @dev Returns the smallest of two signed numbers.
                     */
                    function min(int256 a, int256 b) internal pure returns (int256) {
                        return a < b ? a : b;
                    }
                    /**
                     * @dev Returns the average of two signed numbers without overflow.
                     * The result is rounded towards zero.
                     */
                    function average(int256 a, int256 b) internal pure returns (int256) {
                        // Formula from the book "Hacker's Delight"
                        int256 x = (a & b) + ((a ^ b) >> 1);
                        return x + (int256(uint256(x) >> 255) & (a ^ b));
                    }
                    /**
                     * @dev Returns the absolute unsigned value of a signed value.
                     */
                    function abs(int256 n) internal pure returns (uint256) {
                        unchecked {
                            // must be unchecked in order to support `n = type(int256).min`
                            return uint256(n >= 0 ? n : -n);
                        }
                    }
                }
                

                File 4 of 5: VaultSupervisor
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {Initializable} from "@openzeppelin-upgradeable/proxy/utils/Initializable.sol";
                import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
                import {PausableUpgradeable} from "@openzeppelin-upgradeable/utils/PausableUpgradeable.sol";
                import {IBeacon} from "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
                import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
                import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
                import {EIP712Upgradeable} from "@openzeppelin-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
                import {UUPSUpgradeable} from "solady/src/utils/UUPSUpgradeable.sol";
                import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol";
                import {ReentrancyGuard} from "solady/src/utils/ReentrancyGuard.sol";
                import {IVault} from "./interfaces/IVault.sol";
                import "./interfaces/IVaultSupervisor.sol";
                import "./interfaces/IVault.sol";
                import "./interfaces/IDelegationSupervisor.sol";
                import "./interfaces/Constants.sol";
                import "./interfaces/Errors.sol";
                import "./interfaces/Events.sol";
                import "./interfaces/ILimiter.sol";
                import "./entities/VaultSupervisorLib.sol";
                contract VaultSupervisor is
                    Initializable,
                    OwnableRoles,
                    ReentrancyGuard,
                    PausableUpgradeable,
                    UUPSUpgradeable,
                    IVaultSupervisor,
                    IBeacon
                {
                    using VaultSupervisorLib for VaultSupervisorLib.Storage;
                    // keccak256(abi.encode(uint256(keccak256("vaultsupervisor.storage")) - 1)) & ~bytes32(uint256(0xff));
                    bytes32 internal constant STORAGE_SLOT = 0xa850f9cb190d34eca968aeee8c951b4765e62744d7c13847a3ad392ad8649100;
                    /* ========== MUTATIVE FUNCTIONS ========== */
                    constructor() {
                        _disableInitializers();
                    }
                    function initialize(address _delegationSupervisor, address _vaultImpl, ILimiter _limiter, address _manager)
                        external
                        initializer
                    {
                        _initializeOwner(msg.sender);
                        __Pausable_init();
                        _grantRoles(_manager, Constants.MANAGER_ROLE);
                        VaultSupervisorLib.Storage storage self = _self();
                        self.initOrUpdate(_delegationSupervisor, _vaultImpl, _limiter);
                    }
                    function deposit(IVault vault, uint256 amount, uint256 minSharesOut)
                        external
                        nonReentrant
                        whenNotPaused
                        returns (uint256 shares)
                    {
                        return depositInternal(msg.sender, vault, amount, minSharesOut);
                    }
                    function depositAndGimmie(IVault vault, uint256 amount, uint256 minSharesOut)
                        external
                        nonReentrant
                        whenNotPaused
                        returns (uint256 shares)
                    {
                        shares = depositInternal(msg.sender, vault, amount, minSharesOut);
                        gimmieShares(vault, shares);
                    }
                    function depositWithSignature(
                        IVault vault,
                        address user,
                        uint256 value,
                        uint256 minSharesOut,
                        uint256 deadline,
                        Signature calldata permit,
                        Signature calldata vaultAllowance
                    ) external nonReentrant whenNotPaused returns (uint256 shares) {
                        VaultSupervisorLib.Storage storage self = _self();
                        VaultSupervisorLib.verifySignatures(
                            vault, user, value, minSharesOut, deadline, permit, vaultAllowance, self.userNonce[user]
                        );
                        self.userNonce[user]++;
                        return depositInternal(user, vault, value, minSharesOut);
                    }
                    function redeemShares(address staker, IVault vault, uint256 shares)
                        external
                        onlyDelegationSupervisor
                        onlyChildVault(vault)
                        nonReentrant
                    {
                        vault.redeem(shares, staker, address(this));
                    }
                    function removeShares(address staker, IVault vault, uint256 shares)
                        external
                        onlyDelegationSupervisor
                        onlyChildVault(vault)
                        nonReentrant
                    {
                        if (shares == 0) revert ZeroShares();
                        VaultSupervisorLib.Storage storage self = _self();
                        uint256 userShares = self.stakerShares[staker][vault];
                        if (shares > userShares) revert NotEnoughShares();
                        // Already checked above that userShares >= shareAmount
                        unchecked {
                            userShares = userShares - shares;
                        }
                        self.stakerShares[staker][vault] = userShares;
                        // if user has no more shares, delete
                        if (userShares == 0) {
                            removeVaultFromStaker(staker, vault);
                        }
                    }
                    function pause(bool toPause) external onlyRolesOrOwner(Constants.MANAGER_ROLE) {
                        if (toPause) _pause();
                        else _unpause();
                    }
                    function deployVault(IERC20 depositToken, string memory name, string memory symbol, IVault.AssetType assetType)
                        external
                        onlyRolesOrOwner(Constants.MANAGER_ROLE)
                        returns (IVault)
                    {
                        VaultSupervisorLib.Storage storage self = _self();
                        IVault vault =
                            cloneVault(abi.encodeCall(IVault.initialize, (address(this), depositToken, name, symbol, assetType)));
                        self.vaults.push(vault);
                        // Optimization: Set to constant so we can see if a vault exists and was made by us in O(1) time
                        self.vaultToImplMap[address(vault)] = Constants.DEFAULT_VAULT_IMPLEMENTATION_FLAG;
                        emit NewVault(address(vault));
                        return vault;
                    }
                    function changeImplementation(address newVaultImpl) external onlyOwner {
                        if (newVaultImpl == address(0)) revert ZeroAddress();
                        VaultSupervisorLib.Storage storage self = _self();
                        self.vaultImpl = newVaultImpl;
                        emit UpgradedAllVaults(newVaultImpl);
                    }
                    function changeImplementationForVault(address vault, address newVaultImpl) external onlyOwner {
                        // Don't let the implementation ever be changed to 0 after it's created.
                        // It's either DEFAULT_VAULT_IMPLEMENTATION_FLAG or a valid address
                        if (newVaultImpl == address(0)) revert ZeroAddress();
                        VaultSupervisorLib.Storage storage self = _self();
                        // Don't let the admin change the implementation from address(0) to something else
                        // bypassing the deployVault flow
                        if (self.vaultToImplMap[vault] == address(0)) revert VaultNotAChildVault();
                        self.vaultToImplMap[vault] = newVaultImpl;
                        emit UpgradedVault(newVaultImpl, vault);
                    }
                    /// @dev Allow for it to be set to address(0)
                    /// in the future to disable the global limit
                    function setLimiter(ILimiter limiter) external onlyRolesOrOwner(Constants.MANAGER_ROLE) {
                        VaultSupervisorLib.Storage storage self = _self();
                        self.limiter = limiter;
                    }
                    function runAdminOperation(IVault vault, bytes calldata fn)
                        external
                        onlyRolesOrOwner(Constants.MANAGER_ROLE)
                        nonReentrant
                        returns (bytes memory)
                    {
                        bytes4 incomingFnSelector = bytes4(fn);
                        bool isValidAdminFunction = (
                            incomingFnSelector == IVault.setLimit.selector || incomingFnSelector == IVault.transferOwnership.selector
                                || incomingFnSelector == IVault.pause.selector
                        );
                        if (!isValidAdminFunction) {
                            revert InvalidVaultAdminFunction();
                        }
                        // Only the owner can transferOwnership of the vault
                        if (incomingFnSelector == IVault.transferOwnership.selector) {
                            _checkOwner();
                        }
                        (bool success, bytes memory result) = address(vault).call(fn);
                        if (!success) {
                            // Load revert reason into memory and revert
                            // with it because we can't revert with bytes
                            // from https://ethereum.stackexchange.com/a/114140
                            assembly {
                                revert(add(result, 32), result)
                            }
                        }
                        return result;
                    }
                    /* ========== VIEWS ========== */
                    function _self() internal pure returns (VaultSupervisorLib.Storage storage $) {
                        assembly {
                            $.slot := STORAGE_SLOT
                        }
                    }
                    function SIGNED_DEPOSIT_TYPEHASH() public pure returns (bytes32) {
                        return Constants.SIGNED_DEPOSIT_TYPEHASH;
                    }
                    function getDeposits(address staker)
                        external
                        view
                        returns (IVault[] memory vaults, IERC20[] memory tokens, uint256[] memory assets, uint256[] memory shares)
                    {
                        VaultSupervisorLib.Storage storage self = _self();
                        uint256 vaultLength = self.stakersVaults[staker].length;
                        assets = new uint256[](vaultLength);
                        shares = new uint256[](vaultLength);
                        tokens = new IERC20[](vaultLength);
                        for (uint256 i = 0; i < vaultLength; i++) {
                            uint256 _shares = self.stakerShares[staker][self.stakersVaults[staker][i]];
                            assets[i] = self.stakersVaults[staker][i].convertToAssets(_shares);
                            shares[i] = _shares;
                            tokens[i] = IERC20(self.stakersVaults[staker][i].asset());
                        }
                        return (self.stakersVaults[staker], tokens, assets, shares);
                    }
                    function implementation() external view override returns (address) {
                        return implementation(msg.sender);
                    }
                    /// @dev Doesn't revert if the vault is not set yet because during `deployVault`
                    /// theres a period before we set it to the default flag where the vault
                    /// needs an impl to be initialized against
                    function implementation(address vault) public view returns (address) {
                        VaultSupervisorLib.Storage storage self = _self();
                        address vaultImplOverride = self.vaultToImplMap[vault];
                        if (vaultImplOverride == Constants.DEFAULT_VAULT_IMPLEMENTATION_FLAG || vaultImplOverride == address(0)) {
                            return self.vaultImpl;
                        }
                        return vaultImplOverride;
                    }
                    function delegationSupervisor() public view returns (IDelegationSupervisor) {
                        VaultSupervisorLib.Storage storage self = _self();
                        return self.delegationSupervisor;
                    }
                    function getUserNonce(address user) external view returns (uint256) {
                        VaultSupervisorLib.Storage storage self = _self();
                        return self.userNonce[user];
                    }
                    function getVaults() external view returns (IVault[] memory) {
                        VaultSupervisorLib.Storage storage self = _self();
                        return self.vaults;
                    }
                    /* ========== INTERNAL FUNCTIONS ========== */
                    function depositInternal(address staker, IVault vault, uint256 amount, uint256 minSharesOut)
                        internal
                        onlyChildVault(vault)
                        whenNotPaused
                        returns (uint256 shares)
                    {
                        VaultSupervisorLib.Storage storage self = _self();
                        shares = vault.deposit(amount, staker);
                        if (shares < minSharesOut) revert NotEnoughShares();
                        // If the limiter is set, check if the deposit limit is breached
                        // allow for it to be set to address(0) in the future to disable the global limit
                        if (address(self.limiter) != address(0)) {
                            if (self.limiter.isLimitBreached(self.vaults)) revert CrossedDepositLimit();
                        }
                        // add the returned shares to the staker's existing shares for this Vault
                        increaseShares(staker, vault, shares);
                        // Increase shares delegated to operator
                        // TODO: to be enabled in the next version when delegation is activated
                        //self.delegationSupervisor.increaseDelegatedShares(staker, vault, shares);
                        return shares;
                    }
                    function increaseShares(address staker, IVault vault, uint256 shares) internal {
                        // sanity checks on inputs
                        if (staker == address(0)) revert ZeroAddress();
                        if (shares == 0) revert ZeroShares();
                        VaultSupervisorLib.Storage storage self = _self();
                        // if they dont have existing shares of this Vault, add it to their strats
                        if (self.stakerShares[staker][vault] == 0) {
                            if (self.stakersVaults[staker].length >= Constants.MAX_VAULTS_PER_STAKER) revert MaxStakerVault();
                            self.stakersVaults[staker].push(vault);
                        }
                        // add the returned shares to their existing shares for this Vault
                        self.stakerShares[staker][vault] += shares;
                    }
                    /// This function allows `shares` tokens NOT the underlying asset to be withdrawn
                    /// for use in other protocols by the holder. You have to return the share tokens back to
                    /// this contract to fully withdraw.
                    function gimmieShares(IVault vault, uint256 shares) public onlyChildVault(vault) nonReentrant {
                        if (shares == 0) revert ZeroShares();
                        IERC20 shareToken = IERC20(vault);
                        VaultSupervisorLib.Storage storage self = _self();
                        // Verify the user is the owner of these shares
                        if (self.stakerShares[msg.sender][vault] < shares) revert NotEnoughShares();
                        self.stakerShares[msg.sender][vault] -= shares;
                        shareToken.transfer(msg.sender, shares);
                        if (self.stakerShares[msg.sender][vault] == 0) {
                            removeVaultFromStaker(msg.sender, vault);
                        }
                        emit GaveShares(msg.sender, address(vault), address(shareToken), shares);
                    }
                    function returnShares(IVault vault, uint256 shares) external onlyChildVault(vault) nonReentrant {
                        increaseShares(msg.sender, vault, shares);
                        IERC20 shareToken = IERC20(vault);
                        shareToken.transferFrom(msg.sender, address(this), shares);
                        emit ReturnedShares(msg.sender, address(vault), address(shareToken), shares);
                    }
                    function removeVaultFromStaker(address staker, IVault vault) internal {
                        VaultSupervisorLib.Storage storage self = _self();
                        uint256 vaultsLength = self.stakersVaults[staker].length;
                        uint256 i = 0;
                        while (i < vaultsLength) {
                            if (self.stakersVaults[staker][i] == vault) {
                                // Replace this vault with the last vault and then pop the last one off
                                // prevents leaving a gap in the array
                                self.stakersVaults[staker][i] = self.stakersVaults[staker][vaultsLength - 1];
                                break;
                            }
                            unchecked {
                                i++;
                            }
                        }
                        if (i == vaultsLength) revert VaultNotFound();
                        self.stakersVaults[staker].pop();
                    }
                    function cloneVault(bytes memory initData) internal returns (IVault) {
                        return IVault(address(new BeaconProxy(address(this), initData)));
                    }
                    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
                    /* ========== MODIFIERS ========== */
                    modifier onlyChildVault(IVault vault) {
                        VaultSupervisorLib.Storage storage self = _self();
                        if (self.vaultToImplMap[address(vault)] == address(0)) {
                            revert VaultNotAChildVault();
                        }
                        _;
                    }
                    modifier onlyDelegationSupervisor() {
                        VaultSupervisorLib.Storage storage self = _self();
                        if (msg.sender != address(self.delegationSupervisor)) {
                            revert NotDelegationSupervisor();
                        }
                        _;
                    }
                    /* ========== EVENTS ========== */
                    event UpgradedVault(address indexed implementation, address indexed vault);
                    event UpgradedAllVaults(address indexed implementation);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
                 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
                 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
                 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
                 *
                 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
                 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
                 * case an upgrade adds a module that needs to be initialized.
                 *
                 * For example:
                 *
                 * [.hljs-theme-light.nopadding]
                 * ```solidity
                 * contract MyToken is ERC20Upgradeable {
                 *     function initialize() initializer public {
                 *         __ERC20_init("MyToken", "MTK");
                 *     }
                 * }
                 *
                 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
                 *     function initializeV2() reinitializer(2) public {
                 *         __ERC20Permit_init("MyToken");
                 *     }
                 * }
                 * ```
                 *
                 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
                 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
                 *
                 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
                 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
                 *
                 * [CAUTION]
                 * ====
                 * Avoid leaving a contract uninitialized.
                 *
                 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
                 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
                 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
                 *
                 * [.hljs-theme-light.nopadding]
                 * ```
                 * /// @custom:oz-upgrades-unsafe-allow constructor
                 * constructor() {
                 *     _disableInitializers();
                 * }
                 * ```
                 * ====
                 */
                abstract contract Initializable {
                    /**
                     * @dev Storage of the initializable contract.
                     *
                     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
                     * when using with upgradeable contracts.
                     *
                     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
                     */
                    struct InitializableStorage {
                        /**
                         * @dev Indicates that the contract has been initialized.
                         */
                        uint64 _initialized;
                        /**
                         * @dev Indicates that the contract is in the process of being initialized.
                         */
                        bool _initializing;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
                    /**
                     * @dev The contract is already initialized.
                     */
                    error InvalidInitialization();
                    /**
                     * @dev The contract is not initializing.
                     */
                    error NotInitializing();
                    /**
                     * @dev Triggered when the contract has been initialized or reinitialized.
                     */
                    event Initialized(uint64 version);
                    /**
                     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
                     * `onlyInitializing` functions can be used to initialize parent contracts.
                     *
                     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
                     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
                     * production.
                     *
                     * Emits an {Initialized} event.
                     */
                    modifier initializer() {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        // Cache values to avoid duplicated sloads
                        bool isTopLevelCall = !$._initializing;
                        uint64 initialized = $._initialized;
                        // Allowed calls:
                        // - initialSetup: the contract is not in the initializing state and no previous version was
                        //                 initialized
                        // - construction: the contract is initialized at version 1 (no reininitialization) and the
                        //                 current contract is just being deployed
                        bool initialSetup = initialized == 0 && isTopLevelCall;
                        bool construction = initialized == 1 && address(this).code.length == 0;
                        if (!initialSetup && !construction) {
                            revert InvalidInitialization();
                        }
                        $._initialized = 1;
                        if (isTopLevelCall) {
                            $._initializing = true;
                        }
                        _;
                        if (isTopLevelCall) {
                            $._initializing = false;
                            emit Initialized(1);
                        }
                    }
                    /**
                     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
                     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
                     * used to initialize parent contracts.
                     *
                     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
                     * are added through upgrades and that require initialization.
                     *
                     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
                     * cannot be nested. If one is invoked in the context of another, execution will revert.
                     *
                     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
                     * a contract, executing them in the right order is up to the developer or operator.
                     *
                     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
                     *
                     * Emits an {Initialized} event.
                     */
                    modifier reinitializer(uint64 version) {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        if ($._initializing || $._initialized >= version) {
                            revert InvalidInitialization();
                        }
                        $._initialized = version;
                        $._initializing = true;
                        _;
                        $._initializing = false;
                        emit Initialized(version);
                    }
                    /**
                     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
                     * {initializer} and {reinitializer} modifiers, directly or indirectly.
                     */
                    modifier onlyInitializing() {
                        _checkInitializing();
                        _;
                    }
                    /**
                     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
                     */
                    function _checkInitializing() internal view virtual {
                        if (!_isInitializing()) {
                            revert NotInitializing();
                        }
                    }
                    /**
                     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
                     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
                     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
                     * through proxies.
                     *
                     * Emits an {Initialized} event the first time it is successfully executed.
                     */
                    function _disableInitializers() internal virtual {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        if ($._initializing) {
                            revert InvalidInitialization();
                        }
                        if ($._initialized != type(uint64).max) {
                            $._initialized = type(uint64).max;
                            emit Initialized(type(uint64).max);
                        }
                    }
                    /**
                     * @dev Returns the highest version that has been initialized. See {reinitializer}.
                     */
                    function _getInitializedVersion() internal view returns (uint64) {
                        return _getInitializableStorage()._initialized;
                    }
                    /**
                     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
                     */
                    function _isInitializing() internal view returns (bool) {
                        return _getInitializableStorage()._initializing;
                    }
                    /**
                     * @dev Returns a pointer to the storage namespace.
                     */
                    // solhint-disable-next-line var-name-mixedcase
                    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
                        assembly {
                            $.slot := INITIALIZABLE_STORAGE
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
                 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
                 *
                 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
                 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
                 * need to send a transaction, and thus is not required to hold Ether at all.
                 *
                 * ==== Security Considerations
                 *
                 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
                 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
                 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
                 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
                 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
                 * generally recommended is:
                 *
                 * ```solidity
                 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
                 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
                 *     doThing(..., value);
                 * }
                 *
                 * function doThing(..., uint256 value) public {
                 *     token.safeTransferFrom(msg.sender, address(this), value);
                 *     ...
                 * }
                 * ```
                 *
                 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
                 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
                 * {SafeERC20-safeTransferFrom}).
                 *
                 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
                 * contracts should have entry points that don't rely on permit.
                 */
                interface IERC20Permit {
                    /**
                     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
                     * given ``owner``'s signed approval.
                     *
                     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
                     * ordering also apply here.
                     *
                     * Emits an {Approval} event.
                     *
                     * Requirements:
                     *
                     * - `spender` cannot be the zero address.
                     * - `deadline` must be a timestamp in the future.
                     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
                     * over the EIP712-formatted function arguments.
                     * - the signature must use ``owner``'s current nonce (see {nonces}).
                     *
                     * For more information on the signature format, see the
                     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
                     * section].
                     *
                     * CAUTION: See Security Considerations above.
                     */
                    function permit(
                        address owner,
                        address spender,
                        uint256 value,
                        uint256 deadline,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) external;
                    /**
                     * @dev Returns the current nonce for `owner`. This value must be
                     * included whenever a signature is generated for {permit}.
                     *
                     * Every successful call to {permit} increases ``owner``'s nonce by one. This
                     * prevents a signature from being used multiple times.
                     */
                    function nonces(address owner) external view returns (uint256);
                    /**
                     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
                     */
                    // solhint-disable-next-line func-name-mixedcase
                    function DOMAIN_SEPARATOR() external view returns (bytes32);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
                pragma solidity ^0.8.20;
                import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
                import {Initializable} from "../proxy/utils/Initializable.sol";
                /**
                 * @dev Contract module which allows children to implement an emergency stop
                 * mechanism that can be triggered by an authorized account.
                 *
                 * This module is used through inheritance. It will make available the
                 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
                 * the functions of your contract. Note that they will not be pausable by
                 * simply including this module, only once the modifiers are put in place.
                 */
                abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
                    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
                    struct PausableStorage {
                        bool _paused;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;
                    function _getPausableStorage() private pure returns (PausableStorage storage $) {
                        assembly {
                            $.slot := PausableStorageLocation
                        }
                    }
                    /**
                     * @dev Emitted when the pause is triggered by `account`.
                     */
                    event Paused(address account);
                    /**
                     * @dev Emitted when the pause is lifted by `account`.
                     */
                    event Unpaused(address account);
                    /**
                     * @dev The operation failed because the contract is paused.
                     */
                    error EnforcedPause();
                    /**
                     * @dev The operation failed because the contract is not paused.
                     */
                    error ExpectedPause();
                    /**
                     * @dev Initializes the contract in unpaused state.
                     */
                    function __Pausable_init() internal onlyInitializing {
                        __Pausable_init_unchained();
                    }
                    function __Pausable_init_unchained() internal onlyInitializing {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = false;
                    }
                    /**
                     * @dev Modifier to make a function callable only when the contract is not paused.
                     *
                     * Requirements:
                     *
                     * - The contract must not be paused.
                     */
                    modifier whenNotPaused() {
                        _requireNotPaused();
                        _;
                    }
                    /**
                     * @dev Modifier to make a function callable only when the contract is paused.
                     *
                     * Requirements:
                     *
                     * - The contract must be paused.
                     */
                    modifier whenPaused() {
                        _requirePaused();
                        _;
                    }
                    /**
                     * @dev Returns true if the contract is paused, and false otherwise.
                     */
                    function paused() public view virtual returns (bool) {
                        PausableStorage storage $ = _getPausableStorage();
                        return $._paused;
                    }
                    /**
                     * @dev Throws if the contract is paused.
                     */
                    function _requireNotPaused() internal view virtual {
                        if (paused()) {
                            revert EnforcedPause();
                        }
                    }
                    /**
                     * @dev Throws if the contract is not paused.
                     */
                    function _requirePaused() internal view virtual {
                        if (!paused()) {
                            revert ExpectedPause();
                        }
                    }
                    /**
                     * @dev Triggers stopped state.
                     *
                     * Requirements:
                     *
                     * - The contract must not be paused.
                     */
                    function _pause() internal virtual whenNotPaused {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = true;
                        emit Paused(_msgSender());
                    }
                    /**
                     * @dev Returns to normal state.
                     *
                     * Requirements:
                     *
                     * - The contract must be paused.
                     */
                    function _unpause() internal virtual whenPaused {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = false;
                        emit Unpaused(_msgSender());
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This is the interface that {BeaconProxy} expects of its beacon.
                 */
                interface IBeacon {
                    /**
                     * @dev Must return an address that can be used as a delegate call target.
                     *
                     * {UpgradeableBeacon} will check that this address is a contract.
                     */
                    function implementation() external view returns (address);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Clones.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
                 * deploying minimal proxy contracts, also known as "clones".
                 *
                 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
                 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
                 *
                 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
                 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
                 * deterministic method.
                 */
                library Clones {
                    /**
                     * @dev A clone instance deployment failed.
                     */
                    error ERC1167FailedCreateClone();
                    /**
                     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
                     *
                     * This function uses the create opcode, which should never revert.
                     */
                    function clone(address implementation) internal returns (address instance) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
                            // of the `implementation` address with the bytecode before the address.
                            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
                            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
                            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
                            instance := create(0, 0x09, 0x37)
                        }
                        if (instance == address(0)) {
                            revert ERC1167FailedCreateClone();
                        }
                    }
                    /**
                     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
                     *
                     * This function uses the create2 opcode and a `salt` to deterministically deploy
                     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
                     * the clones cannot be deployed twice at the same address.
                     */
                    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
                            // of the `implementation` address with the bytecode before the address.
                            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
                            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
                            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
                            instance := create2(0, 0x09, 0x37, salt)
                        }
                        if (instance == address(0)) {
                            revert ERC1167FailedCreateClone();
                        }
                    }
                    /**
                     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
                     */
                    function predictDeterministicAddress(
                        address implementation,
                        bytes32 salt,
                        address deployer
                    ) internal pure returns (address predicted) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let ptr := mload(0x40)
                            mstore(add(ptr, 0x38), deployer)
                            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
                            mstore(add(ptr, 0x14), implementation)
                            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
                            mstore(add(ptr, 0x58), salt)
                            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
                            predicted := keccak256(add(ptr, 0x43), 0x55)
                        }
                    }
                    /**
                     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
                     */
                    function predictDeterministicAddress(
                        address implementation,
                        bytes32 salt
                    ) internal view returns (address predicted) {
                        return predictDeterministicAddress(implementation, salt, address(this));
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/BeaconProxy.sol)
                pragma solidity ^0.8.20;
                import {IBeacon} from "./IBeacon.sol";
                import {Proxy} from "../Proxy.sol";
                import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
                /**
                 * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
                 *
                 * The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an
                 * immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
                 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally.
                 *
                 * CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
                 * the beacon to not upgrade the implementation maliciously.
                 *
                 * IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in
                 * an inconsistent state where the beacon storage slot does not match the beacon address.
                 */
                contract BeaconProxy is Proxy {
                    // An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.
                    address private immutable _beacon;
                    /**
                     * @dev Initializes the proxy with `beacon`.
                     *
                     * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
                     * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
                     * constructor.
                     *
                     * Requirements:
                     *
                     * - `beacon` must be a contract with the interface {IBeacon}.
                     * - If `data` is empty, `msg.value` must be zero.
                     */
                    constructor(address beacon, bytes memory data) payable {
                        ERC1967Utils.upgradeBeaconToAndCall(beacon, data);
                        _beacon = beacon;
                    }
                    /**
                     * @dev Returns the current implementation address of the associated beacon.
                     */
                    function _implementation() internal view virtual override returns (address) {
                        return IBeacon(_getBeacon()).implementation();
                    }
                    /**
                     * @dev Returns the beacon.
                     */
                    function _getBeacon() internal view virtual returns (address) {
                        return _beacon;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
                pragma solidity ^0.8.20;
                import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
                import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol";
                import {Initializable} from "../../proxy/utils/Initializable.sol";
                /**
                 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
                 *
                 * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
                 * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
                 * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
                 * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
                 *
                 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
                 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
                 * ({_hashTypedDataV4}).
                 *
                 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
                 * the chain id to protect against replay attacks on an eventual fork of the chain.
                 *
                 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
                 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
                 *
                 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
                 * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
                 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
                 */
                abstract contract EIP712Upgradeable is Initializable, IERC5267 {
                    bytes32 private constant TYPE_HASH =
                        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
                    /// @custom:storage-location erc7201:openzeppelin.storage.EIP712
                    struct EIP712Storage {
                        /// @custom:oz-renamed-from _HASHED_NAME
                        bytes32 _hashedName;
                        /// @custom:oz-renamed-from _HASHED_VERSION
                        bytes32 _hashedVersion;
                        string _name;
                        string _version;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100;
                    function _getEIP712Storage() private pure returns (EIP712Storage storage $) {
                        assembly {
                            $.slot := EIP712StorageLocation
                        }
                    }
                    /**
                     * @dev Initializes the domain separator and parameter caches.
                     *
                     * The meaning of `name` and `version` is specified in
                     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
                     *
                     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
                     * - `version`: the current major version of the signing domain.
                     *
                     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
                     * contract upgrade].
                     */
                    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
                        __EIP712_init_unchained(name, version);
                    }
                    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {
                        EIP712Storage storage $ = _getEIP712Storage();
                        $._name = name;
                        $._version = version;
                        // Reset prior values in storage if upgrading
                        $._hashedName = 0;
                        $._hashedVersion = 0;
                    }
                    /**
                     * @dev Returns the domain separator for the current chain.
                     */
                    function _domainSeparatorV4() internal view returns (bytes32) {
                        return _buildDomainSeparator();
                    }
                    function _buildDomainSeparator() private view returns (bytes32) {
                        return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));
                    }
                    /**
                     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
                     * function returns the hash of the fully encoded EIP712 message for this domain.
                     *
                     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
                     *
                     * ```solidity
                     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
                     *     keccak256("Mail(address to,string contents)"),
                     *     mailTo,
                     *     keccak256(bytes(mailContents))
                     * )));
                     * address signer = ECDSA.recover(digest, signature);
                     * ```
                     */
                    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
                        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
                    }
                    /**
                     * @dev See {IERC-5267}.
                     */
                    function eip712Domain()
                        public
                        view
                        virtual
                        returns (
                            bytes1 fields,
                            string memory name,
                            string memory version,
                            uint256 chainId,
                            address verifyingContract,
                            bytes32 salt,
                            uint256[] memory extensions
                        )
                    {
                        EIP712Storage storage $ = _getEIP712Storage();
                        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized
                        // and the EIP712 domain is not reliable, as it will be missing name and version.
                        require($._hashedName == 0 && $._hashedVersion == 0, "EIP712: Uninitialized");
                        return (
                            hex"0f", // 01111
                            _EIP712Name(),
                            _EIP712Version(),
                            block.chainid,
                            address(this),
                            bytes32(0),
                            new uint256[](0)
                        );
                    }
                    /**
                     * @dev The name parameter for the EIP712 domain.
                     *
                     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
                     * are a concern.
                     */
                    function _EIP712Name() internal view virtual returns (string memory) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        return $._name;
                    }
                    /**
                     * @dev The version parameter for the EIP712 domain.
                     *
                     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
                     * are a concern.
                     */
                    function _EIP712Version() internal view virtual returns (string memory) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        return $._version;
                    }
                    /**
                     * @dev The hash of the name parameter for the EIP712 domain.
                     *
                     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.
                     */
                    function _EIP712NameHash() internal view returns (bytes32) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        string memory name = _EIP712Name();
                        if (bytes(name).length > 0) {
                            return keccak256(bytes(name));
                        } else {
                            // If the name is empty, the contract may have been upgraded without initializing the new storage.
                            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.
                            bytes32 hashedName = $._hashedName;
                            if (hashedName != 0) {
                                return hashedName;
                            } else {
                                return keccak256("");
                            }
                        }
                    }
                    /**
                     * @dev The hash of the version parameter for the EIP712 domain.
                     *
                     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.
                     */
                    function _EIP712VersionHash() internal view returns (bytes32) {
                        EIP712Storage storage $ = _getEIP712Storage();
                        string memory version = _EIP712Version();
                        if (bytes(version).length > 0) {
                            return keccak256(bytes(version));
                        } else {
                            // If the version is empty, the contract may have been upgraded without initializing the new storage.
                            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.
                            bytes32 hashedVersion = $._hashedVersion;
                            if (hashedVersion != 0) {
                                return hashedVersion;
                            } else {
                                return keccak256("");
                            }
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice UUPS proxy mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/UUPSUpgradeable.sol)
                /// @author Modified from OpenZeppelin
                /// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/UUPSUpgradeable.sol)
                ///
                /// Note:
                /// - This implementation is intended to be used with ERC1967 proxies.
                /// See: `LibClone.deployERC1967` and related functions.
                /// - This implementation is NOT compatible with legacy OpenZeppelin proxies
                /// which do not store the implementation at `_ERC1967_IMPLEMENTATION_SLOT`.
                abstract contract UUPSUpgradeable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The upgrade failed.
                    error UpgradeFailed();
                    /// @dev The call is from an unauthorized call context.
                    error UnauthorizedCallContext();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         IMMUTABLES                         */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev For checking if the context is a delegate call.
                    uint256 private immutable __self = uint256(uint160(address(this)));
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Emitted when the proxy's implementation is upgraded.
                    event Upgraded(address indexed implementation);
                    /// @dev `keccak256(bytes("Upgraded(address)"))`.
                    uint256 private constant _UPGRADED_EVENT_SIGNATURE =
                        0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The ERC-1967 storage slot for the implementation in the proxy.
                    /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`.
                    bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT =
                        0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      UUPS OPERATIONS                       */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Please override this function to check if `msg.sender` is authorized
                    /// to upgrade the proxy to `newImplementation`, reverting if not.
                    /// ```
                    ///     function _authorizeUpgrade(address) internal override onlyOwner {}
                    /// ```
                    function _authorizeUpgrade(address newImplementation) internal virtual;
                    /// @dev Returns the storage slot used by the implementation,
                    /// as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822).
                    ///
                    /// Note: The `notDelegated` modifier prevents accidental upgrades to
                    /// an implementation that is a proxy contract.
                    function proxiableUUID() public view virtual notDelegated returns (bytes32) {
                        // This function must always return `_ERC1967_IMPLEMENTATION_SLOT` to comply with ERC1967.
                        return _ERC1967_IMPLEMENTATION_SLOT;
                    }
                    /// @dev Upgrades the proxy's implementation to `newImplementation`.
                    /// Emits a {Upgraded} event.
                    ///
                    /// Note: Passing in empty `data` skips the delegatecall to `newImplementation`.
                    function upgradeToAndCall(address newImplementation, bytes calldata data)
                        public
                        payable
                        virtual
                        onlyProxy
                    {
                        _authorizeUpgrade(newImplementation);
                        /// @solidity memory-safe-assembly
                        assembly {
                            newImplementation := shr(96, shl(96, newImplementation)) // Clears upper 96 bits.
                            mstore(0x01, 0x52d1902d) // `proxiableUUID()`.
                            let s := _ERC1967_IMPLEMENTATION_SLOT
                            // Check if `newImplementation` implements `proxiableUUID` correctly.
                            if iszero(eq(mload(staticcall(gas(), newImplementation, 0x1d, 0x04, 0x01, 0x20)), s)) {
                                mstore(0x01, 0x55299b49) // `UpgradeFailed()`.
                                revert(0x1d, 0x04)
                            }
                            // Emit the {Upgraded} event.
                            log2(codesize(), 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation)
                            sstore(s, newImplementation) // Updates the implementation.
                            // Perform a delegatecall to `newImplementation` if `data` is non-empty.
                            if data.length {
                                // Forwards the `data` to `newImplementation` via delegatecall.
                                let m := mload(0x40)
                                calldatacopy(m, data.offset, data.length)
                                if iszero(delegatecall(gas(), newImplementation, m, data.length, codesize(), 0x00))
                                {
                                    // Bubble up the revert if the call reverts.
                                    returndatacopy(m, 0x00, returndatasize())
                                    revert(m, returndatasize())
                                }
                            }
                        }
                    }
                    /// @dev Requires that the execution is performed through a proxy.
                    modifier onlyProxy() {
                        uint256 s = __self;
                        /// @solidity memory-safe-assembly
                        assembly {
                            // To enable use cases with an immutable default implementation in the bytecode,
                            // (see: ERC6551Proxy), we don't require that the proxy address must match the
                            // value stored in the implementation slot, which may not be initialized.
                            if eq(s, address()) {
                                mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                    /// @dev Requires that the execution is NOT performed via delegatecall.
                    /// This is the opposite of `onlyProxy`.
                    modifier notDelegated() {
                        uint256 s = __self;
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(eq(s, address())) {
                                mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                import {Ownable} from "./Ownable.sol";
                /// @notice Simple single owner and multiroles authorization mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
                /// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173)
                /// for compatibility, the nomenclature for the 2-step ownership handover and roles
                /// may be unique to this codebase.
                abstract contract OwnableRoles is Ownable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The `user`'s roles is updated to `roles`.
                    /// Each bit of `roles` represents whether the role is set.
                    event RolesUpdated(address indexed user, uint256 indexed roles);
                    /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`.
                    uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
                        0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The role slot of `user` is given by:
                    /// ```
                    ///     mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED))
                    ///     let roleSlot := keccak256(0x00, 0x20)
                    /// ```
                    /// This automatically ignores the upper bits of the `user` in case
                    /// they are not clean, as well as keep the `keccak256` under 32-bytes.
                    ///
                    /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`.
                    uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     INTERNAL FUNCTIONS                     */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Overwrite the roles directly without authorization guard.
                    function _setRoles(address user, uint256 roles) internal virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, user)
                            // Store the new value.
                            sstore(keccak256(0x0c, 0x20), roles)
                            // Emit the {RolesUpdated} event.
                            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
                        }
                    }
                    /// @dev Updates the roles directly without authorization guard.
                    /// If `on` is true, each set bit of `roles` will be turned on,
                    /// otherwise, each set bit of `roles` will be turned off.
                    function _updateRoles(address user, uint256 roles, bool on) internal virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, user)
                            let roleSlot := keccak256(0x0c, 0x20)
                            // Load the current value.
                            let current := sload(roleSlot)
                            // Compute the updated roles if `on` is true.
                            let updated := or(current, roles)
                            // Compute the updated roles if `on` is false.
                            // Use `and` to compute the intersection of `current` and `roles`,
                            // `xor` it with `current` to flip the bits in the intersection.
                            if iszero(on) { updated := xor(current, and(current, roles)) }
                            // Then, store the new value.
                            sstore(roleSlot, updated)
                            // Emit the {RolesUpdated} event.
                            log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated)
                        }
                    }
                    /// @dev Grants the roles directly without authorization guard.
                    /// Each bit of `roles` represents the role to turn on.
                    function _grantRoles(address user, uint256 roles) internal virtual {
                        _updateRoles(user, roles, true);
                    }
                    /// @dev Removes the roles directly without authorization guard.
                    /// Each bit of `roles` represents the role to turn off.
                    function _removeRoles(address user, uint256 roles) internal virtual {
                        _updateRoles(user, roles, false);
                    }
                    /// @dev Throws if the sender does not have any of the `roles`.
                    function _checkRoles(uint256 roles) internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the role slot.
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, caller())
                            // Load the stored value, and if the `and` intersection
                            // of the value and `roles` is zero, revert.
                            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Throws if the sender is not the owner,
                    /// and does not have any of the `roles`.
                    /// Checks for ownership first, then lazily checks for roles.
                    function _checkOwnerOrRoles(uint256 roles) internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // If the caller is not the stored owner.
                            // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
                            if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                                // Compute the role slot.
                                mstore(0x0c, _ROLE_SLOT_SEED)
                                mstore(0x00, caller())
                                // Load the stored value, and if the `and` intersection
                                // of the value and `roles` is zero, revert.
                                if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                                    mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                        }
                    }
                    /// @dev Throws if the sender does not have any of the `roles`,
                    /// and is not the owner.
                    /// Checks for roles first, then lazily checks for ownership.
                    function _checkRolesOrOwner(uint256 roles) internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the role slot.
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, caller())
                            // Load the stored value, and if the `and` intersection
                            // of the value and `roles` is zero, revert.
                            if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
                                // If the caller is not the stored owner.
                                // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
                                if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
                                    mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                        }
                    }
                    /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`.
                    /// This is meant for frontends like Etherscan, and is therefore not fully optimized.
                    /// Not recommended to be called on-chain.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } {
                                // We don't need to mask the values of `ordinals`, as Solidity
                                // cleans dirty upper bits when storing variables into memory.
                                roles := or(shl(mload(add(ordinals, i)), 1), roles)
                            }
                        }
                    }
                    /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap.
                    /// This is meant for frontends like Etherscan, and is therefore not fully optimized.
                    /// Not recommended to be called on-chain.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Grab the pointer to the free memory.
                            ordinals := mload(0x40)
                            let ptr := add(ordinals, 0x20)
                            let o := 0
                            // The absence of lookup tables, De Bruijn, etc., here is intentional for
                            // smaller bytecode, as this function is not meant to be called on-chain.
                            for { let t := roles } 1 {} {
                                mstore(ptr, o)
                                // `shr` 5 is equivalent to multiplying by 0x20.
                                // Push back into the ordinals array if the bit is set.
                                ptr := add(ptr, shl(5, and(t, 1)))
                                o := add(o, 1)
                                t := shr(o, roles)
                                if iszero(t) { break }
                            }
                            // Store the length of `ordinals`.
                            mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20))))
                            // Allocate the memory.
                            mstore(0x40, ptr)
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  PUBLIC UPDATE FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Allows the owner to grant `user` `roles`.
                    /// If the `user` already has a role, then it will be an no-op for the role.
                    function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
                        _grantRoles(user, roles);
                    }
                    /// @dev Allows the owner to remove `user` `roles`.
                    /// If the `user` does not have a role, then it will be an no-op for the role.
                    function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
                        _removeRoles(user, roles);
                    }
                    /// @dev Allow the caller to remove their own roles.
                    /// If the caller does not have a role, then it will be an no-op for the role.
                    function renounceRoles(uint256 roles) public payable virtual {
                        _removeRoles(msg.sender, roles);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                   PUBLIC READ FUNCTIONS                    */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the roles of `user`.
                    function rolesOf(address user) public view virtual returns (uint256 roles) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the role slot.
                            mstore(0x0c, _ROLE_SLOT_SEED)
                            mstore(0x00, user)
                            // Load the stored value.
                            roles := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /// @dev Returns whether `user` has any of `roles`.
                    function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) {
                        return rolesOf(user) & roles != 0;
                    }
                    /// @dev Returns whether `user` has all of `roles`.
                    function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) {
                        return rolesOf(user) & roles == roles;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         MODIFIERS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Marks a function as only callable by an account with `roles`.
                    modifier onlyRoles(uint256 roles) virtual {
                        _checkRoles(roles);
                        _;
                    }
                    /// @dev Marks a function as only callable by the owner or by an account
                    /// with `roles`. Checks for ownership first, then lazily checks for roles.
                    modifier onlyOwnerOrRoles(uint256 roles) virtual {
                        _checkOwnerOrRoles(roles);
                        _;
                    }
                    /// @dev Marks a function as only callable by an account with `roles`
                    /// or the owner. Checks for roles first, then lazily checks for ownership.
                    modifier onlyRolesOrOwner(uint256 roles) virtual {
                        _checkRolesOrOwner(roles);
                        _;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       ROLE CONSTANTS                       */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    // IYKYK
                    uint256 internal constant _ROLE_0 = 1 << 0;
                    uint256 internal constant _ROLE_1 = 1 << 1;
                    uint256 internal constant _ROLE_2 = 1 << 2;
                    uint256 internal constant _ROLE_3 = 1 << 3;
                    uint256 internal constant _ROLE_4 = 1 << 4;
                    uint256 internal constant _ROLE_5 = 1 << 5;
                    uint256 internal constant _ROLE_6 = 1 << 6;
                    uint256 internal constant _ROLE_7 = 1 << 7;
                    uint256 internal constant _ROLE_8 = 1 << 8;
                    uint256 internal constant _ROLE_9 = 1 << 9;
                    uint256 internal constant _ROLE_10 = 1 << 10;
                    uint256 internal constant _ROLE_11 = 1 << 11;
                    uint256 internal constant _ROLE_12 = 1 << 12;
                    uint256 internal constant _ROLE_13 = 1 << 13;
                    uint256 internal constant _ROLE_14 = 1 << 14;
                    uint256 internal constant _ROLE_15 = 1 << 15;
                    uint256 internal constant _ROLE_16 = 1 << 16;
                    uint256 internal constant _ROLE_17 = 1 << 17;
                    uint256 internal constant _ROLE_18 = 1 << 18;
                    uint256 internal constant _ROLE_19 = 1 << 19;
                    uint256 internal constant _ROLE_20 = 1 << 20;
                    uint256 internal constant _ROLE_21 = 1 << 21;
                    uint256 internal constant _ROLE_22 = 1 << 22;
                    uint256 internal constant _ROLE_23 = 1 << 23;
                    uint256 internal constant _ROLE_24 = 1 << 24;
                    uint256 internal constant _ROLE_25 = 1 << 25;
                    uint256 internal constant _ROLE_26 = 1 << 26;
                    uint256 internal constant _ROLE_27 = 1 << 27;
                    uint256 internal constant _ROLE_28 = 1 << 28;
                    uint256 internal constant _ROLE_29 = 1 << 29;
                    uint256 internal constant _ROLE_30 = 1 << 30;
                    uint256 internal constant _ROLE_31 = 1 << 31;
                    uint256 internal constant _ROLE_32 = 1 << 32;
                    uint256 internal constant _ROLE_33 = 1 << 33;
                    uint256 internal constant _ROLE_34 = 1 << 34;
                    uint256 internal constant _ROLE_35 = 1 << 35;
                    uint256 internal constant _ROLE_36 = 1 << 36;
                    uint256 internal constant _ROLE_37 = 1 << 37;
                    uint256 internal constant _ROLE_38 = 1 << 38;
                    uint256 internal constant _ROLE_39 = 1 << 39;
                    uint256 internal constant _ROLE_40 = 1 << 40;
                    uint256 internal constant _ROLE_41 = 1 << 41;
                    uint256 internal constant _ROLE_42 = 1 << 42;
                    uint256 internal constant _ROLE_43 = 1 << 43;
                    uint256 internal constant _ROLE_44 = 1 << 44;
                    uint256 internal constant _ROLE_45 = 1 << 45;
                    uint256 internal constant _ROLE_46 = 1 << 46;
                    uint256 internal constant _ROLE_47 = 1 << 47;
                    uint256 internal constant _ROLE_48 = 1 << 48;
                    uint256 internal constant _ROLE_49 = 1 << 49;
                    uint256 internal constant _ROLE_50 = 1 << 50;
                    uint256 internal constant _ROLE_51 = 1 << 51;
                    uint256 internal constant _ROLE_52 = 1 << 52;
                    uint256 internal constant _ROLE_53 = 1 << 53;
                    uint256 internal constant _ROLE_54 = 1 << 54;
                    uint256 internal constant _ROLE_55 = 1 << 55;
                    uint256 internal constant _ROLE_56 = 1 << 56;
                    uint256 internal constant _ROLE_57 = 1 << 57;
                    uint256 internal constant _ROLE_58 = 1 << 58;
                    uint256 internal constant _ROLE_59 = 1 << 59;
                    uint256 internal constant _ROLE_60 = 1 << 60;
                    uint256 internal constant _ROLE_61 = 1 << 61;
                    uint256 internal constant _ROLE_62 = 1 << 62;
                    uint256 internal constant _ROLE_63 = 1 << 63;
                    uint256 internal constant _ROLE_64 = 1 << 64;
                    uint256 internal constant _ROLE_65 = 1 << 65;
                    uint256 internal constant _ROLE_66 = 1 << 66;
                    uint256 internal constant _ROLE_67 = 1 << 67;
                    uint256 internal constant _ROLE_68 = 1 << 68;
                    uint256 internal constant _ROLE_69 = 1 << 69;
                    uint256 internal constant _ROLE_70 = 1 << 70;
                    uint256 internal constant _ROLE_71 = 1 << 71;
                    uint256 internal constant _ROLE_72 = 1 << 72;
                    uint256 internal constant _ROLE_73 = 1 << 73;
                    uint256 internal constant _ROLE_74 = 1 << 74;
                    uint256 internal constant _ROLE_75 = 1 << 75;
                    uint256 internal constant _ROLE_76 = 1 << 76;
                    uint256 internal constant _ROLE_77 = 1 << 77;
                    uint256 internal constant _ROLE_78 = 1 << 78;
                    uint256 internal constant _ROLE_79 = 1 << 79;
                    uint256 internal constant _ROLE_80 = 1 << 80;
                    uint256 internal constant _ROLE_81 = 1 << 81;
                    uint256 internal constant _ROLE_82 = 1 << 82;
                    uint256 internal constant _ROLE_83 = 1 << 83;
                    uint256 internal constant _ROLE_84 = 1 << 84;
                    uint256 internal constant _ROLE_85 = 1 << 85;
                    uint256 internal constant _ROLE_86 = 1 << 86;
                    uint256 internal constant _ROLE_87 = 1 << 87;
                    uint256 internal constant _ROLE_88 = 1 << 88;
                    uint256 internal constant _ROLE_89 = 1 << 89;
                    uint256 internal constant _ROLE_90 = 1 << 90;
                    uint256 internal constant _ROLE_91 = 1 << 91;
                    uint256 internal constant _ROLE_92 = 1 << 92;
                    uint256 internal constant _ROLE_93 = 1 << 93;
                    uint256 internal constant _ROLE_94 = 1 << 94;
                    uint256 internal constant _ROLE_95 = 1 << 95;
                    uint256 internal constant _ROLE_96 = 1 << 96;
                    uint256 internal constant _ROLE_97 = 1 << 97;
                    uint256 internal constant _ROLE_98 = 1 << 98;
                    uint256 internal constant _ROLE_99 = 1 << 99;
                    uint256 internal constant _ROLE_100 = 1 << 100;
                    uint256 internal constant _ROLE_101 = 1 << 101;
                    uint256 internal constant _ROLE_102 = 1 << 102;
                    uint256 internal constant _ROLE_103 = 1 << 103;
                    uint256 internal constant _ROLE_104 = 1 << 104;
                    uint256 internal constant _ROLE_105 = 1 << 105;
                    uint256 internal constant _ROLE_106 = 1 << 106;
                    uint256 internal constant _ROLE_107 = 1 << 107;
                    uint256 internal constant _ROLE_108 = 1 << 108;
                    uint256 internal constant _ROLE_109 = 1 << 109;
                    uint256 internal constant _ROLE_110 = 1 << 110;
                    uint256 internal constant _ROLE_111 = 1 << 111;
                    uint256 internal constant _ROLE_112 = 1 << 112;
                    uint256 internal constant _ROLE_113 = 1 << 113;
                    uint256 internal constant _ROLE_114 = 1 << 114;
                    uint256 internal constant _ROLE_115 = 1 << 115;
                    uint256 internal constant _ROLE_116 = 1 << 116;
                    uint256 internal constant _ROLE_117 = 1 << 117;
                    uint256 internal constant _ROLE_118 = 1 << 118;
                    uint256 internal constant _ROLE_119 = 1 << 119;
                    uint256 internal constant _ROLE_120 = 1 << 120;
                    uint256 internal constant _ROLE_121 = 1 << 121;
                    uint256 internal constant _ROLE_122 = 1 << 122;
                    uint256 internal constant _ROLE_123 = 1 << 123;
                    uint256 internal constant _ROLE_124 = 1 << 124;
                    uint256 internal constant _ROLE_125 = 1 << 125;
                    uint256 internal constant _ROLE_126 = 1 << 126;
                    uint256 internal constant _ROLE_127 = 1 << 127;
                    uint256 internal constant _ROLE_128 = 1 << 128;
                    uint256 internal constant _ROLE_129 = 1 << 129;
                    uint256 internal constant _ROLE_130 = 1 << 130;
                    uint256 internal constant _ROLE_131 = 1 << 131;
                    uint256 internal constant _ROLE_132 = 1 << 132;
                    uint256 internal constant _ROLE_133 = 1 << 133;
                    uint256 internal constant _ROLE_134 = 1 << 134;
                    uint256 internal constant _ROLE_135 = 1 << 135;
                    uint256 internal constant _ROLE_136 = 1 << 136;
                    uint256 internal constant _ROLE_137 = 1 << 137;
                    uint256 internal constant _ROLE_138 = 1 << 138;
                    uint256 internal constant _ROLE_139 = 1 << 139;
                    uint256 internal constant _ROLE_140 = 1 << 140;
                    uint256 internal constant _ROLE_141 = 1 << 141;
                    uint256 internal constant _ROLE_142 = 1 << 142;
                    uint256 internal constant _ROLE_143 = 1 << 143;
                    uint256 internal constant _ROLE_144 = 1 << 144;
                    uint256 internal constant _ROLE_145 = 1 << 145;
                    uint256 internal constant _ROLE_146 = 1 << 146;
                    uint256 internal constant _ROLE_147 = 1 << 147;
                    uint256 internal constant _ROLE_148 = 1 << 148;
                    uint256 internal constant _ROLE_149 = 1 << 149;
                    uint256 internal constant _ROLE_150 = 1 << 150;
                    uint256 internal constant _ROLE_151 = 1 << 151;
                    uint256 internal constant _ROLE_152 = 1 << 152;
                    uint256 internal constant _ROLE_153 = 1 << 153;
                    uint256 internal constant _ROLE_154 = 1 << 154;
                    uint256 internal constant _ROLE_155 = 1 << 155;
                    uint256 internal constant _ROLE_156 = 1 << 156;
                    uint256 internal constant _ROLE_157 = 1 << 157;
                    uint256 internal constant _ROLE_158 = 1 << 158;
                    uint256 internal constant _ROLE_159 = 1 << 159;
                    uint256 internal constant _ROLE_160 = 1 << 160;
                    uint256 internal constant _ROLE_161 = 1 << 161;
                    uint256 internal constant _ROLE_162 = 1 << 162;
                    uint256 internal constant _ROLE_163 = 1 << 163;
                    uint256 internal constant _ROLE_164 = 1 << 164;
                    uint256 internal constant _ROLE_165 = 1 << 165;
                    uint256 internal constant _ROLE_166 = 1 << 166;
                    uint256 internal constant _ROLE_167 = 1 << 167;
                    uint256 internal constant _ROLE_168 = 1 << 168;
                    uint256 internal constant _ROLE_169 = 1 << 169;
                    uint256 internal constant _ROLE_170 = 1 << 170;
                    uint256 internal constant _ROLE_171 = 1 << 171;
                    uint256 internal constant _ROLE_172 = 1 << 172;
                    uint256 internal constant _ROLE_173 = 1 << 173;
                    uint256 internal constant _ROLE_174 = 1 << 174;
                    uint256 internal constant _ROLE_175 = 1 << 175;
                    uint256 internal constant _ROLE_176 = 1 << 176;
                    uint256 internal constant _ROLE_177 = 1 << 177;
                    uint256 internal constant _ROLE_178 = 1 << 178;
                    uint256 internal constant _ROLE_179 = 1 << 179;
                    uint256 internal constant _ROLE_180 = 1 << 180;
                    uint256 internal constant _ROLE_181 = 1 << 181;
                    uint256 internal constant _ROLE_182 = 1 << 182;
                    uint256 internal constant _ROLE_183 = 1 << 183;
                    uint256 internal constant _ROLE_184 = 1 << 184;
                    uint256 internal constant _ROLE_185 = 1 << 185;
                    uint256 internal constant _ROLE_186 = 1 << 186;
                    uint256 internal constant _ROLE_187 = 1 << 187;
                    uint256 internal constant _ROLE_188 = 1 << 188;
                    uint256 internal constant _ROLE_189 = 1 << 189;
                    uint256 internal constant _ROLE_190 = 1 << 190;
                    uint256 internal constant _ROLE_191 = 1 << 191;
                    uint256 internal constant _ROLE_192 = 1 << 192;
                    uint256 internal constant _ROLE_193 = 1 << 193;
                    uint256 internal constant _ROLE_194 = 1 << 194;
                    uint256 internal constant _ROLE_195 = 1 << 195;
                    uint256 internal constant _ROLE_196 = 1 << 196;
                    uint256 internal constant _ROLE_197 = 1 << 197;
                    uint256 internal constant _ROLE_198 = 1 << 198;
                    uint256 internal constant _ROLE_199 = 1 << 199;
                    uint256 internal constant _ROLE_200 = 1 << 200;
                    uint256 internal constant _ROLE_201 = 1 << 201;
                    uint256 internal constant _ROLE_202 = 1 << 202;
                    uint256 internal constant _ROLE_203 = 1 << 203;
                    uint256 internal constant _ROLE_204 = 1 << 204;
                    uint256 internal constant _ROLE_205 = 1 << 205;
                    uint256 internal constant _ROLE_206 = 1 << 206;
                    uint256 internal constant _ROLE_207 = 1 << 207;
                    uint256 internal constant _ROLE_208 = 1 << 208;
                    uint256 internal constant _ROLE_209 = 1 << 209;
                    uint256 internal constant _ROLE_210 = 1 << 210;
                    uint256 internal constant _ROLE_211 = 1 << 211;
                    uint256 internal constant _ROLE_212 = 1 << 212;
                    uint256 internal constant _ROLE_213 = 1 << 213;
                    uint256 internal constant _ROLE_214 = 1 << 214;
                    uint256 internal constant _ROLE_215 = 1 << 215;
                    uint256 internal constant _ROLE_216 = 1 << 216;
                    uint256 internal constant _ROLE_217 = 1 << 217;
                    uint256 internal constant _ROLE_218 = 1 << 218;
                    uint256 internal constant _ROLE_219 = 1 << 219;
                    uint256 internal constant _ROLE_220 = 1 << 220;
                    uint256 internal constant _ROLE_221 = 1 << 221;
                    uint256 internal constant _ROLE_222 = 1 << 222;
                    uint256 internal constant _ROLE_223 = 1 << 223;
                    uint256 internal constant _ROLE_224 = 1 << 224;
                    uint256 internal constant _ROLE_225 = 1 << 225;
                    uint256 internal constant _ROLE_226 = 1 << 226;
                    uint256 internal constant _ROLE_227 = 1 << 227;
                    uint256 internal constant _ROLE_228 = 1 << 228;
                    uint256 internal constant _ROLE_229 = 1 << 229;
                    uint256 internal constant _ROLE_230 = 1 << 230;
                    uint256 internal constant _ROLE_231 = 1 << 231;
                    uint256 internal constant _ROLE_232 = 1 << 232;
                    uint256 internal constant _ROLE_233 = 1 << 233;
                    uint256 internal constant _ROLE_234 = 1 << 234;
                    uint256 internal constant _ROLE_235 = 1 << 235;
                    uint256 internal constant _ROLE_236 = 1 << 236;
                    uint256 internal constant _ROLE_237 = 1 << 237;
                    uint256 internal constant _ROLE_238 = 1 << 238;
                    uint256 internal constant _ROLE_239 = 1 << 239;
                    uint256 internal constant _ROLE_240 = 1 << 240;
                    uint256 internal constant _ROLE_241 = 1 << 241;
                    uint256 internal constant _ROLE_242 = 1 << 242;
                    uint256 internal constant _ROLE_243 = 1 << 243;
                    uint256 internal constant _ROLE_244 = 1 << 244;
                    uint256 internal constant _ROLE_245 = 1 << 245;
                    uint256 internal constant _ROLE_246 = 1 << 246;
                    uint256 internal constant _ROLE_247 = 1 << 247;
                    uint256 internal constant _ROLE_248 = 1 << 248;
                    uint256 internal constant _ROLE_249 = 1 << 249;
                    uint256 internal constant _ROLE_250 = 1 << 250;
                    uint256 internal constant _ROLE_251 = 1 << 251;
                    uint256 internal constant _ROLE_252 = 1 << 252;
                    uint256 internal constant _ROLE_253 = 1 << 253;
                    uint256 internal constant _ROLE_254 = 1 << 254;
                    uint256 internal constant _ROLE_255 = 1 << 255;
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Reentrancy guard mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuard.sol)
                abstract contract ReentrancyGuard {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Unauthorized reentrant call.
                    error Reentrancy();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Equivalent to: `uint72(bytes9(keccak256("_REENTRANCY_GUARD_SLOT")))`.
                    /// 9 bytes is large enough to avoid collisions with lower slots,
                    /// but not too large to result in excessive bytecode bloat.
                    uint256 private constant _REENTRANCY_GUARD_SLOT = 0x929eee149b4bd21268;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      REENTRANCY GUARD                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Guards a function from reentrancy.
                    modifier nonReentrant() virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if eq(sload(_REENTRANCY_GUARD_SLOT), address()) {
                                mstore(0x00, 0xab143c06) // `Reentrancy()`.
                                revert(0x1c, 0x04)
                            }
                            sstore(_REENTRANCY_GUARD_SLOT, address())
                        }
                        _;
                        /// @solidity memory-safe-assembly
                        assembly {
                            sstore(_REENTRANCY_GUARD_SLOT, codesize())
                        }
                    }
                    /// @dev Guards a view function from read-only reentrancy.
                    modifier nonReadReentrant() virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if eq(sload(_REENTRANCY_GUARD_SLOT), address()) {
                                mstore(0x00, 0xab143c06) // `Reentrancy()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import {IVaultSupervisor} from "./IVaultSupervisor.sol";
                interface IVault is IERC4626 {
                    enum AssetType {
                        NONE,
                        ETH,
                        STABLE,
                        BTC,
                        OTHER
                    }
                    function initialize(
                        address _owner,
                        IERC20 _depositToken,
                        string memory _name,
                        string memory _symbol,
                        AssetType _assetType
                    ) external;
                    function deposit(uint256 assets, address depositor) external returns (uint256);
                    function redeem(uint256 shares, address to, address owner) external returns (uint256 assets);
                    function setLimit(uint256 newLimit) external;
                    function assetLimit() external view returns (uint256);
                    function pause(bool toPause) external;
                    function owner() external view returns (address);
                    function transferOwnership(address newOwner) external;
                    function renounceOwnership() external;
                    function totalAssets() external view returns (uint256);
                    function decimals() external view returns (uint8);
                    function assetType() external view returns (AssetType);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import "./IVault.sol";
                import "./ILimiter.sol";
                interface IVaultSupervisor {
                    struct Signature {
                        uint8 v;
                        bytes32 r;
                        bytes32 s;
                    }
                    function getDeposits(address staker)
                        external
                        view
                        returns (IVault[] memory vaults, IERC20[] memory tokens, uint256[] memory assets, uint256[] memory shares);
                    function initialize(address _delegationSupervisor, address _vaultImpl, ILimiter _limiter, address _manager)
                        external;
                    function redeemShares(address staker, IVault vault, uint256 shares) external;
                    function removeShares(address staker, IVault vault, uint256 shares) external;
                    function deposit(IVault vault, uint256 amount, uint256 minSharesOut) external returns (uint256);
                    function deployVault(IERC20 depositToken, string memory name, string memory symbol, IVault.AssetType assetType)
                        external
                        returns (IVault);
                    function runAdminOperation(IVault vault, bytes calldata fn) external returns (bytes memory);
                    function depositWithSignature(
                        IVault vault,
                        address user,
                        uint256 value,
                        uint256 minSharesOut,
                        uint256 deadline,
                        Signature calldata permit,
                        Signature calldata vaultAllowance
                    ) external returns (uint256);
                    function SIGNED_DEPOSIT_TYPEHASH() external returns (bytes32);
                    function getUserNonce(address user) external returns (uint256);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./IVault.sol";
                import "../entities/Withdraw.sol";
                interface IDelegationSupervisor {
                    function withdrawalDelay() external view returns (uint256);
                    function initialize(address vaultSupervisor, uint256 minWithdrawDelay, address manager) external;
                    function startWithdraw(Withdraw.WithdrawRequest[] calldata withdrawRequest)
                        external
                        returns (bytes32[] memory withdrawalRoots, Withdraw.QueuedWithdrawal[] memory);
                    function finishWithdraw(Withdraw.QueuedWithdrawal[] calldata withdrawals) external;
                    function pause(bool toPause) external;
                    function fetchQueuedWithdrawals(address staker)
                        external
                        view
                        returns (Withdraw.QueuedWithdrawal[] memory queuedWithdrawals);
                    function isWithdrawPending(Withdraw.QueuedWithdrawal calldata withdrawal) external view returns (bool);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol";
                library Constants {
                    uint256 public constant MAX_WITHDRAWAL_DELAY = 30 days;
                    uint8 public constant MAX_VAULTS_PER_STAKER = 32;
                    bytes32 public constant SIGNED_DEPOSIT_TYPEHASH =
                        keccak256("Deposit(address vault, uint256 deadline, uint256 value, uint256 minSharesOut, uint256 nonce)");
                    bytes32 constant DOMAIN_TYPEHASH =
                        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
                    address public constant DEFAULT_VAULT_IMPLEMENTATION_FLAG = address(1);
                    // Bit from solady/src/auth/OwnableRoles.sol
                    uint256 public constant MANAGER_ROLE = 1 << 0;
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                error InvalidInput();
                error InvalidWithdrawalDelay();
                error ZeroAddress();
                error NotVaultSupervisor();
                error NotStaker();
                error WithdrawAlreadyCompleted();
                error MinWithdrawDelayNotPassed();
                error WithdrawerNotCaller();
                error ZeroShares();
                error MaxStakerVault();
                error VaultNotAChildVault();
                error NotDelegationSupervisor();
                error NotPreviousNorCurrentDelegationSupervisor();
                error VaultNotFound();
                error NotEnoughShares();
                error InvalidVaultAdminFunction();
                error NotInitialized();
                error RoleNotGranted();
                // Vault.sol
                error NotSupervisor();
                error TokenNotEnabled();
                // Generic
                error NoElementsInArray();
                error ArrayLengthsNotEqual();
                error ZeroAmount();
                // VaultSupervisor.sol
                error PermitFailed();
                error ExpiredSign();
                error InvalidSignature();
                error CrossedDepositLimit();
                // Limiter.sol
                error UnsupportedAsset();
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                event StartedWithdrawal(
                    address indexed vault, address indexed staker, address indexed operator, address withdrawer, uint256 shares
                );
                event FinishedWithdrawal(
                    address indexed vault,
                    address indexed staker,
                    address indexed operator,
                    address withdrawer,
                    uint256 shares,
                    bytes32 withdrawRoot
                );
                event NewVault(address indexed vault);
                event GaveShares(address indexed staker, address indexed vault, address shareToken, uint256 shares);
                event ReturnedShares(address indexed staker, address indexed vault, address shareToken, uint256 shares);
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./IVault.sol";
                interface ILimiter {
                    function globalUsdLimit() external view returns (uint256);
                    function usdPerEth() external view returns (uint256);
                    function isLimitBreached(IVault[] calldata vaults) external view returns (bool);
                    function remainingGlobalUsdLimit(IVault[] memory vaults) external view returns (uint256);
                    function computeGlobalDepositsInUsd(IVault[] memory vaults) external view returns (uint256);
                    function computeUserMaximumDeposit(
                        IVault[] memory vaults,
                        IVault vaultToDeposit,
                        address user,
                        uint256 walletBalance
                    ) external view returns (uint256);
                    function setGlobalUsdLimit(uint256 _limit) external;
                    function setUsdPerEth(uint256 _usdPerEth) external;
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IVault} from "../interfaces/IVault.sol";
                import {IVaultSupervisor} from "../interfaces/IVaultSupervisor.sol";
                import {IDelegationSupervisor} from "../interfaces/IDelegationSupervisor.sol";
                import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
                import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
                import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
                import "../interfaces/Constants.sol";
                import "../interfaces/Errors.sol";
                import "../interfaces/ILimiter.sol";
                library VaultSupervisorLib {
                    /// @custom:storage-location erc7201:vaultsupervisor.storage
                    struct Storage {
                        mapping(address staker => mapping(IVault vault => uint256 shares)) stakerShares;
                        mapping(address staker => IVault[] vaults) stakersVaults;
                        mapping(address staker => uint256 nonce) userNonce;
                        mapping(address vault => address implementation) vaultToImplMap;
                        IVault[] vaults;
                        address vaultImpl;
                        IDelegationSupervisor delegationSupervisor;
                        ILimiter limiter;
                    }
                    function initOrUpdate(Storage storage self, address _delegationSupervisor, address _vaultImpl, ILimiter _limiter)
                        internal
                    {
                        if (_vaultImpl == address(0) || _delegationSupervisor == address(0)) {
                            revert ZeroAddress();
                        }
                        self.delegationSupervisor = IDelegationSupervisor(_delegationSupervisor);
                        self.vaultImpl = _vaultImpl;
                        self.limiter = _limiter;
                    }
                    function verifySignatures(
                        IVault vault,
                        address user,
                        uint256 value,
                        uint256 minSharesOut,
                        uint256 deadline,
                        IVaultSupervisor.Signature calldata permit,
                        IVaultSupervisor.Signature calldata vaultAllowance,
                        uint256 nonce
                    ) internal {
                        try IERC20Permit(address(vault.asset())).permit(
                            user, address(vault), value, deadline, permit.v, permit.r, permit.s
                        ) {} catch {
                            if (IERC20(vault.asset()).allowance(user, address(vault)) < value) revert PermitFailed();
                        }
                        verifyVaultSign({
                            vault: address(vault),
                            user: user,
                            value: value,
                            minSharesOut: minSharesOut,
                            deadline: deadline,
                            vaultSign: vaultAllowance,
                            nonce: nonce
                        });
                    }
                    function verifyVaultSign(
                        address vault,
                        address user,
                        uint256 value,
                        uint256 minSharesOut,
                        uint256 deadline,
                        IVaultSupervisor.Signature calldata vaultSign,
                        uint256 nonce
                    ) internal view {
                        if (deadline < block.timestamp) revert ExpiredSign();
                        bytes32 EIP712DomainHash = keccak256(
                            abi.encode(
                                Constants.DOMAIN_TYPEHASH,
                                keccak256(bytes("Karak_Vault_Sup")),
                                keccak256(bytes("v1")),
                                block.chainid,
                                address(this)
                            )
                        );
                        bytes32 vaultHash =
                            keccak256(abi.encodePacked(Constants.SIGNED_DEPOSIT_TYPEHASH, vault, deadline, value, minSharesOut, nonce));
                        bytes32 combinedHash = keccak256(abi.encodePacked("\\x19\\x01", EIP712DomainHash, vaultHash));
                        address signer = ECDSA.recover(combinedHash, vaultSign.v, vaultSign.r, vaultSign.s);
                        if (signer != user) revert InvalidSignature();
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
                pragma solidity ^0.8.20;
                import {Initializable} from "../proxy/utils/Initializable.sol";
                /**
                 * @dev Provides information about the current execution context, including the
                 * sender of the transaction and its data. While these are generally available
                 * via msg.sender and msg.data, they should not be accessed in such a direct
                 * manner, since when dealing with meta-transactions the account sending and
                 * paying for execution may not be the actual sender (as far as an application
                 * is concerned).
                 *
                 * This contract is only required for intermediate, library-like contracts.
                 */
                abstract contract ContextUpgradeable is Initializable {
                    function __Context_init() internal onlyInitializing {
                    }
                    function __Context_init_unchained() internal onlyInitializing {
                    }
                    function _msgSender() internal view virtual returns (address) {
                        return msg.sender;
                    }
                    function _msgData() internal view virtual returns (bytes calldata) {
                        return msg.data;
                    }
                    function _contextSuffixLength() internal view virtual returns (uint256) {
                        return 0;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
                 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
                 * be specified by overriding the virtual {_implementation} function.
                 *
                 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
                 * different contract through the {_delegate} function.
                 *
                 * The success and return data of the delegated call will be returned back to the caller of the proxy.
                 */
                abstract contract Proxy {
                    /**
                     * @dev Delegates the current call to `implementation`.
                     *
                     * This function does not return to its internal call site, it will return directly to the external caller.
                     */
                    function _delegate(address implementation) internal virtual {
                        assembly {
                            // Copy msg.data. We take full control of memory in this inline assembly
                            // block because it will not return to Solidity code. We overwrite the
                            // Solidity scratch pad at memory position 0.
                            calldatacopy(0, 0, calldatasize())
                            // Call the implementation.
                            // out and outsize are 0 because we don't know the size yet.
                            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
                            // Copy the returned data.
                            returndatacopy(0, 0, returndatasize())
                            switch result
                            // delegatecall returns 0 on error.
                            case 0 {
                                revert(0, returndatasize())
                            }
                            default {
                                return(0, returndatasize())
                            }
                        }
                    }
                    /**
                     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
                     * function and {_fallback} should delegate.
                     */
                    function _implementation() internal view virtual returns (address);
                    /**
                     * @dev Delegates the current call to the address returned by `_implementation()`.
                     *
                     * This function does not return to its internal call site, it will return directly to the external caller.
                     */
                    function _fallback() internal virtual {
                        _delegate(_implementation());
                    }
                    /**
                     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
                     * function in the contract matches the call data.
                     */
                    fallback() external payable virtual {
                        _fallback();
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)
                pragma solidity ^0.8.20;
                import {IBeacon} from "../beacon/IBeacon.sol";
                import {Address} from "../../utils/Address.sol";
                import {StorageSlot} from "../../utils/StorageSlot.sol";
                /**
                 * @dev This abstract contract provides getters and event emitting update functions for
                 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
                 */
                library ERC1967Utils {
                    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
                    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
                    /**
                     * @dev Emitted when the implementation is upgraded.
                     */
                    event Upgraded(address indexed implementation);
                    /**
                     * @dev Emitted when the admin account has changed.
                     */
                    event AdminChanged(address previousAdmin, address newAdmin);
                    /**
                     * @dev Emitted when the beacon is changed.
                     */
                    event BeaconUpgraded(address indexed beacon);
                    /**
                     * @dev Storage slot with the address of the current implementation.
                     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
                     */
                    // solhint-disable-next-line private-vars-leading-underscore
                    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                    /**
                     * @dev The `implementation` of the proxy is invalid.
                     */
                    error ERC1967InvalidImplementation(address implementation);
                    /**
                     * @dev The `admin` of the proxy is invalid.
                     */
                    error ERC1967InvalidAdmin(address admin);
                    /**
                     * @dev The `beacon` of the proxy is invalid.
                     */
                    error ERC1967InvalidBeacon(address beacon);
                    /**
                     * @dev An upgrade function sees `msg.value > 0` that may be lost.
                     */
                    error ERC1967NonPayable();
                    /**
                     * @dev Returns the current implementation address.
                     */
                    function getImplementation() internal view returns (address) {
                        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
                    }
                    /**
                     * @dev Stores a new address in the EIP1967 implementation slot.
                     */
                    function _setImplementation(address newImplementation) private {
                        if (newImplementation.code.length == 0) {
                            revert ERC1967InvalidImplementation(newImplementation);
                        }
                        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
                    }
                    /**
                     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
                     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
                     * to avoid stuck value in the contract.
                     *
                     * Emits an {IERC1967-Upgraded} event.
                     */
                    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
                        _setImplementation(newImplementation);
                        emit Upgraded(newImplementation);
                        if (data.length > 0) {
                            Address.functionDelegateCall(newImplementation, data);
                        } else {
                            _checkNonPayable();
                        }
                    }
                    /**
                     * @dev Storage slot with the admin of the contract.
                     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
                     */
                    // solhint-disable-next-line private-vars-leading-underscore
                    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
                    /**
                     * @dev Returns the current admin.
                     *
                     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
                     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
                     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
                     */
                    function getAdmin() internal view returns (address) {
                        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
                    }
                    /**
                     * @dev Stores a new address in the EIP1967 admin slot.
                     */
                    function _setAdmin(address newAdmin) private {
                        if (newAdmin == address(0)) {
                            revert ERC1967InvalidAdmin(address(0));
                        }
                        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
                    }
                    /**
                     * @dev Changes the admin of the proxy.
                     *
                     * Emits an {IERC1967-AdminChanged} event.
                     */
                    function changeAdmin(address newAdmin) internal {
                        emit AdminChanged(getAdmin(), newAdmin);
                        _setAdmin(newAdmin);
                    }
                    /**
                     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
                     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
                     */
                    // solhint-disable-next-line private-vars-leading-underscore
                    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
                    /**
                     * @dev Returns the current beacon.
                     */
                    function getBeacon() internal view returns (address) {
                        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
                    }
                    /**
                     * @dev Stores a new beacon in the EIP1967 beacon slot.
                     */
                    function _setBeacon(address newBeacon) private {
                        if (newBeacon.code.length == 0) {
                            revert ERC1967InvalidBeacon(newBeacon);
                        }
                        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;
                        address beaconImplementation = IBeacon(newBeacon).implementation();
                        if (beaconImplementation.code.length == 0) {
                            revert ERC1967InvalidImplementation(beaconImplementation);
                        }
                    }
                    /**
                     * @dev Change the beacon and trigger a setup call if data is nonempty.
                     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
                     * to avoid stuck value in the contract.
                     *
                     * Emits an {IERC1967-BeaconUpgraded} event.
                     *
                     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
                     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
                     * efficiency.
                     */
                    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
                        _setBeacon(newBeacon);
                        emit BeaconUpgraded(newBeacon);
                        if (data.length > 0) {
                            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
                        } else {
                            _checkNonPayable();
                        }
                    }
                    /**
                     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
                     * if an upgrade doesn't perform an initialization call.
                     */
                    function _checkNonPayable() private {
                        if (msg.value > 0) {
                            revert ERC1967NonPayable();
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)
                pragma solidity ^0.8.20;
                import {Strings} from "../Strings.sol";
                /**
                 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
                 *
                 * The library provides methods for generating a hash of a message that conforms to the
                 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
                 * specifications.
                 */
                library MessageHashUtils {
                    /**
                     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
                     * `0x45` (`personal_sign` messages).
                     *
                     * The digest is calculated by prefixing a bytes32 `messageHash` with
                     * `"\\x19Ethereum Signed Message:\
                32"` and hashing the result. It corresponds with the
                     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
                     *
                     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
                     * keccak256, although any bytes32 value can be safely used because the final digest will
                     * be re-hashed.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x00, "\\x19Ethereum Signed Message:\
                32") // 32 is the bytes-length of messageHash
                            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
                            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
                        }
                    }
                    /**
                     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
                     * `0x45` (`personal_sign` messages).
                     *
                     * The digest is calculated by prefixing an arbitrary `message` with
                     * `"\\x19Ethereum Signed Message:\
                " + len(message)` and hashing the result. It corresponds with the
                     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
                        return
                            keccak256(bytes.concat("\\x19Ethereum Signed Message:\
                ", bytes(Strings.toString(message.length)), message));
                    }
                    /**
                     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
                     * `0x00` (data with intended validator).
                     *
                     * The digest is calculated by prefixing an arbitrary `data` with `"\\x19\\x00"` and the intended
                     * `validator` address. Then hashing the result.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
                        return keccak256(abi.encodePacked(hex"19_00", validator, data));
                    }
                    /**
                     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
                     *
                     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
                     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the
                     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
                     *
                     * See {ECDSA-recover}.
                     */
                    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let ptr := mload(0x40)
                            mstore(ptr, hex"19_01")
                            mstore(add(ptr, 0x02), domainSeparator)
                            mstore(add(ptr, 0x22), structHash)
                            digest := keccak256(ptr, 0x42)
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)
                pragma solidity ^0.8.20;
                interface IERC5267 {
                    /**
                     * @dev MAY be emitted to signal that the domain could have changed.
                     */
                    event EIP712DomainChanged();
                    /**
                     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
                     * signature.
                     */
                    function eip712Domain()
                        external
                        view
                        returns (
                            bytes1 fields,
                            string memory name,
                            string memory version,
                            uint256 chainId,
                            address verifyingContract,
                            bytes32 salt,
                            uint256[] memory extensions
                        );
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Simple single owner authorization mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
                ///
                /// @dev Note:
                /// This implementation does NOT auto-initialize the owner to `msg.sender`.
                /// You MUST call the `_initializeOwner` in the constructor / initializer.
                ///
                /// While the ownable portion follows
                /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
                /// the nomenclature for the 2-step ownership handover may be unique to this codebase.
                abstract contract Ownable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The caller is not authorized to call the function.
                    error Unauthorized();
                    /// @dev The `newOwner` cannot be the zero address.
                    error NewOwnerIsZeroAddress();
                    /// @dev The `pendingOwner` does not have a valid handover request.
                    error NoHandoverRequest();
                    /// @dev Cannot double-initialize.
                    error AlreadyInitialized();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
                    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
                    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
                    /// despite it not being as lightweight as a single argument event.
                    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
                    /// @dev An ownership handover to `pendingOwner` has been requested.
                    event OwnershipHandoverRequested(address indexed pendingOwner);
                    /// @dev The ownership handover to `pendingOwner` has been canceled.
                    event OwnershipHandoverCanceled(address indexed pendingOwner);
                    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
                    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
                        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
                    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
                    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
                        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;
                    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
                    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
                        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The owner slot is given by:
                    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
                    /// It is intentionally chosen to be a high value
                    /// to avoid collision with lower slots.
                    /// The choice of manual storage layout is to enable compatibility
                    /// with both regular and upgradeable contracts.
                    bytes32 internal constant _OWNER_SLOT =
                        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;
                    /// The ownership handover slot of `newOwner` is given by:
                    /// ```
                    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
                    ///     let handoverSlot := keccak256(0x00, 0x20)
                    /// ```
                    /// It stores the expiry timestamp of the two-step ownership handover.
                    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     INTERNAL FUNCTIONS                     */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
                    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}
                    /// @dev Initializes the owner directly without authorization guard.
                    /// This function must be called upon initialization,
                    /// regardless of whether the contract is upgradeable or not.
                    /// This is to enable generalization to both regular and upgradeable contracts,
                    /// and to save gas in case the initial owner is not the caller.
                    /// For performance reasons, this function will not check if there
                    /// is an existing owner.
                    function _initializeOwner(address newOwner) internal virtual {
                        if (_guardInitializeOwner()) {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                if sload(ownerSlot) {
                                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                                    revert(0x1c, 0x04)
                                }
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Store the new value.
                                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
                            }
                        } else {
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Store the new value.
                                sstore(_OWNER_SLOT, newOwner)
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
                            }
                        }
                    }
                    /// @dev Sets the owner directly without authorization guard.
                    function _setOwner(address newOwner) internal virtual {
                        if (_guardInitializeOwner()) {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                                // Store the new value.
                                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                            }
                        } else {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                                // Store the new value.
                                sstore(ownerSlot, newOwner)
                            }
                        }
                    }
                    /// @dev Throws if the sender is not the owner.
                    function _checkOwner() internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // If the caller is not the stored owner, revert.
                            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
                    /// Override to return a different value if needed.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
                        return 48 * 3600;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  PUBLIC UPDATE FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Allows the owner to transfer the ownership to `newOwner`.
                    function transferOwnership(address newOwner) public payable virtual onlyOwner {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(shl(96, newOwner)) {
                                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _setOwner(newOwner);
                    }
                    /// @dev Allows the owner to renounce their ownership.
                    function renounceOwnership() public payable virtual onlyOwner {
                        _setOwner(address(0));
                    }
                    /// @dev Request a two-step ownership handover to the caller.
                    /// The request will automatically expire in 48 hours (172800 seconds) by default.
                    function requestOwnershipHandover() public payable virtual {
                        unchecked {
                            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Compute and set the handover slot to `expires`.
                                mstore(0x0c, _HANDOVER_SLOT_SEED)
                                mstore(0x00, caller())
                                sstore(keccak256(0x0c, 0x20), expires)
                                // Emit the {OwnershipHandoverRequested} event.
                                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
                            }
                        }
                    }
                    /// @dev Cancels the two-step ownership handover to the caller, if any.
                    function cancelOwnershipHandover() public payable virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute and set the handover slot to 0.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, caller())
                            sstore(keccak256(0x0c, 0x20), 0)
                            // Emit the {OwnershipHandoverCanceled} event.
                            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
                        }
                    }
                    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
                    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
                    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute and set the handover slot to 0.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, pendingOwner)
                            let handoverSlot := keccak256(0x0c, 0x20)
                            // If the handover does not exist, or has expired.
                            if gt(timestamp(), sload(handoverSlot)) {
                                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                                revert(0x1c, 0x04)
                            }
                            // Set the handover slot to 0.
                            sstore(handoverSlot, 0)
                        }
                        _setOwner(pendingOwner);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                   PUBLIC READ FUNCTIONS                    */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the owner of the contract.
                    function owner() public view virtual returns (address result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            result := sload(_OWNER_SLOT)
                        }
                    }
                    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
                    function ownershipHandoverExpiresAt(address pendingOwner)
                        public
                        view
                        virtual
                        returns (uint256 result)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the handover slot.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, pendingOwner)
                            // Load the handover slot.
                            result := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         MODIFIERS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Marks a function as only callable by the owner.
                    modifier onlyOwner() virtual {
                        _checkOwner();
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../token/ERC20/IERC20.sol";
                import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
                /**
                 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
                 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
                 */
                interface IERC4626 is IERC20, IERC20Metadata {
                    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
                    event Withdraw(
                        address indexed sender,
                        address indexed receiver,
                        address indexed owner,
                        uint256 assets,
                        uint256 shares
                    );
                    /**
                     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
                     *
                     * - MUST be an ERC-20 token contract.
                     * - MUST NOT revert.
                     */
                    function asset() external view returns (address assetTokenAddress);
                    /**
                     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
                     *
                     * - SHOULD include any compounding that occurs from yield.
                     * - MUST be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT revert.
                     */
                    function totalAssets() external view returns (uint256 totalManagedAssets);
                    /**
                     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
                     * scenario where all the conditions are met.
                     *
                     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT show any variations depending on the caller.
                     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
                     * - MUST NOT revert.
                     *
                     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
                     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
                     * from.
                     */
                    function convertToShares(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
                     * scenario where all the conditions are met.
                     *
                     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT show any variations depending on the caller.
                     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
                     * - MUST NOT revert.
                     *
                     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
                     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
                     * from.
                     */
                    function convertToAssets(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
                     * through a deposit call.
                     *
                     * - MUST return a limited value if receiver is subject to some deposit limit.
                     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
                     * - MUST NOT revert.
                     */
                    function maxDeposit(address receiver) external view returns (uint256 maxAssets);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
                     * current on-chain conditions.
                     *
                     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
                     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
                     *   in the same transaction.
                     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
                     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
                     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
                     */
                    function previewDeposit(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
                     *
                     * - MUST emit the Deposit event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   deposit execution, and are accounted for during deposit.
                     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
                     *   approving enough underlying tokens to the Vault contract, etc).
                     *
                     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
                     */
                    function deposit(uint256 assets, address receiver) external returns (uint256 shares);
                    /**
                     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
                     * - MUST return a limited value if receiver is subject to some mint limit.
                     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
                     * - MUST NOT revert.
                     */
                    function maxMint(address receiver) external view returns (uint256 maxShares);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
                     * current on-chain conditions.
                     *
                     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
                     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
                     *   same transaction.
                     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
                     *   would be accepted, regardless if the user has enough tokens approved, etc.
                     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by minting.
                     */
                    function previewMint(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
                     *
                     * - MUST emit the Deposit event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
                     *   execution, and are accounted for during mint.
                     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
                     *   approving enough underlying tokens to the Vault contract, etc).
                     *
                     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
                     */
                    function mint(uint256 shares, address receiver) external returns (uint256 assets);
                    /**
                     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
                     * Vault, through a withdraw call.
                     *
                     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
                     * - MUST NOT revert.
                     */
                    function maxWithdraw(address owner) external view returns (uint256 maxAssets);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
                     * given current on-chain conditions.
                     *
                     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
                     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
                     *   called
                     *   in the same transaction.
                     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
                     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
                     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
                     */
                    function previewWithdraw(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
                     *
                     * - MUST emit the Withdraw event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   withdraw execution, and are accounted for during withdraw.
                     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
                     *   not having enough shares, etc).
                     *
                     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
                     * Those methods should be performed separately.
                     */
                    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
                    /**
                     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
                     * through a redeem call.
                     *
                     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
                     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
                     * - MUST NOT revert.
                     */
                    function maxRedeem(address owner) external view returns (uint256 maxShares);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
                     * given current on-chain conditions.
                     *
                     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
                     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
                     *   same transaction.
                     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
                     *   redemption would be accepted, regardless if the user has enough shares, etc.
                     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
                     */
                    function previewRedeem(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
                     *
                     * - MUST emit the Withdraw event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   redeem execution, and are accounted for during redeem.
                     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
                     *   not having enough shares, etc).
                     *
                     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
                     * Those methods should be performed separately.
                     */
                    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Interface of the ERC20 standard as defined in the EIP.
                 */
                interface IERC20 {
                    /**
                     * @dev Emitted when `value` tokens are moved from one account (`from`) to
                     * another (`to`).
                     *
                     * Note that `value` may be zero.
                     */
                    event Transfer(address indexed from, address indexed to, uint256 value);
                    /**
                     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
                     * a call to {approve}. `value` is the new allowance.
                     */
                    event Approval(address indexed owner, address indexed spender, uint256 value);
                    /**
                     * @dev Returns the value of tokens in existence.
                     */
                    function totalSupply() external view returns (uint256);
                    /**
                     * @dev Returns the value of tokens owned by `account`.
                     */
                    function balanceOf(address account) external view returns (uint256);
                    /**
                     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * Emits a {Transfer} event.
                     */
                    function transfer(address to, uint256 value) external returns (bool);
                    /**
                     * @dev Returns the remaining number of tokens that `spender` will be
                     * allowed to spend on behalf of `owner` through {transferFrom}. This is
                     * zero by default.
                     *
                     * This value changes when {approve} or {transferFrom} are called.
                     */
                    function allowance(address owner, address spender) external view returns (uint256);
                    /**
                     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
                     * caller's tokens.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * IMPORTANT: Beware that changing an allowance with this method brings the risk
                     * that someone may use both the old and the new allowance by unfortunate
                     * transaction ordering. One possible solution to mitigate this race
                     * condition is to first reduce the spender's allowance to 0 and set the
                     * desired value afterwards:
                     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                     *
                     * Emits an {Approval} event.
                     */
                    function approve(address spender, uint256 value) external returns (bool);
                    /**
                     * @dev Moves a `value` amount of tokens from `from` to `to` using the
                     * allowance mechanism. `value` is then deducted from the caller's
                     * allowance.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * Emits a {Transfer} event.
                     */
                    function transferFrom(address from, address to, uint256 value) external returns (bool);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./DelegationSupervisorLib.sol";
                import "../interfaces/IVault.sol";
                import "../interfaces/IVaultSupervisor.sol";
                import "../interfaces/Errors.sol";
                import "../interfaces/Events.sol";
                library Withdraw {
                    struct QueuedWithdrawal {
                        address staker;
                        address delegatedTo;
                        uint256 nonce;
                        uint256 start;
                        WithdrawRequest request;
                    }
                    struct WithdrawRequest {
                        IVault[] vaults;
                        uint256[] shares;
                        address withdrawer;
                    }
                    function finishStartedWithdrawal(
                        QueuedWithdrawal calldata withdrawal,
                        DelegationSupervisorLib.Storage storage delegationSupervisor
                    ) internal {
                        bytes32 withdrawalRoot = calculateWithdrawalRoot(withdrawal);
                        if (withdrawal.request.withdrawer != msg.sender) revert WithdrawerNotCaller();
                        if (withdrawal.start + delegationSupervisor.withdrawalDelay > block.timestamp) {
                            revert MinWithdrawDelayNotPassed();
                        }
                        if (!delegationSupervisor.pendingWithdrawals[withdrawalRoot]) revert WithdrawAlreadyCompleted();
                        delete delegationSupervisor.pendingWithdrawals[withdrawalRoot];
                        for (uint256 i = 0; i < withdrawal.request.vaults.length; i++) {
                            delegationSupervisor.vaultSupervisor.redeemShares(
                                msg.sender, withdrawal.request.vaults[i], withdrawal.request.shares[i]
                            );
                            emit FinishedWithdrawal(
                                address(withdrawal.request.vaults[i]),
                                withdrawal.staker,
                                withdrawal.delegatedTo,
                                withdrawal.request.withdrawer,
                                withdrawal.request.shares[i],
                                withdrawalRoot
                            );
                        }
                    }
                    function calculateWithdrawalRoot(QueuedWithdrawal memory withdrawal) internal pure returns (bytes32) {
                        return keccak256(abi.encode(withdrawal));
                    }
                    function validate(Withdraw.WithdrawRequest calldata withdrawalRequest) internal view {
                        // Length Checks
                        if (withdrawalRequest.shares.length == 0 || withdrawalRequest.vaults.length == 0) revert NoElementsInArray();
                        if (withdrawalRequest.shares.length != withdrawalRequest.vaults.length) revert ArrayLengthsNotEqual();
                        // ACL checks
                        if (withdrawalRequest.withdrawer != msg.sender) revert NotStaker();
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
                 *
                 * These functions can be used to verify that a message was signed by the holder
                 * of the private keys of a given address.
                 */
                library ECDSA {
                    enum RecoverError {
                        NoError,
                        InvalidSignature,
                        InvalidSignatureLength,
                        InvalidSignatureS
                    }
                    /**
                     * @dev The signature derives the `address(0)`.
                     */
                    error ECDSAInvalidSignature();
                    /**
                     * @dev The signature has an invalid length.
                     */
                    error ECDSAInvalidSignatureLength(uint256 length);
                    /**
                     * @dev The signature has an S value that is in the upper half order.
                     */
                    error ECDSAInvalidSignatureS(bytes32 s);
                    /**
                     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
                     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
                     * and a bytes32 providing additional information about the error.
                     *
                     * If no error is returned, then the address can be used for verification purposes.
                     *
                     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
                     * this function rejects them by requiring the `s` value to be in the lower
                     * half order, and the `v` value to be either 27 or 28.
                     *
                     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
                     * verification to be secure: it is possible to craft signatures that
                     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
                     * this is by receiving a hash of the original message (which may otherwise
                     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
                     *
                     * Documentation for signature generation:
                     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
                     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
                     */
                    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
                        if (signature.length == 65) {
                            bytes32 r;
                            bytes32 s;
                            uint8 v;
                            // ecrecover takes the signature parameters, and the only way to get them
                            // currently is to use assembly.
                            /// @solidity memory-safe-assembly
                            assembly {
                                r := mload(add(signature, 0x20))
                                s := mload(add(signature, 0x40))
                                v := byte(0, mload(add(signature, 0x60)))
                            }
                            return tryRecover(hash, v, r, s);
                        } else {
                            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
                        }
                    }
                    /**
                     * @dev Returns the address that signed a hashed message (`hash`) with
                     * `signature`. This address can then be used for verification purposes.
                     *
                     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
                     * this function rejects them by requiring the `s` value to be in the lower
                     * half order, and the `v` value to be either 27 or 28.
                     *
                     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
                     * verification to be secure: it is possible to craft signatures that
                     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
                     * this is by receiving a hash of the original message (which may otherwise
                     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
                     */
                    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
                        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
                        _throwError(error, errorArg);
                        return recovered;
                    }
                    /**
                     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
                     *
                     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
                     */
                    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
                        unchecked {
                            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
                            // We do not check for an overflow here since the shift operation results in 0 or 1.
                            uint8 v = uint8((uint256(vs) >> 255) + 27);
                            return tryRecover(hash, v, r, s);
                        }
                    }
                    /**
                     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
                     */
                    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
                        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
                        _throwError(error, errorArg);
                        return recovered;
                    }
                    /**
                     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
                     * `r` and `s` signature fields separately.
                     */
                    function tryRecover(
                        bytes32 hash,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) internal pure returns (address, RecoverError, bytes32) {
                        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
                        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
                        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
                        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
                        //
                        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
                        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
                        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
                        // these malleable signatures as well.
                        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
                            return (address(0), RecoverError.InvalidSignatureS, s);
                        }
                        // If the signature is valid (and not malleable), return the signer address
                        address signer = ecrecover(hash, v, r, s);
                        if (signer == address(0)) {
                            return (address(0), RecoverError.InvalidSignature, bytes32(0));
                        }
                        return (signer, RecoverError.NoError, bytes32(0));
                    }
                    /**
                     * @dev Overload of {ECDSA-recover} that receives the `v`,
                     * `r` and `s` signature fields separately.
                     */
                    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
                        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
                        _throwError(error, errorArg);
                        return recovered;
                    }
                    /**
                     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
                     */
                    function _throwError(RecoverError error, bytes32 errorArg) private pure {
                        if (error == RecoverError.NoError) {
                            return; // no error: do nothing
                        } else if (error == RecoverError.InvalidSignature) {
                            revert ECDSAInvalidSignature();
                        } else if (error == RecoverError.InvalidSignatureLength) {
                            revert ECDSAInvalidSignatureLength(uint256(errorArg));
                        } else if (error == RecoverError.InvalidSignatureS) {
                            revert ECDSAInvalidSignatureS(errorArg);
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../token/ERC20/IERC20.sol";
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Collection of functions related to the address type
                 */
                library Address {
                    /**
                     * @dev The ETH balance of the account is not enough to perform the operation.
                     */
                    error AddressInsufficientBalance(address account);
                    /**
                     * @dev There's no code at `target` (it is not a contract).
                     */
                    error AddressEmptyCode(address target);
                    /**
                     * @dev A call to an address target failed. The target may have reverted.
                     */
                    error FailedInnerCall();
                    /**
                     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                     * `recipient`, forwarding all available gas and reverting on errors.
                     *
                     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                     * of certain opcodes, possibly making contracts go over the 2300 gas limit
                     * imposed by `transfer`, making them unable to receive funds via
                     * `transfer`. {sendValue} removes this limitation.
                     *
                     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                     *
                     * IMPORTANT: because control is transferred to `recipient`, care must be
                     * taken to not create reentrancy vulnerabilities. Consider using
                     * {ReentrancyGuard} or the
                     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                     */
                    function sendValue(address payable recipient, uint256 amount) internal {
                        if (address(this).balance < amount) {
                            revert AddressInsufficientBalance(address(this));
                        }
                        (bool success, ) = recipient.call{value: amount}("");
                        if (!success) {
                            revert FailedInnerCall();
                        }
                    }
                    /**
                     * @dev Performs a Solidity function call using a low level `call`. A
                     * plain `call` is an unsafe replacement for a function call: use this
                     * function instead.
                     *
                     * If `target` reverts with a revert reason or custom error, it is bubbled
                     * up by this function (like regular Solidity function calls). However, if
                     * the call reverted with no returned reason, this function reverts with a
                     * {FailedInnerCall} error.
                     *
                     * Returns the raw returned data. To convert to the expected return value,
                     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
                     *
                     * Requirements:
                     *
                     * - `target` must be a contract.
                     * - calling `target` with `data` must not revert.
                     */
                    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
                        return functionCallWithValue(target, data, 0);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but also transferring `value` wei to `target`.
                     *
                     * Requirements:
                     *
                     * - the calling contract must have an ETH balance of at least `value`.
                     * - the called Solidity function must be `payable`.
                     */
                    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
                        if (address(this).balance < value) {
                            revert AddressInsufficientBalance(address(this));
                        }
                        (bool success, bytes memory returndata) = target.call{value: value}(data);
                        return verifyCallResultFromTarget(target, success, returndata);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but performing a static call.
                     */
                    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
                        (bool success, bytes memory returndata) = target.staticcall(data);
                        return verifyCallResultFromTarget(target, success, returndata);
                    }
                    /**
                     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                     * but performing a delegate call.
                     */
                    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
                        (bool success, bytes memory returndata) = target.delegatecall(data);
                        return verifyCallResultFromTarget(target, success, returndata);
                    }
                    /**
                     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
                     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
                     * unsuccessful call.
                     */
                    function verifyCallResultFromTarget(
                        address target,
                        bool success,
                        bytes memory returndata
                    ) internal view returns (bytes memory) {
                        if (!success) {
                            _revert(returndata);
                        } else {
                            // only check if target is a contract if the call was successful and the return data is empty
                            // otherwise we already know that it was a contract
                            if (returndata.length == 0 && target.code.length == 0) {
                                revert AddressEmptyCode(target);
                            }
                            return returndata;
                        }
                    }
                    /**
                     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
                     * revert reason or with a default {FailedInnerCall} error.
                     */
                    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
                        if (!success) {
                            _revert(returndata);
                        } else {
                            return returndata;
                        }
                    }
                    /**
                     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
                     */
                    function _revert(bytes memory returndata) private pure {
                        // Look for revert reason and bubble it up if present
                        if (returndata.length > 0) {
                            // The easiest way to bubble the revert reason is using memory via assembly
                            /// @solidity memory-safe-assembly
                            assembly {
                                let returndata_size := mload(returndata)
                                revert(add(32, returndata), returndata_size)
                            }
                        } else {
                            revert FailedInnerCall();
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
                // This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
                pragma solidity ^0.8.20;
                /**
                 * @dev Library for reading and writing primitive types to specific storage slots.
                 *
                 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
                 * This library helps with reading and writing to such slots without the need for inline assembly.
                 *
                 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
                 *
                 * Example usage to set ERC1967 implementation slot:
                 * ```solidity
                 * contract ERC1967 {
                 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
                 *
                 *     function _getImplementation() internal view returns (address) {
                 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
                 *     }
                 *
                 *     function _setImplementation(address newImplementation) internal {
                 *         require(newImplementation.code.length > 0);
                 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
                 *     }
                 * }
                 * ```
                 */
                library StorageSlot {
                    struct AddressSlot {
                        address value;
                    }
                    struct BooleanSlot {
                        bool value;
                    }
                    struct Bytes32Slot {
                        bytes32 value;
                    }
                    struct Uint256Slot {
                        uint256 value;
                    }
                    struct StringSlot {
                        string value;
                    }
                    struct BytesSlot {
                        bytes value;
                    }
                    /**
                     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
                     */
                    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
                     */
                    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
                     */
                    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
                     */
                    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `StringSlot` with member `value` located at `slot`.
                     */
                    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
                     */
                    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := store.slot
                        }
                    }
                    /**
                     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
                     */
                    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := slot
                        }
                    }
                    /**
                     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
                     */
                    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r.slot := store.slot
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
                pragma solidity ^0.8.20;
                import {Math} from "./math/Math.sol";
                import {SignedMath} from "./math/SignedMath.sol";
                /**
                 * @dev String operations.
                 */
                library Strings {
                    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
                    uint8 private constant ADDRESS_LENGTH = 20;
                    /**
                     * @dev The `value` string doesn't fit in the specified `length`.
                     */
                    error StringsInsufficientHexLength(uint256 value, uint256 length);
                    /**
                     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
                     */
                    function toString(uint256 value) internal pure returns (string memory) {
                        unchecked {
                            uint256 length = Math.log10(value) + 1;
                            string memory buffer = new string(length);
                            uint256 ptr;
                            /// @solidity memory-safe-assembly
                            assembly {
                                ptr := add(buffer, add(32, length))
                            }
                            while (true) {
                                ptr--;
                                /// @solidity memory-safe-assembly
                                assembly {
                                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                                }
                                value /= 10;
                                if (value == 0) break;
                            }
                            return buffer;
                        }
                    }
                    /**
                     * @dev Converts a `int256` to its ASCII `string` decimal representation.
                     */
                    function toStringSigned(int256 value) internal pure returns (string memory) {
                        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
                    }
                    /**
                     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
                     */
                    function toHexString(uint256 value) internal pure returns (string memory) {
                        unchecked {
                            return toHexString(value, Math.log256(value) + 1);
                        }
                    }
                    /**
                     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
                     */
                    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
                        uint256 localValue = value;
                        bytes memory buffer = new bytes(2 * length + 2);
                        buffer[0] = "0";
                        buffer[1] = "x";
                        for (uint256 i = 2 * length + 1; i > 1; --i) {
                            buffer[i] = HEX_DIGITS[localValue & 0xf];
                            localValue >>= 4;
                        }
                        if (localValue != 0) {
                            revert StringsInsufficientHexLength(value, length);
                        }
                        return string(buffer);
                    }
                    /**
                     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
                     * representation.
                     */
                    function toHexString(address addr) internal pure returns (string memory) {
                        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
                    }
                    /**
                     * @dev Returns true if the two strings are equal.
                     */
                    function equal(string memory a, string memory b) internal pure returns (bool) {
                        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../IERC20.sol";
                /**
                 * @dev Interface for the optional metadata functions from the ERC20 standard.
                 */
                interface IERC20Metadata is IERC20 {
                    /**
                     * @dev Returns the name of the token.
                     */
                    function name() external view returns (string memory);
                    /**
                     * @dev Returns the symbol of the token.
                     */
                    function symbol() external view returns (string memory);
                    /**
                     * @dev Returns the decimals places of the token.
                     */
                    function decimals() external view returns (uint8);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {Staker} from "./Staker.sol";
                import {IVault} from "../interfaces/IVault.sol";
                import {IVaultSupervisor} from "../interfaces/IVaultSupervisor.sol";
                import "../interfaces/Errors.sol";
                import "../interfaces/Constants.sol";
                library DelegationSupervisorLib {
                    /// @custom:storage-location erc7201:delegationsupervisor.storage
                    struct Storage {
                        mapping(bytes32 => bool) pendingWithdrawals;
                        mapping(address => mapping(bytes32 => bool)) delegationApproverSaltIsSpent;
                        mapping(address staker => Staker.StakerState state) stakers;
                        uint256 withdrawalDelay;
                        IVaultSupervisor vaultSupervisor;
                    }
                    function initOrUpdate(Storage storage self, address vaultSupervisor, uint256 withdrawDelay) internal {
                        if (withdrawDelay > Constants.MAX_WITHDRAWAL_DELAY) revert InvalidWithdrawalDelay();
                        self.withdrawalDelay = withdrawDelay;
                        self.vaultSupervisor = IVaultSupervisor(vaultSupervisor);
                    }
                    function updateMinWithdrawDelay(Storage storage self, uint256 withdrawDelay) internal {
                        if (withdrawDelay > Constants.MAX_WITHDRAWAL_DELAY) revert InvalidWithdrawalDelay();
                        self.withdrawalDelay = withdrawDelay;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Standard math utilities missing in the Solidity language.
                 */
                library Math {
                    /**
                     * @dev Muldiv operation overflow.
                     */
                    error MathOverflowedMulDiv();
                    enum Rounding {
                        Floor, // Toward negative infinity
                        Ceil, // Toward positive infinity
                        Trunc, // Toward zero
                        Expand // Away from zero
                    }
                    /**
                     * @dev Returns the addition of two unsigned integers, with an overflow flag.
                     */
                    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            uint256 c = a + b;
                            if (c < a) return (false, 0);
                            return (true, c);
                        }
                    }
                    /**
                     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
                     */
                    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            if (b > a) return (false, 0);
                            return (true, a - b);
                        }
                    }
                    /**
                     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
                     */
                    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
                            // benefit is lost if 'b' is also tested.
                            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
                            if (a == 0) return (true, 0);
                            uint256 c = a * b;
                            if (c / a != b) return (false, 0);
                            return (true, c);
                        }
                    }
                    /**
                     * @dev Returns the division of two unsigned integers, with a division by zero flag.
                     */
                    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            if (b == 0) return (false, 0);
                            return (true, a / b);
                        }
                    }
                    /**
                     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
                     */
                    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                        unchecked {
                            if (b == 0) return (false, 0);
                            return (true, a % b);
                        }
                    }
                    /**
                     * @dev Returns the largest of two numbers.
                     */
                    function max(uint256 a, uint256 b) internal pure returns (uint256) {
                        return a > b ? a : b;
                    }
                    /**
                     * @dev Returns the smallest of two numbers.
                     */
                    function min(uint256 a, uint256 b) internal pure returns (uint256) {
                        return a < b ? a : b;
                    }
                    /**
                     * @dev Returns the average of two numbers. The result is rounded towards
                     * zero.
                     */
                    function average(uint256 a, uint256 b) internal pure returns (uint256) {
                        // (a + b) / 2 can overflow.
                        return (a & b) + (a ^ b) / 2;
                    }
                    /**
                     * @dev Returns the ceiling of the division of two numbers.
                     *
                     * This differs from standard division with `/` in that it rounds towards infinity instead
                     * of rounding towards zero.
                     */
                    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
                        if (b == 0) {
                            // Guarantee the same behavior as in a regular Solidity division.
                            return a / b;
                        }
                        // (a + b - 1) / b can overflow on addition, so we distribute.
                        return a == 0 ? 0 : (a - 1) / b + 1;
                    }
                    /**
                     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
                     * denominator == 0.
                     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
                     * Uniswap Labs also under MIT license.
                     */
                    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
                        unchecked {
                            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
                            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
                            // variables such that product = prod1 * 2^256 + prod0.
                            uint256 prod0 = x * y; // Least significant 256 bits of the product
                            uint256 prod1; // Most significant 256 bits of the product
                            assembly {
                                let mm := mulmod(x, y, not(0))
                                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
                            }
                            // Handle non-overflow cases, 256 by 256 division.
                            if (prod1 == 0) {
                                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                                // The surrounding unchecked block does not change this fact.
                                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                                return prod0 / denominator;
                            }
                            // Make sure the result is less than 2^256. Also prevents denominator == 0.
                            if (denominator <= prod1) {
                                revert MathOverflowedMulDiv();
                            }
                            ///////////////////////////////////////////////
                            // 512 by 256 division.
                            ///////////////////////////////////////////////
                            // Make division exact by subtracting the remainder from [prod1 prod0].
                            uint256 remainder;
                            assembly {
                                // Compute remainder using mulmod.
                                remainder := mulmod(x, y, denominator)
                                // Subtract 256 bit number from 512 bit number.
                                prod1 := sub(prod1, gt(remainder, prod0))
                                prod0 := sub(prod0, remainder)
                            }
                            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
                            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
                            uint256 twos = denominator & (0 - denominator);
                            assembly {
                                // Divide denominator by twos.
                                denominator := div(denominator, twos)
                                // Divide [prod1 prod0] by twos.
                                prod0 := div(prod0, twos)
                                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                                twos := add(div(sub(0, twos), twos), 1)
                            }
                            // Shift in bits from prod1 into prod0.
                            prod0 |= prod1 * twos;
                            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
                            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
                            // four bits. That is, denominator * inv = 1 mod 2^4.
                            uint256 inverse = (3 * denominator) ^ 2;
                            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
                            // works in modular arithmetic, doubling the correct bits in each step.
                            inverse *= 2 - denominator * inverse; // inverse mod 2^8
                            inverse *= 2 - denominator * inverse; // inverse mod 2^16
                            inverse *= 2 - denominator * inverse; // inverse mod 2^32
                            inverse *= 2 - denominator * inverse; // inverse mod 2^64
                            inverse *= 2 - denominator * inverse; // inverse mod 2^128
                            inverse *= 2 - denominator * inverse; // inverse mod 2^256
                            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
                            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
                            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
                            // is no longer required.
                            result = prod0 * inverse;
                            return result;
                        }
                    }
                    /**
                     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
                     */
                    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
                        uint256 result = mulDiv(x, y, denominator);
                        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
                            result += 1;
                        }
                        return result;
                    }
                    /**
                     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
                     * towards zero.
                     *
                     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
                     */
                    function sqrt(uint256 a) internal pure returns (uint256) {
                        if (a == 0) {
                            return 0;
                        }
                        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
                        //
                        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
                        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
                        //
                        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
                        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
                        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
                        //
                        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
                        uint256 result = 1 << (log2(a) >> 1);
                        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
                        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
                        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
                        // into the expected uint128 result.
                        unchecked {
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            result = (result + a / result) >> 1;
                            return min(result, a / result);
                        }
                    }
                    /**
                     * @notice Calculates sqrt(a), following the selected rounding direction.
                     */
                    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = sqrt(a);
                            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Return the log in base 2 of a positive value rounded towards zero.
                     * Returns 0 if given 0.
                     */
                    function log2(uint256 value) internal pure returns (uint256) {
                        uint256 result = 0;
                        unchecked {
                            if (value >> 128 > 0) {
                                value >>= 128;
                                result += 128;
                            }
                            if (value >> 64 > 0) {
                                value >>= 64;
                                result += 64;
                            }
                            if (value >> 32 > 0) {
                                value >>= 32;
                                result += 32;
                            }
                            if (value >> 16 > 0) {
                                value >>= 16;
                                result += 16;
                            }
                            if (value >> 8 > 0) {
                                value >>= 8;
                                result += 8;
                            }
                            if (value >> 4 > 0) {
                                value >>= 4;
                                result += 4;
                            }
                            if (value >> 2 > 0) {
                                value >>= 2;
                                result += 2;
                            }
                            if (value >> 1 > 0) {
                                result += 1;
                            }
                        }
                        return result;
                    }
                    /**
                     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
                     * Returns 0 if given 0.
                     */
                    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = log2(value);
                            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Return the log in base 10 of a positive value rounded towards zero.
                     * Returns 0 if given 0.
                     */
                    function log10(uint256 value) internal pure returns (uint256) {
                        uint256 result = 0;
                        unchecked {
                            if (value >= 10 ** 64) {
                                value /= 10 ** 64;
                                result += 64;
                            }
                            if (value >= 10 ** 32) {
                                value /= 10 ** 32;
                                result += 32;
                            }
                            if (value >= 10 ** 16) {
                                value /= 10 ** 16;
                                result += 16;
                            }
                            if (value >= 10 ** 8) {
                                value /= 10 ** 8;
                                result += 8;
                            }
                            if (value >= 10 ** 4) {
                                value /= 10 ** 4;
                                result += 4;
                            }
                            if (value >= 10 ** 2) {
                                value /= 10 ** 2;
                                result += 2;
                            }
                            if (value >= 10 ** 1) {
                                result += 1;
                            }
                        }
                        return result;
                    }
                    /**
                     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
                     * Returns 0 if given 0.
                     */
                    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = log10(value);
                            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Return the log in base 256 of a positive value rounded towards zero.
                     * Returns 0 if given 0.
                     *
                     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
                     */
                    function log256(uint256 value) internal pure returns (uint256) {
                        uint256 result = 0;
                        unchecked {
                            if (value >> 128 > 0) {
                                value >>= 128;
                                result += 16;
                            }
                            if (value >> 64 > 0) {
                                value >>= 64;
                                result += 8;
                            }
                            if (value >> 32 > 0) {
                                value >>= 32;
                                result += 4;
                            }
                            if (value >> 16 > 0) {
                                value >>= 16;
                                result += 2;
                            }
                            if (value >> 8 > 0) {
                                result += 1;
                            }
                        }
                        return result;
                    }
                    /**
                     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
                     * Returns 0 if given 0.
                     */
                    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
                        unchecked {
                            uint256 result = log256(value);
                            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
                        }
                    }
                    /**
                     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
                     */
                    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
                        return uint8(rounding) % 2 == 1;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Standard signed math utilities missing in the Solidity language.
                 */
                library SignedMath {
                    /**
                     * @dev Returns the largest of two signed numbers.
                     */
                    function max(int256 a, int256 b) internal pure returns (int256) {
                        return a > b ? a : b;
                    }
                    /**
                     * @dev Returns the smallest of two signed numbers.
                     */
                    function min(int256 a, int256 b) internal pure returns (int256) {
                        return a < b ? a : b;
                    }
                    /**
                     * @dev Returns the average of two signed numbers without overflow.
                     * The result is rounded towards zero.
                     */
                    function average(int256 a, int256 b) internal pure returns (int256) {
                        // Formula from the book "Hacker's Delight"
                        int256 x = (a & b) + ((a ^ b) >> 1);
                        return x + (int256(uint256(x) >> 255) & (a ^ b));
                    }
                    /**
                     * @dev Returns the absolute unsigned value of a signed value.
                     */
                    function abs(int256 n) internal pure returns (uint256) {
                        unchecked {
                            // must be unchecked in order to support `n = type(int256).min`
                            return uint256(n >= 0 ? n : -n);
                        }
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./Withdraw.sol";
                library Staker {
                    struct StakerState {
                        address delegatee; // staker this staker is delegating to
                        uint256 nonce;
                        uint256 totalWithdrawsQueued;
                        Withdraw.QueuedWithdrawal[] queuedWithdrawals;
                    }
                }
                

                File 5 of 5: Vault
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {ERC4626} from "solady/src/tokens/ERC4626.sol";
                import {Ownable} from "solady/src/auth/Ownable.sol";
                import {ReentrancyGuard} from "solady/src/utils/ReentrancyGuard.sol";
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import {PausableUpgradeable} from "@openzeppelin-upgradeable/utils/PausableUpgradeable.sol";
                import {Initializable} from "@openzeppelin-upgradeable/proxy/utils/Initializable.sol";
                import "./interfaces/Errors.sol";
                import "./interfaces/IVault.sol";
                contract Vault is ERC4626, Initializable, Ownable, PausableUpgradeable, ReentrancyGuard {
                    IERC20 public depositToken;
                    uint256 public assetLimit;
                    IVault.AssetType public assetType;
                    uint8 private _decimals;
                    string private nameStr;
                    string private symbolStr;
                    uint256[44] private __gap;
                    /* ========== MUTATIVE FUNCTIONS ========== */
                    constructor() {
                        _disableInitializers();
                    }
                    function initialize(
                        address _owner,
                        IERC20 _depositToken,
                        string memory _name,
                        string memory _symbol,
                        IVault.AssetType _assetType
                    ) external initializer {
                        if (_assetType == IVault.AssetType.NONE) revert TokenNotEnabled();
                        _initializeOwner(_owner);
                        __Pausable_init();
                        depositToken = _depositToken;
                        nameStr = _name;
                        symbolStr = _symbol;
                        (bool success, uint8 result) = _tryGetAssetDecimals(address(_depositToken));
                        _decimals = success ? result : _DEFAULT_UNDERLYING_DECIMALS;
                        assetType = _assetType;
                    }
                    function _underlyingDecimals() internal view override returns (uint8) {
                        return _decimals;
                    }
                    /**
                     * @notice ERC4626 `_deposit` implementation calls `maxDeposit` which checks the asset limit
                     */
                    function deposit(uint256 assets, address depositor)
                        public
                        override
                        onlyOwner
                        whenNotPaused
                        nonReentrant
                        returns (uint256 shares)
                    {
                        if (assets == 0) revert ZeroAmount();
                        if (assets > maxDeposit(depositor)) revert DepositMoreThanMax();
                        shares = previewDeposit(assets);
                        // by: the user
                        // to: the vaultSupervisor
                        _deposit({by: depositor, to: msg.sender, assets: assets, shares: shares});
                    }
                    function mint(uint256 shares, address to)
                        public
                        override
                        onlyOwner
                        whenNotPaused
                        nonReentrant
                        returns (uint256 assets)
                    {
                        return super.mint(shares, to);
                    }
                    function withdraw(uint256 assets, address to, address owner)
                        public
                        override
                        onlyOwner
                        whenNotPaused
                        nonReentrant
                        returns (uint256 shares)
                    {
                        if (assets == 0) revert ZeroAmount();
                        return super.withdraw(assets, to, owner);
                    }
                    function redeem(uint256 shares, address to, address owner)
                        public
                        override
                        onlyOwner
                        nonReentrant
                        whenNotPaused
                        returns (uint256 assets)
                    {
                        if (shares == 0) revert ZeroAmount();
                        return super.redeem(shares, to, owner);
                    }
                    function setLimit(uint256 newLimit) external onlySupervisor {
                        assetLimit = newLimit;
                    }
                    function pause(bool toPause) external onlySupervisor {
                        if (toPause) _pause();
                        else _unpause();
                    }
                    /* ========== VIEWS ========== */
                    function maxDeposit(address to) public view override returns (uint256 maxAssets) {
                        to = to; // Silence unused variable warning.
                        maxAssets = assetLimit <= totalAssets() ? 0 : assetLimit - totalAssets();
                    }
                    function name() public view override returns (string memory) {
                        return nameStr;
                    }
                    function symbol() public view override returns (string memory) {
                        return symbolStr;
                    }
                    function asset() public view override returns (address) {
                        return address(depositToken);
                    }
                    /* ========== MODIFIERS ========== */
                    modifier onlySupervisor() {
                        _checkOwner();
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                import {ERC20} from "./ERC20.sol";
                import {FixedPointMathLib} from "../utils/FixedPointMathLib.sol";
                import {SafeTransferLib} from "../utils/SafeTransferLib.sol";
                /// @notice Simple ERC4626 tokenized Vault implementation.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC4626.sol)
                /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)
                /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC4626.sol)
                abstract contract ERC4626 is ERC20 {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         CONSTANTS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The default underlying decimals.
                    uint8 internal constant _DEFAULT_UNDERLYING_DECIMALS = 18;
                    /// @dev The default decimals offset.
                    uint8 internal constant _DEFAULT_DECIMALS_OFFSET = 0;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Cannot deposit more than the max limit.
                    error DepositMoreThanMax();
                    /// @dev Cannot mint more than the max limit.
                    error MintMoreThanMax();
                    /// @dev Cannot withdraw more than the max limit.
                    error WithdrawMoreThanMax();
                    /// @dev Cannot redeem more than the max limit.
                    error RedeemMoreThanMax();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Emitted during a mint call or deposit call.
                    event Deposit(address indexed by, address indexed owner, uint256 assets, uint256 shares);
                    /// @dev Emitted during a withdraw call or redeem call.
                    event Withdraw(
                        address indexed by,
                        address indexed to,
                        address indexed owner,
                        uint256 assets,
                        uint256 shares
                    );
                    /// @dev `keccak256(bytes("Deposit(address,address,uint256,uint256)"))`.
                    uint256 private constant _DEPOSIT_EVENT_SIGNATURE =
                        0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7;
                    /// @dev `keccak256(bytes("Withdraw(address,address,address,uint256,uint256)"))`.
                    uint256 private constant _WITHDRAW_EVENT_SIGNATURE =
                        0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     ERC4626 CONSTANTS                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev To be overridden to return the address of the underlying asset.
                    ///
                    /// - MUST be an ERC20 token contract.
                    /// - MUST NOT revert.
                    function asset() public view virtual returns (address);
                    /// @dev To be overridden to return the number of decimals of the underlying asset.
                    /// Default: 18.
                    ///
                    /// - MUST NOT revert.
                    function _underlyingDecimals() internal view virtual returns (uint8) {
                        return _DEFAULT_UNDERLYING_DECIMALS;
                    }
                    /// @dev Override to return a non-zero value to make the inflation attack even more unfeasible.
                    /// Only used when {_useVirtualShares} returns true.
                    /// Default: 0.
                    ///
                    /// - MUST NOT revert.
                    function _decimalsOffset() internal view virtual returns (uint8) {
                        return _DEFAULT_DECIMALS_OFFSET;
                    }
                    /// @dev Returns whether virtual shares will be used to mitigate the inflation attack.
                    /// See: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3706
                    /// Override to return true or false.
                    /// Default: true.
                    ///
                    /// - MUST NOT revert.
                    function _useVirtualShares() internal view virtual returns (bool) {
                        return true;
                    }
                    /// @dev Returns the decimals places of the token.
                    ///
                    /// - MUST NOT revert.
                    function decimals() public view virtual override(ERC20) returns (uint8) {
                        if (!_useVirtualShares()) return _underlyingDecimals();
                        return _underlyingDecimals() + _decimalsOffset();
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                ASSET DECIMALS GETTER HELPER                */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Helper function to get the decimals of the underlying asset.
                    /// Useful for setting the return value of `_underlyingDecimals` during initialization.
                    /// If the retrieval succeeds, `success` will be true, and `result` will hold the result.
                    /// Otherwise, `success` will be false, and `result` will be zero.
                    ///
                    /// Example usage:
                    /// ```
                    /// (bool success, uint8 result) = _tryGetAssetDecimals(underlying);
                    /// _decimals = success ? result : _DEFAULT_UNDERLYING_DECIMALS;
                    /// ```
                    function _tryGetAssetDecimals(address underlying)
                        internal
                        view
                        returns (bool success, uint8 result)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Store the function selector of `decimals()`.
                            mstore(0x00, 0x313ce567)
                            // Arguments are evaluated last to first.
                            success :=
                                and(
                                    // Returned value is less than 256, at left-padded to 32 bytes.
                                    and(lt(mload(0x00), 0x100), gt(returndatasize(), 0x1f)),
                                    // The staticcall succeeds.
                                    staticcall(gas(), underlying, 0x1c, 0x04, 0x00, 0x20)
                                )
                            result := mul(mload(0x00), success)
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      ACCOUNTING LOGIC                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the total amount of the underlying asset managed by the Vault.
                    ///
                    /// - SHOULD include any compounding that occurs from the yield.
                    /// - MUST be inclusive of any fees that are charged against assets in the Vault.
                    /// - MUST NOT revert.
                    function totalAssets() public view virtual returns (uint256 assets) {
                        assets = SafeTransferLib.balanceOf(asset(), address(this));
                    }
                    /// @dev Returns the amount of shares that the Vault will exchange for the amount of
                    /// assets provided, in an ideal scenario where all conditions are met.
                    ///
                    /// - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                    /// - MUST NOT show any variations depending on the caller.
                    /// - MUST NOT reflect slippage or other on-chain conditions, during the actual exchange.
                    /// - MUST NOT revert.
                    ///
                    /// Note: This calculation MAY NOT reflect the "per-user" price-per-share, and instead
                    /// should reflect the "average-user's" price-per-share, i.e. what the average user should
                    /// expect to see when exchanging to and from.
                    function convertToShares(uint256 assets) public view virtual returns (uint256 shares) {
                        if (!_useVirtualShares()) {
                            uint256 supply = totalSupply();
                            return _eitherIsZero(assets, supply)
                                ? _initialConvertToShares(assets)
                                : FixedPointMathLib.fullMulDiv(assets, supply, totalAssets());
                        }
                        uint256 o = _decimalsOffset();
                        if (o == 0) {
                            return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 1, _inc(totalAssets()));
                        }
                        return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
                    }
                    /// @dev Returns the amount of assets that the Vault will exchange for the amount of
                    /// shares provided, in an ideal scenario where all conditions are met.
                    ///
                    /// - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                    /// - MUST NOT show any variations depending on the caller.
                    /// - MUST NOT reflect slippage or other on-chain conditions, during the actual exchange.
                    /// - MUST NOT revert.
                    ///
                    /// Note: This calculation MAY NOT reflect the "per-user" price-per-share, and instead
                    /// should reflect the "average-user's" price-per-share, i.e. what the average user should
                    /// expect to see when exchanging to and from.
                    function convertToAssets(uint256 shares) public view virtual returns (uint256 assets) {
                        if (!_useVirtualShares()) {
                            uint256 supply = totalSupply();
                            return supply == 0
                                ? _initialConvertToAssets(shares)
                                : FixedPointMathLib.fullMulDiv(shares, totalAssets(), supply);
                        }
                        uint256 o = _decimalsOffset();
                        if (o == 0) {
                            return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, _inc(totalSupply()));
                        }
                        return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, totalSupply() + 10 ** o);
                    }
                    /// @dev Allows an on-chain or off-chain user to simulate the effects of their deposit
                    /// at the current block, given current on-chain conditions.
                    ///
                    /// - MUST return as close to and no more than the exact amount of Vault shares that
                    ///   will be minted in a deposit call in the same transaction, i.e. deposit should
                    ///   return the same or more shares as `previewDeposit` if call in the same transaction.
                    /// - MUST NOT account for deposit limits like those returned from `maxDeposit` and should
                    ///   always act as if the deposit will be accepted, regardless of approvals, etc.
                    /// - MUST be inclusive of deposit fees. Integrators should be aware of this.
                    /// - MUST not revert.
                    ///
                    /// Note: Any unfavorable discrepancy between `convertToShares` and `previewDeposit` SHOULD
                    /// be considered slippage in share price or some other type of condition, meaning
                    /// the depositor will lose assets by depositing.
                    function previewDeposit(uint256 assets) public view virtual returns (uint256 shares) {
                        shares = convertToShares(assets);
                    }
                    /// @dev Allows an on-chain or off-chain user to simulate the effects of their mint
                    /// at the current block, given current on-chain conditions.
                    ///
                    /// - MUST return as close to and no fewer than the exact amount of assets that
                    ///   will be deposited in a mint call in the same transaction, i.e. mint should
                    ///   return the same or fewer assets as `previewMint` if called in the same transaction.
                    /// - MUST NOT account for mint limits like those returned from `maxMint` and should
                    ///   always act as if the mint will be accepted, regardless of approvals, etc.
                    /// - MUST be inclusive of deposit fees. Integrators should be aware of this.
                    /// - MUST not revert.
                    ///
                    /// Note: Any unfavorable discrepancy between `convertToAssets` and `previewMint` SHOULD
                    /// be considered slippage in share price or some other type of condition,
                    /// meaning the depositor will lose assets by minting.
                    function previewMint(uint256 shares) public view virtual returns (uint256 assets) {
                        if (!_useVirtualShares()) {
                            uint256 supply = totalSupply();
                            return supply == 0
                                ? _initialConvertToAssets(shares)
                                : FixedPointMathLib.fullMulDivUp(shares, totalAssets(), supply);
                        }
                        uint256 o = _decimalsOffset();
                        if (o == 0) {
                            return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, _inc(totalSupply()));
                        }
                        return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, totalSupply() + 10 ** o);
                    }
                    /// @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal
                    /// at the current block, given the current on-chain conditions.
                    ///
                    /// - MUST return as close to and no fewer than the exact amount of Vault shares that
                    ///   will be burned in a withdraw call in the same transaction, i.e. withdraw should
                    ///   return the same or fewer shares as `previewWithdraw` if call in the same transaction.
                    /// - MUST NOT account for withdrawal limits like those returned from `maxWithdraw` and should
                    ///   always act as if the withdrawal will be accepted, regardless of share balance, etc.
                    /// - MUST be inclusive of withdrawal fees. Integrators should be aware of this.
                    /// - MUST not revert.
                    ///
                    /// Note: Any unfavorable discrepancy between `convertToShares` and `previewWithdraw` SHOULD
                    /// be considered slippage in share price or some other type of condition,
                    /// meaning the depositor will lose assets by depositing.
                    function previewWithdraw(uint256 assets) public view virtual returns (uint256 shares) {
                        if (!_useVirtualShares()) {
                            uint256 supply = totalSupply();
                            return _eitherIsZero(assets, supply)
                                ? _initialConvertToShares(assets)
                                : FixedPointMathLib.fullMulDivUp(assets, supply, totalAssets());
                        }
                        uint256 o = _decimalsOffset();
                        if (o == 0) {
                            return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 1, _inc(totalAssets()));
                        }
                        return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 10 ** o, _inc(totalAssets()));
                    }
                    /// @dev Allows an on-chain or off-chain user to simulate the effects of their redemption
                    /// at the current block, given current on-chain conditions.
                    ///
                    /// - MUST return as close to and no more than the exact amount of assets that
                    ///   will be withdrawn in a redeem call in the same transaction, i.e. redeem should
                    ///   return the same or more assets as `previewRedeem` if called in the same transaction.
                    /// - MUST NOT account for redemption limits like those returned from `maxRedeem` and should
                    ///   always act as if the redemption will be accepted, regardless of approvals, etc.
                    /// - MUST be inclusive of withdrawal fees. Integrators should be aware of this.
                    /// - MUST NOT revert.
                    ///
                    /// Note: Any unfavorable discrepancy between `convertToAssets` and `previewRedeem` SHOULD
                    /// be considered slippage in share price or some other type of condition,
                    /// meaning the depositor will lose assets by depositing.
                    function previewRedeem(uint256 shares) public view virtual returns (uint256 assets) {
                        assets = convertToAssets(shares);
                    }
                    /// @dev Private helper to return if either value is zero.
                    function _eitherIsZero(uint256 a, uint256 b) private pure returns (bool result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            result := or(iszero(a), iszero(b))
                        }
                    }
                    /// @dev Private helper to return `x + 1` without the overflow check.
                    /// Used for computing the denominator input to `FixedPointMathLib.fullMulDiv(a, b, x + 1)`.
                    /// When `x == type(uint256).max`, we get `x + 1 == 0` (mod 2**256 - 1),
                    /// and `FixedPointMathLib.fullMulDiv` will revert as the denominator is zero.
                    function _inc(uint256 x) private pure returns (uint256) {
                        unchecked {
                            return x + 1;
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*              DEPOSIT / WITHDRAWAL LIMIT LOGIC              */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the maximum amount of the underlying asset that can be deposited
                    /// into the Vault for `to`, via a deposit call.
                    ///
                    /// - MUST return a limited value if `to` is subject to some deposit limit.
                    /// - MUST return `2**256-1` if there is no maximum limit.
                    /// - MUST NOT revert.
                    function maxDeposit(address to) public view virtual returns (uint256 maxAssets) {
                        to = to; // Silence unused variable warning.
                        maxAssets = type(uint256).max;
                    }
                    /// @dev Returns the maximum amount of the Vault shares that can be minter for `to`,
                    /// via a mint call.
                    ///
                    /// - MUST return a limited value if `to` is subject to some mint limit.
                    /// - MUST return `2**256-1` if there is no maximum limit.
                    /// - MUST NOT revert.
                    function maxMint(address to) public view virtual returns (uint256 maxShares) {
                        to = to; // Silence unused variable warning.
                        maxShares = type(uint256).max;
                    }
                    /// @dev Returns the maximum amount of the underlying asset that can be withdrawn
                    /// from the `owner`'s balance in the Vault, via a withdraw call.
                    ///
                    /// - MUST return a limited value if `owner` is subject to some withdrawal limit or timelock.
                    /// - MUST NOT revert.
                    function maxWithdraw(address owner) public view virtual returns (uint256 maxAssets) {
                        maxAssets = convertToAssets(balanceOf(owner));
                    }
                    /// @dev Returns the maximum amount of Vault shares that can be redeemed
                    /// from the `owner`'s balance in the Vault, via a redeem call.
                    ///
                    /// - MUST return a limited value if `owner` is subject to some withdrawal limit or timelock.
                    /// - MUST return `balanceOf(owner)` otherwise.
                    /// - MUST NOT revert.
                    function maxRedeem(address owner) public view virtual returns (uint256 maxShares) {
                        maxShares = balanceOf(owner);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                 DEPOSIT / WITHDRAWAL LOGIC                 */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Mints `shares` Vault shares to `to` by depositing exactly `assets`
                    /// of underlying tokens.
                    ///
                    /// - MUST emit the {Deposit} event.
                    /// - MAY support an additional flow in which the underlying tokens are owned by the Vault
                    ///   contract before the deposit execution, and are accounted for during deposit.
                    /// - MUST revert if all of `assets` cannot be deposited, such as due to deposit limit,
                    ///   slippage, insufficient approval, etc.
                    ///
                    /// Note: Most implementations will require pre-approval of the Vault with the
                    /// Vault's underlying `asset` token.
                    function deposit(uint256 assets, address to) public virtual returns (uint256 shares) {
                        if (assets > maxDeposit(to)) _revert(0xb3c61a83); // `DepositMoreThanMax()`.
                        shares = previewDeposit(assets);
                        _deposit(msg.sender, to, assets, shares);
                    }
                    /// @dev Mints exactly `shares` Vault shares to `to` by depositing `assets`
                    /// of underlying tokens.
                    ///
                    /// - MUST emit the {Deposit} event.
                    /// - MAY support an additional flow in which the underlying tokens are owned by the Vault
                    ///   contract before the mint execution, and are accounted for during mint.
                    /// - MUST revert if all of `shares` cannot be deposited, such as due to deposit limit,
                    ///   slippage, insufficient approval, etc.
                    ///
                    /// Note: Most implementations will require pre-approval of the Vault with the
                    /// Vault's underlying `asset` token.
                    function mint(uint256 shares, address to) public virtual returns (uint256 assets) {
                        if (shares > maxMint(to)) _revert(0x6a695959); // `MintMoreThanMax()`.
                        assets = previewMint(shares);
                        _deposit(msg.sender, to, assets, shares);
                    }
                    /// @dev Burns `shares` from `owner` and sends exactly `assets` of underlying tokens to `to`.
                    ///
                    /// - MUST emit the {Withdraw} event.
                    /// - MAY support an additional flow in which the underlying tokens are owned by the Vault
                    ///   contract before the withdraw execution, and are accounted for during withdraw.
                    /// - MUST revert if all of `assets` cannot be withdrawn, such as due to withdrawal limit,
                    ///   slippage, insufficient balance, etc.
                    ///
                    /// Note: Some implementations will require pre-requesting to the Vault before a withdrawal
                    /// may be performed. Those methods should be performed separately.
                    function withdraw(uint256 assets, address to, address owner)
                        public
                        virtual
                        returns (uint256 shares)
                    {
                        if (assets > maxWithdraw(owner)) _revert(0x936941fc); // `WithdrawMoreThanMax()`.
                        shares = previewWithdraw(assets);
                        _withdraw(msg.sender, to, owner, assets, shares);
                    }
                    /// @dev Burns exactly `shares` from `owner` and sends `assets` of underlying tokens to `to`.
                    ///
                    /// - MUST emit the {Withdraw} event.
                    /// - MAY support an additional flow in which the underlying tokens are owned by the Vault
                    ///   contract before the redeem execution, and are accounted for during redeem.
                    /// - MUST revert if all of shares cannot be redeemed, such as due to withdrawal limit,
                    ///   slippage, insufficient balance, etc.
                    ///
                    /// Note: Some implementations will require pre-requesting to the Vault before a redeem
                    /// may be performed. Those methods should be performed separately.
                    function redeem(uint256 shares, address to, address owner)
                        public
                        virtual
                        returns (uint256 assets)
                    {
                        if (shares > maxRedeem(owner)) _revert(0x4656425a); // `RedeemMoreThanMax()`.
                        assets = previewRedeem(shares);
                        _withdraw(msg.sender, to, owner, assets, shares);
                    }
                    /// @dev Internal helper for reverting efficiently.
                    function _revert(uint256 s) private pure {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x00, s)
                            revert(0x1c, 0x04)
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      INTERNAL HELPERS                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev For deposits and mints.
                    ///
                    /// Emits a {Deposit} event.
                    function _deposit(address by, address to, uint256 assets, uint256 shares) internal virtual {
                        SafeTransferLib.safeTransferFrom(asset(), by, address(this), assets);
                        _mint(to, shares);
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Emit the {Deposit} event.
                            mstore(0x00, assets)
                            mstore(0x20, shares)
                            let m := shr(96, not(0))
                            log3(0x00, 0x40, _DEPOSIT_EVENT_SIGNATURE, and(m, by), and(m, to))
                        }
                        _afterDeposit(assets, shares);
                    }
                    /// @dev For withdrawals and redemptions.
                    ///
                    /// Emits a {Withdraw} event.
                    function _withdraw(address by, address to, address owner, uint256 assets, uint256 shares)
                        internal
                        virtual
                    {
                        if (by != owner) _spendAllowance(owner, by, shares);
                        _beforeWithdraw(assets, shares);
                        _burn(owner, shares);
                        SafeTransferLib.safeTransfer(asset(), to, assets);
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Emit the {Withdraw} event.
                            mstore(0x00, assets)
                            mstore(0x20, shares)
                            let m := shr(96, not(0))
                            log4(0x00, 0x40, _WITHDRAW_EVENT_SIGNATURE, and(m, by), and(m, to), and(m, owner))
                        }
                    }
                    /// @dev Internal conversion function (from assets to shares) to apply when the Vault is empty.
                    /// Only used when {_useVirtualShares} returns false.
                    ///
                    /// Note: Make sure to keep this function consistent with {_initialConvertToAssets}
                    /// when overriding it.
                    function _initialConvertToShares(uint256 assets)
                        internal
                        view
                        virtual
                        returns (uint256 shares)
                    {
                        shares = assets;
                    }
                    /// @dev Internal conversion function (from shares to assets) to apply when the Vault is empty.
                    /// Only used when {_useVirtualShares} returns false.
                    ///
                    /// Note: Make sure to keep this function consistent with {_initialConvertToShares}
                    /// when overriding it.
                    function _initialConvertToAssets(uint256 shares)
                        internal
                        view
                        virtual
                        returns (uint256 assets)
                    {
                        assets = shares;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     HOOKS TO OVERRIDE                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Hook that is called before any withdrawal or redemption.
                    function _beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}
                    /// @dev Hook that is called after any deposit or mint.
                    function _afterDeposit(uint256 assets, uint256 shares) internal virtual {}
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Simple single owner authorization mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
                ///
                /// @dev Note:
                /// This implementation does NOT auto-initialize the owner to `msg.sender`.
                /// You MUST call the `_initializeOwner` in the constructor / initializer.
                ///
                /// While the ownable portion follows
                /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
                /// the nomenclature for the 2-step ownership handover may be unique to this codebase.
                abstract contract Ownable {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The caller is not authorized to call the function.
                    error Unauthorized();
                    /// @dev The `newOwner` cannot be the zero address.
                    error NewOwnerIsZeroAddress();
                    /// @dev The `pendingOwner` does not have a valid handover request.
                    error NoHandoverRequest();
                    /// @dev Cannot double-initialize.
                    error AlreadyInitialized();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
                    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
                    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
                    /// despite it not being as lightweight as a single argument event.
                    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
                    /// @dev An ownership handover to `pendingOwner` has been requested.
                    event OwnershipHandoverRequested(address indexed pendingOwner);
                    /// @dev The ownership handover to `pendingOwner` has been canceled.
                    event OwnershipHandoverCanceled(address indexed pendingOwner);
                    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
                    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
                        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
                    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
                    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
                        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;
                    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
                    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
                        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The owner slot is given by:
                    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
                    /// It is intentionally chosen to be a high value
                    /// to avoid collision with lower slots.
                    /// The choice of manual storage layout is to enable compatibility
                    /// with both regular and upgradeable contracts.
                    bytes32 internal constant _OWNER_SLOT =
                        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;
                    /// The ownership handover slot of `newOwner` is given by:
                    /// ```
                    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
                    ///     let handoverSlot := keccak256(0x00, 0x20)
                    /// ```
                    /// It stores the expiry timestamp of the two-step ownership handover.
                    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     INTERNAL FUNCTIONS                     */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
                    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}
                    /// @dev Initializes the owner directly without authorization guard.
                    /// This function must be called upon initialization,
                    /// regardless of whether the contract is upgradeable or not.
                    /// This is to enable generalization to both regular and upgradeable contracts,
                    /// and to save gas in case the initial owner is not the caller.
                    /// For performance reasons, this function will not check if there
                    /// is an existing owner.
                    function _initializeOwner(address newOwner) internal virtual {
                        if (_guardInitializeOwner()) {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                if sload(ownerSlot) {
                                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                                    revert(0x1c, 0x04)
                                }
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Store the new value.
                                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
                            }
                        } else {
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Store the new value.
                                sstore(_OWNER_SLOT, newOwner)
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
                            }
                        }
                    }
                    /// @dev Sets the owner directly without authorization guard.
                    function _setOwner(address newOwner) internal virtual {
                        if (_guardInitializeOwner()) {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                                // Store the new value.
                                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                            }
                        } else {
                            /// @solidity memory-safe-assembly
                            assembly {
                                let ownerSlot := _OWNER_SLOT
                                // Clean the upper 96 bits.
                                newOwner := shr(96, shl(96, newOwner))
                                // Emit the {OwnershipTransferred} event.
                                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                                // Store the new value.
                                sstore(ownerSlot, newOwner)
                            }
                        }
                    }
                    /// @dev Throws if the sender is not the owner.
                    function _checkOwner() internal view virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // If the caller is not the stored owner, revert.
                            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
                    /// Override to return a different value if needed.
                    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
                    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
                        return 48 * 3600;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  PUBLIC UPDATE FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Allows the owner to transfer the ownership to `newOwner`.
                    function transferOwnership(address newOwner) public payable virtual onlyOwner {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(shl(96, newOwner)) {
                                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _setOwner(newOwner);
                    }
                    /// @dev Allows the owner to renounce their ownership.
                    function renounceOwnership() public payable virtual onlyOwner {
                        _setOwner(address(0));
                    }
                    /// @dev Request a two-step ownership handover to the caller.
                    /// The request will automatically expire in 48 hours (172800 seconds) by default.
                    function requestOwnershipHandover() public payable virtual {
                        unchecked {
                            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Compute and set the handover slot to `expires`.
                                mstore(0x0c, _HANDOVER_SLOT_SEED)
                                mstore(0x00, caller())
                                sstore(keccak256(0x0c, 0x20), expires)
                                // Emit the {OwnershipHandoverRequested} event.
                                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
                            }
                        }
                    }
                    /// @dev Cancels the two-step ownership handover to the caller, if any.
                    function cancelOwnershipHandover() public payable virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute and set the handover slot to 0.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, caller())
                            sstore(keccak256(0x0c, 0x20), 0)
                            // Emit the {OwnershipHandoverCanceled} event.
                            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
                        }
                    }
                    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
                    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
                    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute and set the handover slot to 0.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, pendingOwner)
                            let handoverSlot := keccak256(0x0c, 0x20)
                            // If the handover does not exist, or has expired.
                            if gt(timestamp(), sload(handoverSlot)) {
                                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                                revert(0x1c, 0x04)
                            }
                            // Set the handover slot to 0.
                            sstore(handoverSlot, 0)
                        }
                        _setOwner(pendingOwner);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                   PUBLIC READ FUNCTIONS                    */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the owner of the contract.
                    function owner() public view virtual returns (address result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            result := sload(_OWNER_SLOT)
                        }
                    }
                    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
                    function ownershipHandoverExpiresAt(address pendingOwner)
                        public
                        view
                        virtual
                        returns (uint256 result)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the handover slot.
                            mstore(0x0c, _HANDOVER_SLOT_SEED)
                            mstore(0x00, pendingOwner)
                            // Load the handover slot.
                            result := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         MODIFIERS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Marks a function as only callable by the owner.
                    modifier onlyOwner() virtual {
                        _checkOwner();
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Reentrancy guard mixin.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuard.sol)
                abstract contract ReentrancyGuard {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Unauthorized reentrant call.
                    error Reentrancy();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Equivalent to: `uint72(bytes9(keccak256("_REENTRANCY_GUARD_SLOT")))`.
                    /// 9 bytes is large enough to avoid collisions with lower slots,
                    /// but not too large to result in excessive bytecode bloat.
                    uint256 private constant _REENTRANCY_GUARD_SLOT = 0x929eee149b4bd21268;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      REENTRANCY GUARD                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Guards a function from reentrancy.
                    modifier nonReentrant() virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if eq(sload(_REENTRANCY_GUARD_SLOT), address()) {
                                mstore(0x00, 0xab143c06) // `Reentrancy()`.
                                revert(0x1c, 0x04)
                            }
                            sstore(_REENTRANCY_GUARD_SLOT, address())
                        }
                        _;
                        /// @solidity memory-safe-assembly
                        assembly {
                            sstore(_REENTRANCY_GUARD_SLOT, codesize())
                        }
                    }
                    /// @dev Guards a view function from read-only reentrancy.
                    modifier nonReadReentrant() virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if eq(sload(_REENTRANCY_GUARD_SLOT), address()) {
                                mstore(0x00, 0xab143c06) // `Reentrancy()`.
                                revert(0x1c, 0x04)
                            }
                        }
                        _;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev Interface of the ERC20 standard as defined in the EIP.
                 */
                interface IERC20 {
                    /**
                     * @dev Emitted when `value` tokens are moved from one account (`from`) to
                     * another (`to`).
                     *
                     * Note that `value` may be zero.
                     */
                    event Transfer(address indexed from, address indexed to, uint256 value);
                    /**
                     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
                     * a call to {approve}. `value` is the new allowance.
                     */
                    event Approval(address indexed owner, address indexed spender, uint256 value);
                    /**
                     * @dev Returns the value of tokens in existence.
                     */
                    function totalSupply() external view returns (uint256);
                    /**
                     * @dev Returns the value of tokens owned by `account`.
                     */
                    function balanceOf(address account) external view returns (uint256);
                    /**
                     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * Emits a {Transfer} event.
                     */
                    function transfer(address to, uint256 value) external returns (bool);
                    /**
                     * @dev Returns the remaining number of tokens that `spender` will be
                     * allowed to spend on behalf of `owner` through {transferFrom}. This is
                     * zero by default.
                     *
                     * This value changes when {approve} or {transferFrom} are called.
                     */
                    function allowance(address owner, address spender) external view returns (uint256);
                    /**
                     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
                     * caller's tokens.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * IMPORTANT: Beware that changing an allowance with this method brings the risk
                     * that someone may use both the old and the new allowance by unfortunate
                     * transaction ordering. One possible solution to mitigate this race
                     * condition is to first reduce the spender's allowance to 0 and set the
                     * desired value afterwards:
                     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                     *
                     * Emits an {Approval} event.
                     */
                    function approve(address spender, uint256 value) external returns (bool);
                    /**
                     * @dev Moves a `value` amount of tokens from `from` to `to` using the
                     * allowance mechanism. `value` is then deducted from the caller's
                     * allowance.
                     *
                     * Returns a boolean value indicating whether the operation succeeded.
                     *
                     * Emits a {Transfer} event.
                     */
                    function transferFrom(address from, address to, uint256 value) external returns (bool);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
                pragma solidity ^0.8.20;
                import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
                import {Initializable} from "../proxy/utils/Initializable.sol";
                /**
                 * @dev Contract module which allows children to implement an emergency stop
                 * mechanism that can be triggered by an authorized account.
                 *
                 * This module is used through inheritance. It will make available the
                 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
                 * the functions of your contract. Note that they will not be pausable by
                 * simply including this module, only once the modifiers are put in place.
                 */
                abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
                    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
                    struct PausableStorage {
                        bool _paused;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;
                    function _getPausableStorage() private pure returns (PausableStorage storage $) {
                        assembly {
                            $.slot := PausableStorageLocation
                        }
                    }
                    /**
                     * @dev Emitted when the pause is triggered by `account`.
                     */
                    event Paused(address account);
                    /**
                     * @dev Emitted when the pause is lifted by `account`.
                     */
                    event Unpaused(address account);
                    /**
                     * @dev The operation failed because the contract is paused.
                     */
                    error EnforcedPause();
                    /**
                     * @dev The operation failed because the contract is not paused.
                     */
                    error ExpectedPause();
                    /**
                     * @dev Initializes the contract in unpaused state.
                     */
                    function __Pausable_init() internal onlyInitializing {
                        __Pausable_init_unchained();
                    }
                    function __Pausable_init_unchained() internal onlyInitializing {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = false;
                    }
                    /**
                     * @dev Modifier to make a function callable only when the contract is not paused.
                     *
                     * Requirements:
                     *
                     * - The contract must not be paused.
                     */
                    modifier whenNotPaused() {
                        _requireNotPaused();
                        _;
                    }
                    /**
                     * @dev Modifier to make a function callable only when the contract is paused.
                     *
                     * Requirements:
                     *
                     * - The contract must be paused.
                     */
                    modifier whenPaused() {
                        _requirePaused();
                        _;
                    }
                    /**
                     * @dev Returns true if the contract is paused, and false otherwise.
                     */
                    function paused() public view virtual returns (bool) {
                        PausableStorage storage $ = _getPausableStorage();
                        return $._paused;
                    }
                    /**
                     * @dev Throws if the contract is paused.
                     */
                    function _requireNotPaused() internal view virtual {
                        if (paused()) {
                            revert EnforcedPause();
                        }
                    }
                    /**
                     * @dev Throws if the contract is not paused.
                     */
                    function _requirePaused() internal view virtual {
                        if (!paused()) {
                            revert ExpectedPause();
                        }
                    }
                    /**
                     * @dev Triggers stopped state.
                     *
                     * Requirements:
                     *
                     * - The contract must not be paused.
                     */
                    function _pause() internal virtual whenNotPaused {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = true;
                        emit Paused(_msgSender());
                    }
                    /**
                     * @dev Returns to normal state.
                     *
                     * Requirements:
                     *
                     * - The contract must be paused.
                     */
                    function _unpause() internal virtual whenPaused {
                        PausableStorage storage $ = _getPausableStorage();
                        $._paused = false;
                        emit Unpaused(_msgSender());
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
                pragma solidity ^0.8.20;
                /**
                 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
                 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
                 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
                 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
                 *
                 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
                 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
                 * case an upgrade adds a module that needs to be initialized.
                 *
                 * For example:
                 *
                 * [.hljs-theme-light.nopadding]
                 * ```solidity
                 * contract MyToken is ERC20Upgradeable {
                 *     function initialize() initializer public {
                 *         __ERC20_init("MyToken", "MTK");
                 *     }
                 * }
                 *
                 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
                 *     function initializeV2() reinitializer(2) public {
                 *         __ERC20Permit_init("MyToken");
                 *     }
                 * }
                 * ```
                 *
                 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
                 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
                 *
                 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
                 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
                 *
                 * [CAUTION]
                 * ====
                 * Avoid leaving a contract uninitialized.
                 *
                 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
                 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
                 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
                 *
                 * [.hljs-theme-light.nopadding]
                 * ```
                 * /// @custom:oz-upgrades-unsafe-allow constructor
                 * constructor() {
                 *     _disableInitializers();
                 * }
                 * ```
                 * ====
                 */
                abstract contract Initializable {
                    /**
                     * @dev Storage of the initializable contract.
                     *
                     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
                     * when using with upgradeable contracts.
                     *
                     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
                     */
                    struct InitializableStorage {
                        /**
                         * @dev Indicates that the contract has been initialized.
                         */
                        uint64 _initialized;
                        /**
                         * @dev Indicates that the contract is in the process of being initialized.
                         */
                        bool _initializing;
                    }
                    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
                    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
                    /**
                     * @dev The contract is already initialized.
                     */
                    error InvalidInitialization();
                    /**
                     * @dev The contract is not initializing.
                     */
                    error NotInitializing();
                    /**
                     * @dev Triggered when the contract has been initialized or reinitialized.
                     */
                    event Initialized(uint64 version);
                    /**
                     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
                     * `onlyInitializing` functions can be used to initialize parent contracts.
                     *
                     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
                     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
                     * production.
                     *
                     * Emits an {Initialized} event.
                     */
                    modifier initializer() {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        // Cache values to avoid duplicated sloads
                        bool isTopLevelCall = !$._initializing;
                        uint64 initialized = $._initialized;
                        // Allowed calls:
                        // - initialSetup: the contract is not in the initializing state and no previous version was
                        //                 initialized
                        // - construction: the contract is initialized at version 1 (no reininitialization) and the
                        //                 current contract is just being deployed
                        bool initialSetup = initialized == 0 && isTopLevelCall;
                        bool construction = initialized == 1 && address(this).code.length == 0;
                        if (!initialSetup && !construction) {
                            revert InvalidInitialization();
                        }
                        $._initialized = 1;
                        if (isTopLevelCall) {
                            $._initializing = true;
                        }
                        _;
                        if (isTopLevelCall) {
                            $._initializing = false;
                            emit Initialized(1);
                        }
                    }
                    /**
                     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
                     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
                     * used to initialize parent contracts.
                     *
                     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
                     * are added through upgrades and that require initialization.
                     *
                     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
                     * cannot be nested. If one is invoked in the context of another, execution will revert.
                     *
                     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
                     * a contract, executing them in the right order is up to the developer or operator.
                     *
                     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
                     *
                     * Emits an {Initialized} event.
                     */
                    modifier reinitializer(uint64 version) {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        if ($._initializing || $._initialized >= version) {
                            revert InvalidInitialization();
                        }
                        $._initialized = version;
                        $._initializing = true;
                        _;
                        $._initializing = false;
                        emit Initialized(version);
                    }
                    /**
                     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
                     * {initializer} and {reinitializer} modifiers, directly or indirectly.
                     */
                    modifier onlyInitializing() {
                        _checkInitializing();
                        _;
                    }
                    /**
                     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
                     */
                    function _checkInitializing() internal view virtual {
                        if (!_isInitializing()) {
                            revert NotInitializing();
                        }
                    }
                    /**
                     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
                     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
                     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
                     * through proxies.
                     *
                     * Emits an {Initialized} event the first time it is successfully executed.
                     */
                    function _disableInitializers() internal virtual {
                        // solhint-disable-next-line var-name-mixedcase
                        InitializableStorage storage $ = _getInitializableStorage();
                        if ($._initializing) {
                            revert InvalidInitialization();
                        }
                        if ($._initialized != type(uint64).max) {
                            $._initialized = type(uint64).max;
                            emit Initialized(type(uint64).max);
                        }
                    }
                    /**
                     * @dev Returns the highest version that has been initialized. See {reinitializer}.
                     */
                    function _getInitializedVersion() internal view returns (uint64) {
                        return _getInitializableStorage()._initialized;
                    }
                    /**
                     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
                     */
                    function _isInitializing() internal view returns (bool) {
                        return _getInitializableStorage()._initializing;
                    }
                    /**
                     * @dev Returns a pointer to the storage namespace.
                     */
                    // solhint-disable-next-line var-name-mixedcase
                    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
                        assembly {
                            $.slot := INITIALIZABLE_STORAGE
                        }
                    }
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                error InvalidInput();
                error InvalidWithdrawalDelay();
                error ZeroAddress();
                error NotVaultSupervisor();
                error NotStaker();
                error WithdrawAlreadyCompleted();
                error MinWithdrawDelayNotPassed();
                error WithdrawerNotCaller();
                error ZeroShares();
                error MaxStakerVault();
                error VaultNotAChildVault();
                error NotDelegationSupervisor();
                error NotPreviousNorCurrentDelegationSupervisor();
                error VaultNotFound();
                error NotEnoughShares();
                error InvalidVaultAdminFunction();
                error NotInitialized();
                error RoleNotGranted();
                // Vault.sol
                error NotSupervisor();
                error TokenNotEnabled();
                // Generic
                error NoElementsInArray();
                error ArrayLengthsNotEqual();
                error ZeroAmount();
                // VaultSupervisor.sol
                error PermitFailed();
                error ExpiredSign();
                error InvalidSignature();
                error CrossedDepositLimit();
                // Limiter.sol
                error UnsupportedAsset();
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import {IVaultSupervisor} from "./IVaultSupervisor.sol";
                interface IVault is IERC4626 {
                    enum AssetType {
                        NONE,
                        ETH,
                        STABLE,
                        BTC,
                        OTHER
                    }
                    function initialize(
                        address _owner,
                        IERC20 _depositToken,
                        string memory _name,
                        string memory _symbol,
                        AssetType _assetType
                    ) external;
                    function deposit(uint256 assets, address depositor) external returns (uint256);
                    function redeem(uint256 shares, address to, address owner) external returns (uint256 assets);
                    function setLimit(uint256 newLimit) external;
                    function pause(bool toPause) external;
                    function owner() external view returns (address);
                    function transferOwnership(address newOwner) external;
                    function renounceOwnership() external;
                    function totalAssets() external view returns (uint256);
                    function decimals() external view returns (uint8);
                    function assetType() external view returns (AssetType);
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Simple ERC20 + EIP-2612 implementation.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol)
                /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
                /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol)
                ///
                /// @dev Note:
                /// - The ERC20 standard allows minting and transferring to and from the zero address,
                ///   minting and transferring zero tokens, as well as self-approvals.
                ///   For performance, this implementation WILL NOT revert for such actions.
                ///   Please add any checks with overrides if desired.
                /// - The `permit` function uses the ecrecover precompile (0x1).
                ///
                /// If you are overriding:
                /// - NEVER violate the ERC20 invariant:
                ///   the total sum of all balances must be equal to `totalSupply()`.
                /// - Check that the overridden function is actually used in the function you want to
                ///   change the behavior of. Much of the code has been manually inlined for performance.
                abstract contract ERC20 {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The total supply has overflowed.
                    error TotalSupplyOverflow();
                    /// @dev The allowance has overflowed.
                    error AllowanceOverflow();
                    /// @dev The allowance has underflowed.
                    error AllowanceUnderflow();
                    /// @dev Insufficient balance.
                    error InsufficientBalance();
                    /// @dev Insufficient allowance.
                    error InsufficientAllowance();
                    /// @dev The permit is invalid.
                    error InvalidPermit();
                    /// @dev The permit has expired.
                    error PermitExpired();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           EVENTS                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Emitted when `amount` tokens is transferred from `from` to `to`.
                    event Transfer(address indexed from, address indexed to, uint256 amount);
                    /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`.
                    event Approval(address indexed owner, address indexed spender, uint256 amount);
                    /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`.
                    uint256 private constant _TRANSFER_EVENT_SIGNATURE =
                        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
                    /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`.
                    uint256 private constant _APPROVAL_EVENT_SIGNATURE =
                        0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          STORAGE                           */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The storage slot for the total supply.
                    uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c;
                    /// @dev The balance slot of `owner` is given by:
                    /// ```
                    ///     mstore(0x0c, _BALANCE_SLOT_SEED)
                    ///     mstore(0x00, owner)
                    ///     let balanceSlot := keccak256(0x0c, 0x20)
                    /// ```
                    uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2;
                    /// @dev The allowance slot of (`owner`, `spender`) is given by:
                    /// ```
                    ///     mstore(0x20, spender)
                    ///     mstore(0x0c, _ALLOWANCE_SLOT_SEED)
                    ///     mstore(0x00, owner)
                    ///     let allowanceSlot := keccak256(0x0c, 0x34)
                    /// ```
                    uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20;
                    /// @dev The nonce slot of `owner` is given by:
                    /// ```
                    ///     mstore(0x0c, _NONCES_SLOT_SEED)
                    ///     mstore(0x00, owner)
                    ///     let nonceSlot := keccak256(0x0c, 0x20)
                    /// ```
                    uint256 private constant _NONCES_SLOT_SEED = 0x38377508;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         CONSTANTS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev `(_NONCES_SLOT_SEED << 16) | 0x1901`.
                    uint256 private constant _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX = 0x383775081901;
                    /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`.
                    bytes32 private constant _DOMAIN_TYPEHASH =
                        0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
                    /// @dev `keccak256("1")`.
                    bytes32 private constant _VERSION_HASH =
                        0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6;
                    /// @dev `keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")`.
                    bytes32 private constant _PERMIT_TYPEHASH =
                        0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       ERC20 METADATA                       */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the name of the token.
                    function name() public view virtual returns (string memory);
                    /// @dev Returns the symbol of the token.
                    function symbol() public view virtual returns (string memory);
                    /// @dev Returns the decimals places of the token.
                    function decimals() public view virtual returns (uint8) {
                        return 18;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                           ERC20                            */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns the amount of tokens in existence.
                    function totalSupply() public view virtual returns (uint256 result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            result := sload(_TOTAL_SUPPLY_SLOT)
                        }
                    }
                    /// @dev Returns the amount of tokens owned by `owner`.
                    function balanceOf(address owner) public view virtual returns (uint256 result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x0c, _BALANCE_SLOT_SEED)
                            mstore(0x00, owner)
                            result := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`.
                    function allowance(address owner, address spender)
                        public
                        view
                        virtual
                        returns (uint256 result)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x20, spender)
                            mstore(0x0c, _ALLOWANCE_SLOT_SEED)
                            mstore(0x00, owner)
                            result := sload(keccak256(0x0c, 0x34))
                        }
                    }
                    /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
                    ///
                    /// Emits a {Approval} event.
                    function approve(address spender, uint256 amount) public virtual returns (bool) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the allowance slot and store the amount.
                            mstore(0x20, spender)
                            mstore(0x0c, _ALLOWANCE_SLOT_SEED)
                            mstore(0x00, caller())
                            sstore(keccak256(0x0c, 0x34), amount)
                            // Emit the {Approval} event.
                            mstore(0x00, amount)
                            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c)))
                        }
                        return true;
                    }
                    /// @dev Transfer `amount` tokens from the caller to `to`.
                    ///
                    /// Requirements:
                    /// - `from` must at least have `amount`.
                    ///
                    /// Emits a {Transfer} event.
                    function transfer(address to, uint256 amount) public virtual returns (bool) {
                        _beforeTokenTransfer(msg.sender, to, amount);
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the balance slot and load its value.
                            mstore(0x0c, _BALANCE_SLOT_SEED)
                            mstore(0x00, caller())
                            let fromBalanceSlot := keccak256(0x0c, 0x20)
                            let fromBalance := sload(fromBalanceSlot)
                            // Revert if insufficient balance.
                            if gt(amount, fromBalance) {
                                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
                                revert(0x1c, 0x04)
                            }
                            // Subtract and store the updated balance.
                            sstore(fromBalanceSlot, sub(fromBalance, amount))
                            // Compute the balance slot of `to`.
                            mstore(0x00, to)
                            let toBalanceSlot := keccak256(0x0c, 0x20)
                            // Add and store the updated balance of `to`.
                            // Will not overflow because the sum of all user balances
                            // cannot exceed the maximum uint256 value.
                            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))
                            // Emit the {Transfer} event.
                            mstore(0x20, amount)
                            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c)))
                        }
                        _afterTokenTransfer(msg.sender, to, amount);
                        return true;
                    }
                    /// @dev Transfers `amount` tokens from `from` to `to`.
                    ///
                    /// Note: Does not update the allowance if it is the maximum uint256 value.
                    ///
                    /// Requirements:
                    /// - `from` must at least have `amount`.
                    /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`.
                    ///
                    /// Emits a {Transfer} event.
                    function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {
                        _beforeTokenTransfer(from, to, amount);
                        /// @solidity memory-safe-assembly
                        assembly {
                            let from_ := shl(96, from)
                            // Compute the allowance slot and load its value.
                            mstore(0x20, caller())
                            mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED))
                            let allowanceSlot := keccak256(0x0c, 0x34)
                            let allowance_ := sload(allowanceSlot)
                            // If the allowance is not the maximum uint256 value.
                            if add(allowance_, 1) {
                                // Revert if the amount to be transferred exceeds the allowance.
                                if gt(amount, allowance_) {
                                    mstore(0x00, 0x13be252b) // `InsufficientAllowance()`.
                                    revert(0x1c, 0x04)
                                }
                                // Subtract and store the updated allowance.
                                sstore(allowanceSlot, sub(allowance_, amount))
                            }
                            // Compute the balance slot and load its value.
                            mstore(0x0c, or(from_, _BALANCE_SLOT_SEED))
                            let fromBalanceSlot := keccak256(0x0c, 0x20)
                            let fromBalance := sload(fromBalanceSlot)
                            // Revert if insufficient balance.
                            if gt(amount, fromBalance) {
                                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
                                revert(0x1c, 0x04)
                            }
                            // Subtract and store the updated balance.
                            sstore(fromBalanceSlot, sub(fromBalance, amount))
                            // Compute the balance slot of `to`.
                            mstore(0x00, to)
                            let toBalanceSlot := keccak256(0x0c, 0x20)
                            // Add and store the updated balance of `to`.
                            // Will not overflow because the sum of all user balances
                            // cannot exceed the maximum uint256 value.
                            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))
                            // Emit the {Transfer} event.
                            mstore(0x20, amount)
                            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))
                        }
                        _afterTokenTransfer(from, to, amount);
                        return true;
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                          EIP-2612                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev For more performance, override to return the constant value
                    /// of `keccak256(bytes(name()))` if `name()` will never change.
                    function _constantNameHash() internal view virtual returns (bytes32 result) {}
                    /// @dev Returns the current nonce for `owner`.
                    /// This value is used to compute the signature for EIP-2612 permit.
                    function nonces(address owner) public view virtual returns (uint256 result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the nonce slot and load its value.
                            mstore(0x0c, _NONCES_SLOT_SEED)
                            mstore(0x00, owner)
                            result := sload(keccak256(0x0c, 0x20))
                        }
                    }
                    /// @dev Sets `value` as the allowance of `spender` over the tokens of `owner`,
                    /// authorized by a signed approval by `owner`.
                    ///
                    /// Emits a {Approval} event.
                    function permit(
                        address owner,
                        address spender,
                        uint256 value,
                        uint256 deadline,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) public virtual {
                        bytes32 nameHash = _constantNameHash();
                        //  We simply calculate it on-the-fly to allow for cases where the `name` may change.
                        if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name()));
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Revert if the block timestamp is greater than `deadline`.
                            if gt(timestamp(), deadline) {
                                mstore(0x00, 0x1a15a3cc) // `PermitExpired()`.
                                revert(0x1c, 0x04)
                            }
                            let m := mload(0x40) // Grab the free memory pointer.
                            // Clean the upper 96 bits.
                            owner := shr(96, shl(96, owner))
                            spender := shr(96, shl(96, spender))
                            // Compute the nonce slot and load its value.
                            mstore(0x0e, _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX)
                            mstore(0x00, owner)
                            let nonceSlot := keccak256(0x0c, 0x20)
                            let nonceValue := sload(nonceSlot)
                            // Prepare the domain separator.
                            mstore(m, _DOMAIN_TYPEHASH)
                            mstore(add(m, 0x20), nameHash)
                            mstore(add(m, 0x40), _VERSION_HASH)
                            mstore(add(m, 0x60), chainid())
                            mstore(add(m, 0x80), address())
                            mstore(0x2e, keccak256(m, 0xa0))
                            // Prepare the struct hash.
                            mstore(m, _PERMIT_TYPEHASH)
                            mstore(add(m, 0x20), owner)
                            mstore(add(m, 0x40), spender)
                            mstore(add(m, 0x60), value)
                            mstore(add(m, 0x80), nonceValue)
                            mstore(add(m, 0xa0), deadline)
                            mstore(0x4e, keccak256(m, 0xc0))
                            // Prepare the ecrecover calldata.
                            mstore(0x00, keccak256(0x2c, 0x42))
                            mstore(0x20, and(0xff, v))
                            mstore(0x40, r)
                            mstore(0x60, s)
                            let t := staticcall(gas(), 1, 0, 0x80, 0x20, 0x20)
                            // If the ecrecover fails, the returndatasize will be 0x00,
                            // `owner` will be checked if it equals the hash at 0x00,
                            // which evaluates to false (i.e. 0), and we will revert.
                            // If the ecrecover succeeds, the returndatasize will be 0x20,
                            // `owner` will be compared against the returned address at 0x20.
                            if iszero(eq(mload(returndatasize()), owner)) {
                                mstore(0x00, 0xddafbaef) // `InvalidPermit()`.
                                revert(0x1c, 0x04)
                            }
                            // Increment and store the updated nonce.
                            sstore(nonceSlot, add(nonceValue, t)) // `t` is 1 if ecrecover succeeds.
                            // Compute the allowance slot and store the value.
                            // The `owner` is already at slot 0x20.
                            mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender))
                            sstore(keccak256(0x2c, 0x34), value)
                            // Emit the {Approval} event.
                            log3(add(m, 0x60), 0x20, _APPROVAL_EVENT_SIGNATURE, owner, spender)
                            mstore(0x40, m) // Restore the free memory pointer.
                            mstore(0x60, 0) // Restore the zero pointer.
                        }
                    }
                    /// @dev Returns the EIP-712 domain separator for the EIP-2612 permit.
                    function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) {
                        bytes32 nameHash = _constantNameHash();
                        //  We simply calculate it on-the-fly to allow for cases where the `name` may change.
                        if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name()));
                        /// @solidity memory-safe-assembly
                        assembly {
                            let m := mload(0x40) // Grab the free memory pointer.
                            mstore(m, _DOMAIN_TYPEHASH)
                            mstore(add(m, 0x20), nameHash)
                            mstore(add(m, 0x40), _VERSION_HASH)
                            mstore(add(m, 0x60), chainid())
                            mstore(add(m, 0x80), address())
                            result := keccak256(m, 0xa0)
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  INTERNAL MINT FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Mints `amount` tokens to `to`, increasing the total supply.
                    ///
                    /// Emits a {Transfer} event.
                    function _mint(address to, uint256 amount) internal virtual {
                        _beforeTokenTransfer(address(0), to, amount);
                        /// @solidity memory-safe-assembly
                        assembly {
                            let totalSupplyBefore := sload(_TOTAL_SUPPLY_SLOT)
                            let totalSupplyAfter := add(totalSupplyBefore, amount)
                            // Revert if the total supply overflows.
                            if lt(totalSupplyAfter, totalSupplyBefore) {
                                mstore(0x00, 0xe5cfe957) // `TotalSupplyOverflow()`.
                                revert(0x1c, 0x04)
                            }
                            // Store the updated total supply.
                            sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter)
                            // Compute the balance slot and load its value.
                            mstore(0x0c, _BALANCE_SLOT_SEED)
                            mstore(0x00, to)
                            let toBalanceSlot := keccak256(0x0c, 0x20)
                            // Add and store the updated balance.
                            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))
                            // Emit the {Transfer} event.
                            mstore(0x20, amount)
                            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c)))
                        }
                        _afterTokenTransfer(address(0), to, amount);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  INTERNAL BURN FUNCTIONS                   */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Burns `amount` tokens from `from`, reducing the total supply.
                    ///
                    /// Emits a {Transfer} event.
                    function _burn(address from, uint256 amount) internal virtual {
                        _beforeTokenTransfer(from, address(0), amount);
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the balance slot and load its value.
                            mstore(0x0c, _BALANCE_SLOT_SEED)
                            mstore(0x00, from)
                            let fromBalanceSlot := keccak256(0x0c, 0x20)
                            let fromBalance := sload(fromBalanceSlot)
                            // Revert if insufficient balance.
                            if gt(amount, fromBalance) {
                                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
                                revert(0x1c, 0x04)
                            }
                            // Subtract and store the updated balance.
                            sstore(fromBalanceSlot, sub(fromBalance, amount))
                            // Subtract and store the updated total supply.
                            sstore(_TOTAL_SUPPLY_SLOT, sub(sload(_TOTAL_SUPPLY_SLOT), amount))
                            // Emit the {Transfer} event.
                            mstore(0x00, amount)
                            log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0)
                        }
                        _afterTokenTransfer(from, address(0), amount);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                INTERNAL TRANSFER FUNCTIONS                 */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Moves `amount` of tokens from `from` to `to`.
                    function _transfer(address from, address to, uint256 amount) internal virtual {
                        _beforeTokenTransfer(from, to, amount);
                        /// @solidity memory-safe-assembly
                        assembly {
                            let from_ := shl(96, from)
                            // Compute the balance slot and load its value.
                            mstore(0x0c, or(from_, _BALANCE_SLOT_SEED))
                            let fromBalanceSlot := keccak256(0x0c, 0x20)
                            let fromBalance := sload(fromBalanceSlot)
                            // Revert if insufficient balance.
                            if gt(amount, fromBalance) {
                                mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
                                revert(0x1c, 0x04)
                            }
                            // Subtract and store the updated balance.
                            sstore(fromBalanceSlot, sub(fromBalance, amount))
                            // Compute the balance slot of `to`.
                            mstore(0x00, to)
                            let toBalanceSlot := keccak256(0x0c, 0x20)
                            // Add and store the updated balance of `to`.
                            // Will not overflow because the sum of all user balances
                            // cannot exceed the maximum uint256 value.
                            sstore(toBalanceSlot, add(sload(toBalanceSlot), amount))
                            // Emit the {Transfer} event.
                            mstore(0x20, amount)
                            log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c)))
                        }
                        _afterTokenTransfer(from, to, amount);
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                INTERNAL ALLOWANCE FUNCTIONS                */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Updates the allowance of `owner` for `spender` based on spent `amount`.
                    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Compute the allowance slot and load its value.
                            mstore(0x20, spender)
                            mstore(0x0c, _ALLOWANCE_SLOT_SEED)
                            mstore(0x00, owner)
                            let allowanceSlot := keccak256(0x0c, 0x34)
                            let allowance_ := sload(allowanceSlot)
                            // If the allowance is not the maximum uint256 value.
                            if add(allowance_, 1) {
                                // Revert if the amount to be transferred exceeds the allowance.
                                if gt(amount, allowance_) {
                                    mstore(0x00, 0x13be252b) // `InsufficientAllowance()`.
                                    revert(0x1c, 0x04)
                                }
                                // Subtract and store the updated allowance.
                                sstore(allowanceSlot, sub(allowance_, amount))
                            }
                        }
                    }
                    /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`.
                    ///
                    /// Emits a {Approval} event.
                    function _approve(address owner, address spender, uint256 amount) internal virtual {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let owner_ := shl(96, owner)
                            // Compute the allowance slot and store the amount.
                            mstore(0x20, spender)
                            mstore(0x0c, or(owner_, _ALLOWANCE_SLOT_SEED))
                            sstore(keccak256(0x0c, 0x34), amount)
                            // Emit the {Approval} event.
                            mstore(0x00, amount)
                            log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c)))
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                     HOOKS TO OVERRIDE                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Hook that is called before any transfer of tokens.
                    /// This includes minting and burning.
                    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
                    /// @dev Hook that is called after any transfer of tokens.
                    /// This includes minting and burning.
                    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Arithmetic library with operations for fixed-point numbers.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/FixedPointMathLib.sol)
                /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
                library FixedPointMathLib {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The operation failed, as the output exceeds the maximum value of uint256.
                    error ExpOverflow();
                    /// @dev The operation failed, as the output exceeds the maximum value of uint256.
                    error FactorialOverflow();
                    /// @dev The operation failed, due to an overflow.
                    error RPowOverflow();
                    /// @dev The mantissa is too big to fit.
                    error MantissaOverflow();
                    /// @dev The operation failed, due to an multiplication overflow.
                    error MulWadFailed();
                    /// @dev The operation failed, due to an multiplication overflow.
                    error SMulWadFailed();
                    /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero.
                    error DivWadFailed();
                    /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero.
                    error SDivWadFailed();
                    /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero.
                    error MulDivFailed();
                    /// @dev The division failed, as the denominator is zero.
                    error DivFailed();
                    /// @dev The full precision multiply-divide operation failed, either due
                    /// to the result being larger than 256 bits, or a division by a zero.
                    error FullMulDivFailed();
                    /// @dev The output is undefined, as the input is less-than-or-equal to zero.
                    error LnWadUndefined();
                    /// @dev The input outside the acceptable domain.
                    error OutOfDomain();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         CONSTANTS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The scalar of ETH and most ERC20s.
                    uint256 internal constant WAD = 1e18;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*              SIMPLIFIED FIXED POINT OPERATIONS             */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Equivalent to `(x * y) / WAD` rounded down.
                    function mulWad(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`.
                            if mul(y, gt(x, div(not(0), y))) {
                                mstore(0x00, 0xbac65e5b) // `MulWadFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := div(mul(x, y), WAD)
                        }
                    }
                    /// @dev Equivalent to `(x * y) / WAD` rounded down.
                    function sMulWad(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := mul(x, y)
                            // Equivalent to `require((x == 0 || z / x == y) && !(x == -1 && y == type(int256).min))`.
                            if iszero(gt(or(iszero(x), eq(sdiv(z, x), y)), lt(not(x), eq(y, shl(255, 1))))) {
                                mstore(0x00, 0xedcd4dd4) // `SMulWadFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := sdiv(z, WAD)
                        }
                    }
                    /// @dev Equivalent to `(x * y) / WAD` rounded down, but without overflow checks.
                    function rawMulWad(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := div(mul(x, y), WAD)
                        }
                    }
                    /// @dev Equivalent to `(x * y) / WAD` rounded down, but without overflow checks.
                    function rawSMulWad(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := sdiv(mul(x, y), WAD)
                        }
                    }
                    /// @dev Equivalent to `(x * y) / WAD` rounded up.
                    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`.
                            if mul(y, gt(x, div(not(0), y))) {
                                mstore(0x00, 0xbac65e5b) // `MulWadFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD))
                        }
                    }
                    /// @dev Equivalent to `(x * y) / WAD` rounded up, but without overflow checks.
                    function rawMulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD))
                        }
                    }
                    /// @dev Equivalent to `(x * WAD) / y` rounded down.
                    function divWad(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`.
                            if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) {
                                mstore(0x00, 0x7c5f487d) // `DivWadFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := div(mul(x, WAD), y)
                        }
                    }
                    /// @dev Equivalent to `(x * WAD) / y` rounded down.
                    function sDivWad(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := mul(x, WAD)
                            // Equivalent to `require(y != 0 && ((x * WAD) / WAD == x))`.
                            if iszero(and(iszero(iszero(y)), eq(sdiv(z, WAD), x))) {
                                mstore(0x00, 0x5c43740d) // `SDivWadFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := sdiv(mul(x, WAD), y)
                        }
                    }
                    /// @dev Equivalent to `(x * WAD) / y` rounded down, but without overflow and divide by zero checks.
                    function rawDivWad(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := div(mul(x, WAD), y)
                        }
                    }
                    /// @dev Equivalent to `(x * WAD) / y` rounded down, but without overflow and divide by zero checks.
                    function rawSDivWad(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := sdiv(mul(x, WAD), y)
                        }
                    }
                    /// @dev Equivalent to `(x * WAD) / y` rounded up.
                    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`.
                            if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) {
                                mstore(0x00, 0x7c5f487d) // `DivWadFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y))
                        }
                    }
                    /// @dev Equivalent to `(x * WAD) / y` rounded up, but without overflow and divide by zero checks.
                    function rawDivWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y))
                        }
                    }
                    /// @dev Equivalent to `x` to the power of `y`.
                    /// because `x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)`.
                    function powWad(int256 x, int256 y) internal pure returns (int256) {
                        // Using `ln(x)` means `x` must be greater than 0.
                        return expWad((lnWad(x) * y) / int256(WAD));
                    }
                    /// @dev Returns `exp(x)`, denominated in `WAD`.
                    /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln
                    function expWad(int256 x) internal pure returns (int256 r) {
                        unchecked {
                            // When the result is less than 0.5 we return zero.
                            // This happens when `x <= (log(1e-18) * 1e18) ~ -4.15e19`.
                            if (x <= -41446531673892822313) return r;
                            /// @solidity memory-safe-assembly
                            assembly {
                                // When the result is greater than `(2**255 - 1) / 1e18` we can not represent it as
                                // an int. This happens when `x >= floor(log((2**255 - 1) / 1e18) * 1e18) ≈ 135`.
                                if iszero(slt(x, 135305999368893231589)) {
                                    mstore(0x00, 0xa37bfec9) // `ExpOverflow()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                            // `x` is now in the range `(-42, 136) * 1e18`. Convert to `(-42, 136) * 2**96`
                            // for more intermediate precision and a binary basis. This base conversion
                            // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.
                            x = (x << 78) / 5 ** 18;
                            // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers
                            // of two such that exp(x) = exp(x') * 2**k, where k is an integer.
                            // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).
                            int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96;
                            x = x - k * 54916777467707473351141471128;
                            // `k` is in the range `[-61, 195]`.
                            // Evaluate using a (6, 7)-term rational approximation.
                            // `p` is made monic, we'll multiply by a scale factor later.
                            int256 y = x + 1346386616545796478920950773328;
                            y = ((y * x) >> 96) + 57155421227552351082224309758442;
                            int256 p = y + x - 94201549194550492254356042504812;
                            p = ((p * y) >> 96) + 28719021644029726153956944680412240;
                            p = p * x + (4385272521454847904659076985693276 << 96);
                            // We leave `p` in `2**192` basis so we don't need to scale it back up for the division.
                            int256 q = x - 2855989394907223263936484059900;
                            q = ((q * x) >> 96) + 50020603652535783019961831881945;
                            q = ((q * x) >> 96) - 533845033583426703283633433725380;
                            q = ((q * x) >> 96) + 3604857256930695427073651918091429;
                            q = ((q * x) >> 96) - 14423608567350463180887372962807573;
                            q = ((q * x) >> 96) + 26449188498355588339934803723976023;
                            /// @solidity memory-safe-assembly
                            assembly {
                                // Div in assembly because solidity adds a zero check despite the unchecked.
                                // The q polynomial won't have zeros in the domain as all its roots are complex.
                                // No scaling is necessary because p is already `2**96` too large.
                                r := sdiv(p, q)
                            }
                            // r should be in the range `(0.09, 0.25) * 2**96`.
                            // We now need to multiply r by:
                            // - The scale factor `s ≈ 6.031367120`.
                            // - The `2**k` factor from the range reduction.
                            // - The `1e18 / 2**96` factor for base conversion.
                            // We do this all at once, with an intermediate result in `2**213`
                            // basis, so the final right shift is always by a positive amount.
                            r = int256(
                                (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)
                            );
                        }
                    }
                    /// @dev Returns `ln(x)`, denominated in `WAD`.
                    /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln
                    function lnWad(int256 x) internal pure returns (int256 r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // We want to convert `x` from `10**18` fixed point to `2**96` fixed point.
                            // We do this by multiplying by `2**96 / 10**18`. But since
                            // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here
                            // and add `ln(2**96 / 10**18)` at the end.
                            // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`.
                            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
                            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
                            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
                            r := or(r, shl(4, lt(0xffff, shr(r, x))))
                            r := or(r, shl(3, lt(0xff, shr(r, x))))
                            // We place the check here for more optimal stack operations.
                            if iszero(sgt(x, 0)) {
                                mstore(0x00, 0x1615e638) // `LnWadUndefined()`.
                                revert(0x1c, 0x04)
                            }
                            // forgefmt: disable-next-item
                            r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),
                                0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff))
                            // Reduce range of x to (1, 2) * 2**96
                            // ln(2^k * x) = k * ln(2) + ln(x)
                            x := shr(159, shl(r, x))
                            // Evaluate using a (8, 8)-term rational approximation.
                            // `p` is made monic, we will multiply by a scale factor later.
                            // forgefmt: disable-next-item
                            let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir.
                                sar(96, mul(add(43456485725739037958740375743393,
                                sar(96, mul(add(24828157081833163892658089445524,
                                sar(96, mul(add(3273285459638523848632254066296,
                                    x), x))), x))), x)), 11111509109440967052023855526967)
                            p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857)
                            p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526)
                            p := sub(mul(p, x), shl(96, 795164235651350426258249787498))
                            // We leave `p` in `2**192` basis so we don't need to scale it back up for the division.
                            // `q` is monic by convention.
                            let q := add(5573035233440673466300451813936, x)
                            q := add(71694874799317883764090561454958, sar(96, mul(x, q)))
                            q := add(283447036172924575727196451306956, sar(96, mul(x, q)))
                            q := add(401686690394027663651624208769553, sar(96, mul(x, q)))
                            q := add(204048457590392012362485061816622, sar(96, mul(x, q)))
                            q := add(31853899698501571402653359427138, sar(96, mul(x, q)))
                            q := add(909429971244387300277376558375, sar(96, mul(x, q)))
                            // `p / q` is in the range `(0, 0.125) * 2**96`.
                            // Finalization, we need to:
                            // - Multiply by the scale factor `s = 5.549…`.
                            // - Add `ln(2**96 / 10**18)`.
                            // - Add `k * ln(2)`.
                            // - Multiply by `10**18 / 2**96 = 5**18 >> 78`.
                            // The q polynomial is known not to have zeros in the domain.
                            // No scaling required because p is already `2**96` too large.
                            p := sdiv(p, q)
                            // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`.
                            p := mul(1677202110996718588342820967067443963516166, p)
                            // Add `ln(2) * k * 5**18 * 2**192`.
                            // forgefmt: disable-next-item
                            p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p)
                            // Add `ln(2**96 / 10**18) * 5**18 * 2**192`.
                            p := add(600920179829731861736702779321621459595472258049074101567377883020018308, p)
                            // Base conversion: mul `2**18 / 2**192`.
                            r := sar(174, p)
                        }
                    }
                    /// @dev Returns `W_0(x)`, denominated in `WAD`.
                    /// See: https://en.wikipedia.org/wiki/Lambert_W_function
                    /// a.k.a. Product log function. This is an approximation of the principal branch.
                    function lambertW0Wad(int256 x) internal pure returns (int256 w) {
                        // forgefmt: disable-next-item
                        unchecked {
                            if ((w = x) <= -367879441171442322) revert OutOfDomain(); // `x` less than `-1/e`.
                            int256 wad = int256(WAD);
                            int256 p = x;
                            uint256 c; // Whether we need to avoid catastrophic cancellation.
                            uint256 i = 4; // Number of iterations.
                            if (w <= 0x1ffffffffffff) {
                                if (-0x4000000000000 <= w) {
                                    i = 1; // Inputs near zero only take one step to converge.
                                } else if (w <= -0x3ffffffffffffff) {
                                    i = 32; // Inputs near `-1/e` take very long to converge.
                                }
                            } else if (w >> 63 == 0) {
                                /// @solidity memory-safe-assembly
                                assembly {
                                    // Inline log2 for more performance, since the range is small.
                                    let v := shr(49, w)
                                    let l := shl(3, lt(0xff, v))
                                    l := add(or(l, byte(and(0x1f, shr(shr(l, v), 0x8421084210842108cc6318c6db6d54be)),
                                        0x0706060506020504060203020504030106050205030304010505030400000000)), 49)
                                    w := sdiv(shl(l, 7), byte(sub(l, 31), 0x0303030303030303040506080c13))
                                    c := gt(l, 60)
                                    i := add(2, add(gt(l, 53), c))
                                }
                            } else {
                                int256 ll = lnWad(w = lnWad(w));
                                /// @solidity memory-safe-assembly
                                assembly {
                                    // `w = ln(x) - ln(ln(x)) + b * ln(ln(x)) / ln(x)`.
                                    w := add(sdiv(mul(ll, 1023715080943847266), w), sub(w, ll))
                                    i := add(3, iszero(shr(68, x)))
                                    c := iszero(shr(143, x))
                                }
                                if (c == 0) {
                                    do { // If `x` is big, use Newton's so that intermediate values won't overflow.
                                        int256 e = expWad(w);
                                        /// @solidity memory-safe-assembly
                                        assembly {
                                            let t := mul(w, div(e, wad))
                                            w := sub(w, sdiv(sub(t, x), div(add(e, t), wad)))
                                        }
                                        if (p <= w) break;
                                        p = w;
                                    } while (--i != 0);
                                    /// @solidity memory-safe-assembly
                                    assembly {
                                        w := sub(w, sgt(w, 2))
                                    }
                                    return w;
                                }
                            }
                            do { // Otherwise, use Halley's for faster convergence.
                                int256 e = expWad(w);
                                /// @solidity memory-safe-assembly
                                assembly {
                                    let t := add(w, wad)
                                    let s := sub(mul(w, e), mul(x, wad))
                                    w := sub(w, sdiv(mul(s, wad), sub(mul(e, t), sdiv(mul(add(t, wad), s), add(t, t)))))
                                }
                                if (p <= w) break;
                                p = w;
                            } while (--i != c);
                            /// @solidity memory-safe-assembly
                            assembly {
                                w := sub(w, sgt(w, 2))
                            }
                            // For certain ranges of `x`, we'll use the quadratic-rate recursive formula of
                            // R. Iacono and J.P. Boyd for the last iteration, to avoid catastrophic cancellation.
                            if (c != 0) {
                                int256 t = w | 1;
                                /// @solidity memory-safe-assembly
                                assembly {
                                    x := sdiv(mul(x, wad), t)
                                }
                                x = (t * (wad + lnWad(x)));
                                /// @solidity memory-safe-assembly
                                assembly {
                                    w := sdiv(x, add(wad, t))
                                }
                            }
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                  GENERAL NUMBER UTILITIES                  */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Calculates `floor(x * y / d)` with full precision.
                    /// Throws if result overflows a uint256 or when `d` is zero.
                    /// Credit to Remco Bloemen under MIT license: https://2π.com/21/muldiv
                    function fullMulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            for {} 1 {} {
                                // 512-bit multiply `[p1 p0] = x * y`.
                                // Compute the product mod `2**256` and mod `2**256 - 1`
                                // then use the Chinese Remainder Theorem to reconstruct
                                // the 512 bit result. The result is stored in two 256
                                // variables such that `product = p1 * 2**256 + p0`.
                                // Least significant 256 bits of the product.
                                result := mul(x, y) // Temporarily use `result` as `p0` to save gas.
                                let mm := mulmod(x, y, not(0))
                                // Most significant 256 bits of the product.
                                let p1 := sub(mm, add(result, lt(mm, result)))
                                // Handle non-overflow cases, 256 by 256 division.
                                if iszero(p1) {
                                    if iszero(d) {
                                        mstore(0x00, 0xae47f702) // `FullMulDivFailed()`.
                                        revert(0x1c, 0x04)
                                    }
                                    result := div(result, d)
                                    break
                                }
                                // Make sure the result is less than `2**256`. Also prevents `d == 0`.
                                if iszero(gt(d, p1)) {
                                    mstore(0x00, 0xae47f702) // `FullMulDivFailed()`.
                                    revert(0x1c, 0x04)
                                }
                                /*------------------- 512 by 256 division --------------------*/
                                // Make division exact by subtracting the remainder from `[p1 p0]`.
                                // Compute remainder using mulmod.
                                let r := mulmod(x, y, d)
                                // `t` is the least significant bit of `d`.
                                // Always greater or equal to 1.
                                let t := and(d, sub(0, d))
                                // Divide `d` by `t`, which is a power of two.
                                d := div(d, t)
                                // Invert `d mod 2**256`
                                // Now that `d` is an odd number, it has an inverse
                                // modulo `2**256` such that `d * inv = 1 mod 2**256`.
                                // Compute the inverse by starting with a seed that is correct
                                // correct for four bits. That is, `d * inv = 1 mod 2**4`.
                                let inv := xor(2, mul(3, d))
                                // Now use Newton-Raphson iteration to improve the precision.
                                // Thanks to Hensel's lifting lemma, this also works in modular
                                // arithmetic, doubling the correct bits in each step.
                                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**8
                                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**16
                                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**32
                                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**64
                                inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**128
                                result :=
                                    mul(
                                        // Divide [p1 p0] by the factors of two.
                                        // Shift in bits from `p1` into `p0`. For this we need
                                        // to flip `t` such that it is `2**256 / t`.
                                        or(
                                            mul(sub(p1, gt(r, result)), add(div(sub(0, t), t), 1)),
                                            div(sub(result, r), t)
                                        ),
                                        // inverse mod 2**256
                                        mul(inv, sub(2, mul(d, inv)))
                                    )
                                break
                            }
                        }
                    }
                    /// @dev Calculates `floor(x * y / d)` with full precision, rounded up.
                    /// Throws if result overflows a uint256 or when `d` is zero.
                    /// Credit to Uniswap-v3-core under MIT license:
                    /// https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/FullMath.sol
                    function fullMulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 result) {
                        result = fullMulDiv(x, y, d);
                        /// @solidity memory-safe-assembly
                        assembly {
                            if mulmod(x, y, d) {
                                result := add(result, 1)
                                if iszero(result) {
                                    mstore(0x00, 0xae47f702) // `FullMulDivFailed()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                        }
                    }
                    /// @dev Returns `floor(x * y / d)`.
                    /// Reverts if `x * y` overflows, or `d` is zero.
                    function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Equivalent to require(d != 0 && (y == 0 || x <= type(uint256).max / y))
                            if iszero(mul(d, iszero(mul(y, gt(x, div(not(0), y)))))) {
                                mstore(0x00, 0xad251c27) // `MulDivFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := div(mul(x, y), d)
                        }
                    }
                    /// @dev Returns `ceil(x * y / d)`.
                    /// Reverts if `x * y` overflows, or `d` is zero.
                    function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Equivalent to require(d != 0 && (y == 0 || x <= type(uint256).max / y))
                            if iszero(mul(d, iszero(mul(y, gt(x, div(not(0), y)))))) {
                                mstore(0x00, 0xad251c27) // `MulDivFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := add(iszero(iszero(mod(mul(x, y), d))), div(mul(x, y), d))
                        }
                    }
                    /// @dev Returns `ceil(x / d)`.
                    /// Reverts if `d` is zero.
                    function divUp(uint256 x, uint256 d) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(d) {
                                mstore(0x00, 0x65244e4e) // `DivFailed()`.
                                revert(0x1c, 0x04)
                            }
                            z := add(iszero(iszero(mod(x, d))), div(x, d))
                        }
                    }
                    /// @dev Returns `max(0, x - y)`.
                    function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := mul(gt(x, y), sub(x, y))
                        }
                    }
                    /// @dev Exponentiate `x` to `y` by squaring, denominated in base `b`.
                    /// Reverts if the computation overflows.
                    function rpow(uint256 x, uint256 y, uint256 b) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := mul(b, iszero(y)) // `0 ** 0 = 1`. Otherwise, `0 ** n = 0`.
                            if x {
                                z := xor(b, mul(xor(b, x), and(y, 1))) // `z = isEven(y) ? scale : x`
                                let half := shr(1, b) // Divide `b` by 2.
                                // Divide `y` by 2 every iteration.
                                for { y := shr(1, y) } y { y := shr(1, y) } {
                                    let xx := mul(x, x) // Store x squared.
                                    let xxRound := add(xx, half) // Round to the nearest number.
                                    // Revert if `xx + half` overflowed, or if `x ** 2` overflows.
                                    if or(lt(xxRound, xx), shr(128, x)) {
                                        mstore(0x00, 0x49f7642b) // `RPowOverflow()`.
                                        revert(0x1c, 0x04)
                                    }
                                    x := div(xxRound, b) // Set `x` to scaled `xxRound`.
                                    // If `y` is odd:
                                    if and(y, 1) {
                                        let zx := mul(z, x) // Compute `z * x`.
                                        let zxRound := add(zx, half) // Round to the nearest number.
                                        // If `z * x` overflowed or `zx + half` overflowed:
                                        if or(xor(div(zx, x), z), lt(zxRound, zx)) {
                                            // Revert if `x` is non-zero.
                                            if iszero(iszero(x)) {
                                                mstore(0x00, 0x49f7642b) // `RPowOverflow()`.
                                                revert(0x1c, 0x04)
                                            }
                                        }
                                        z := div(zxRound, b) // Return properly scaled `zxRound`.
                                    }
                                }
                            }
                        }
                    }
                    /// @dev Returns the square root of `x`.
                    function sqrt(uint256 x) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`.
                            z := 181 // The "correct" value is 1, but this saves a multiplication later.
                            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad
                            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.
                            // Let `y = x / 2**r`. We check `y >= 2**(k + 8)`
                            // but shift right by `k` bits to ensure that if `x >= 256`, then `y >= 256`.
                            let r := shl(7, lt(0xffffffffffffffffffffffffffffffffff, x))
                            r := or(r, shl(6, lt(0xffffffffffffffffff, shr(r, x))))
                            r := or(r, shl(5, lt(0xffffffffff, shr(r, x))))
                            r := or(r, shl(4, lt(0xffffff, shr(r, x))))
                            z := shl(shr(1, r), z)
                            // Goal was to get `z*z*y` within a small factor of `x`. More iterations could
                            // get y in a tighter range. Currently, we will have y in `[256, 256*(2**16))`.
                            // We ensured `y >= 256` so that the relative difference between `y` and `y+1` is small.
                            // That's not possible if `x < 256` but we can just verify those cases exhaustively.
                            // Now, `z*z*y <= x < z*z*(y+1)`, and `y <= 2**(16+8)`, and either `y >= 256`, or `x < 256`.
                            // Correctness can be checked exhaustively for `x < 256`, so we assume `y >= 256`.
                            // Then `z*sqrt(y)` is within `sqrt(257)/sqrt(256)` of `sqrt(x)`, or about 20bps.
                            // For `s` in the range `[1/256, 256]`, the estimate `f(s) = (181/1024) * (s+1)`
                            // is in the range `(1/2.84 * sqrt(s), 2.84 * sqrt(s))`,
                            // with largest error when `s = 1` and when `s = 256` or `1/256`.
                            // Since `y` is in `[256, 256*(2**16))`, let `a = y/65536`, so that `a` is in `[1/256, 256)`.
                            // Then we can estimate `sqrt(y)` using
                            // `sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2**18`.
                            // There is no overflow risk here since `y < 2**136` after the first branch above.
                            z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181.
                            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.
                            z := shr(1, add(z, div(x, z)))
                            z := shr(1, add(z, div(x, z)))
                            z := shr(1, add(z, div(x, z)))
                            z := shr(1, add(z, div(x, z)))
                            z := shr(1, add(z, div(x, z)))
                            z := shr(1, add(z, div(x, z)))
                            z := shr(1, add(z, div(x, z)))
                            // If `x+1` is a perfect square, the Babylonian method cycles between
                            // `floor(sqrt(x))` and `ceil(sqrt(x))`. This statement ensures we return floor.
                            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division
                            z := sub(z, lt(div(x, z), z))
                        }
                    }
                    /// @dev Returns the cube root of `x`.
                    /// Credit to bout3fiddy and pcaversaccio under AGPLv3 license:
                    /// https://github.com/pcaversaccio/snekmate/blob/main/src/utils/Math.vy
                    function cbrt(uint256 x) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
                            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
                            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
                            r := or(r, shl(4, lt(0xffff, shr(r, x))))
                            r := or(r, shl(3, lt(0xff, shr(r, x))))
                            z := div(shl(div(r, 3), shl(lt(0xf, shr(r, x)), 0xf)), xor(7, mod(r, 3)))
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := div(add(add(div(x, mul(z, z)), z), z), 3)
                            z := sub(z, lt(div(x, mul(z, z)), z))
                        }
                    }
                    /// @dev Returns the square root of `x`, denominated in `WAD`.
                    function sqrtWad(uint256 x) internal pure returns (uint256 z) {
                        unchecked {
                            z = 10 ** 9;
                            if (x <= type(uint256).max / 10 ** 36 - 1) {
                                x *= 10 ** 18;
                                z = 1;
                            }
                            z *= sqrt(x);
                        }
                    }
                    /// @dev Returns the cube root of `x`, denominated in `WAD`.
                    function cbrtWad(uint256 x) internal pure returns (uint256 z) {
                        unchecked {
                            z = 10 ** 12;
                            if (x <= (type(uint256).max / 10 ** 36) * 10 ** 18 - 1) {
                                if (x >= type(uint256).max / 10 ** 36) {
                                    x *= 10 ** 18;
                                    z = 10 ** 6;
                                } else {
                                    x *= 10 ** 36;
                                    z = 1;
                                }
                            }
                            z *= cbrt(x);
                        }
                    }
                    /// @dev Returns the factorial of `x`.
                    function factorial(uint256 x) internal pure returns (uint256 result) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(lt(x, 58)) {
                                mstore(0x00, 0xaba0f2a2) // `FactorialOverflow()`.
                                revert(0x1c, 0x04)
                            }
                            for { result := 1 } x { x := sub(x, 1) } { result := mul(result, x) }
                        }
                    }
                    /// @dev Returns the log2 of `x`.
                    /// Equivalent to computing the index of the most significant bit (MSB) of `x`.
                    /// Returns 0 if `x` is zero.
                    function log2(uint256 x) internal pure returns (uint256 r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
                            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
                            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
                            r := or(r, shl(4, lt(0xffff, shr(r, x))))
                            r := or(r, shl(3, lt(0xff, shr(r, x))))
                            // forgefmt: disable-next-item
                            r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),
                                0x0706060506020504060203020504030106050205030304010505030400000000))
                        }
                    }
                    /// @dev Returns the log2 of `x`, rounded up.
                    /// Returns 0 if `x` is zero.
                    function log2Up(uint256 x) internal pure returns (uint256 r) {
                        r = log2(x);
                        /// @solidity memory-safe-assembly
                        assembly {
                            r := add(r, lt(shl(r, 1), x))
                        }
                    }
                    /// @dev Returns the log10 of `x`.
                    /// Returns 0 if `x` is zero.
                    function log10(uint256 x) internal pure returns (uint256 r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(lt(x, 100000000000000000000000000000000000000)) {
                                x := div(x, 100000000000000000000000000000000000000)
                                r := 38
                            }
                            if iszero(lt(x, 100000000000000000000)) {
                                x := div(x, 100000000000000000000)
                                r := add(r, 20)
                            }
                            if iszero(lt(x, 10000000000)) {
                                x := div(x, 10000000000)
                                r := add(r, 10)
                            }
                            if iszero(lt(x, 100000)) {
                                x := div(x, 100000)
                                r := add(r, 5)
                            }
                            r := add(r, add(gt(x, 9), add(gt(x, 99), add(gt(x, 999), gt(x, 9999)))))
                        }
                    }
                    /// @dev Returns the log10 of `x`, rounded up.
                    /// Returns 0 if `x` is zero.
                    function log10Up(uint256 x) internal pure returns (uint256 r) {
                        r = log10(x);
                        /// @solidity memory-safe-assembly
                        assembly {
                            r := add(r, lt(exp(10, r), x))
                        }
                    }
                    /// @dev Returns the log256 of `x`.
                    /// Returns 0 if `x` is zero.
                    function log256(uint256 x) internal pure returns (uint256 r) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
                            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
                            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
                            r := or(r, shl(4, lt(0xffff, shr(r, x))))
                            r := or(shr(3, r), lt(0xff, shr(r, x)))
                        }
                    }
                    /// @dev Returns the log256 of `x`, rounded up.
                    /// Returns 0 if `x` is zero.
                    function log256Up(uint256 x) internal pure returns (uint256 r) {
                        r = log256(x);
                        /// @solidity memory-safe-assembly
                        assembly {
                            r := add(r, lt(shl(shl(3, r), 1), x))
                        }
                    }
                    /// @dev Returns the scientific notation format `mantissa * 10 ** exponent` of `x`.
                    /// Useful for compressing prices (e.g. using 25 bit mantissa and 7 bit exponent).
                    function sci(uint256 x) internal pure returns (uint256 mantissa, uint256 exponent) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mantissa := x
                            if mantissa {
                                if iszero(mod(mantissa, 1000000000000000000000000000000000)) {
                                    mantissa := div(mantissa, 1000000000000000000000000000000000)
                                    exponent := 33
                                }
                                if iszero(mod(mantissa, 10000000000000000000)) {
                                    mantissa := div(mantissa, 10000000000000000000)
                                    exponent := add(exponent, 19)
                                }
                                if iszero(mod(mantissa, 1000000000000)) {
                                    mantissa := div(mantissa, 1000000000000)
                                    exponent := add(exponent, 12)
                                }
                                if iszero(mod(mantissa, 1000000)) {
                                    mantissa := div(mantissa, 1000000)
                                    exponent := add(exponent, 6)
                                }
                                if iszero(mod(mantissa, 10000)) {
                                    mantissa := div(mantissa, 10000)
                                    exponent := add(exponent, 4)
                                }
                                if iszero(mod(mantissa, 100)) {
                                    mantissa := div(mantissa, 100)
                                    exponent := add(exponent, 2)
                                }
                                if iszero(mod(mantissa, 10)) {
                                    mantissa := div(mantissa, 10)
                                    exponent := add(exponent, 1)
                                }
                            }
                        }
                    }
                    /// @dev Convenience function for packing `x` into a smaller number using `sci`.
                    /// The `mantissa` will be in bits [7..255] (the upper 249 bits).
                    /// The `exponent` will be in bits [0..6] (the lower 7 bits).
                    /// Use `SafeCastLib` to safely ensure that the `packed` number is small
                    /// enough to fit in the desired unsigned integer type:
                    /// ```
                    ///     uint32 packed = SafeCastLib.toUint32(FixedPointMathLib.packSci(777 ether));
                    /// ```
                    function packSci(uint256 x) internal pure returns (uint256 packed) {
                        (x, packed) = sci(x); // Reuse for `mantissa` and `exponent`.
                        /// @solidity memory-safe-assembly
                        assembly {
                            if shr(249, x) {
                                mstore(0x00, 0xce30380c) // `MantissaOverflow()`.
                                revert(0x1c, 0x04)
                            }
                            packed := or(shl(7, x), packed)
                        }
                    }
                    /// @dev Convenience function for unpacking a packed number from `packSci`.
                    function unpackSci(uint256 packed) internal pure returns (uint256 unpacked) {
                        unchecked {
                            unpacked = (packed >> 7) * 10 ** (packed & 0x7f);
                        }
                    }
                    /// @dev Returns the average of `x` and `y`.
                    function avg(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        unchecked {
                            z = (x & y) + ((x ^ y) >> 1);
                        }
                    }
                    /// @dev Returns the average of `x` and `y`.
                    function avg(int256 x, int256 y) internal pure returns (int256 z) {
                        unchecked {
                            z = (x >> 1) + (y >> 1) + (x & y & 1);
                        }
                    }
                    /// @dev Returns the absolute value of `x`.
                    function abs(int256 x) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(sub(0, shr(255, x)), add(sub(0, shr(255, x)), x))
                        }
                    }
                    /// @dev Returns the absolute distance between `x` and `y`.
                    function dist(int256 x, int256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(mul(xor(sub(y, x), sub(x, y)), sgt(x, y)), sub(y, x))
                        }
                    }
                    /// @dev Returns the minimum of `x` and `y`.
                    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(x, mul(xor(x, y), lt(y, x)))
                        }
                    }
                    /// @dev Returns the minimum of `x` and `y`.
                    function min(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(x, mul(xor(x, y), slt(y, x)))
                        }
                    }
                    /// @dev Returns the maximum of `x` and `y`.
                    function max(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(x, mul(xor(x, y), gt(y, x)))
                        }
                    }
                    /// @dev Returns the maximum of `x` and `y`.
                    function max(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(x, mul(xor(x, y), sgt(y, x)))
                        }
                    }
                    /// @dev Returns `x`, bounded to `minValue` and `maxValue`.
                    function clamp(uint256 x, uint256 minValue, uint256 maxValue)
                        internal
                        pure
                        returns (uint256 z)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(x, mul(xor(x, minValue), gt(minValue, x)))
                            z := xor(z, mul(xor(z, maxValue), lt(maxValue, z)))
                        }
                    }
                    /// @dev Returns `x`, bounded to `minValue` and `maxValue`.
                    function clamp(int256 x, int256 minValue, int256 maxValue) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := xor(x, mul(xor(x, minValue), sgt(minValue, x)))
                            z := xor(z, mul(xor(z, maxValue), slt(maxValue, z)))
                        }
                    }
                    /// @dev Returns greatest common divisor of `x` and `y`.
                    function gcd(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            for { z := x } y {} {
                                let t := y
                                y := mod(z, y)
                                z := t
                            }
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                   RAW NUMBER OPERATIONS                    */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Returns `x + y`, without checking for overflow.
                    function rawAdd(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        unchecked {
                            z = x + y;
                        }
                    }
                    /// @dev Returns `x + y`, without checking for overflow.
                    function rawAdd(int256 x, int256 y) internal pure returns (int256 z) {
                        unchecked {
                            z = x + y;
                        }
                    }
                    /// @dev Returns `x - y`, without checking for underflow.
                    function rawSub(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        unchecked {
                            z = x - y;
                        }
                    }
                    /// @dev Returns `x - y`, without checking for underflow.
                    function rawSub(int256 x, int256 y) internal pure returns (int256 z) {
                        unchecked {
                            z = x - y;
                        }
                    }
                    /// @dev Returns `x * y`, without checking for overflow.
                    function rawMul(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        unchecked {
                            z = x * y;
                        }
                    }
                    /// @dev Returns `x * y`, without checking for overflow.
                    function rawMul(int256 x, int256 y) internal pure returns (int256 z) {
                        unchecked {
                            z = x * y;
                        }
                    }
                    /// @dev Returns `x / y`, returning 0 if `y` is zero.
                    function rawDiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := div(x, y)
                        }
                    }
                    /// @dev Returns `x / y`, returning 0 if `y` is zero.
                    function rawSDiv(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := sdiv(x, y)
                        }
                    }
                    /// @dev Returns `x % y`, returning 0 if `y` is zero.
                    function rawMod(uint256 x, uint256 y) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := mod(x, y)
                        }
                    }
                    /// @dev Returns `x % y`, returning 0 if `y` is zero.
                    function rawSMod(int256 x, int256 y) internal pure returns (int256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := smod(x, y)
                        }
                    }
                    /// @dev Returns `(x + y) % d`, return 0 if `d` if zero.
                    function rawAddMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := addmod(x, y, d)
                        }
                    }
                    /// @dev Returns `(x * y) % d`, return 0 if `d` if zero.
                    function rawMulMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            z := mulmod(x, y, d)
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                pragma solidity ^0.8.4;
                /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
                /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
                /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
                /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol)
                ///
                /// @dev Note:
                /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
                /// - For ERC20s, this implementation won't check that a token has code,
                ///   responsibility is delegated to the caller.
                library SafeTransferLib {
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       CUSTOM ERRORS                        */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev The ETH transfer has failed.
                    error ETHTransferFailed();
                    /// @dev The ERC20 `transferFrom` has failed.
                    error TransferFromFailed();
                    /// @dev The ERC20 `transfer` has failed.
                    error TransferFailed();
                    /// @dev The ERC20 `approve` has failed.
                    error ApproveFailed();
                    /// @dev The Permit2 operation has failed.
                    error Permit2Failed();
                    /// @dev The Permit2 amount must be less than `2**160 - 1`.
                    error Permit2AmountOverflow();
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                         CONSTANTS                          */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
                    uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;
                    /// @dev Suggested gas stipend for contract receiving ETH to perform a few
                    /// storage reads and writes, but low enough to prevent griefing.
                    uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;
                    /// @dev The unique EIP-712 domain domain separator for the DAI token contract.
                    bytes32 internal constant DAI_DOMAIN_SEPARATOR =
                        0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;
                    /// @dev The address for the WETH9 contract on Ethereum mainnet.
                    address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
                    /// @dev The canonical Permit2 address.
                    /// [Github](https://github.com/Uniswap/permit2)
                    /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
                    address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                       ETH OPERATIONS                       */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
                    //
                    // The regular variants:
                    // - Forwards all remaining gas to the target.
                    // - Reverts if the target reverts.
                    // - Reverts if the current contract has insufficient balance.
                    //
                    // The force variants:
                    // - Forwards with an optional gas stipend
                    //   (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
                    // - If the target reverts, or if the gas stipend is exhausted,
                    //   creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
                    //   Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
                    // - Reverts if the current contract has insufficient balance.
                    //
                    // The try variants:
                    // - Forwards with a mandatory gas stipend.
                    // - Instead of reverting, returns whether the transfer succeeded.
                    /// @dev Sends `amount` (in wei) ETH to `to`.
                    function safeTransferETH(address to, uint256 amount) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
                                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Sends all the ETH in the current contract to `to`.
                    function safeTransferAllETH(address to) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // Transfer all the ETH and check if it succeeded or not.
                            if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
                    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if lt(selfbalance(), amount) {
                                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                            if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                                mstore(0x00, to) // Store the address in scratch space.
                                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
                            }
                        }
                    }
                    /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
                    function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                                mstore(0x00, to) // Store the address in scratch space.
                                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
                            }
                        }
                    }
                    /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
                    function forceSafeTransferETH(address to, uint256 amount) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            if lt(selfbalance(), amount) {
                                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                            if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                                mstore(0x00, to) // Store the address in scratch space.
                                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
                            }
                        }
                    }
                    /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
                    function forceSafeTransferAllETH(address to) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            // forgefmt: disable-next-item
                            if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                                mstore(0x00, to) // Store the address in scratch space.
                                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
                            }
                        }
                    }
                    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
                    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
                        internal
                        returns (bool success)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
                        }
                    }
                    /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
                    function trySafeTransferAllETH(address to, uint256 gasStipend)
                        internal
                        returns (bool success)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
                        }
                    }
                    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
                    /*                      ERC20 OPERATIONS                      */
                    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
                    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
                    /// Reverts upon failure.
                    ///
                    /// The `from` account must have at least `amount` approved for
                    /// the current contract to manage.
                    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let m := mload(0x40) // Cache the free memory pointer.
                            mstore(0x60, amount) // Store the `amount` argument.
                            mstore(0x40, to) // Store the `to` argument.
                            mstore(0x2c, shl(96, from)) // Store the `from` argument.
                            mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
                            // Perform the transfer, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x60, 0) // Restore the zero slot to zero.
                            mstore(0x40, m) // Restore the free memory pointer.
                        }
                    }
                    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
                    ///
                    /// The `from` account must have at least `amount` approved for the current contract to manage.
                    function trySafeTransferFrom(address token, address from, address to, uint256 amount)
                        internal
                        returns (bool success)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let m := mload(0x40) // Cache the free memory pointer.
                            mstore(0x60, amount) // Store the `amount` argument.
                            mstore(0x40, to) // Store the `to` argument.
                            mstore(0x2c, shl(96, from)) // Store the `from` argument.
                            mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
                            success :=
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                                )
                            mstore(0x60, 0) // Restore the zero slot to zero.
                            mstore(0x40, m) // Restore the free memory pointer.
                        }
                    }
                    /// @dev Sends all of ERC20 `token` from `from` to `to`.
                    /// Reverts upon failure.
                    ///
                    /// The `from` account must have their entire balance approved for the current contract to manage.
                    function safeTransferAllFrom(address token, address from, address to)
                        internal
                        returns (uint256 amount)
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let m := mload(0x40) // Cache the free memory pointer.
                            mstore(0x40, to) // Store the `to` argument.
                            mstore(0x2c, shl(96, from)) // Store the `from` argument.
                            mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
                            // Read the balance, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                                    staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
                            amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
                            // Perform the transfer, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x60, 0) // Restore the zero slot to zero.
                            mstore(0x40, m) // Restore the free memory pointer.
                        }
                    }
                    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
                    /// Reverts upon failure.
                    function safeTransfer(address token, address to, uint256 amount) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x14, to) // Store the `to` argument.
                            mstore(0x34, amount) // Store the `amount` argument.
                            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
                            // Perform the transfer, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
                        }
                    }
                    /// @dev Sends all of ERC20 `token` from the current contract to `to`.
                    /// Reverts upon failure.
                    function safeTransferAll(address token, address to) internal returns (uint256 amount) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
                            mstore(0x20, address()) // Store the address of the current contract.
                            // Read the balance, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                                    staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x14, to) // Store the `to` argument.
                            amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
                            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
                            // Perform the transfer, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
                        }
                    }
                    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
                    /// Reverts upon failure.
                    function safeApprove(address token, address to, uint256 amount) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x14, to) // Store the `to` argument.
                            mstore(0x34, amount) // Store the `amount` argument.
                            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
                            // Perform the approval, reverting upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                                )
                            ) {
                                mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                                revert(0x1c, 0x04)
                            }
                            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
                        }
                    }
                    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
                    /// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
                    /// then retries the approval again (some tokens, e.g. USDT, requires this).
                    /// Reverts upon failure.
                    function safeApproveWithRetry(address token, address to, uint256 amount) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x14, to) // Store the `to` argument.
                            mstore(0x34, amount) // Store the `amount` argument.
                            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
                            // Perform the approval, retrying upon failure.
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                                )
                            ) {
                                mstore(0x34, 0) // Store 0 for the `amount`.
                                mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
                                pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
                                mstore(0x34, amount) // Store back the original `amount`.
                                // Retry the approval, reverting upon failure.
                                if iszero(
                                    and(
                                        or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                                        call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                                    )
                                ) {
                                    mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                                    revert(0x1c, 0x04)
                                }
                            }
                            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
                        }
                    }
                    /// @dev Returns the amount of ERC20 `token` owned by `account`.
                    /// Returns zero if the `token` does not exist.
                    function balanceOf(address token, address account) internal view returns (uint256 amount) {
                        /// @solidity memory-safe-assembly
                        assembly {
                            mstore(0x14, account) // Store the `account` argument.
                            mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
                            amount :=
                                mul( // The arguments of `mul` are evaluated from right to left.
                                    mload(0x20),
                                    and( // The arguments of `and` are evaluated from right to left.
                                        gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                                        staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
                                    )
                                )
                        }
                    }
                    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
                    /// If the initial attempt fails, try to use Permit2 to transfer the token.
                    /// Reverts upon failure.
                    ///
                    /// The `from` account must have at least `amount` approved for the current contract to manage.
                    function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
                        if (!trySafeTransferFrom(token, from, to, amount)) {
                            permit2TransferFrom(token, from, to, amount);
                        }
                    }
                    /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
                    /// Reverts upon failure.
                    function permit2TransferFrom(address token, address from, address to, uint256 amount)
                        internal
                    {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let m := mload(0x40)
                            mstore(add(m, 0x74), shr(96, shl(96, token)))
                            mstore(add(m, 0x54), amount)
                            mstore(add(m, 0x34), to)
                            mstore(add(m, 0x20), shl(96, from))
                            // `transferFrom(address,address,uint160,address)`.
                            mstore(m, 0x36c78516000000000000000000000000)
                            let p := mul(PERMIT2, iszero(shr(160, amount)))
                            if iszero(mul(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), extcodesize(p)))
                            {
                                mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
                                revert(add(0x18, shl(2, iszero(p))), 0x04)
                            }
                        }
                    }
                    /// @dev Permit a user to spend a given amount of
                    /// another user's tokens via native EIP-2612 permit if possible, falling
                    /// back to Permit2 if native permit fails or is not implemented on the token.
                    function permit2(
                        address token,
                        address owner,
                        address spender,
                        uint256 amount,
                        uint256 deadline,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) internal {
                        bool success;
                        /// @solidity memory-safe-assembly
                        assembly {
                            for {} shl(96, xor(token, WETH9)) {} {
                                mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
                                if iszero(
                                    and( // The arguments of `and` are evaluated from right to left.
                                        lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
                                        // Gas stipend to limit gas burn for tokens that don't refund gas when
                                        // an non-existing function is called. 5K should be enough for a SLOAD.
                                        staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
                                    )
                                ) { break }
                                let m := mload(0x40)
                                mstore(add(m, 0x34), spender)
                                mstore(add(m, 0x20), shl(96, owner))
                                mstore(add(m, 0x74), deadline)
                                if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
                                    mstore(0x14, owner)
                                    mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
                                    mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
                                    mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
                                    // `nonces` is already at `add(m, 0x54)`.
                                    // `1` is already stored at `add(m, 0x94)`.
                                    mstore(add(m, 0xb4), and(0xff, v))
                                    mstore(add(m, 0xd4), r)
                                    mstore(add(m, 0xf4), s)
                                    success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
                                    break
                                }
                                mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
                                mstore(add(m, 0x54), amount)
                                mstore(add(m, 0x94), and(0xff, v))
                                mstore(add(m, 0xb4), r)
                                mstore(add(m, 0xd4), s)
                                success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
                                break
                            }
                        }
                        if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
                    }
                    /// @dev Simple permit on the Permit2 contract.
                    function simplePermit2(
                        address token,
                        address owner,
                        address spender,
                        uint256 amount,
                        uint256 deadline,
                        uint8 v,
                        bytes32 r,
                        bytes32 s
                    ) internal {
                        /// @solidity memory-safe-assembly
                        assembly {
                            let m := mload(0x40)
                            mstore(m, 0x927da105) // `allowance(address,address,address)`.
                            {
                                let addressMask := shr(96, not(0))
                                mstore(add(m, 0x20), and(addressMask, owner))
                                mstore(add(m, 0x40), and(addressMask, token))
                                mstore(add(m, 0x60), and(addressMask, spender))
                                mstore(add(m, 0xc0), and(addressMask, spender))
                            }
                            let p := mul(PERMIT2, iszero(shr(160, amount)))
                            if iszero(
                                and( // The arguments of `and` are evaluated from right to left.
                                    gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
                                    staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
                                )
                            ) {
                                mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
                                revert(add(0x18, shl(2, iszero(p))), 0x04)
                            }
                            mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
                            // `owner` is already `add(m, 0x20)`.
                            // `token` is already at `add(m, 0x40)`.
                            mstore(add(m, 0x60), amount)
                            mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
                            // `nonce` is already at `add(m, 0xa0)`.
                            // `spender` is already at `add(m, 0xc0)`.
                            mstore(add(m, 0xe0), deadline)
                            mstore(add(m, 0x100), 0x100) // `signature` offset.
                            mstore(add(m, 0x120), 0x41) // `signature` length.
                            mstore(add(m, 0x140), r)
                            mstore(add(m, 0x160), s)
                            mstore(add(m, 0x180), shl(248, v))
                            if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) {
                                mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
                                revert(0x1c, 0x04)
                            }
                        }
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
                pragma solidity ^0.8.20;
                import {Initializable} from "../proxy/utils/Initializable.sol";
                /**
                 * @dev Provides information about the current execution context, including the
                 * sender of the transaction and its data. While these are generally available
                 * via msg.sender and msg.data, they should not be accessed in such a direct
                 * manner, since when dealing with meta-transactions the account sending and
                 * paying for execution may not be the actual sender (as far as an application
                 * is concerned).
                 *
                 * This contract is only required for intermediate, library-like contracts.
                 */
                abstract contract ContextUpgradeable is Initializable {
                    function __Context_init() internal onlyInitializing {
                    }
                    function __Context_init_unchained() internal onlyInitializing {
                    }
                    function _msgSender() internal view virtual returns (address) {
                        return msg.sender;
                    }
                    function _msgData() internal view virtual returns (bytes calldata) {
                        return msg.data;
                    }
                    function _contextSuffixLength() internal view virtual returns (uint256) {
                        return 0;
                    }
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../token/ERC20/IERC20.sol";
                import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";
                /**
                 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
                 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
                 */
                interface IERC4626 is IERC20, IERC20Metadata {
                    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
                    event Withdraw(
                        address indexed sender,
                        address indexed receiver,
                        address indexed owner,
                        uint256 assets,
                        uint256 shares
                    );
                    /**
                     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
                     *
                     * - MUST be an ERC-20 token contract.
                     * - MUST NOT revert.
                     */
                    function asset() external view returns (address assetTokenAddress);
                    /**
                     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
                     *
                     * - SHOULD include any compounding that occurs from yield.
                     * - MUST be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT revert.
                     */
                    function totalAssets() external view returns (uint256 totalManagedAssets);
                    /**
                     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
                     * scenario where all the conditions are met.
                     *
                     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT show any variations depending on the caller.
                     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
                     * - MUST NOT revert.
                     *
                     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
                     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
                     * from.
                     */
                    function convertToShares(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
                     * scenario where all the conditions are met.
                     *
                     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
                     * - MUST NOT show any variations depending on the caller.
                     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
                     * - MUST NOT revert.
                     *
                     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
                     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
                     * from.
                     */
                    function convertToAssets(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
                     * through a deposit call.
                     *
                     * - MUST return a limited value if receiver is subject to some deposit limit.
                     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
                     * - MUST NOT revert.
                     */
                    function maxDeposit(address receiver) external view returns (uint256 maxAssets);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
                     * current on-chain conditions.
                     *
                     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
                     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
                     *   in the same transaction.
                     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
                     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
                     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
                     */
                    function previewDeposit(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
                     *
                     * - MUST emit the Deposit event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   deposit execution, and are accounted for during deposit.
                     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
                     *   approving enough underlying tokens to the Vault contract, etc).
                     *
                     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
                     */
                    function deposit(uint256 assets, address receiver) external returns (uint256 shares);
                    /**
                     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
                     * - MUST return a limited value if receiver is subject to some mint limit.
                     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
                     * - MUST NOT revert.
                     */
                    function maxMint(address receiver) external view returns (uint256 maxShares);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
                     * current on-chain conditions.
                     *
                     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
                     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
                     *   same transaction.
                     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
                     *   would be accepted, regardless if the user has enough tokens approved, etc.
                     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by minting.
                     */
                    function previewMint(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
                     *
                     * - MUST emit the Deposit event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
                     *   execution, and are accounted for during mint.
                     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
                     *   approving enough underlying tokens to the Vault contract, etc).
                     *
                     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
                     */
                    function mint(uint256 shares, address receiver) external returns (uint256 assets);
                    /**
                     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
                     * Vault, through a withdraw call.
                     *
                     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
                     * - MUST NOT revert.
                     */
                    function maxWithdraw(address owner) external view returns (uint256 maxAssets);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
                     * given current on-chain conditions.
                     *
                     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
                     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
                     *   called
                     *   in the same transaction.
                     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
                     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
                     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
                     */
                    function previewWithdraw(uint256 assets) external view returns (uint256 shares);
                    /**
                     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
                     *
                     * - MUST emit the Withdraw event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   withdraw execution, and are accounted for during withdraw.
                     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
                     *   not having enough shares, etc).
                     *
                     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
                     * Those methods should be performed separately.
                     */
                    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
                    /**
                     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
                     * through a redeem call.
                     *
                     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
                     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
                     * - MUST NOT revert.
                     */
                    function maxRedeem(address owner) external view returns (uint256 maxShares);
                    /**
                     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
                     * given current on-chain conditions.
                     *
                     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
                     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
                     *   same transaction.
                     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
                     *   redemption would be accepted, regardless if the user has enough shares, etc.
                     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
                     * - MUST NOT revert.
                     *
                     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
                     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
                     */
                    function previewRedeem(uint256 shares) external view returns (uint256 assets);
                    /**
                     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
                     *
                     * - MUST emit the Withdraw event.
                     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
                     *   redeem execution, and are accounted for during redeem.
                     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
                     *   not having enough shares, etc).
                     *
                     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
                     * Those methods should be performed separately.
                     */
                    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                import "./IVault.sol";
                import "./ILimiter.sol";
                interface IVaultSupervisor {
                    struct Signature {
                        uint8 v;
                        bytes32 r;
                        bytes32 s;
                    }
                    function getDeposits(address staker)
                        external
                        view
                        returns (IVault[] memory vaults, IERC20[] memory tokens, uint256[] memory assets, uint256[] memory shares);
                    function initialize(address _delegationSupervisor, address _vaultImpl, ILimiter _limiter, address _manager)
                        external;
                    function redeemShares(address staker, IVault vault, uint256 shares) external;
                    function removeShares(address staker, IVault vault, uint256 shares) external;
                    function deposit(IVault vault, uint256 amount) external returns (uint256);
                    function deployVault(IERC20 depositToken, string memory name, string memory symbol, IVault.AssetType assetType)
                        external
                        returns (IVault);
                    function runAdminOperation(IVault vault, bytes calldata fn) external returns (bytes memory);
                    function depositWithSignature(
                        IVault vault,
                        address user,
                        uint256 value,
                        uint256 deadline,
                        Signature calldata permit,
                        Signature calldata vaultAllowance
                    ) external returns (uint256);
                    function SIGNED_DEPOSIT_TYPEHASH() external returns (bytes32);
                    function getUserNonce(address user) external returns (uint256);
                }
                // SPDX-License-Identifier: MIT
                // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
                pragma solidity ^0.8.20;
                import {IERC20} from "../IERC20.sol";
                /**
                 * @dev Interface for the optional metadata functions from the ERC20 standard.
                 */
                interface IERC20Metadata is IERC20 {
                    /**
                     * @dev Returns the name of the token.
                     */
                    function name() external view returns (string memory);
                    /**
                     * @dev Returns the symbol of the token.
                     */
                    function symbol() external view returns (string memory);
                    /**
                     * @dev Returns the decimals places of the token.
                     */
                    function decimals() external view returns (uint8);
                }
                // SPDX-License-Identifier: SEE LICENSE IN LICENSE
                pragma solidity ^0.8.21;
                import "./IVault.sol";
                interface ILimiter {
                    function isLimitBreached(IVault[] calldata vaults) external returns (bool);
                    function setGlobalUsdLimit(uint256 _limit) external;
                    function setUsdPerEth(uint256 _usdPerEth) external;
                }