{"file_path":"src/MetaMorphoV1_1.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.26;\n\nimport {\n    MarketConfig,\n    PendingUint192,\n    PendingAddress,\n    MarketAllocation,\n    IMetaMorphoV1_1Base,\n    IMetaMorphoV1_1StaticTyping\n} from \"./interfaces/IMetaMorphoV1_1.sol\";\nimport {Id, MarketParams, Market, IMorpho} from \"../lib/morpho-blue/src/interfaces/IMorpho.sol\";\n\nimport {PendingUint192, PendingAddress, PendingLib} from \"./libraries/PendingLib.sol\";\nimport {ConstantsLib} from \"./libraries/ConstantsLib.sol\";\nimport {ErrorsLib} from \"./libraries/ErrorsLib.sol\";\nimport {EventsLib} from \"./libraries/EventsLib.sol\";\nimport {WAD} from \"../lib/morpho-blue/src/libraries/MathLib.sol\";\nimport {UtilsLib} from \"../lib/morpho-blue/src/libraries/UtilsLib.sol\";\nimport {SafeCast} from \"../lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol\";\nimport {SharesMathLib} from \"../lib/morpho-blue/src/libraries/SharesMathLib.sol\";\nimport {MorphoLib} from \"../lib/morpho-blue/src/libraries/periphery/MorphoLib.sol\";\nimport {MarketParamsLib} from \"../lib/morpho-blue/src/libraries/MarketParamsLib.sol\";\nimport {IERC20Metadata} from \"../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {MorphoBalancesLib} from \"../lib/morpho-blue/src/libraries/periphery/MorphoBalancesLib.sol\";\n\nimport {Multicall} from \"../lib/openzeppelin-contracts/contracts/utils/Multicall.sol\";\nimport {Ownable2Step, Ownable} from \"../lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol\";\nimport {ERC20Permit} from \"../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol\";\nimport {\n    IERC20,\n    IERC4626,\n    ERC20,\n    ERC4626,\n    Math,\n    SafeERC20\n} from \"../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol\";\n\n/// @title MetaMorpho\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice ERC4626 compliant vault allowing users to deposit assets to Morpho.\ncontract MetaMorphoV1_1 is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorphoV1_1StaticTyping {\n    using Math for uint256;\n    using UtilsLib for uint256;\n    using SafeCast for uint256;\n    using SafeERC20 for IERC20;\n    using MorphoLib for IMorpho;\n    using SharesMathLib for uint256;\n    using MorphoBalancesLib for IMorpho;\n    using MarketParamsLib for MarketParams;\n    using PendingLib for MarketConfig;\n    using PendingLib for PendingUint192;\n    using PendingLib for PendingAddress;\n\n    /* IMMUTABLES */\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    IMorpho public immutable MORPHO;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    uint8 public immutable DECIMALS_OFFSET;\n\n    /* STORAGE */\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    address public curator;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    mapping(address => bool) public isAllocator;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    address public guardian;\n\n    /// @inheritdoc IMetaMorphoV1_1StaticTyping\n    mapping(Id => MarketConfig) public config;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    uint256 public timelock;\n\n    /// @inheritdoc IMetaMorphoV1_1StaticTyping\n    PendingAddress public pendingGuardian;\n\n    /// @inheritdoc IMetaMorphoV1_1StaticTyping\n    mapping(Id => PendingUint192) public pendingCap;\n\n    /// @inheritdoc IMetaMorphoV1_1StaticTyping\n    PendingUint192 public pendingTimelock;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    uint96 public fee;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    address public feeRecipient;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    address public skimRecipient;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    Id[] public supplyQueue;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    Id[] public withdrawQueue;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    uint256 public lastTotalAssets;\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    uint256 public lostAssets;\n\n    /// @dev \"Overrides\" the ERC20's storage variable to be able to modify it.\n    string private _name;\n\n    /// @dev \"Overrides\" the ERC20's storage variable to be able to modify it.\n    string private _symbol;\n\n    /* CONSTRUCTOR */\n\n    /// @dev Initializes the contract.\n    /// @param owner The owner of the contract.\n    /// @param morpho The address of the Morpho contract.\n    /// @param initialTimelock The initial timelock.\n    /// @param _asset The address of the underlying asset.\n    /// @param __name The name of the vault.\n    /// @param __symbol The symbol of the vault.\n    /// @dev We pass \"\" as name and symbol to the ERC20 because these are overriden in this contract.\n    /// This means that the contract deviates slightly from the ERC2612 standard.\n    constructor(\n        address owner,\n        address morpho,\n        uint256 initialTimelock,\n        address _asset,\n        string memory __name,\n        string memory __symbol\n    ) ERC4626(IERC20(_asset)) ERC20Permit(\"\") ERC20(\"\", \"\") Ownable(owner) {\n        if (morpho == address(0)) revert ErrorsLib.ZeroAddress();\n        if (initialTimelock != 0) _checkTimelockBounds(initialTimelock);\n        _setTimelock(initialTimelock);\n\n        _name = __name;\n        emit EventsLib.SetName(__name);\n\n        _symbol = __symbol;\n        emit EventsLib.SetSymbol(__symbol);\n\n        MORPHO = IMorpho(morpho);\n        DECIMALS_OFFSET = uint8(uint256(18).zeroFloorSub(IERC20Metadata(_asset).decimals()));\n\n        IERC20(_asset).forceApprove(morpho, type(uint256).max);\n    }\n\n    /* MODIFIERS */\n\n    /// @dev Reverts if the caller doesn't have the curator role.\n    modifier onlyCuratorRole() {\n        address sender = _msgSender();\n        if (sender != curator && sender != owner()) revert ErrorsLib.NotCuratorRole();\n\n        _;\n    }\n\n    /// @dev Reverts if the caller doesn't have the allocator role.\n    modifier onlyAllocatorRole() {\n        address sender = _msgSender();\n        if (!isAllocator[sender] && sender != curator && sender != owner()) {\n            revert ErrorsLib.NotAllocatorRole();\n        }\n\n        _;\n    }\n\n    /// @dev Reverts if the caller doesn't have the guardian role.\n    modifier onlyGuardianRole() {\n        if (_msgSender() != owner() && _msgSender() != guardian) revert ErrorsLib.NotGuardianRole();\n\n        _;\n    }\n\n    /// @dev Reverts if the caller doesn't have the curator nor the guardian role.\n    modifier onlyCuratorOrGuardianRole() {\n        if (_msgSender() != guardian && _msgSender() != curator && _msgSender() != owner()) {\n            revert ErrorsLib.NotCuratorNorGuardianRole();\n        }\n\n        _;\n    }\n\n    /// @dev Makes sure conditions are met to accept a pending value.\n    /// @dev Reverts if:\n    /// - there's no pending value;\n    /// - the timelock has not elapsed since the pending value has been submitted.\n    modifier afterTimelock(uint256 validAt) {\n        if (validAt == 0) revert ErrorsLib.NoPendingValue();\n        if (block.timestamp < validAt) revert ErrorsLib.TimelockNotElapsed();\n\n        _;\n    }\n\n    /* ONLY OWNER FUNCTIONS */\n\n    function setName(string memory newName) external onlyOwner {\n        _name = newName;\n\n        emit EventsLib.SetName(newName);\n    }\n\n    function setSymbol(string memory newSymbol) external onlyOwner {\n        _symbol = newSymbol;\n\n        emit EventsLib.SetSymbol(newSymbol);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function setCurator(address newCurator) external onlyOwner {\n        if (newCurator == curator) revert ErrorsLib.AlreadySet();\n\n        curator = newCurator;\n\n        emit EventsLib.SetCurator(newCurator);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function setIsAllocator(address newAllocator, bool newIsAllocator) external onlyOwner {\n        if (isAllocator[newAllocator] == newIsAllocator) revert ErrorsLib.AlreadySet();\n\n        isAllocator[newAllocator] = newIsAllocator;\n\n        emit EventsLib.SetIsAllocator(newAllocator, newIsAllocator);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function setSkimRecipient(address newSkimRecipient) external onlyOwner {\n        if (newSkimRecipient == skimRecipient) revert ErrorsLib.AlreadySet();\n\n        skimRecipient = newSkimRecipient;\n\n        emit EventsLib.SetSkimRecipient(newSkimRecipient);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function submitTimelock(uint256 newTimelock) external onlyOwner {\n        if (newTimelock == timelock) revert ErrorsLib.AlreadySet();\n        if (pendingTimelock.validAt != 0) revert ErrorsLib.AlreadyPending();\n        _checkTimelockBounds(newTimelock);\n\n        if (newTimelock > timelock) {\n            _setTimelock(newTimelock);\n        } else {\n            // Safe \"unchecked\" cast because newTimelock <= MAX_TIMELOCK.\n            pendingTimelock.update(uint184(newTimelock), timelock);\n\n            emit EventsLib.SubmitTimelock(newTimelock);\n        }\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function setFee(uint256 newFee) external onlyOwner {\n        if (newFee == fee) revert ErrorsLib.AlreadySet();\n        if (newFee > ConstantsLib.MAX_FEE) revert ErrorsLib.MaxFeeExceeded();\n        if (newFee != 0 && feeRecipient == address(0)) revert ErrorsLib.ZeroFeeRecipient();\n\n        // Accrue interest and fee using the previous fee set before changing it.\n        _accrueInterest();\n\n        // Safe \"unchecked\" cast because newFee <= MAX_FEE.\n        fee = uint96(newFee);\n\n        emit EventsLib.SetFee(_msgSender(), fee);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function setFeeRecipient(address newFeeRecipient) external onlyOwner {\n        if (newFeeRecipient == feeRecipient) revert ErrorsLib.AlreadySet();\n        if (newFeeRecipient == address(0) && fee != 0) revert ErrorsLib.ZeroFeeRecipient();\n\n        // Accrue interest and fee to the previous fee recipient set before changing it.\n        _accrueInterest();\n\n        feeRecipient = newFeeRecipient;\n\n        emit EventsLib.SetFeeRecipient(newFeeRecipient);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function submitGuardian(address newGuardian) external onlyOwner {\n        if (newGuardian == guardian) revert ErrorsLib.AlreadySet();\n        if (pendingGuardian.validAt != 0) revert ErrorsLib.AlreadyPending();\n\n        if (guardian == address(0)) {\n            _setGuardian(newGuardian);\n        } else {\n            pendingGuardian.update(newGuardian, timelock);\n\n            emit EventsLib.SubmitGuardian(newGuardian);\n        }\n    }\n\n    /* ONLY CURATOR FUNCTIONS */\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function submitCap(MarketParams memory marketParams, uint256 newSupplyCap) external onlyCuratorRole {\n        Id id = marketParams.id();\n        if (marketParams.loanToken != asset()) revert ErrorsLib.InconsistentAsset(id);\n        if (MORPHO.lastUpdate(id) == 0) revert ErrorsLib.MarketNotCreated();\n        if (pendingCap[id].validAt != 0) revert ErrorsLib.AlreadyPending();\n        if (config[id].removableAt != 0) revert ErrorsLib.PendingRemoval();\n        uint256 supplyCap = config[id].cap;\n        if (newSupplyCap == supplyCap) revert ErrorsLib.AlreadySet();\n\n        if (newSupplyCap < supplyCap) {\n            _setCap(marketParams, id, newSupplyCap.toUint184());\n        } else {\n            pendingCap[id].update(newSupplyCap.toUint184(), timelock);\n\n            emit EventsLib.SubmitCap(_msgSender(), id, newSupplyCap);\n        }\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function submitMarketRemoval(MarketParams memory marketParams) external onlyCuratorRole {\n        Id id = marketParams.id();\n        if (config[id].removableAt != 0) revert ErrorsLib.AlreadyPending();\n        if (config[id].cap != 0) revert ErrorsLib.NonZeroCap();\n        if (!config[id].enabled) revert ErrorsLib.MarketNotEnabled(id);\n        if (pendingCap[id].validAt != 0) revert ErrorsLib.PendingCap(id);\n\n        // Safe \"unchecked\" cast because timelock <= MAX_TIMELOCK.\n        config[id].removableAt = uint64(block.timestamp + timelock);\n\n        emit EventsLib.SubmitMarketRemoval(_msgSender(), id);\n    }\n\n    /* ONLY ALLOCATOR FUNCTIONS */\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function setSupplyQueue(Id[] calldata newSupplyQueue) external onlyAllocatorRole {\n        uint256 length = newSupplyQueue.length;\n\n        if (length > ConstantsLib.MAX_QUEUE_LENGTH) revert ErrorsLib.MaxQueueLengthExceeded();\n\n        for (uint256 i; i < length; ++i) {\n            if (config[newSupplyQueue[i]].cap == 0) revert ErrorsLib.UnauthorizedMarket(newSupplyQueue[i]);\n        }\n\n        supplyQueue = newSupplyQueue;\n\n        emit EventsLib.SetSupplyQueue(_msgSender(), newSupplyQueue);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function updateWithdrawQueue(uint256[] calldata indexes) external onlyAllocatorRole {\n        uint256 newLength = indexes.length;\n        uint256 currLength = withdrawQueue.length;\n\n        bool[] memory seen = new bool[](currLength);\n        Id[] memory newWithdrawQueue = new Id[](newLength);\n\n        for (uint256 i; i < newLength; ++i) {\n            uint256 prevIndex = indexes[i];\n\n            // If prevIndex >= currLength, it will revert with native \"Index out of bounds\".\n            Id id = withdrawQueue[prevIndex];\n            if (seen[prevIndex]) revert ErrorsLib.DuplicateMarket(id);\n            seen[prevIndex] = true;\n\n            newWithdrawQueue[i] = id;\n        }\n\n        for (uint256 i; i < currLength; ++i) {\n            if (!seen[i]) {\n                Id id = withdrawQueue[i];\n\n                if (config[id].cap != 0) revert ErrorsLib.InvalidMarketRemovalNonZeroCap(id);\n                if (pendingCap[id].validAt != 0) revert ErrorsLib.PendingCap(id);\n\n                if (MORPHO.supplyShares(id, address(this)) != 0) {\n                    if (config[id].removableAt == 0) revert ErrorsLib.InvalidMarketRemovalNonZeroSupply(id);\n\n                    if (block.timestamp < config[id].removableAt) {\n                        revert ErrorsLib.InvalidMarketRemovalTimelockNotElapsed(id);\n                    }\n                }\n\n                delete config[id];\n            }\n        }\n\n        withdrawQueue = newWithdrawQueue;\n\n        emit EventsLib.SetWithdrawQueue(_msgSender(), newWithdrawQueue);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function reallocate(MarketAllocation[] calldata allocations) external onlyAllocatorRole {\n        uint256 totalSupplied;\n        uint256 totalWithdrawn;\n        for (uint256 i; i < allocations.length; ++i) {\n            MarketAllocation memory allocation = allocations[i];\n            Id id = allocation.marketParams.id();\n            if (!config[id].enabled) revert ErrorsLib.MarketNotEnabled(id);\n\n            (uint256 supplyAssets, uint256 supplyShares,) = _accruedSupplyBalance(allocation.marketParams, id);\n            uint256 withdrawn = supplyAssets.zeroFloorSub(allocation.assets);\n\n            if (withdrawn > 0) {\n                // Guarantees that unknown frontrunning donations can be withdrawn, in order to disable a market.\n                uint256 shares;\n                if (allocation.assets == 0) {\n                    shares = supplyShares;\n                    withdrawn = 0;\n                }\n\n                (uint256 withdrawnAssets, uint256 withdrawnShares) =\n                    MORPHO.withdraw(allocation.marketParams, withdrawn, shares, address(this), address(this));\n\n                emit EventsLib.ReallocateWithdraw(_msgSender(), id, withdrawnAssets, withdrawnShares);\n\n                totalWithdrawn += withdrawnAssets;\n            } else {\n                uint256 suppliedAssets = allocation.assets == type(uint256).max\n                    ? totalWithdrawn.zeroFloorSub(totalSupplied)\n                    : allocation.assets.zeroFloorSub(supplyAssets);\n\n                if (suppliedAssets == 0) continue;\n\n                uint256 supplyCap = config[id].cap;\n                if (supplyAssets + suppliedAssets > supplyCap) revert ErrorsLib.SupplyCapExceeded(id);\n\n                // The market's loan asset is guaranteed to be the vault's asset because it has a non-zero supply cap.\n                (, uint256 suppliedShares) =\n                    MORPHO.supply(allocation.marketParams, suppliedAssets, 0, address(this), hex\"\");\n\n                emit EventsLib.ReallocateSupply(_msgSender(), id, suppliedAssets, suppliedShares);\n\n                totalSupplied += suppliedAssets;\n            }\n        }\n\n        if (totalWithdrawn != totalSupplied) revert ErrorsLib.InconsistentReallocation();\n    }\n\n    /* REVOKE FUNCTIONS */\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function revokePendingTimelock() external onlyGuardianRole {\n        delete pendingTimelock;\n\n        emit EventsLib.RevokePendingTimelock(_msgSender());\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function revokePendingGuardian() external onlyGuardianRole {\n        delete pendingGuardian;\n\n        emit EventsLib.RevokePendingGuardian(_msgSender());\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function revokePendingCap(Id id) external onlyCuratorOrGuardianRole {\n        delete pendingCap[id];\n\n        emit EventsLib.RevokePendingCap(_msgSender(), id);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function revokePendingMarketRemoval(Id id) external onlyCuratorOrGuardianRole {\n        delete config[id].removableAt;\n\n        emit EventsLib.RevokePendingMarketRemoval(_msgSender(), id);\n    }\n\n    /* EXTERNAL */\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function supplyQueueLength() external view returns (uint256) {\n        return supplyQueue.length;\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function withdrawQueueLength() external view returns (uint256) {\n        return withdrawQueue.length;\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function acceptTimelock() external afterTimelock(pendingTimelock.validAt) {\n        _setTimelock(pendingTimelock.value);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function acceptGuardian() external afterTimelock(pendingGuardian.validAt) {\n        _setGuardian(pendingGuardian.value);\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function acceptCap(MarketParams memory marketParams)\n        external\n        afterTimelock(pendingCap[marketParams.id()].validAt)\n    {\n        Id id = marketParams.id();\n\n        // Safe \"unchecked\" cast because pendingCap <= type(uint184).max.\n        _setCap(marketParams, id, uint184(pendingCap[id].value));\n    }\n\n    /// @inheritdoc IMetaMorphoV1_1Base\n    function skim(address token) external {\n        if (skimRecipient == address(0)) revert ErrorsLib.ZeroAddress();\n\n        uint256 amount = IERC20(token).balanceOf(address(this));\n\n        IERC20(token).safeTransfer(skimRecipient, amount);\n\n        emit EventsLib.Skim(_msgSender(), token, amount);\n    }\n\n    /* ERC4626 (PUBLIC) */\n\n    /// @inheritdoc IERC20Metadata\n    function decimals() public view override(ERC20, ERC4626) returns (uint8) {\n        return ERC4626.decimals();\n    }\n\n    function name() public view override(IERC20Metadata, ERC20) returns (string memory) {\n        return _name;\n    }\n\n    function symbol() public view override(IERC20Metadata, ERC20) returns (string memory) {\n        return _symbol;\n    }\n\n    /// @inheritdoc IERC4626\n    /// @dev Warning: May be higher than the actual max deposit due to duplicate markets in the supplyQueue.\n    function maxDeposit(address) public view override returns (uint256) {\n        return _maxDeposit();\n    }\n\n    /// @inheritdoc IERC4626\n    /// @dev Warning: May be higher than the actual max mint due to duplicate markets in the supplyQueue.\n    function maxMint(address) public view override returns (uint256) {\n        uint256 suppliable = _maxDeposit();\n\n        return _convertToShares(suppliable, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    /// @dev Warning: May be lower than the actual amount of assets that can be withdrawn by `owner` due to conversion\n    /// roundings between shares and assets.\n    function maxWithdraw(address owner) public view override returns (uint256 assets) {\n        (assets,,) = _maxWithdraw(owner);\n    }\n\n    /// @inheritdoc IERC4626\n    /// @dev Warning: May be lower than the actual amount of shares that can be redeemed by `owner` due to conversion\n    /// roundings between shares and assets.\n    function maxRedeem(address owner) public view override returns (uint256) {\n        (uint256 assets, uint256 newTotalSupply, uint256 newTotalAssets) = _maxWithdraw(owner);\n\n        return _convertToSharesWithTotals(assets, newTotalSupply, newTotalAssets, Math.Rounding.Floor);\n    }\n\n    /// @inheritdoc IERC4626\n    /// @notice For tokens with 18 decimals, the protection against the inflation front-running attack is low. To\n    /// protect against this attack, vault deployers should make an initial deposit of a non-trivial amount in the vault\n    /// or depositors should check that the share price does not exceed a certain limit.\n    function deposit(uint256 assets, address receiver) public override returns (uint256 shares) {\n        _accrueInterest();\n\n        shares = _convertToSharesWithTotals(assets, totalSupply(), lastTotalAssets, Math.Rounding.Floor);\n\n        _deposit(_msgSender(), receiver, assets, shares);\n    }\n\n    /// @inheritdoc IERC4626\n    function mint(uint256 shares, address receiver) public override returns (uint256 assets) {\n        _accrueInterest();\n\n        assets = _convertToAssetsWithTotals(shares, totalSupply(), lastTotalAssets, Math.Rounding.Ceil);\n\n        _deposit(_msgSender(), receiver, assets, shares);\n    }\n\n    /// @inheritdoc IERC4626\n    function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {\n        _accrueInterest();\n\n        // Do not call expensive `maxWithdraw` and optimistically withdraw assets.\n\n        shares = _convertToSharesWithTotals(assets, totalSupply(), lastTotalAssets, Math.Rounding.Ceil);\n\n        _withdraw(_msgSender(), receiver, owner, assets, shares);\n    }\n\n    /// @inheritdoc IERC4626\n    function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {\n        _accrueInterest();\n\n        // Do not call expensive `maxRedeem` and optimistically redeem shares.\n\n        assets = _convertToAssetsWithTotals(shares, totalSupply(), lastTotalAssets, Math.Rounding.Floor);\n\n        _withdraw(_msgSender(), receiver, owner, assets, shares);\n    }\n\n    /// @inheritdoc IERC4626\n    /// @dev totalAssets is the sum of the vault's assets on the Morpho markets plus the lost assets (see corresponding\n    /// docs in IMetaMorphoV1_1.sol).\n    function totalAssets() public view override returns (uint256) {\n        (, uint256 newTotalAssets,) = _accruedFeeAndAssets();\n\n        return newTotalAssets;\n    }\n\n    /* ERC4626 (INTERNAL) */\n\n    /// @inheritdoc ERC4626\n    function _decimalsOffset() internal view override returns (uint8) {\n        return DECIMALS_OFFSET;\n    }\n\n    /// @dev Returns the maximum amount of asset (`assets`) that the `owner` can withdraw from the vault, as well as the\n    /// new vault's total supply (`newTotalSupply`) and total assets (`newTotalAssets`).\n    function _maxWithdraw(address owner)\n        internal\n        view\n        returns (uint256 assets, uint256 newTotalSupply, uint256 newTotalAssets)\n    {\n        uint256 feeShares;\n        (feeShares, newTotalAssets,) = _accruedFeeAndAssets();\n        newTotalSupply = totalSupply() + feeShares;\n\n        assets = _convertToAssetsWithTotals(balanceOf(owner), newTotalSupply, newTotalAssets, Math.Rounding.Floor);\n        assets -= _simulateWithdrawMorpho(assets);\n    }\n\n    /// @dev Returns the maximum amount of assets that the vault can supply on Morpho.\n    function _maxDeposit() internal view returns (uint256 totalSuppliable) {\n        for (uint256 i; i < supplyQueue.length; ++i) {\n            Id id = supplyQueue[i];\n\n            uint256 supplyCap = config[id].cap;\n            if (supplyCap == 0) continue;\n\n            uint256 supplyShares = MORPHO.supplyShares(id, address(this));\n            (uint256 totalSupplyAssets, uint256 totalSupplyShares,,) = MORPHO.expectedMarketBalances(_marketParams(id));\n            // `supplyAssets` needs to be rounded up for `totalSuppliable` to be rounded down.\n            uint256 supplyAssets = supplyShares.toAssetsUp(totalSupplyAssets, totalSupplyShares);\n\n            totalSuppliable += supplyCap.zeroFloorSub(supplyAssets);\n        }\n    }\n\n    /// @inheritdoc ERC4626\n    /// @dev The accrual of performance fees is taken into account in the conversion.\n    function _convertToShares(uint256 assets, Math.Rounding rounding) internal view override returns (uint256) {\n        (uint256 feeShares, uint256 newTotalAssets,) = _accruedFeeAndAssets();\n\n        return _convertToSharesWithTotals(assets, totalSupply() + feeShares, newTotalAssets, rounding);\n    }\n\n    /// @inheritdoc ERC4626\n    /// @dev The accrual of performance fees is taken into account in the conversion.\n    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view override returns (uint256) {\n        (uint256 feeShares, uint256 newTotalAssets,) = _accruedFeeAndAssets();\n\n        return _convertToAssetsWithTotals(shares, totalSupply() + feeShares, newTotalAssets, rounding);\n    }\n\n    /// @dev Returns the amount of shares that the vault would exchange for the amount of `assets` provided.\n    /// @dev It assumes that the arguments `newTotalSupply` and `newTotalAssets` are up to date.\n    function _convertToSharesWithTotals(\n        uint256 assets,\n        uint256 newTotalSupply,\n        uint256 newTotalAssets,\n        Math.Rounding rounding\n    ) internal view returns (uint256) {\n        return assets.mulDiv(newTotalSupply + 10 ** _decimalsOffset(), newTotalAssets + 1, rounding);\n    }\n\n    /// @dev Returns the amount of assets that the vault would exchange for the amount of `shares` provided.\n    /// @dev It assumes that the arguments `newTotalSupply` and `newTotalAssets` are up to date.\n    function _convertToAssetsWithTotals(\n        uint256 shares,\n        uint256 newTotalSupply,\n        uint256 newTotalAssets,\n        Math.Rounding rounding\n    ) internal view returns (uint256) {\n        return shares.mulDiv(newTotalAssets + 1, newTotalSupply + 10 ** _decimalsOffset(), rounding);\n    }\n\n    /// @inheritdoc ERC4626\n    /// @dev Used in mint or deposit to deposit the underlying asset to Morpho markets.\n    function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal override {\n        super._deposit(caller, receiver, assets, shares);\n\n        _supplyMorpho(assets);\n\n        // `lastTotalAssets + assets` may be a little above `totalAssets()`.\n        // This can lead to a small accrual of `lostAssets` at the next interaction.\n        _updateLastTotalAssets(lastTotalAssets + assets);\n    }\n\n    /// @inheritdoc ERC4626\n    /// @dev Used in redeem or withdraw to withdraw the underlying asset from Morpho markets.\n    /// @dev Depending on 3 cases, reverts when withdrawing \"too much\" with:\n    /// 1. NotEnoughLiquidity when withdrawing more than available liquidity.\n    /// 2. ERC20InsufficientAllowance when withdrawing more than `caller`'s allowance.\n    /// 3. ERC20InsufficientBalance when withdrawing more than `owner`'s balance.\n    function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares)\n        internal\n        override\n    {\n        // `lastTotalAssets - assets` may be a little above `totalAssets()`.\n        // This can lead to a small accrual of `lostAssets` at the next interaction.\n        // clamp at 0 so the error raised is the more informative NotEnoughLiquidity.\n        _updateLastTotalAssets(lastTotalAssets.zeroFloorSub(assets));\n\n        _withdrawMorpho(assets);\n\n        super._withdraw(caller, receiver, owner, assets, shares);\n    }\n\n    /* INTERNAL */\n\n    /// @dev Returns the market params of the market defined by `id`.\n    function _marketParams(Id id) internal view returns (MarketParams memory) {\n        return MORPHO.idToMarketParams(id);\n    }\n\n    /// @dev Accrues interest on Morpho Blue and returns the vault's assets & corresponding shares supplied on the\n    /// market defined by `marketParams`, as well as the market's state.\n    /// @dev Assumes that the inputs `marketParams` and `id` match.\n    function _accruedSupplyBalance(MarketParams memory marketParams, Id id)\n        internal\n        returns (uint256 assets, uint256 shares, Market memory market)\n    {\n        MORPHO.accrueInterest(marketParams);\n\n        market = MORPHO.market(id);\n        shares = MORPHO.supplyShares(id, address(this));\n        assets = shares.toAssetsDown(market.totalSupplyAssets, market.totalSupplyShares);\n    }\n\n    /// @dev Reverts if `newTimelock` is not within the bounds.\n    function _checkTimelockBounds(uint256 newTimelock) internal pure {\n        if (newTimelock > ConstantsLib.MAX_TIMELOCK) revert ErrorsLib.AboveMaxTimelock();\n        if (newTimelock < ConstantsLib.POST_INITIALIZATION_MIN_TIMELOCK) revert ErrorsLib.BelowMinTimelock();\n    }\n\n    /// @dev Sets `timelock` to `newTimelock`.\n    function _setTimelock(uint256 newTimelock) internal {\n        timelock = newTimelock;\n\n        emit EventsLib.SetTimelock(_msgSender(), newTimelock);\n\n        delete pendingTimelock;\n    }\n\n    /// @dev Sets `guardian` to `newGuardian`.\n    function _setGuardian(address newGuardian) internal {\n        guardian = newGuardian;\n\n        emit EventsLib.SetGuardian(_msgSender(), newGuardian);\n\n        delete pendingGuardian;\n    }\n\n    /// @dev Sets the cap of the market defined by `id` to `supplyCap`.\n    /// @dev Assumes that the inputs `marketParams` and `id` match.\n    function _setCap(MarketParams memory marketParams, Id id, uint184 supplyCap) internal {\n        MarketConfig storage marketConfig = config[id];\n\n        if (supplyCap > 0) {\n            if (!marketConfig.enabled) {\n                withdrawQueue.push(id);\n\n                if (withdrawQueue.length > ConstantsLib.MAX_QUEUE_LENGTH) revert ErrorsLib.MaxQueueLengthExceeded();\n\n                marketConfig.enabled = true;\n\n                // Take into account assets of the new market without applying a fee.\n                _updateLastTotalAssets(lastTotalAssets + MORPHO.expectedSupplyAssets(marketParams, address(this)));\n\n                emit EventsLib.SetWithdrawQueue(msg.sender, withdrawQueue);\n            }\n\n            marketConfig.removableAt = 0;\n        }\n\n        marketConfig.cap = supplyCap;\n\n        emit EventsLib.SetCap(_msgSender(), id, supplyCap);\n\n        delete pendingCap[id];\n    }\n\n    /* LIQUIDITY ALLOCATION */\n\n    /// @dev Supplies `assets` to Morpho.\n    function _supplyMorpho(uint256 assets) internal {\n        for (uint256 i; i < supplyQueue.length; ++i) {\n            Id id = supplyQueue[i];\n\n            uint256 supplyCap = config[id].cap;\n            if (supplyCap == 0) continue;\n\n            MarketParams memory marketParams = _marketParams(id);\n\n            MORPHO.accrueInterest(marketParams);\n\n            Market memory market = MORPHO.market(id);\n            uint256 supplyShares = MORPHO.supplyShares(id, address(this));\n            // `supplyAssets` needs to be rounded up for `toSupply` to be rounded down.\n            uint256 supplyAssets = supplyShares.toAssetsUp(market.totalSupplyAssets, market.totalSupplyShares);\n\n            uint256 toSupply = UtilsLib.min(supplyCap.zeroFloorSub(supplyAssets), assets);\n\n            if (toSupply > 0) {\n                // Using try/catch to skip markets that revert.\n                try MORPHO.supply(marketParams, toSupply, 0, address(this), hex\"\") {\n                    assets -= toSupply;\n                } catch {}\n            }\n\n            if (assets == 0) return;\n        }\n\n        if (assets != 0) revert ErrorsLib.AllCapsReached();\n    }\n\n    /// @dev Withdraws `assets` from Morpho.\n    function _withdrawMorpho(uint256 assets) internal {\n        for (uint256 i; i < withdrawQueue.length; ++i) {\n            Id id = withdrawQueue[i];\n            MarketParams memory marketParams = _marketParams(id);\n            (uint256 supplyAssets,, Market memory market) = _accruedSupplyBalance(marketParams, id);\n\n            uint256 toWithdraw = UtilsLib.min(\n                _withdrawable(marketParams, market.totalSupplyAssets, market.totalBorrowAssets, supplyAssets), assets\n            );\n\n            if (toWithdraw > 0) {\n                // Using try/catch to skip markets that revert.\n                try MORPHO.withdraw(marketParams, toWithdraw, 0, address(this), address(this)) {\n                    assets -= toWithdraw;\n                } catch {}\n            }\n\n            if (assets == 0) return;\n        }\n\n        if (assets != 0) revert ErrorsLib.NotEnoughLiquidity();\n    }\n\n    /// @dev Simulates a withdraw of `assets` from Morpho.\n    /// @return The remaining assets to be withdrawn.\n    function _simulateWithdrawMorpho(uint256 assets) internal view returns (uint256) {\n        for (uint256 i; i < withdrawQueue.length; ++i) {\n            Id id = withdrawQueue[i];\n            MarketParams memory marketParams = _marketParams(id);\n\n            uint256 supplyShares = MORPHO.supplyShares(id, address(this));\n            (uint256 totalSupplyAssets, uint256 totalSupplyShares, uint256 totalBorrowAssets,) =\n                MORPHO.expectedMarketBalances(marketParams);\n\n            // The vault withdrawing from Morpho cannot fail because:\n            // 1. oracle.price() is never called (the vault doesn't borrow)\n            // 2. the amount is capped to the liquidity available on Morpho\n            // 3. virtually accruing interest didn't fail\n            assets = assets.zeroFloorSub(\n                _withdrawable(\n                    marketParams,\n                    totalSupplyAssets,\n                    totalBorrowAssets,\n                    supplyShares.toAssetsDown(totalSupplyAssets, totalSupplyShares)\n                )\n            );\n\n            if (assets == 0) break;\n        }\n\n        return assets;\n    }\n\n    /// @dev Returns the withdrawable amount of assets from the market defined by `marketParams`, given the market's\n    /// total supply and borrow assets and the vault's assets supplied.\n    function _withdrawable(\n        MarketParams memory marketParams,\n        uint256 totalSupplyAssets,\n        uint256 totalBorrowAssets,\n        uint256 supplyAssets\n    ) internal view returns (uint256) {\n        // Inside a flashloan callback, liquidity on Morpho Blue may be limited to the singleton's balance.\n        uint256 availableLiquidity = UtilsLib.min(\n            totalSupplyAssets - totalBorrowAssets, ERC20(marketParams.loanToken).balanceOf(address(MORPHO))\n        );\n\n        return UtilsLib.min(supplyAssets, availableLiquidity);\n    }\n\n    /* FEE MANAGEMENT */\n\n    /// @dev Updates `lastTotalAssets` to `updatedTotalAssets`.\n    function _updateLastTotalAssets(uint256 updatedTotalAssets) internal {\n        lastTotalAssets = updatedTotalAssets;\n\n        emit EventsLib.UpdateLastTotalAssets(updatedTotalAssets);\n    }\n\n    /// @dev Accrues `lastTotalAssets`, `lostAssets` and mints the fee shares to the fee recipient.\n    function _accrueInterest() internal {\n        (uint256 feeShares, uint256 newTotalAssets, uint256 newLostAssets) = _accruedFeeAndAssets();\n\n        _updateLastTotalAssets(newTotalAssets);\n        lostAssets = newLostAssets;\n        emit EventsLib.UpdateLostAssets(newLostAssets);\n\n        if (feeShares != 0) _mint(feeRecipient, feeShares);\n\n        emit EventsLib.AccrueInterest(newTotalAssets, feeShares);\n    }\n\n    /// @dev Computes and returns the `feeShares` to mint, the new `totalAssets` and the new `lostAssets`.\n    /// @return feeShares the shares to mint to `feeRecipient`.\n    /// @return newTotalAssets the new `totalAssets`.\n    /// @return newLostAssets the new lostAssets.\n    function _accruedFeeAndAssets()\n        internal\n        view\n        returns (uint256 feeShares, uint256 newTotalAssets, uint256 newLostAssets)\n    {\n        // The assets that the vault has on Morpho.\n        uint256 realTotalAssets;\n        for (uint256 i; i < withdrawQueue.length; ++i) {\n            realTotalAssets += MORPHO.expectedSupplyAssets(_marketParams(withdrawQueue[i]), address(this));\n        }\n\n        // If the vault lost some assets (realTotalAssets decreased), lostAssets is increased.\n        if (realTotalAssets < lastTotalAssets - lostAssets) newLostAssets = lastTotalAssets - realTotalAssets;\n        // If it did not, lostAssets stays the same.\n        else newLostAssets = lostAssets;\n\n        newTotalAssets = realTotalAssets + newLostAssets;\n        uint256 totalInterest = newTotalAssets - lastTotalAssets;\n        if (totalInterest != 0 && fee != 0) {\n            // It is acknowledged that `feeAssets` may be rounded down to 0 if `totalInterest * fee < WAD`.\n            uint256 feeAssets = totalInterest.mulDiv(fee, WAD);\n            // The fee assets is subtracted from the total assets in this calculation to compensate for the fact\n            // that total assets is already increased by the total interest (including the fee assets).\n            feeShares =\n                _convertToSharesWithTotals(feeAssets, totalSupply(), newTotalAssets - feeAssets, Math.Rounding.Floor);\n        }\n    }\n}\n","deployed_bytecode":"0x60806040526004361015610011575f80fd5b5f3560e01c806301e1d11414612aff57806306fdde0314612a6d57806307a2d13a14611ded578063095ea7b314612a475780630a28a47714612a1e578063102f7b6c1461298d57806318160ddd146129705780631ecca77c1461290757806321cb4b14146128ea57806323b872dd146128b25780632acc56f9146126bc5780632b30997b1461264f578063313ce567146125e057806333f91ebb146125c35780633644e515146125a9578063388af5b51461258157806338d52e0f1461253d5780633acb5624146124f95780633b24c2bf14612270578063402d267d1461224c57806341b6783314611ee7578063452a932014611ebf5780634690484014611e9f5780634b998de514611df25780634cdad50614611ded5780634dedf20e14611db0578063568efc0714611d9357806362518ddf14611d6a57806369fe0e2d14611cb05780636e553f6514611c6e5780636fda386814611c1257806370a0823114611bdb578063715018a614611b765780637224a51214611a8c5780637299aa3114611683578063762c31ba1461164957806379ba5097146115c35780637cc4d9a1146115925780637ecebe001461155a57806384755b5f1461140357806384b0196e1461130b5780638a2c7b39146112d65780638da5cb5b146112ae57806394bf804d1461126c57806395d89b41146111b55780639d6b4a45146110da578063a17b3130146110bd578063a31be5d614611076578063a5f31d611461101a578063a9059cbb14610fe9578063ac9650d814610e84578063aea70acc14610e47578063b192a84a14610dae578063b3d7f6b914610d7a578063b460af9414610d44578063b84c824614610ba1578063ba08765214610b6a578063bc25cf7714610a7d578063c47f0027146108c0578063c63d75b61461087d578063c6e6f59214610405578063c9649aa914610805578063cc718f76146107bc578063ce96cb7714610794578063d33219b414610777578063d505accf14610632578063d905777e146105fe578063dd62ed3e146105ae578063ddca3f4314610588578063e30c397814610560578063e66f53b714610538578063e74b981b14610486578063e90956cf1461040a578063ef8b30f714610405578063f2fde38b146103995763f7d185211461035d575f80fd5b346103955760203660031901126103955760043560145481101561039557610386602091612ce5565b90549060031b1c604051908152f35b5f80fd5b34610395576020366003190112610395576103b2612b71565b6103ba61324b565b600980546001600160a01b0319166001600160a01b039283169081179091556008549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227005f80a3005b612dc6565b3461039557602036600319011261039557610423612b71565b61042b61324b565b600a546001600160a01b039182169181168214610477576001600160a01b0319168117600a557fbd0a63c12948fbc9194a5839019f99c9d71db924e5c70018265bc778b8f1a5065f80a2005b63a741a04560e01b5f5260045ffd5b346103955760203660031901126103955761049f612b71565b6104a761324b565b6012546001600160a01b0382169190606081901c83146104775782159081610525575b50610516576104d761378c565b6001600160601b036012549181199060601b169116176012557f2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a735f80a2005b6333fe7c6560e21b5f5260045ffd5b6001600160601b039150161515836104ca565b34610395575f36600319011261039557600a546040516001600160a01b039091168152602090f35b34610395575f366003190112610395576009546040516001600160a01b039091168152602090f35b34610395575f3660031901126103955760206001600160601b0360125416604051908152f35b34610395576040366003190112610395576105c7612b71565b6105cf612b87565b6001600160a01b039182165f908152600160209081526040808320949093168252928352819020549051908152f35b3461039557602036600319011261039557602061062a61062461061f612b71565b613de0565b9161386f565b604051908152f35b346103955760e03660031901126103955761064b612b71565b610653612b87565b604435906064359260843560ff8116810361039557844211610764576107276107309160018060a01b03841696875f52600760205260405f20908154916001830190556040519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c984528a604084015260018060a01b038916606084015289608084015260a083015260c082015260c081526106f560e082612c17565b51902061070061325f565b906040519161190160f01b83526002830152602282015260c43591604260a4359220614a61565b90929192614b01565b6001600160a01b031684810361074d575061074b935061410a565b005b84906325c0072360e11b5f5260045260245260445ffd5b8463313c898160e11b5f5260045260245ffd5b34610395575f366003190112610395576020600e54604051908152f35b346103955760203660031901126103955760206107b261061f612b71565b5050604051908152f35b34610395576020366003190112610395576004355f52600d602052606060405f20546040519060018060b81b038116825260ff8160b81c161515602083015260c01c6040820152f35b34610395575f366003190112610395576008546001600160a01b031633141580610868575b610859575f601155337f921828337692c347c634c5d2aacbc7b756014674bd236f3cc2058d8e284a951b5f80a2005b637cf97e4d60e11b5f5260045ffd5b50600c546001600160a01b031633141561082a565b3461039557602036600319011261039557610896612b71565b50602061062a6108ba6108a761361c565b6108af612fad565b509290600254612f03565b9061386f565b34610395576108ce36612d88565b6108d661324b565b80516001600160401b038111610a69576108f1601854612def565b601f8111610a01575b506020601f821160011461096f57918161095f927f4df9dcd34ae35f40f2c756fd8ac83210ed0b76d065543ee73d868aec7c7fcf02945f91610964575b508160011b915f199060031b1c1916176018555b604051918291602083526020830190612b24565b0390a1005b905082015185610937565b601f1982169060185f525f80516020614c9d833981519152915f5b8181106109e95750927f4df9dcd34ae35f40f2c756fd8ac83210ed0b76d065543ee73d868aec7c7fcf0294926001928261095f96106109d1575b5050811b0160185561094b565b8401515f1960f88460031b161c1916905585806109c4565b9192602060018192868901518155019401920161098a565b60185f52601f820160051c5f80516020614c9d833981519152019060208310610a54575b601f0160051c5f80516020614c9d83398151915201905b818110610a4957506108fa565b5f8155600101610a3c565b5f80516020614c9d8339815191529150610a25565b634e487b7160e01b5f52604160045260245ffd5b3461039557602036600319011261039557610a96612b71565b6013546001600160a01b0316908115610b5b576040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa918215610b50575f92610b1a575b5081610aec9184613da0565b6040519081527f2ae72b44f59d038340fca5739135a1d51fc5ab720bb02d983e4c5ff4119ca7b860203392a3005b9091506020813d602011610b48575b81610b3660209383612c17565b81010312610395575190610aec610ae0565b3d9150610b29565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b3461039557602061062a610b7d36612cfd565b929190610b8861378c565b610b986002546016549084613bc5565b93849133613c7b565b3461039557610baf36612d88565b610bb761324b565b80516001600160401b038111610a6957610bd2601954612def565b601f8111610cdc575b506020601f8211600114610c4a57918161095f927fadf3ae8bd543b3007d464f15cb8ea1db3f44e84d41d203164f40b95e27558ac6945f91610c3f575b508160011b915f199060031b1c191617601955604051918291602083526020830190612b24565b905082015185610c18565b601f1982169060195f525f80516020614cbd833981519152915f5b818110610cc45750927fadf3ae8bd543b3007d464f15cb8ea1db3f44e84d41d203164f40b95e27558ac694926001928261095f9610610cac575b5050811b0160195561094b565b8401515f1960f88460031b161c191690558580610c9f565b91926020600181928689015181550194019201610c65565b60195f52601f820160051c5f80516020614cbd833981519152019060208310610d2f575b601f0160051c5f80516020614cbd83398151915201905b818110610d245750610bdb565b5f8155600101610d17565b5f80516020614cbd8339815191529150610d00565b3461039557602061062a610d5736612cfd565b9291610d6161378c565b610d716002546016549083613829565b93849233613c7b565b3461039557602036600319011261039557602061062a610da6610d9b612fad565b509190600254612f03565b600435613b81565b3461039557604036600319011261039557610dc7612b71565b6024359081151580920361039557610ddd61324b565b6001600160a01b03165f818152600b602052604090205490919060ff16151581146104775760207f74dc60cbc81a9472d04ad1d20e151d369c41104d655ed3f2f3091166a502cd8d91835f52600b825260405f2060ff1981541660ff8316179055604051908152a2005b34610395575f36600319011261039557602060405160ff7f000000000000000000000000000000000000000000000000000000000000000c168152f35b34610395576020366003190112610395576004356001600160401b03811161039557610eb4903690600401612bb1565b90610ebe82612ecb565b91610ecc6040519384612c17565b808352601f19610edb82612ecb565b015f5b818110610fd8575050905f90601e1981360301915b83811015610f71578060051b82013583811215610395578201908135916001600160401b038311610395576020018236038113610395575f80610f3d610f55936001963691612d52565b602081519101305af4610f4e613c4c565b903061485d565b610f5f8288612eef565b52610f6a8187612eef565b5001610ef3565b846040518091602082016020835281518091526040830190602060408260051b8601019301915f905b828210610fa957505050500390f35b91936001919395506020610fc88192603f198a82030186528851612b24565b9601920192018594939192610f9a565b806060602080938801015201610ede565b346103955760403660031901126103955761100f611005612b71565b602435903361318e565b602060405160018152f35b34610395575f36600319011261039557600f546001600160401b038160a01c1680156110675742106110585761074b906001600160a01b0316613c02565b63333bd2cb60e11b5f5260045ffd5b63e5f408a560e01b5f5260045ffd5b34610395576020366003190112610395576004355f908152601060209081526040918290205482516001600160c01b038216815260c09190911c91810191909152f35b0390f35b34610395575f366003190112610395576020601454604051908152f35b34610395576020366003190112610395576110f3612b71565b6110fb61324b565b600c546001600160a01b03828116929116828114610477576001600160401b03600f5460a01c166111a6576111345761074b9150613c02565b50611155600e54826001600160601b0360a01b600f541617600f5542612f03565b600f805467ffffffffffffffff60a01b191660a09290921b67ffffffffffffffff60a01b169190911790557f7633313af54753bce8a149927263b1a55eba857ba4ef1d13c6aee25d384d3c4b5f80a2005b6324d9026760e11b5f5260045ffd5b34610395575f366003190112610395576040515f6019546111d581612def565b808452906001811690811561124857506001146111fd575b6110b98361094b81850382612c17565b60195f9081525f80516020614cbd833981519152939250905b80821061122e5750909150810160200161094b6111ed565b919260018160209254838588010152019101909291611216565b60ff191660208086019190915291151560051b8401909101915061094b90506111ed565b3461039557604036600319011261039557602060043561062a61128d612b87565b9161129661378c565b6112a66002546016549083613b81565b8093336138b4565b34610395575f366003190112610395576008546040516001600160a01b039091168152602090f35b34610395575f366003190112610395576011548060c01c80156110675742106110585761074b906001600160c01b0316613979565b34610395575f366003190112610395576113a76113477f00000000000000000000000000000000000000000000000000000000000000006147c6565b6113707f3100000000000000000000000000000000000000000000000000000000000001614826565b60206113b5604051926113838385612c17565b5f84525f368137604051958695600f60f81b875260e08588015260e0870190612b24565b908582036040870152612b24565b4660608501523060808501525f60a085015283810360c08501528180845192838152019301915f5b8281106113ec57505050500390f35b8351855286955093810193928101926001016113dd565b346103955760a03660031901126103955761141d36612c38565b600a546001600160a01b031633141580611545575b6115365760a09020805f52600d60205260405f205460c01c6111a6575f818152600d60205260409020546001600160b81b031661152757805f52600d60205260ff60405f205460b81c161561151557805f52601060205260405f205460c01c611504576114dd6001600160401b036114ac600e5442612f03565b5f848152600d6020526040902080546001600160c01b03169290911660c01b6001600160c01b031916919091179055565b337f3240fc70754c5a2b4dab10bf7081a00024bfc8491581ee3d355360ec0dd91f165f80a3005b62463af360e81b5f5260045260245ffd5b636113d8c760e01b5f5260045260245ffd5b63624718b960e11b5f5260045ffd5b6332a2673b60e21b5f5260045ffd5b506008546001600160a01b0316331415611432565b34610395576020366003190112610395576001600160a01b0361157b612b71565b165f526007602052602060405f2054604051908152f35b34610395575f36600319011261039557601154604080516001600160c01b038316815260c09290921c602083015290f35b34610395575f36600319011261039557600954336001600160a01b039091160361163657600980546001600160a01b0319908116909155600880543392811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b63118cdaa760e01b5f523360045260245ffd5b34610395575f36600319011261039557600f54604080516001600160a01b038316815260a09290921c6001600160401b0316602083015290f35b34610395576020366003190112610395576004356001600160401b03811161039557366023820112156103955780600401356001600160401b0381116103955736602460c083028401011161039557335f52600b60205260ff60405f2054161580611a77575b80611a62575b611a53575f918290815b83831015611a3c5760c083028201906023198236030160c08112610395576040519060408201908282106001600160401b03831117610a695760a091604052126103955760a060405161174b81612be1565b61175760248601612b9d565b815261176560448601612b9d565b602082015261177660648601612b9d565b604082015261178760848601612b9d565b606082015260a4850135608082015280835260c46020840195013585522092835f52600d60205260ff60405f205460b81c1615611a29576117c9848351613a3d565b5082518083118184030294929085156118e95750505f9251156118de575b5051604051635c2bea4960e01b81529290611806906004850190612f26565b60a483015260c48201523060e48201819052610104820152604081610124815f7f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e6001600160a01b03165af1918215610b50576001936118a1935f935f916118aa575b506040519084825260208201527fdd8bf5226dff861316e0fa7863fdb7dc7b87c614eb29a135f524eb79d5a1189a60403392a3612f03565b925b01916116f9565b90506118ce91935060403d81116118d7575b6118c68183612c17565b810190612f10565b9290928a611869565b503d6118bc565b5f93509150896117e7565b9293509497999350505f1981145f14611a1c575081860382871102925b8315611a0e575f858152600d60205260409020546001600160b81b03169061192f908590612f03565b116119fb5790604061195993925181518095819263a99aad8960e01b835286309160048501612f65565b03815f7f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e6001600160a01b03165af1938415610b50576001946119d5945f916119db575b506040519084825260208201527f89bf199df65bf65155e3e0a8abc4ad4a1be606220c8295840dba2ab5656c1f6d60403392a3612f03565b946118a3565b6119f3915060403d81116118d7576118c68183612c17565b90508a61199d565b83635e25afa560e01b5f5260045260245ffd5b5050959050600191506118a3565b8380820391110292611906565b83636113d8c760e01b5f5260045260245ffd5b8403611a4457005b6309e36b8960e41b5f5260045ffd5b63f7137c0f60e01b5f5260045ffd5b506008546001600160a01b03163314156116ef565b50600a546001600160a01b03163314156116e9565b3461039557602036600319011261039557600435611aa861324b565b600e548082146104775760115460c01c6111a657621275008211611b6757620151808210611b585780821115611ae2575061074b90613979565b601180546001600160c01b0319166001600160b81b0384161790557fb3aa0ade2442acf51d06713c2d1a5a3ec0373cce969d42b53f4689f97bccf38091602091611b2c9042612f03565b601180546001600160c01b031660c09290921b6001600160c01b031916919091179055604051908152a1005b631a1593df60e11b5f5260045ffd5b6346fedb5760e01b5f5260045ffd5b34610395575f36600319011261039557611b8e61324b565b600980546001600160a01b03199081169091556008805491821690555f906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610395576020366003190112610395576001600160a01b03611bfc612b71565b165f525f602052602060405f2054604051908152f35b346103955760a036600319011261039557611c2c36612c38565b60a081205f52601060205260405f205460c01c8015611067574210611058578060a061074b9220805f52601060205260018060b81b0360405f2054169161345e565b3461039557604036600319011261039557602060043561062a611c8f612b87565b611c9761378c565b611ca7600254601654908561386f565b928391336138b4565b3461039557602036600319011261039557600435611ccc61324b565b6012546001600160601b0381168214610477576706f05b59d3b200008211611d5b578115159081611d4f575b50610516576001600160601b0390611d0e61378c565b16806001600160601b031960125416176012556040519081527f01fe2943baee27f47add82886c2200f910c749c461c9b63c5fe83901a53bdb4960203392a2005b905060601c1582611cf8565b63f4df6ae560e01b5f5260045ffd5b346103955760203660031901126103955760043560155481101561039557610386602091612cb9565b34610395575f366003190112610395576020601654604051908152f35b34610395576020366003190112610395576001600160a01b03611dd1612b71565b165f52600b602052602060ff60405f2054166040519015158152f35b612b48565b346103955760203660031901126103955760043560018060a01b03600c541633141580611e8a575b80611e75575b611e66575f818152600d6020526040812080546001600160c01b0316905533907fcbeb8ecdaa5a3c133e62219b63bfc35bce3fda13065d2bed32e3b7dde60a59f49080a3005b63d080fa3160e01b5f5260045ffd5b506008546001600160a01b0316331415611e20565b50600a546001600160a01b0316331415611e1a565b34610395575f36600319011261039557602060125460601c604051908152f35b34610395575f36600319011261039557600c546040516001600160a01b039091168152602090f35b34610395576020366003190112610395576004356001600160401b03811161039557611f17903690600401612bb1565b90335f52600b60205260ff60405f2054161580612237575b80612222575b611a5357601554611f4581612ecb565b611f526040519182612c17565b818152601f19611f6183612ecb565b01366020830137611f7184612ecb565b92611f7f6040519485612c17565b848452611f8b85612ecb565b602085019590601f19013687375f5b8181106121c2575050505f5b8281106120c35750505080516001600160401b038111610a6957600160401b8111610a69576015548160155580821061207f575b508260155f525f5b82811061204b5750505060405190602082019060208352518091526040820192905f5b81811061203557337fe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d85870386a2005b8251855260209485019490920191600101612005565b60019060208351930192817f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475015501611fe2565b60155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4759081019082015b8181106120b85750611fda565b5f81556001016120ab565b6120cd8183612eef565b51156120dc575b600101611fa6565b6120e581612cb9565b905460039190911b1c5f818152600d60205260409020546001600160b81b03166121b057805f52601060205260405f205460c01c6115045761214830827f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e6136d4565b612160575b5f908152600d60205260408120556120d4565b805f52600d60205260405f205460c01c1561219e57805f52600d60205260405f205460c01c42101561214d57632cd5119960e21b5f5260045260245ffd5b63af8ae28760e01b5f5260045260245ffd5b63401d83d960e11b5f5260045260245ffd5b6121cd818385612ea8565b356121d781612cb9565b90549060031b1c906121e98187612eef565b5161220f579060016121fd81949388612eef565b526122088289612eef565b5201611f9a565b506392a726c360e01b5f5260045260245ffd5b506008546001600160a01b0316331415611f35565b50600a546001600160a01b0316331415611f2f565b3461039557602036600319011261039557612265612b71565b50602061062a61361c565b346103955760c03660031901126103955761228a36612c38565b60a4359060018060a01b03600a5416331415806124e4575b6115365760a0812081519092906001600160a01b039081167f000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831909116036124d15760405160208101908482526003604082015260408152612304606082612c17565b519020600281018091116124bd575f61231f6123399261416d565b60405180938192637784c68560e01b8352600483016133f4565b03817f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e6001600160a01b03165afa908115610b50576001600160801b0391612388915f9161249b575b50612ee2565b51161561248c57825f52601060205260405f205460c01c6111a657825f52600d60205260405f205460c01c61247d575f838152600d60205260409020546001600160b81b0316818114610477578110156123ef57916123e961074b9361342d565b9161345e565b9050815f52601060205261244f60405f206001600160401b036124306124148561342d565b600e549060018060b81b03168360c01b85541617845542612f03565b82546001600160c01b0316911660c01b6001600160c01b031916179055565b6040519081527fe851bb5856808a50efd748be463b8f35bcfb5ec74c5bfde776fe0a4d2a26db2760203392a3005b6325f600a360e11b5f5260045ffd5b6396e1352960e01b5f5260045ffd5b6124b791503d805f833e6124af8183612c17565b81019061337b565b86612382565b634e487b7160e01b5f52601160045260245ffd5b826333cbfd2760e21b5f5260045260245ffd5b506008546001600160a01b03163314156122a2565b34610395575f366003190112610395576040517f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e6001600160a01b03168152602090f35b34610395575f366003190112610395576040517f000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e58316001600160a01b03168152602090f35b34610395575f366003190112610395576013546040516001600160a01b039091168152602090f35b34610395575f36600319011261039557602061062a61325f565b34610395575f366003190112610395576020601554604051908152f35b34610395575f3660031901126103955760ff7f000000000000000000000000000000000000000000000000000000000000000c1660ff7f0000000000000000000000000000000000000000000000000000000000000006160160ff81116124bd5760209060ff60405191168152f35b3461039557602036600319011261039557612668612b71565b61267061324b565b6013546001600160a01b039182169181168214610477576001600160a01b03191681176013557f2e7908865670e21b9779422cadf5f1cba271a62bb95c71eaaf615c0a1c48ebee5f80a2005b34610395576020366003190112610395576004356001600160401b038111610395576126ec903690600401612bb1565b335f52600b60205260ff60405f205416158061289d575b80612888575b611a5357601e8111612879575f5b81811061282c57506001600160401b038111610a6957600160401b8111610a6957601454816014558082106127e8575b508160145f525f5b8281106127b457505060405190806020830160208452526040820192905f5b81811061279e57337f6ce31538fc7fba95714ddc8a275a09252b4b1fb8f33d2550aa58a5f62ad934de85870386a2005b823585526020948501949092019160010161276e565b60019060208335930192817fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec01550161274f565b60145f527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec9081019082015b8181106128215750612747565b5f8155600101612814565b612837818385612ea8565b355f908152600d60205260409020546001600160b81b03161561285c57600101612717565b9061286692612ea8565b3563067f0a2560e41b5f5260045260245ffd5b6340797bd760e11b5f5260045ffd5b506008546001600160a01b0316331415612709565b50600a546001600160a01b0316331415612703565b346103955760603660031901126103955761100f6128ce612b71565b6128d6612b87565b604435916128e58333836130c8565b61318e565b34610395575f366003190112610395576020601754604051908152f35b34610395575f366003190112610395576008546001600160a01b03163314158061295b575b610859575f600f55337fc40a085ccfa20f5fd518ade5c3a77a7ecbdfbb4c75efcdca6146a8e3c841d6635f80a2005b50600c546001600160a01b031633141561292c565b34610395575f366003190112610395576020600254604051908152f35b346103955760203660031901126103955760043560018060a01b03600c541633141580612a09575b806129f4575b611e6657805f5260106020525f6040812055337f1026ceca5ed3747eb5edec555732d4a6f901ce1a875ecf981064628cadde11205f80a3005b506008546001600160a01b03163314156129bb565b50600a546001600160a01b03163314156129b5565b3461039557602036600319011261039557602061062a612a3f610d9b612fad565b600435613829565b346103955760403660031901126103955761100f612a63612b71565b602435903361410a565b34610395575f366003190112610395576040515f601854612a8d81612def565b80845290600181169081156112485750600114612ab4576110b98361094b81850382612c17565b60185f9081525f80516020614c9d833981519152939250905b808210612ae55750909150810160200161094b6111ed565b919260018160209254838588010152019101909291612acd565b34610395575f366003190112610395576020612b19612fad565b509050604051908152f35b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b3461039557602036600319011261039557602061062a612b69610d9b612fad565b600435613bc5565b600435906001600160a01b038216820361039557565b602435906001600160a01b038216820361039557565b35906001600160a01b038216820361039557565b9181601f84011215610395578235916001600160401b038311610395576020808501948460051b01011161039557565b60a081019081106001600160401b03821117610a6957604052565b60c081019081106001600160401b03821117610a6957604052565b90601f801991011681019081106001600160401b03821117610a6957604052565b60a09060031901126103955760405190612c5182612be1565b816004356001600160a01b03811681036103955781526024356001600160a01b03811681036103955760208201526044356001600160a01b03811681036103955760408201526064356001600160a01b03811681036103955760608201526080608435910152565b601554811015612cd15760155f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b601454811015612cd15760145f5260205f2001905f90565b606090600319011261039557600435906024356001600160a01b038116810361039557906044356001600160a01b03811681036103955790565b6001600160401b038111610a6957601f01601f191660200190565b929192612d5e82612d37565b91612d6c6040519384612c17565b829481845281830111610395578281602093845f960137010152565b602060031982011261039557600435906001600160401b038211610395578060238301121561039557816024612dc393600401359101612d52565b90565b3461039557602036600319011261039557602061062a612de7610d9b612fad565b60043561386f565b90600182811c92168015612e1d575b6020831014612e0957565b634e487b7160e01b5f52602260045260245ffd5b91607f1691612dfe565b5f9291815491612e3683612def565b8083529260018116908115612e8b5750600114612e5257505050565b5f9081526020812093945091925b838310612e71575060209250010190565b600181602092949394548385870101520191019190612e60565b915050602093945060ff929192191683830152151560051b010190565b9190811015612cd15760051b0190565b818102929181159184041417156124bd57565b6001600160401b038111610a695760051b60200190565b805115612cd15760200190565b8051821015612cd15760209160051b010190565b919082018092116124bd57565b9190826040910312610395576020825192015190565b80516001600160a01b03908116835260208083015182169084015260408083015182169084015260608083015190911690830152608090810151910152565b91612f74836101409593612f26565b60a08301525f60c083015260018060a01b031660e08201526101206101008201525f6101208201520190565b919082039182116124bd57565b5f905f806015547f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e5b8183106130755750505060165491601754612ff18185612fa0565b83101561306757506130176130106130098486612fa0565b8094612f03565b9384612fa0565b80151580613053575b6130275750565b613050919450613043906001600160601b036012541690613fe4565b6002546106248286612fa0565b92565b506001600160601b03601254161515613020565b613010613017918094612f03565b9091926130bf6001916130b961309961308d88612cb9565b90549060031b1c613eca565b6130b16130aa3060a08420896136d4565b91876141e5565b5050916147a0565b90612f03565b93019190612fd6565b6001600160a01b039081165f81815260016020818152604080842095871684529490529290205493929184016130ff575b50505050565b82841061316b578015613158576001600160a01b03821615613145575f52600160205260405f209060018060a01b03165f5260205260405f20910390555f8080806130f9565b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b508290637dc7a0d960e11b5f5260018060a01b031660045260245260445260645ffd5b6001600160a01b0316908115613238576001600160a01b031691821561322557815f525f60205260405f205481811061320c57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b634b637e8f60e11b5f525f60045260245ffd5b6008546001600160a01b0316330361163657565b307f0000000000000000000000007c574174da4b2be3f705c6244b4bfa0815a8b3ed6001600160a01b03161480613352575b156132ba577fb7ea5bb91088ac5b737819e6e411574622d87bfb7e6715b42edfebc27d66f6a290565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815261334c60c082612c17565b51902090565b507f000000000000000000000000000000000000000000000000000000000000a4b14614613291565b602081830312610395578051906001600160401b03821161039557019080601f830112156103955781516133ae81612ecb565b926133bc6040519485612c17565b81845260208085019260051b82010192831161039557602001905b8282106133e45750505090565b81518152602091820191016133d7565b60206040818301928281528451809452019201905f5b8181106134175750505090565b825184526020938401939092019160010161340a565b6001600160b81b038111613447576001600160b81b031690565b6306dfcc6560e41b5f5260b860045260245260445ffd5b5f828152600d6020526040902093926001600160b81b031690816134d0575b508192938168ffffffffffffffffff60b81b8254161790556040519081527fe86b6d3313d3098f4c5f689c935de8fde876a597c185def2cedab85efedac68660203392a35f5260106020525f6040812055565b60ff855460b81c16156134f2575b5083546001600160c01b031684558161347d565b601554600160401b811015610a69578060016135119201601555612cb9565b81549060031b9085821b915f19901b1916179055601e601554116128795761358761358c91600160b81b60ff60b81b198854161787556130b9601654916130b17f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e916135813060a08320856136d4565b926141e5565b614194565b604051936020850160208652601554809152604086019060155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475905f5b818110613606575050507fe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d8685969733930390a293926134de565b82548452602090930192600192830192016135cb565b5f905f6014547f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e5b81831061365057505050565b90919361365c85612ce5565b905460039190911b1c5f818152600d60205260409020546001600160b81b03169081156136c957916136bf916136b36001946136ab6136a561369f30848b6136d4565b92613eca565b886141e5565b5050916144cd565b80820391110290612f03565b945b019190613644565b5050936001906136c1565b61372f61374b935f936040516020810191825260026040820152604081526136fd606082612c17565b51902060405190602082019260018060a01b03168352604082015260408152613727606082612c17565b51902061416d565b906040518080958194637784c68560e01b8352600483016133f4565b03916001600160a01b03165afa8015610b505761376e915f916137725750612ee2565b5190565b61378691503d805f833e6124af8183612c17565b5f612382565b7ff66f28b40975dbb933913542c7e6a0f50a1d0f20aa74ea6e0efe65ab616323ec60407f548669ea9bcc24888e6d74a69c9865fa98d795686853b8aa3eb87814261bbb7160206137da612fad565b6137e78295939492614194565b806017558551908152a180613804575b82519182526020820152a1565b6138138160125460601c61450c565b6137f7565b60ff16604d81116124bd57600a0a90565b90613857906130b97f000000000000000000000000000000000000000000000000000000000000000c613818565b91600181018091116124bd57612dc392600192614569565b9061389d906130b97f000000000000000000000000000000000000000000000000000000000000000c613818565b91600181018091116124bd57612dc3925f92614569565b92613977937fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7604061358795946139448251946323b872dd60e01b602087015260018060a01b0316948560248201523060448201528760648201526064815261391e608482612c17565b7f000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e58316149ed565b61394e858261450c565b815186815260208101959095526001600160a01b031693a361396f816145b9565b601654612f03565b565b80600e556040519081527fd28e9b90ee9b37c5936ff84392d71f29ff18117d7e76bcee60615262a90a3f7560203392a25f601155565b51906001600160801b038216820361039557565b908160c091031261039557613a3560a0604051926139e084612bfc565b6139e9816139af565b84526139f7602082016139af565b6020850152613a08604082016139af565b6040850152613a19606082016139af565b6060850152613a2a608082016139af565b6080850152016139af565b60a082015290565b905f915f60a0604051613a4f81612bfc565b82815282602082015282604082015282606082015282608082015201527f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e9060018060a01b03821690813b1561039557604051630a8e0d6f60e11b815290613abb906004830190612f26565b5f8160a48183865af18015610b5057613b6b575b5060c060249160405192838092632e3071cd60e11b82528760048301525afa938415613b5f5793613b26575b50613b0c61305091849330916136d4565b926001600160801b036020818351169201511690846147a0565b613050919350613b50613b0c9160c03d60c011613b58575b613b488183612c17565b8101906139c3565b939150613afb565b503d613b3e565b604051903d90823e3d90fd5b613b789194505f90612c17565b5f9260c0613acf565b600183018093116124bd57612dc392613bbf6001936130b97f000000000000000000000000000000000000000000000000000000000000000c613818565b91614569565b600183018093116124bd57612dc392613bbf5f936130b97f000000000000000000000000000000000000000000000000000000000000000c613818565b600c80546001600160a01b0319166001600160a01b03929092169182179055337fcb11cc8aade2f5a556749d1b2380d108a16fac3431e6a5d5ce12ef9de0bd76e35f80a35f600f55565b3d15613c76573d90613c5d82612d37565b91613c6b6040519384612c17565b82523d5f602084013e565b606090565b9193613c8f60165485808203911102614194565b613c98846148bb565b6001600160a01b0385811695908416938290878603613d8f575b505050841561323857845f525f60205260405f2054818110613d765791816040927ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db94885f525f60205203835f205580600254036002555f877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208651858152a3613d5f86837f000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831613da0565b825195865260208601526001600160a01b031693a4565b8563391434e360e21b5f5260045260245260445260645ffd5b613d98926130c8565b5f8181613cb2565b60405163a9059cbb60e01b60208201526001600160a01b03909216602483015260448083019390935291815261397791613ddb606483612c17565b6149ed565b613e1590613dec612fad565b50613dfb819492600254612f03565b9260018060a01b03165f525f6020528260405f2054613bc5565b6015549290805f7f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e5b868210613e54575b505061305092939450612fa0565b9092613e9b613e6285612cb9565b90549060031b1c613e95613e81613e7883613eca565b923090876136d4565b613e8b83876141e5565b50939180936147a0565b92614bef565b808203911102928315613eb15760010190613e3e565b613e46565b51906001600160a01b038216820361039557565b5f6080604051613ed981612be1565b828152826020820152826040820152826060820152015260405190632c3c915760e01b8252600482015260a081602481600180851b037f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e165afa908115610b50575f91613f44575090565b905060a0813d60a011613fbe575b81613f5f60a09383612c17565b8101031261039557608060405191613f7683612be1565b613f7f81613eb6565b8352613f8d60208201613eb6565b6020840152613f9e60408201613eb6565b6040840152613faf60608201613eb6565b60608401520151608082015290565b3d9150613f52565b8115613fd0570490565b634e487b7160e01b5f52601260045260245ffd5b9190915f838202915f19858209918380841093039280840393146140635782670de0b6b3a7640000111561405457507faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac106699394670de0b6b3a7640000910990828211900360ee1b910360121c170290565b63227bc15360e01b8152600490fd5b505050670de0b6b3a76400009192500490565b9091828202915f19848209938380861095039480860395146140fd57848311156140ee57829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b63227bc15360e01b5f5260045ffd5b505090612dc39250613fc6565b6001600160a01b0316908115613158576001600160a01b03169182156131455760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591835f526001825260405f20855f5282528060405f2055604051908152a3565b6040519061417c604083612c17565b600182526020368184013761419082612ee2565b5290565b60207f15c027cc4fd826d986cad358803439f7326d3aa4ed969ff90dbee4bc150f68e99180601655604051908152a1565b906001600160801b03809116911601906001600160801b0382116124bd57565b9060c060a08220602460405180958193632e3071cd60e11b8352600483015260018060a01b03165afa918215610b50575f926144ac575b50608082016142356001600160801b0382511642612fa0565b9182151580614496575b80614480575b614283575b5050506001600160801b038151166001600160801b03602083015116926001600160801b03606081604086015116940151169193929190565b6060810151604051638c00bf6b60e01b8152916001600160a01b03909116906142b0906004840190612f26565b6001600160801b0385511660a483015260208501936001600160801b0385511660c48401526001600160801b0360408701948186511660e48601528160608901511661010486015251166101248401526020836101648160a08a01956001600160801b038751166101448301525afa928315610b50575f9361444a575b506143906001600160801b039361438a614354670de0b6b3a7640000948789511693612eb8565b614385671bc16d674ec8000061436a8380612eb8565b046729a2241af62c000061437e8483612eb8565b0492612f03565b612f03565b90612eb8565b0492826143a861439f86614b7d565b828451166141c5565b169052816143c16143b885614b7d565b828851166141c5565b168552511690811561424a57670de0b6b3a7640000916143e091612eb8565b046143f5816001600160801b03855116612fa0565b6001600160801b0383511691620f424083018093116124bd57600182018092116124bd5761443a61443f926144356001600160801b039561439f94612eb8565b613fc6565b614b7d565b1690525f808061424a565b92506020833d602011614478575b8161446560209383612c17565b810103126103955791519161439061432d565b3d9150614458565b5060608101516001600160a01b03161515614245565b506001600160801b03604085015116151561423f565b6144c691925060c03d60c011613b5857613b488183612c17565b905f61421c565b90600181018091116124bd57620f42408301918284116124bd57620f423f916144f591612eb8565b9201918183116124bd57612dc39261443591612f03565b6001600160a01b0316908115613225577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208261454d5f94600254612f03565b60025584845283825260408420818154019055604051908152a3565b9190600180614579848487614076565b9561458381614ae3565b161492836145a4575b5050506145965790565b600181018091116124bd5790565b909180935015613fd0570915155f808061458c565b7f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e906001600160a01b0382165f5b601454811015614787576145fa81612ce5565b905460039190911b1c5f818152600d60205260409020546001600160b81b0316801561477d5761462982613eca565b91843b1561039557604051630a8e0d6f60e11b815261464b6004820185612f26565b5f8160a481838a5af18015610b505761476d575b50604051632e3071cd60e11b8152600481018290529060c082602481895afa908115610b50576146b6925f92614749575b5061469d9030908a6136d4565b906001600160801b0360208183511692015116916144cd565b808203911102908185108583180280831892036146e0575b505082156130f9576001905b016145e7565b60406147029181518093819263a99aad8960e01b835286309160048501612f65565b03815f885af1908161472c575b5061471b575b806146ce565b6147259193612fa0565b915f614715565b6147439060403d81116118d7576118c68183612c17565b5061470f565b61469d9192506147669060c03d8111613b5857613b488183612c17565b9190614690565b5f61477791612c17565b5f61465f565b50506001906146da565b5050905061479157565b63ded0652d60e01b5f5260045ffd5b60018201929183106124bd57620f424082018092116124bd57612dc39261443591612eb8565b60ff811461480c5760ff811690601f82116147fd57604051916147ea604084612c17565b6020808452838101919036833783525290565b632cd44ac360e21b5f5260045ffd5b50604051612dc38161481f816005612e27565b0382612c17565b60ff811461484a5760ff811690601f82116147fd57604051916147ea604084612c17565b50604051612dc38161481f816006612e27565b90614881575080511561487257805190602001fd5b630a12f52160e11b5f5260045ffd5b815115806148b2575b614892575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561488a565b5f5b6015548110156149d7576148d081612cb9565b90549060031b1c6149086148ed6148e683613eca565b9283613a3d565b90506001600160801b03604081835116920151169084614bef565b9081841084831802808318920361492e575b5050811561492a576001016148bd565b5050565b604051635c2bea4960e01b81529061494a906004830190612f26565b8160a48201525f60c48201523060e482015230610104820152604081610124815f60018060a01b037f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e165af190816149ba575b506149a9575b8061491a565b6149b39192612fa0565b905f6149a3565b6149d19060403d81116118d7576118c68183612c17565b5061499d565b506149de57565b634323a55560e01b5f5260045ffd5b5f80614a159260018060a01b03169360208151910182865af1614a0e613c4c565b908361485d565b8051908115159182614a3d575b5050614a2b5750565b635274afe760e01b5f5260045260245ffd5b81925090602091810103126103955760200151801590811503610395575f80614a22565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411614ad8579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa15610b50575f516001600160a01b03811615614ace57905f905f90565b505f906001905f90565b5050505f9160039190565b60041115614aed57565b634e487b7160e01b5f52602160045260245ffd5b614b0a81614ae3565b80614b13575050565b614b1c81614ae3565b60018103614b335763f645eedf60e01b5f5260045ffd5b614b3c81614ae3565b60028103614b57575063fce698f760e01b5f5260045260245ffd5b600390614b6381614ae3565b14614b6b5750565b6335e2f38360e21b5f5260045260245ffd5b604051614b8b604082612c17565b60148152731b585e081d5a5b9d0c4c8e08195e18d95959195960621b60208201526001600160801b038211614bc757506001600160801b031690565b60405162461bcd60e51b815260206004820152908190614beb906024830190612b24565b0390fd5b91614bfe602091602493612fa0565b92516040516370a0823160e01b81526001600160a01b037f0000000000000000000000006c247b1f6182318877311737bac0844baa518f5e811660048301529093849290918391165afa908115610b50575f91614c6a575b508181109082180218818110908218021890565b90506020813d602011614c94575b81614c8560209383612c17565b8101031261039557515f614c56565b3d9150614c7856feb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c9695a164736f6c634300081a000a","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"github_repository_metadata":null,"compiler_settings":{"evmVersion":"cancun","libraries":{},"metadata":{"appendCBOR":true,"bytecodeHash":"none","useLiteralContent":false},"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}},"remappings":["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","ds-test/=lib/morpho-blue-irm/lib/forge-std/lib/ds-test/src/","erc4626-tests/=lib/erc4626-tests/","forge-std/=lib/forge-std/src/","halmos-cheatcodes/=lib/morpho-blue/lib/halmos-cheatcodes/src/","morpho-blue-irm/=lib/morpho-blue-irm/src/","morpho-blue/=lib/morpho-blue/","openzeppelin-contracts/=lib/openzeppelin-contracts/","solmate/=lib/morpho-blue-irm/lib/solmate/src/"],"viaIR":true},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":[["0x5a4E19842e09000a582c20A4f524C26Fb48Dd4D0",{"internalType":"address","name":"owner","type":"address"}],["0x6c247b1F6182318877311737BaC0844bAa518F5e",{"internalType":"address","name":"morpho","type":"address"}],["0",{"internalType":"uint256","name":"initialTimelock","type":"uint256"}],["0xaf88d065e77c8cC2239327C5EDb3A432268e5831",{"internalType":"address","name":"_asset","type":"address"}],["xUSDC",{"internalType":"string","name":"__name","type":"string"}],["xUSDC",{"internalType":"string","name":"__symbol","type":"string"}]],"compiler_version":"v0.8.26+commit.8a97fa7a","is_verified_via_verifier_alliance":false,"verified_at":"2025-07-19T00:44:14.747372Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x6101e0806040523461065157615c28803803809161001d8285610a31565b8339810160c0828203126106515761003482610a54565b9061004160208401610a54565b9160408401519161005460608601610a54565b60808601519095906001600160401b0381116106515782610076918301610a83565b60a08201519092906001600160401b038111610651576100969201610a83565b90602094604051966100a88789610a31565b5f885260018060a01b0316936040516100c18882610a31565b5f8152604051986100d2898b610a31565b5f8a526040998a51926100e58c85610a31565b60018452603160f81b8b8501528051906001600160401b03821161075a5760035490600182811c92168015610a27575b8d83101461073c578c82601f8594116109d5575b50508c90601f831160011461096e575f92610963575b50508160011b915f199060031b1c1916176003555b8051906001600160401b03821161075a5760045490600182811c92168015610959575b8c83101461073c5781601f84931161090a575b508b90601f83116001146108a3575f92610898575b50508160011b915f199060031b1c1916176004555b6101bd87610dc2565b9015610890575b60a052866080526101d481610af3565b610160526101e182610c5b565b6101805288815191012090816101205288815191012080610140524660e052895190898201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f84528b83015260608201524660808201523060a082015260a0815261024e60c082610a31565b51902060c05230610100526001600160a01b031690811561087d57600980546001600160a01b03199081169091556008805491821684179055885192906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001600160a01b031694851561086e578061083b575b80600e5581527fd28e9b90ee9b37c5936ff84392d71f29ff18117d7e76bcee60615262a90a3f75863392a25f60115580516001600160401b03811161075a57601854600181811c91168015610831575b8782101461073c57601f81116107ed575b5085601f8211600114610779579181610377925f80516020615c08833981519152945f9161076e575b508160011b915f199060031b1c1916176018555b875191829182610ac9565b0390a180516001600160401b03811161075a57601954600181811c91168015610750575b8682101461073c57601f81116106f8575b5084601f8211600114610671579181610407927fadf3ae8bd543b3007d464f15cb8ea1db3f44e84d41d203164f40b95e27558ac6945f91610666575b508160011b915f199060031b1c1916176019555b865191829182610ac9565b0390a16101a0829052835163313ce56760e01b81528381600481855afa90811561065c575f91610620575b5060ff809116806012039060121102166101c0528351915f8085850163095ea7b360e01b81528360248701528119604487015260448652610474606487610a31565b85519082865af1610483610d93565b816105f0575b50806105e6575b156105a1575b8451614ce99081610f1f82396080518181816122bc01528181612552015281816139200152613d3b015260a05181612618015260c05181613298015260e0518161335501526101005181613262015261012051816132e70152610140518161330d015261016051816113230152610180518161134c01526101a0518181816118280152818161195e015281816121240152818161233d0152818161250e01528181612fb6015281816135530152818161362401528181613a6e01528181613e1e01528181613f11015281816145bb015281816149740152614c1701526101c051818181610e60015281816125f4015281816138330152818161387901528181613b9b0152613bde0152f35b6105dd936105d89186519163095ea7b360e01b9083015260248201525f6044820152604481526105d2606482610a31565b82610e55565b610e55565b5f808080610496565b50813b1515610490565b80518015925086908315610608575b5050505f610489565b6106189350820181019101610e3d565b5f85816105ff565b90508381813d8311610655575b6106378183610a31565b81010312610651575160ff811681036106515760ff610432565b5f80fd5b503d61062d565b85513d5f823e3d90fd5b90508201515f6103e8565b601f1982169060195f52865f20915f5b888282106106e2575050927fadf3ae8bd543b3007d464f15cb8ea1db3f44e84d41d203164f40b95e27558ac694926001928261040796106106ca575b5050811b016019556103fc565b8401515f1960f88460031b161c191690555f806106bd565b6001849582939589015181550194019201610681565b60195f52855f20601f830160051c810191878410610732575b601f0160051c01905b81811061072757506103ac565b5f815560010161071a565b9091508190610711565b634e487b7160e01b5f52602260045260245ffd5b90607f169061039b565b634e487b7160e01b5f52604160045260245ffd5b90508201515f610358565b601f1982169060185f52875f20915f5b898282106107d7575050925f80516020615c0883398151915294926001928261037796106107bf575b5050811b0160185561036c565b8401515f1960f88460031b161c191690555f806107b2565b6001849582939589015181550194019201610789565b60185f52865f20601f830160051c810191888410610827575b601f0160051c01905b81811061081c575061032f565b5f815560010161080f565b9091508190610806565b90607f169061031e565b62127500811161085f57620151808110156102ce57631a1593df60e11b5f5260045ffd5b6346fedb5760e01b5f5260045ffd5b63d92e233d60e01b5f5260045ffd5b631e4fbdf760e01b5f525f60045260245ffd5b5060126101c4565b015190505f8061019f565b60045f9081528d81209350601f198516908e5b8282106108f35750509084600195949392106108db575b505050811b016004556101b4565b01515f1960f88460031b161c191690555f80806108cd565b60018596829396860151815501950193018e6108b6565b90915060045f528b5f20601f840160051c8101918d851061094f575b90601f859493920160051c01905b818110610941575061018a565b5f8155849350600101610934565b9091508190610926565b91607f1691610177565b015190505f8061013f565b60035f9081528e81209350601f198516908f5b8282106109be5750509084600195949392106109a6575b505050811b01600355610154565b01515f1960f88460031b161c191690555f8080610998565b60018596829396860151815501950193018f610981565b9091925060035f52815f2090601f850160051c8201928510610a1d575b90601f859493920160051c01905b818110610a0f578e9150610129565b5f8155849350600101610a00565b90915081906109f2565b91607f1691610115565b601f909101601f19168101906001600160401b0382119082101761075a57604052565b51906001600160a01b038216820361065157565b6001600160401b03811161075a57601f01601f191660200190565b81601f8201121561065157805190610a9a82610a68565b92610aa86040519485610a31565b8284526020838301011161065157815f9260208093018386015e8301015290565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b908151602081105f14610b4e575090601f815111610b2d576020815191015160208210610b1e571790565b5f198260200360031b1b161790565b60405163305a27a960e01b8152908190610b4a9060048301610ac9565b0390fd5b6001600160401b03811161075a57600554600181811c91168015610c51575b602082101461073c57601f8111610c1e575b50602092601f8211600114610bbd57928192935f92610bb2575b50508160011b915f199060031b1c19161760055560ff90565b015190505f80610b99565b601f1982169360055f52805f20915f5b868110610c065750836001959610610bee575b505050811b0160055560ff90565b01515f1960f88460031b161c191690555f8080610be0565b91926020600181928685015181550194019201610bcd565b60055f52601f60205f20910160051c810190601f830160051c015b818110610c465750610b7f565b5f8155600101610c39565b90607f1690610b6d565b908151602081105f14610c86575090601f815111610b2d576020815191015160208210610b1e571790565b6001600160401b03811161075a57600654600181811c91168015610d89575b602082101461073c57601f8111610d56575b50602092601f8211600114610cf557928192935f92610cea575b50508160011b915f199060031b1c19161760065560ff90565b015190505f80610cd1565b601f1982169360065f52805f20915f5b868110610d3e5750836001959610610d26575b505050811b0160065560ff90565b01515f1960f88460031b161c191690555f8080610d18565b91926020600181928685015181550194019201610d05565b60065f52601f60205f20910160051c810190601f830160051c015b818110610d7e5750610cb7565b5f8155600101610d71565b90607f1690610ca5565b3d15610dbd573d90610da482610a68565b91610db26040519384610a31565b82523d5f602084013e565b606090565b5f8091604051602081019063313ce56760e01b825260048152610de6602482610a31565b51916001600160a01b03165afa610dfb610d93565b9080610e31575b610e0e575b505f905f90565b602081805181010312610651576020015160ff8111610e07579060ff6001921690565b50602081511015610e02565b90816020910312610651575180151581036106515790565b5f80610e7d9260018060a01b03169360208151910182865af1610e76610d93565b9083610ec0565b8051908115159182610ea5575b5050610e935750565b635274afe760e01b5f5260045260245ffd5b610eb89250602080918301019101610e3d565b155f80610e8a565b90610ee45750805115610ed557805190602001fd5b630a12f52160e11b5f5260045ffd5b81511580610f15575b610ef5575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b15610eed56fe60806040526004361015610011575f80fd5b5f3560e01c806301e1d11414612aff57806306fdde0314612a6d57806307a2d13a14611ded578063095ea7b314612a475780630a28a47714612a1e578063102f7b6c1461298d57806318160ddd146129705780631ecca77c1461290757806321cb4b14146128ea57806323b872dd146128b25780632acc56f9146126bc5780632b30997b1461264f578063313ce567146125e057806333f91ebb146125c35780633644e515146125a9578063388af5b51461258157806338d52e0f1461253d5780633acb5624146124f95780633b24c2bf14612270578063402d267d1461224c57806341b6783314611ee7578063452a932014611ebf5780634690484014611e9f5780634b998de514611df25780634cdad50614611ded5780634dedf20e14611db0578063568efc0714611d9357806362518ddf14611d6a57806369fe0e2d14611cb05780636e553f6514611c6e5780636fda386814611c1257806370a0823114611bdb578063715018a614611b765780637224a51214611a8c5780637299aa3114611683578063762c31ba1461164957806379ba5097146115c35780637cc4d9a1146115925780637ecebe001461155a57806384755b5f1461140357806384b0196e1461130b5780638a2c7b39146112d65780638da5cb5b146112ae57806394bf804d1461126c57806395d89b41146111b55780639d6b4a45146110da578063a17b3130146110bd578063a31be5d614611076578063a5f31d611461101a578063a9059cbb14610fe9578063ac9650d814610e84578063aea70acc14610e47578063b192a84a14610dae578063b3d7f6b914610d7a578063b460af9414610d44578063b84c824614610ba1578063ba08765214610b6a578063bc25cf7714610a7d578063c47f0027146108c0578063c63d75b61461087d578063c6e6f59214610405578063c9649aa914610805578063cc718f76146107bc578063ce96cb7714610794578063d33219b414610777578063d505accf14610632578063d905777e146105fe578063dd62ed3e146105ae578063ddca3f4314610588578063e30c397814610560578063e66f53b714610538578063e74b981b14610486578063e90956cf1461040a578063ef8b30f714610405578063f2fde38b146103995763f7d185211461035d575f80fd5b346103955760203660031901126103955760043560145481101561039557610386602091612ce5565b90549060031b1c604051908152f35b5f80fd5b34610395576020366003190112610395576103b2612b71565b6103ba61324b565b600980546001600160a01b0319166001600160a01b039283169081179091556008549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227005f80a3005b612dc6565b3461039557602036600319011261039557610423612b71565b61042b61324b565b600a546001600160a01b039182169181168214610477576001600160a01b0319168117600a557fbd0a63c12948fbc9194a5839019f99c9d71db924e5c70018265bc778b8f1a5065f80a2005b63a741a04560e01b5f5260045ffd5b346103955760203660031901126103955761049f612b71565b6104a761324b565b6012546001600160a01b0382169190606081901c83146104775782159081610525575b50610516576104d761378c565b6001600160601b036012549181199060601b169116176012557f2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a735f80a2005b6333fe7c6560e21b5f5260045ffd5b6001600160601b039150161515836104ca565b34610395575f36600319011261039557600a546040516001600160a01b039091168152602090f35b34610395575f366003190112610395576009546040516001600160a01b039091168152602090f35b34610395575f3660031901126103955760206001600160601b0360125416604051908152f35b34610395576040366003190112610395576105c7612b71565b6105cf612b87565b6001600160a01b039182165f908152600160209081526040808320949093168252928352819020549051908152f35b3461039557602036600319011261039557602061062a61062461061f612b71565b613de0565b9161386f565b604051908152f35b346103955760e03660031901126103955761064b612b71565b610653612b87565b604435906064359260843560ff8116810361039557844211610764576107276107309160018060a01b03841696875f52600760205260405f20908154916001830190556040519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c984528a604084015260018060a01b038916606084015289608084015260a083015260c082015260c081526106f560e082612c17565b51902061070061325f565b906040519161190160f01b83526002830152602282015260c43591604260a4359220614a61565b90929192614b01565b6001600160a01b031684810361074d575061074b935061410a565b005b84906325c0072360e11b5f5260045260245260445ffd5b8463313c898160e11b5f5260045260245ffd5b34610395575f366003190112610395576020600e54604051908152f35b346103955760203660031901126103955760206107b261061f612b71565b5050604051908152f35b34610395576020366003190112610395576004355f52600d602052606060405f20546040519060018060b81b038116825260ff8160b81c161515602083015260c01c6040820152f35b34610395575f366003190112610395576008546001600160a01b031633141580610868575b610859575f601155337f921828337692c347c634c5d2aacbc7b756014674bd236f3cc2058d8e284a951b5f80a2005b637cf97e4d60e11b5f5260045ffd5b50600c546001600160a01b031633141561082a565b3461039557602036600319011261039557610896612b71565b50602061062a6108ba6108a761361c565b6108af612fad565b509290600254612f03565b9061386f565b34610395576108ce36612d88565b6108d661324b565b80516001600160401b038111610a69576108f1601854612def565b601f8111610a01575b506020601f821160011461096f57918161095f927f4df9dcd34ae35f40f2c756fd8ac83210ed0b76d065543ee73d868aec7c7fcf02945f91610964575b508160011b915f199060031b1c1916176018555b604051918291602083526020830190612b24565b0390a1005b905082015185610937565b601f1982169060185f525f80516020614c9d833981519152915f5b8181106109e95750927f4df9dcd34ae35f40f2c756fd8ac83210ed0b76d065543ee73d868aec7c7fcf0294926001928261095f96106109d1575b5050811b0160185561094b565b8401515f1960f88460031b161c1916905585806109c4565b9192602060018192868901518155019401920161098a565b60185f52601f820160051c5f80516020614c9d833981519152019060208310610a54575b601f0160051c5f80516020614c9d83398151915201905b818110610a4957506108fa565b5f8155600101610a3c565b5f80516020614c9d8339815191529150610a25565b634e487b7160e01b5f52604160045260245ffd5b3461039557602036600319011261039557610a96612b71565b6013546001600160a01b0316908115610b5b576040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa918215610b50575f92610b1a575b5081610aec9184613da0565b6040519081527f2ae72b44f59d038340fca5739135a1d51fc5ab720bb02d983e4c5ff4119ca7b860203392a3005b9091506020813d602011610b48575b81610b3660209383612c17565b81010312610395575190610aec610ae0565b3d9150610b29565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b3461039557602061062a610b7d36612cfd565b929190610b8861378c565b610b986002546016549084613bc5565b93849133613c7b565b3461039557610baf36612d88565b610bb761324b565b80516001600160401b038111610a6957610bd2601954612def565b601f8111610cdc575b506020601f8211600114610c4a57918161095f927fadf3ae8bd543b3007d464f15cb8ea1db3f44e84d41d203164f40b95e27558ac6945f91610c3f575b508160011b915f199060031b1c191617601955604051918291602083526020830190612b24565b905082015185610c18565b601f1982169060195f525f80516020614cbd833981519152915f5b818110610cc45750927fadf3ae8bd543b3007d464f15cb8ea1db3f44e84d41d203164f40b95e27558ac694926001928261095f9610610cac575b5050811b0160195561094b565b8401515f1960f88460031b161c191690558580610c9f565b91926020600181928689015181550194019201610c65565b60195f52601f820160051c5f80516020614cbd833981519152019060208310610d2f575b601f0160051c5f80516020614cbd83398151915201905b818110610d245750610bdb565b5f8155600101610d17565b5f80516020614cbd8339815191529150610d00565b3461039557602061062a610d5736612cfd565b9291610d6161378c565b610d716002546016549083613829565b93849233613c7b565b3461039557602036600319011261039557602061062a610da6610d9b612fad565b509190600254612f03565b600435613b81565b3461039557604036600319011261039557610dc7612b71565b6024359081151580920361039557610ddd61324b565b6001600160a01b03165f818152600b602052604090205490919060ff16151581146104775760207f74dc60cbc81a9472d04ad1d20e151d369c41104d655ed3f2f3091166a502cd8d91835f52600b825260405f2060ff1981541660ff8316179055604051908152a2005b34610395575f36600319011261039557602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610395576020366003190112610395576004356001600160401b03811161039557610eb4903690600401612bb1565b90610ebe82612ecb565b91610ecc6040519384612c17565b808352601f19610edb82612ecb565b015f5b818110610fd8575050905f90601e1981360301915b83811015610f71578060051b82013583811215610395578201908135916001600160401b038311610395576020018236038113610395575f80610f3d610f55936001963691612d52565b602081519101305af4610f4e613c4c565b903061485d565b610f5f8288612eef565b52610f6a8187612eef565b5001610ef3565b846040518091602082016020835281518091526040830190602060408260051b8601019301915f905b828210610fa957505050500390f35b91936001919395506020610fc88192603f198a82030186528851612b24565b9601920192018594939192610f9a565b806060602080938801015201610ede565b346103955760403660031901126103955761100f611005612b71565b602435903361318e565b602060405160018152f35b34610395575f36600319011261039557600f546001600160401b038160a01c1680156110675742106110585761074b906001600160a01b0316613c02565b63333bd2cb60e11b5f5260045ffd5b63e5f408a560e01b5f5260045ffd5b34610395576020366003190112610395576004355f908152601060209081526040918290205482516001600160c01b038216815260c09190911c91810191909152f35b0390f35b34610395575f366003190112610395576020601454604051908152f35b34610395576020366003190112610395576110f3612b71565b6110fb61324b565b600c546001600160a01b03828116929116828114610477576001600160401b03600f5460a01c166111a6576111345761074b9150613c02565b50611155600e54826001600160601b0360a01b600f541617600f5542612f03565b600f805467ffffffffffffffff60a01b191660a09290921b67ffffffffffffffff60a01b169190911790557f7633313af54753bce8a149927263b1a55eba857ba4ef1d13c6aee25d384d3c4b5f80a2005b6324d9026760e11b5f5260045ffd5b34610395575f366003190112610395576040515f6019546111d581612def565b808452906001811690811561124857506001146111fd575b6110b98361094b81850382612c17565b60195f9081525f80516020614cbd833981519152939250905b80821061122e5750909150810160200161094b6111ed565b919260018160209254838588010152019101909291611216565b60ff191660208086019190915291151560051b8401909101915061094b90506111ed565b3461039557604036600319011261039557602060043561062a61128d612b87565b9161129661378c565b6112a66002546016549083613b81565b8093336138b4565b34610395575f366003190112610395576008546040516001600160a01b039091168152602090f35b34610395575f366003190112610395576011548060c01c80156110675742106110585761074b906001600160c01b0316613979565b34610395575f366003190112610395576113a76113477f00000000000000000000000000000000000000000000000000000000000000006147c6565b6113707f0000000000000000000000000000000000000000000000000000000000000000614826565b60206113b5604051926113838385612c17565b5f84525f368137604051958695600f60f81b875260e08588015260e0870190612b24565b908582036040870152612b24565b4660608501523060808501525f60a085015283810360c08501528180845192838152019301915f5b8281106113ec57505050500390f35b8351855286955093810193928101926001016113dd565b346103955760a03660031901126103955761141d36612c38565b600a546001600160a01b031633141580611545575b6115365760a09020805f52600d60205260405f205460c01c6111a6575f818152600d60205260409020546001600160b81b031661152757805f52600d60205260ff60405f205460b81c161561151557805f52601060205260405f205460c01c611504576114dd6001600160401b036114ac600e5442612f03565b5f848152600d6020526040902080546001600160c01b03169290911660c01b6001600160c01b031916919091179055565b337f3240fc70754c5a2b4dab10bf7081a00024bfc8491581ee3d355360ec0dd91f165f80a3005b62463af360e81b5f5260045260245ffd5b636113d8c760e01b5f5260045260245ffd5b63624718b960e11b5f5260045ffd5b6332a2673b60e21b5f5260045ffd5b506008546001600160a01b0316331415611432565b34610395576020366003190112610395576001600160a01b0361157b612b71565b165f526007602052602060405f2054604051908152f35b34610395575f36600319011261039557601154604080516001600160c01b038316815260c09290921c602083015290f35b34610395575f36600319011261039557600954336001600160a01b039091160361163657600980546001600160a01b0319908116909155600880543392811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b63118cdaa760e01b5f523360045260245ffd5b34610395575f36600319011261039557600f54604080516001600160a01b038316815260a09290921c6001600160401b0316602083015290f35b34610395576020366003190112610395576004356001600160401b03811161039557366023820112156103955780600401356001600160401b0381116103955736602460c083028401011161039557335f52600b60205260ff60405f2054161580611a77575b80611a62575b611a53575f918290815b83831015611a3c5760c083028201906023198236030160c08112610395576040519060408201908282106001600160401b03831117610a695760a091604052126103955760a060405161174b81612be1565b61175760248601612b9d565b815261176560448601612b9d565b602082015261177660648601612b9d565b604082015261178760848601612b9d565b606082015260a4850135608082015280835260c46020840195013585522092835f52600d60205260ff60405f205460b81c1615611a29576117c9848351613a3d565b5082518083118184030294929085156118e95750505f9251156118de575b5051604051635c2bea4960e01b81529290611806906004850190612f26565b60a483015260c48201523060e48201819052610104820152604081610124815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1918215610b50576001936118a1935f935f916118aa575b506040519084825260208201527fdd8bf5226dff861316e0fa7863fdb7dc7b87c614eb29a135f524eb79d5a1189a60403392a3612f03565b925b01916116f9565b90506118ce91935060403d81116118d7575b6118c68183612c17565b810190612f10565b9290928a611869565b503d6118bc565b5f93509150896117e7565b9293509497999350505f1981145f14611a1c575081860382871102925b8315611a0e575f858152600d60205260409020546001600160b81b03169061192f908590612f03565b116119fb5790604061195993925181518095819263a99aad8960e01b835286309160048501612f65565b03815f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af1938415610b50576001946119d5945f916119db575b506040519084825260208201527f89bf199df65bf65155e3e0a8abc4ad4a1be606220c8295840dba2ab5656c1f6d60403392a3612f03565b946118a3565b6119f3915060403d81116118d7576118c68183612c17565b90508a61199d565b83635e25afa560e01b5f5260045260245ffd5b5050959050600191506118a3565b8380820391110292611906565b83636113d8c760e01b5f5260045260245ffd5b8403611a4457005b6309e36b8960e41b5f5260045ffd5b63f7137c0f60e01b5f5260045ffd5b506008546001600160a01b03163314156116ef565b50600a546001600160a01b03163314156116e9565b3461039557602036600319011261039557600435611aa861324b565b600e548082146104775760115460c01c6111a657621275008211611b6757620151808210611b585780821115611ae2575061074b90613979565b601180546001600160c01b0319166001600160b81b0384161790557fb3aa0ade2442acf51d06713c2d1a5a3ec0373cce969d42b53f4689f97bccf38091602091611b2c9042612f03565b601180546001600160c01b031660c09290921b6001600160c01b031916919091179055604051908152a1005b631a1593df60e11b5f5260045ffd5b6346fedb5760e01b5f5260045ffd5b34610395575f36600319011261039557611b8e61324b565b600980546001600160a01b03199081169091556008805491821690555f906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610395576020366003190112610395576001600160a01b03611bfc612b71565b165f525f602052602060405f2054604051908152f35b346103955760a036600319011261039557611c2c36612c38565b60a081205f52601060205260405f205460c01c8015611067574210611058578060a061074b9220805f52601060205260018060b81b0360405f2054169161345e565b3461039557604036600319011261039557602060043561062a611c8f612b87565b611c9761378c565b611ca7600254601654908561386f565b928391336138b4565b3461039557602036600319011261039557600435611ccc61324b565b6012546001600160601b0381168214610477576706f05b59d3b200008211611d5b578115159081611d4f575b50610516576001600160601b0390611d0e61378c565b16806001600160601b031960125416176012556040519081527f01fe2943baee27f47add82886c2200f910c749c461c9b63c5fe83901a53bdb4960203392a2005b905060601c1582611cf8565b63f4df6ae560e01b5f5260045ffd5b346103955760203660031901126103955760043560155481101561039557610386602091612cb9565b34610395575f366003190112610395576020601654604051908152f35b34610395576020366003190112610395576001600160a01b03611dd1612b71565b165f52600b602052602060ff60405f2054166040519015158152f35b612b48565b346103955760203660031901126103955760043560018060a01b03600c541633141580611e8a575b80611e75575b611e66575f818152600d6020526040812080546001600160c01b0316905533907fcbeb8ecdaa5a3c133e62219b63bfc35bce3fda13065d2bed32e3b7dde60a59f49080a3005b63d080fa3160e01b5f5260045ffd5b506008546001600160a01b0316331415611e20565b50600a546001600160a01b0316331415611e1a565b34610395575f36600319011261039557602060125460601c604051908152f35b34610395575f36600319011261039557600c546040516001600160a01b039091168152602090f35b34610395576020366003190112610395576004356001600160401b03811161039557611f17903690600401612bb1565b90335f52600b60205260ff60405f2054161580612237575b80612222575b611a5357601554611f4581612ecb565b611f526040519182612c17565b818152601f19611f6183612ecb565b01366020830137611f7184612ecb565b92611f7f6040519485612c17565b848452611f8b85612ecb565b602085019590601f19013687375f5b8181106121c2575050505f5b8281106120c35750505080516001600160401b038111610a6957600160401b8111610a69576015548160155580821061207f575b508260155f525f5b82811061204b5750505060405190602082019060208352518091526040820192905f5b81811061203557337fe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d85870386a2005b8251855260209485019490920191600101612005565b60019060208351930192817f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475015501611fe2565b60155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4759081019082015b8181106120b85750611fda565b5f81556001016120ab565b6120cd8183612eef565b51156120dc575b600101611fa6565b6120e581612cb9565b905460039190911b1c5f818152600d60205260409020546001600160b81b03166121b057805f52601060205260405f205460c01c6115045761214830827f00000000000000000000000000000000000000000000000000000000000000006136d4565b612160575b5f908152600d60205260408120556120d4565b805f52600d60205260405f205460c01c1561219e57805f52600d60205260405f205460c01c42101561214d57632cd5119960e21b5f5260045260245ffd5b63af8ae28760e01b5f5260045260245ffd5b63401d83d960e11b5f5260045260245ffd5b6121cd818385612ea8565b356121d781612cb9565b90549060031b1c906121e98187612eef565b5161220f579060016121fd81949388612eef565b526122088289612eef565b5201611f9a565b506392a726c360e01b5f5260045260245ffd5b506008546001600160a01b0316331415611f35565b50600a546001600160a01b0316331415611f2f565b3461039557602036600319011261039557612265612b71565b50602061062a61361c565b346103955760c03660031901126103955761228a36612c38565b60a4359060018060a01b03600a5416331415806124e4575b6115365760a0812081519092906001600160a01b039081167f0000000000000000000000000000000000000000000000000000000000000000909116036124d15760405160208101908482526003604082015260408152612304606082612c17565b519020600281018091116124bd575f61231f6123399261416d565b60405180938192637784c68560e01b8352600483016133f4565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610b50576001600160801b0391612388915f9161249b575b50612ee2565b51161561248c57825f52601060205260405f205460c01c6111a657825f52600d60205260405f205460c01c61247d575f838152600d60205260409020546001600160b81b0316818114610477578110156123ef57916123e961074b9361342d565b9161345e565b9050815f52601060205261244f60405f206001600160401b036124306124148561342d565b600e549060018060b81b03168360c01b85541617845542612f03565b82546001600160c01b0316911660c01b6001600160c01b031916179055565b6040519081527fe851bb5856808a50efd748be463b8f35bcfb5ec74c5bfde776fe0a4d2a26db2760203392a3005b6325f600a360e11b5f5260045ffd5b6396e1352960e01b5f5260045ffd5b6124b791503d805f833e6124af8183612c17565b81019061337b565b86612382565b634e487b7160e01b5f52601160045260245ffd5b826333cbfd2760e21b5f5260045260245ffd5b506008546001600160a01b03163314156122a2565b34610395575f366003190112610395576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34610395575f366003190112610395576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34610395575f366003190112610395576013546040516001600160a01b039091168152602090f35b34610395575f36600319011261039557602061062a61325f565b34610395575f366003190112610395576020601554604051908152f35b34610395575f3660031901126103955760ff7f00000000000000000000000000000000000000000000000000000000000000001660ff7f0000000000000000000000000000000000000000000000000000000000000000160160ff81116124bd5760209060ff60405191168152f35b3461039557602036600319011261039557612668612b71565b61267061324b565b6013546001600160a01b039182169181168214610477576001600160a01b03191681176013557f2e7908865670e21b9779422cadf5f1cba271a62bb95c71eaaf615c0a1c48ebee5f80a2005b34610395576020366003190112610395576004356001600160401b038111610395576126ec903690600401612bb1565b335f52600b60205260ff60405f205416158061289d575b80612888575b611a5357601e8111612879575f5b81811061282c57506001600160401b038111610a6957600160401b8111610a6957601454816014558082106127e8575b508160145f525f5b8281106127b457505060405190806020830160208452526040820192905f5b81811061279e57337f6ce31538fc7fba95714ddc8a275a09252b4b1fb8f33d2550aa58a5f62ad934de85870386a2005b823585526020948501949092019160010161276e565b60019060208335930192817fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec01550161274f565b60145f527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec9081019082015b8181106128215750612747565b5f8155600101612814565b612837818385612ea8565b355f908152600d60205260409020546001600160b81b03161561285c57600101612717565b9061286692612ea8565b3563067f0a2560e41b5f5260045260245ffd5b6340797bd760e11b5f5260045ffd5b506008546001600160a01b0316331415612709565b50600a546001600160a01b0316331415612703565b346103955760603660031901126103955761100f6128ce612b71565b6128d6612b87565b604435916128e58333836130c8565b61318e565b34610395575f366003190112610395576020601754604051908152f35b34610395575f366003190112610395576008546001600160a01b03163314158061295b575b610859575f600f55337fc40a085ccfa20f5fd518ade5c3a77a7ecbdfbb4c75efcdca6146a8e3c841d6635f80a2005b50600c546001600160a01b031633141561292c565b34610395575f366003190112610395576020600254604051908152f35b346103955760203660031901126103955760043560018060a01b03600c541633141580612a09575b806129f4575b611e6657805f5260106020525f6040812055337f1026ceca5ed3747eb5edec555732d4a6f901ce1a875ecf981064628cadde11205f80a3005b506008546001600160a01b03163314156129bb565b50600a546001600160a01b03163314156129b5565b3461039557602036600319011261039557602061062a612a3f610d9b612fad565b600435613829565b346103955760403660031901126103955761100f612a63612b71565b602435903361410a565b34610395575f366003190112610395576040515f601854612a8d81612def565b80845290600181169081156112485750600114612ab4576110b98361094b81850382612c17565b60185f9081525f80516020614c9d833981519152939250905b808210612ae55750909150810160200161094b6111ed565b919260018160209254838588010152019101909291612acd565b34610395575f366003190112610395576020612b19612fad565b509050604051908152f35b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b3461039557602036600319011261039557602061062a612b69610d9b612fad565b600435613bc5565b600435906001600160a01b038216820361039557565b602435906001600160a01b038216820361039557565b35906001600160a01b038216820361039557565b9181601f84011215610395578235916001600160401b038311610395576020808501948460051b01011161039557565b60a081019081106001600160401b03821117610a6957604052565b60c081019081106001600160401b03821117610a6957604052565b90601f801991011681019081106001600160401b03821117610a6957604052565b60a09060031901126103955760405190612c5182612be1565b816004356001600160a01b03811681036103955781526024356001600160a01b03811681036103955760208201526044356001600160a01b03811681036103955760408201526064356001600160a01b03811681036103955760608201526080608435910152565b601554811015612cd15760155f5260205f2001905f90565b634e487b7160e01b5f52603260045260245ffd5b601454811015612cd15760145f5260205f2001905f90565b606090600319011261039557600435906024356001600160a01b038116810361039557906044356001600160a01b03811681036103955790565b6001600160401b038111610a6957601f01601f191660200190565b929192612d5e82612d37565b91612d6c6040519384612c17565b829481845281830111610395578281602093845f960137010152565b602060031982011261039557600435906001600160401b038211610395578060238301121561039557816024612dc393600401359101612d52565b90565b3461039557602036600319011261039557602061062a612de7610d9b612fad565b60043561386f565b90600182811c92168015612e1d575b6020831014612e0957565b634e487b7160e01b5f52602260045260245ffd5b91607f1691612dfe565b5f9291815491612e3683612def565b8083529260018116908115612e8b5750600114612e5257505050565b5f9081526020812093945091925b838310612e71575060209250010190565b600181602092949394548385870101520191019190612e60565b915050602093945060ff929192191683830152151560051b010190565b9190811015612cd15760051b0190565b818102929181159184041417156124bd57565b6001600160401b038111610a695760051b60200190565b805115612cd15760200190565b8051821015612cd15760209160051b010190565b919082018092116124bd57565b9190826040910312610395576020825192015190565b80516001600160a01b03908116835260208083015182169084015260408083015182169084015260608083015190911690830152608090810151910152565b91612f74836101409593612f26565b60a08301525f60c083015260018060a01b031660e08201526101206101008201525f6101208201520190565b919082039182116124bd57565b5f905f806015547f00000000000000000000000000000000000000000000000000000000000000005b8183106130755750505060165491601754612ff18185612fa0565b83101561306757506130176130106130098486612fa0565b8094612f03565b9384612fa0565b80151580613053575b6130275750565b613050919450613043906001600160601b036012541690613fe4565b6002546106248286612fa0565b92565b506001600160601b03601254161515613020565b613010613017918094612f03565b9091926130bf6001916130b961309961308d88612cb9565b90549060031b1c613eca565b6130b16130aa3060a08420896136d4565b91876141e5565b5050916147a0565b90612f03565b93019190612fd6565b6001600160a01b039081165f81815260016020818152604080842095871684529490529290205493929184016130ff575b50505050565b82841061316b578015613158576001600160a01b03821615613145575f52600160205260405f209060018060a01b03165f5260205260405f20910390555f8080806130f9565b634a1406b160e11b5f525f60045260245ffd5b63e602df0560e01b5f525f60045260245ffd5b508290637dc7a0d960e11b5f5260018060a01b031660045260245260445260645ffd5b6001600160a01b0316908115613238576001600160a01b031691821561322557815f525f60205260405f205481811061320c57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b8263391434e360e21b5f5260045260245260445260645ffd5b63ec442f0560e01b5f525f60045260245ffd5b634b637e8f60e11b5f525f60045260245ffd5b6008546001600160a01b0316330361163657565b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480613352575b156132ba577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815261334c60c082612c17565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614613291565b602081830312610395578051906001600160401b03821161039557019080601f830112156103955781516133ae81612ecb565b926133bc6040519485612c17565b81845260208085019260051b82010192831161039557602001905b8282106133e45750505090565b81518152602091820191016133d7565b60206040818301928281528451809452019201905f5b8181106134175750505090565b825184526020938401939092019160010161340a565b6001600160b81b038111613447576001600160b81b031690565b6306dfcc6560e41b5f5260b860045260245260445ffd5b5f828152600d6020526040902093926001600160b81b031690816134d0575b508192938168ffffffffffffffffff60b81b8254161790556040519081527fe86b6d3313d3098f4c5f689c935de8fde876a597c185def2cedab85efedac68660203392a35f5260106020525f6040812055565b60ff855460b81c16156134f2575b5083546001600160c01b031684558161347d565b601554600160401b811015610a69578060016135119201601555612cb9565b81549060031b9085821b915f19901b1916179055601e601554116128795761358761358c91600160b81b60ff60b81b198854161787556130b9601654916130b17f0000000000000000000000000000000000000000000000000000000000000000916135813060a08320856136d4565b926141e5565b614194565b604051936020850160208652601554809152604086019060155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475905f5b818110613606575050507fe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d8685969733930390a293926134de565b82548452602090930192600192830192016135cb565b5f905f6014547f00000000000000000000000000000000000000000000000000000000000000005b81831061365057505050565b90919361365c85612ce5565b905460039190911b1c5f818152600d60205260409020546001600160b81b03169081156136c957916136bf916136b36001946136ab6136a561369f30848b6136d4565b92613eca565b886141e5565b5050916144cd565b80820391110290612f03565b945b019190613644565b5050936001906136c1565b61372f61374b935f936040516020810191825260026040820152604081526136fd606082612c17565b51902060405190602082019260018060a01b03168352604082015260408152613727606082612c17565b51902061416d565b906040518080958194637784c68560e01b8352600483016133f4565b03916001600160a01b03165afa8015610b505761376e915f916137725750612ee2565b5190565b61378691503d805f833e6124af8183612c17565b5f612382565b7ff66f28b40975dbb933913542c7e6a0f50a1d0f20aa74ea6e0efe65ab616323ec60407f548669ea9bcc24888e6d74a69c9865fa98d795686853b8aa3eb87814261bbb7160206137da612fad565b6137e78295939492614194565b806017558551908152a180613804575b82519182526020820152a1565b6138138160125460601c61450c565b6137f7565b60ff16604d81116124bd57600a0a90565b90613857906130b97f0000000000000000000000000000000000000000000000000000000000000000613818565b91600181018091116124bd57612dc392600192614569565b9061389d906130b97f0000000000000000000000000000000000000000000000000000000000000000613818565b91600181018091116124bd57612dc3925f92614569565b92613977937fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7604061358795946139448251946323b872dd60e01b602087015260018060a01b0316948560248201523060448201528760648201526064815261391e608482612c17565b7f00000000000000000000000000000000000000000000000000000000000000006149ed565b61394e858261450c565b815186815260208101959095526001600160a01b031693a361396f816145b9565b601654612f03565b565b80600e556040519081527fd28e9b90ee9b37c5936ff84392d71f29ff18117d7e76bcee60615262a90a3f7560203392a25f601155565b51906001600160801b038216820361039557565b908160c091031261039557613a3560a0604051926139e084612bfc565b6139e9816139af565b84526139f7602082016139af565b6020850152613a08604082016139af565b6040850152613a19606082016139af565b6060850152613a2a608082016139af565b6080850152016139af565b60a082015290565b905f915f60a0604051613a4f81612bfc565b82815282602082015282604082015282606082015282608082015201527f00000000000000000000000000000000000000000000000000000000000000009060018060a01b03821690813b1561039557604051630a8e0d6f60e11b815290613abb906004830190612f26565b5f8160a48183865af18015610b5057613b6b575b5060c060249160405192838092632e3071cd60e11b82528760048301525afa938415613b5f5793613b26575b50613b0c61305091849330916136d4565b926001600160801b036020818351169201511690846147a0565b613050919350613b50613b0c9160c03d60c011613b58575b613b488183612c17565b8101906139c3565b939150613afb565b503d613b3e565b604051903d90823e3d90fd5b613b789194505f90612c17565b5f9260c0613acf565b600183018093116124bd57612dc392613bbf6001936130b97f0000000000000000000000000000000000000000000000000000000000000000613818565b91614569565b600183018093116124bd57612dc392613bbf5f936130b97f0000000000000000000000000000000000000000000000000000000000000000613818565b600c80546001600160a01b0319166001600160a01b03929092169182179055337fcb11cc8aade2f5a556749d1b2380d108a16fac3431e6a5d5ce12ef9de0bd76e35f80a35f600f55565b3d15613c76573d90613c5d82612d37565b91613c6b6040519384612c17565b82523d5f602084013e565b606090565b9193613c8f60165485808203911102614194565b613c98846148bb565b6001600160a01b0385811695908416938290878603613d8f575b505050841561323857845f525f60205260405f2054818110613d765791816040927ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db94885f525f60205203835f205580600254036002555f877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208651858152a3613d5f86837f0000000000000000000000000000000000000000000000000000000000000000613da0565b825195865260208601526001600160a01b031693a4565b8563391434e360e21b5f5260045260245260445260645ffd5b613d98926130c8565b5f8181613cb2565b60405163a9059cbb60e01b60208201526001600160a01b03909216602483015260448083019390935291815261397791613ddb606483612c17565b6149ed565b613e1590613dec612fad565b50613dfb819492600254612f03565b9260018060a01b03165f525f6020528260405f2054613bc5565b6015549290805f7f00000000000000000000000000000000000000000000000000000000000000005b868210613e54575b505061305092939450612fa0565b9092613e9b613e6285612cb9565b90549060031b1c613e95613e81613e7883613eca565b923090876136d4565b613e8b83876141e5565b50939180936147a0565b92614bef565b808203911102928315613eb15760010190613e3e565b613e46565b51906001600160a01b038216820361039557565b5f6080604051613ed981612be1565b828152826020820152826040820152826060820152015260405190632c3c915760e01b8252600482015260a081602481600180851b037f0000000000000000000000000000000000000000000000000000000000000000165afa908115610b50575f91613f44575090565b905060a0813d60a011613fbe575b81613f5f60a09383612c17565b8101031261039557608060405191613f7683612be1565b613f7f81613eb6565b8352613f8d60208201613eb6565b6020840152613f9e60408201613eb6565b6040840152613faf60608201613eb6565b60608401520151608082015290565b3d9150613f52565b8115613fd0570490565b634e487b7160e01b5f52601260045260245ffd5b9190915f838202915f19858209918380841093039280840393146140635782670de0b6b3a7640000111561405457507faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac106699394670de0b6b3a7640000910990828211900360ee1b910360121c170290565b63227bc15360e01b8152600490fd5b505050670de0b6b3a76400009192500490565b9091828202915f19848209938380861095039480860395146140fd57848311156140ee57829109815f0382168092046002816003021880820260020302808202600203028082026002030280820260020302808202600203028091026002030293600183805f03040190848311900302920304170290565b63227bc15360e01b5f5260045ffd5b505090612dc39250613fc6565b6001600160a01b0316908115613158576001600160a01b03169182156131455760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591835f526001825260405f20855f5282528060405f2055604051908152a3565b6040519061417c604083612c17565b600182526020368184013761419082612ee2565b5290565b60207f15c027cc4fd826d986cad358803439f7326d3aa4ed969ff90dbee4bc150f68e99180601655604051908152a1565b906001600160801b03809116911601906001600160801b0382116124bd57565b9060c060a08220602460405180958193632e3071cd60e11b8352600483015260018060a01b03165afa918215610b50575f926144ac575b50608082016142356001600160801b0382511642612fa0565b9182151580614496575b80614480575b614283575b5050506001600160801b038151166001600160801b03602083015116926001600160801b03606081604086015116940151169193929190565b6060810151604051638c00bf6b60e01b8152916001600160a01b03909116906142b0906004840190612f26565b6001600160801b0385511660a483015260208501936001600160801b0385511660c48401526001600160801b0360408701948186511660e48601528160608901511661010486015251166101248401526020836101648160a08a01956001600160801b038751166101448301525afa928315610b50575f9361444a575b506143906001600160801b039361438a614354670de0b6b3a7640000948789511693612eb8565b614385671bc16d674ec8000061436a8380612eb8565b046729a2241af62c000061437e8483612eb8565b0492612f03565b612f03565b90612eb8565b0492826143a861439f86614b7d565b828451166141c5565b169052816143c16143b885614b7d565b828851166141c5565b168552511690811561424a57670de0b6b3a7640000916143e091612eb8565b046143f5816001600160801b03855116612fa0565b6001600160801b0383511691620f424083018093116124bd57600182018092116124bd5761443a61443f926144356001600160801b039561439f94612eb8565b613fc6565b614b7d565b1690525f808061424a565b92506020833d602011614478575b8161446560209383612c17565b810103126103955791519161439061432d565b3d9150614458565b5060608101516001600160a01b03161515614245565b506001600160801b03604085015116151561423f565b6144c691925060c03d60c011613b5857613b488183612c17565b905f61421c565b90600181018091116124bd57620f42408301918284116124bd57620f423f916144f591612eb8565b9201918183116124bd57612dc39261443591612f03565b6001600160a01b0316908115613225577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60208261454d5f94600254612f03565b60025584845283825260408420818154019055604051908152a3565b9190600180614579848487614076565b9561458381614ae3565b161492836145a4575b5050506145965790565b600181018091116124bd5790565b909180935015613fd0570915155f808061458c565b7f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b0382165f5b601454811015614787576145fa81612ce5565b905460039190911b1c5f818152600d60205260409020546001600160b81b0316801561477d5761462982613eca565b91843b1561039557604051630a8e0d6f60e11b815261464b6004820185612f26565b5f8160a481838a5af18015610b505761476d575b50604051632e3071cd60e11b8152600481018290529060c082602481895afa908115610b50576146b6925f92614749575b5061469d9030908a6136d4565b906001600160801b0360208183511692015116916144cd565b808203911102908185108583180280831892036146e0575b505082156130f9576001905b016145e7565b60406147029181518093819263a99aad8960e01b835286309160048501612f65565b03815f885af1908161472c575b5061471b575b806146ce565b6147259193612fa0565b915f614715565b6147439060403d81116118d7576118c68183612c17565b5061470f565b61469d9192506147669060c03d8111613b5857613b488183612c17565b9190614690565b5f61477791612c17565b5f61465f565b50506001906146da565b5050905061479157565b63ded0652d60e01b5f5260045ffd5b60018201929183106124bd57620f424082018092116124bd57612dc39261443591612eb8565b60ff811461480c5760ff811690601f82116147fd57604051916147ea604084612c17565b6020808452838101919036833783525290565b632cd44ac360e21b5f5260045ffd5b50604051612dc38161481f816005612e27565b0382612c17565b60ff811461484a5760ff811690601f82116147fd57604051916147ea604084612c17565b50604051612dc38161481f816006612e27565b90614881575080511561487257805190602001fd5b630a12f52160e11b5f5260045ffd5b815115806148b2575b614892575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561488a565b5f5b6015548110156149d7576148d081612cb9565b90549060031b1c6149086148ed6148e683613eca565b9283613a3d565b90506001600160801b03604081835116920151169084614bef565b9081841084831802808318920361492e575b5050811561492a576001016148bd565b5050565b604051635c2bea4960e01b81529061494a906004830190612f26565b8160a48201525f60c48201523060e482015230610104820152604081610124815f60018060a01b037f0000000000000000000000000000000000000000000000000000000000000000165af190816149ba575b506149a9575b8061491a565b6149b39192612fa0565b905f6149a3565b6149d19060403d81116118d7576118c68183612c17565b5061499d565b506149de57565b634323a55560e01b5f5260045ffd5b5f80614a159260018060a01b03169360208151910182865af1614a0e613c4c565b908361485d565b8051908115159182614a3d575b5050614a2b5750565b635274afe760e01b5f5260045260245ffd5b81925090602091810103126103955760200151801590811503610395575f80614a22565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411614ad8579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa15610b50575f516001600160a01b03811615614ace57905f905f90565b505f906001905f90565b5050505f9160039190565b60041115614aed57565b634e487b7160e01b5f52602160045260245ffd5b614b0a81614ae3565b80614b13575050565b614b1c81614ae3565b60018103614b335763f645eedf60e01b5f5260045ffd5b614b3c81614ae3565b60028103614b57575063fce698f760e01b5f5260045260245ffd5b600390614b6381614ae3565b14614b6b5750565b6335e2f38360e21b5f5260045260245ffd5b604051614b8b604082612c17565b60148152731b585e081d5a5b9d0c4c8e08195e18d95959195960621b60208201526001600160801b038211614bc757506001600160801b031690565b60405162461bcd60e51b815260206004820152908190614beb906024830190612b24565b0390fd5b91614bfe602091602493612fa0565b92516040516370a0823160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529093849290918391165afa908115610b50575f91614c6a575b508181109082180218818110908218021890565b90506020813d602011614c94575b81614c8560209383612c17565b8101031261039557515f614c56565b3d9150614c7856feb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c9695a164736f6c634300081a000a4df9dcd34ae35f40f2c756fd8ac83210ed0b76d065543ee73d868aec7c7fcf020000000000000000000000005a4e19842e09000a582c20a4f524c26fb48dd4d00000000000000000000000006c247b1f6182318877311737bac0844baa518f5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e583100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000005785553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057855534443000000000000000000000000000000000000000000000000000000","name":"MetaMorphoV1_1","is_blueprint":false,"license_type":"none","is_fully_verified":false,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"cancun","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"src/libraries/ConstantsLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\n/// @title ConstantsLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library exposing constants.\nlibrary ConstantsLib {\n    /// @dev The maximum delay of a timelock.\n    uint256 internal constant MAX_TIMELOCK = 2 weeks;\n\n    /// @dev The minimum delay of a timelock post initialization.\n    uint256 internal constant POST_INITIALIZATION_MIN_TIMELOCK = 1 days;\n\n    /// @dev The maximum number of markets in the supply/withdraw queue.\n    uint256 internal constant MAX_QUEUE_LENGTH = 30;\n\n    /// @dev The maximum fee the vault can have (50%).\n    uint256 internal constant MAX_FEE = 0.5e18;\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.20;\n\ninterface IERC5267 {\n    /**\n     * @dev MAY be emitted to signal that the domain could have changed.\n     */\n    event EIP712DomainChanged();\n\n    /**\n     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n     * signature.\n     */\n    function eip712Domain()\n        external\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        );\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in an uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev An uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/periphery/MorphoStorageLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {Id} from \"../../interfaces/IMorpho.sol\";\n\n/// @title MorphoStorageLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Helper library exposing getters to access Morpho storage variables' slot.\n/// @dev This library is not used in Morpho itself and is intended to be used by integrators.\nlibrary MorphoStorageLib {\n    /* SLOTS */\n\n    uint256 internal constant OWNER_SLOT = 0;\n    uint256 internal constant FEE_RECIPIENT_SLOT = 1;\n    uint256 internal constant POSITION_SLOT = 2;\n    uint256 internal constant MARKET_SLOT = 3;\n    uint256 internal constant IS_IRM_ENABLED_SLOT = 4;\n    uint256 internal constant IS_LLTV_ENABLED_SLOT = 5;\n    uint256 internal constant IS_AUTHORIZED_SLOT = 6;\n    uint256 internal constant NONCE_SLOT = 7;\n    uint256 internal constant ID_TO_MARKET_PARAMS_SLOT = 8;\n\n    /* SLOT OFFSETS */\n\n    uint256 internal constant LOAN_TOKEN_OFFSET = 0;\n    uint256 internal constant COLLATERAL_TOKEN_OFFSET = 1;\n    uint256 internal constant ORACLE_OFFSET = 2;\n    uint256 internal constant IRM_OFFSET = 3;\n    uint256 internal constant LLTV_OFFSET = 4;\n\n    uint256 internal constant SUPPLY_SHARES_OFFSET = 0;\n    uint256 internal constant BORROW_SHARES_AND_COLLATERAL_OFFSET = 1;\n\n    uint256 internal constant TOTAL_SUPPLY_ASSETS_AND_SHARES_OFFSET = 0;\n    uint256 internal constant TOTAL_BORROW_ASSETS_AND_SHARES_OFFSET = 1;\n    uint256 internal constant LAST_UPDATE_AND_FEE_OFFSET = 2;\n\n    /* GETTERS */\n\n    function ownerSlot() internal pure returns (bytes32) {\n        return bytes32(OWNER_SLOT);\n    }\n\n    function feeRecipientSlot() internal pure returns (bytes32) {\n        return bytes32(FEE_RECIPIENT_SLOT);\n    }\n\n    function positionSupplySharesSlot(Id id, address user) internal pure returns (bytes32) {\n        return bytes32(\n            uint256(keccak256(abi.encode(user, keccak256(abi.encode(id, POSITION_SLOT))))) + SUPPLY_SHARES_OFFSET\n        );\n    }\n\n    function positionBorrowSharesAndCollateralSlot(Id id, address user) internal pure returns (bytes32) {\n        return bytes32(\n            uint256(keccak256(abi.encode(user, keccak256(abi.encode(id, POSITION_SLOT)))))\n                + BORROW_SHARES_AND_COLLATERAL_OFFSET\n        );\n    }\n\n    function marketTotalSupplyAssetsAndSharesSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, MARKET_SLOT))) + TOTAL_SUPPLY_ASSETS_AND_SHARES_OFFSET);\n    }\n\n    function marketTotalBorrowAssetsAndSharesSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, MARKET_SLOT))) + TOTAL_BORROW_ASSETS_AND_SHARES_OFFSET);\n    }\n\n    function marketLastUpdateAndFeeSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, MARKET_SLOT))) + LAST_UPDATE_AND_FEE_OFFSET);\n    }\n\n    function isIrmEnabledSlot(address irm) internal pure returns (bytes32) {\n        return keccak256(abi.encode(irm, IS_IRM_ENABLED_SLOT));\n    }\n\n    function isLltvEnabledSlot(uint256 lltv) internal pure returns (bytes32) {\n        return keccak256(abi.encode(lltv, IS_LLTV_ENABLED_SLOT));\n    }\n\n    function isAuthorizedSlot(address authorizer, address authorizee) internal pure returns (bytes32) {\n        return keccak256(abi.encode(authorizee, keccak256(abi.encode(authorizer, IS_AUTHORIZED_SLOT))));\n    }\n\n    function nonceSlot(address authorizer) internal pure returns (bytes32) {\n        return keccak256(abi.encode(authorizer, NONCE_SLOT));\n    }\n\n    function idToLoanTokenSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, ID_TO_MARKET_PARAMS_SLOT))) + LOAN_TOKEN_OFFSET);\n    }\n\n    function idToCollateralTokenSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, ID_TO_MARKET_PARAMS_SLOT))) + COLLATERAL_TOKEN_OFFSET);\n    }\n\n    function idToOracleSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, ID_TO_MARKET_PARAMS_SLOT))) + ORACLE_OFFSET);\n    }\n\n    function idToIrmSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, ID_TO_MARKET_PARAMS_SLOT))) + IRM_OFFSET);\n    }\n\n    function idToLltvSlot(Id id) internal pure returns (bytes32) {\n        return bytes32(uint256(keccak256(abi.encode(id, ID_TO_MARKET_PARAMS_SLOT))) + LLTV_OFFSET);\n    }\n}\n"},{"file_path":"src/interfaces/IMetaMorphoV1_1.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport {IMorpho, Id, MarketParams} from \"../../lib/morpho-blue/src/interfaces/IMorpho.sol\";\nimport {IERC4626} from \"../../lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol\";\nimport {IERC20Permit} from \"../../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol\";\n\nimport {MarketConfig, PendingUint192, PendingAddress} from \"../libraries/PendingLib.sol\";\n\nstruct MarketAllocation {\n    /// @notice The market to allocate.\n    MarketParams marketParams;\n    /// @notice The amount of assets to allocate.\n    uint256 assets;\n}\n\ninterface IMulticall {\n    function multicall(bytes[] calldata) external returns (bytes[] memory);\n}\n\ninterface IOwnable {\n    function owner() external view returns (address);\n    function transferOwnership(address) external;\n    function renounceOwnership() external;\n    function acceptOwnership() external;\n    function pendingOwner() external view returns (address);\n}\n\n/// @dev This interface is used for factorizing IMetaMorphoV1_1StaticTyping and IMetaMorphoV1_1.\n/// @dev Consider using the IMetaMorphoV1_1 interface instead of this one.\ninterface IMetaMorphoV1_1Base {\n    /// @notice The address of the Morpho contract.\n    function MORPHO() external view returns (IMorpho);\n\n    /// @notice OpenZeppelin decimals offset used by the ERC4626 implementation.\n    /// @dev Calculated to be max(0, 18 - underlyingDecimals).\n    /// @dev When equal to zero (<=> token decimals >= 18), the protection against the inflation front-running attack on\n    /// empty vault is low (see https://docs.openzeppelin.com/contracts/5.x/erc4626#inflation-attack). To protect\n    /// against this attack, vault deployers should make an initial deposit of a non-trivial amount in the vault or\n    /// depositors should check that the share price does not exceed a certain limit.\n    function DECIMALS_OFFSET() external view returns (uint8);\n\n    /// @notice The address of the curator.\n    function curator() external view returns (address);\n\n    /// @notice Stores whether an address is an allocator or not.\n    function isAllocator(address target) external view returns (bool);\n\n    /// @notice The current guardian. Can be set even without the timelock set.\n    function guardian() external view returns (address);\n\n    /// @notice The current fee.\n    function fee() external view returns (uint96);\n\n    /// @notice The fee recipient.\n    function feeRecipient() external view returns (address);\n\n    /// @notice The skim recipient.\n    function skimRecipient() external view returns (address);\n\n    /// @notice The current timelock.\n    function timelock() external view returns (uint256);\n\n    /// @dev Stores the order of markets on which liquidity is supplied upon deposit.\n    /// @dev Can contain any market. A market is skipped as soon as its supply cap is reached.\n    function supplyQueue(uint256) external view returns (Id);\n\n    /// @notice Returns the length of the supply queue.\n    function supplyQueueLength() external view returns (uint256);\n\n    /// @dev Stores the order of markets from which liquidity is withdrawn upon withdrawal.\n    /// @dev Always contain all non-zero cap markets as well as all markets on which the vault supplies liquidity,\n    /// without duplicate.\n    function withdrawQueue(uint256) external view returns (Id);\n\n    /// @notice Returns the length of the withdraw queue.\n    function withdrawQueueLength() external view returns (uint256);\n\n    /// @notice Stores the total assets managed by this vault when the fee was last accrued.\n    function lastTotalAssets() external view returns (uint256);\n\n    /// @notice Stores the missing assets due to realized bad debt or forced market removal.\n    /// @dev In order to cover those lost assets, it is advised to supply on behalf of address(1) on the vault\n    /// (canonical method).\n    function lostAssets() external view returns (uint256);\n\n    /// @notice Submits a `newTimelock`.\n    /// @dev Warning: Reverts if a timelock is already pending. Revoke the pending timelock to overwrite it.\n    /// @dev In case the new timelock is higher than the current one, the timelock is set immediately.\n    function submitTimelock(uint256 newTimelock) external;\n\n    /// @notice Accepts the pending timelock.\n    function acceptTimelock() external;\n\n    /// @notice Revokes the pending timelock.\n    /// @dev Does not revert if there is no pending timelock.\n    function revokePendingTimelock() external;\n\n    /// @notice Submits a `newSupplyCap` for the market defined by `marketParams`.\n    /// @dev Warning: Reverts if a cap is already pending. Revoke the pending cap to overwrite it.\n    /// @dev Warning: Reverts if a market removal is pending.\n    /// @dev In case the new cap is lower than the current one, the cap is set immediately.\n    function submitCap(MarketParams memory marketParams, uint256 newSupplyCap) external;\n\n    /// @notice Accepts the pending cap of the market defined by `marketParams`.\n    function acceptCap(MarketParams memory marketParams) external;\n\n    /// @notice Revokes the pending cap of the market defined by `id`.\n    /// @dev Does not revert if there is no pending cap.\n    function revokePendingCap(Id id) external;\n\n    /// @notice Submits a forced market removal from the vault, eventually losing all funds supplied to the market.\n    /// @notice This forced removal is expected to be used as an emergency process in case a market constantly reverts.\n    /// To softly remove a sane market, the curator role is expected to bundle a reallocation that empties the market\n    /// first (using `reallocate`), followed by the removal of the market (using `updateWithdrawQueue`).\n    /// @dev Warning: Reverts for non-zero cap or if there is a pending cap. Successfully submitting a zero cap will\n    /// prevent such reverts.\n    function submitMarketRemoval(MarketParams memory marketParams) external;\n\n    /// @notice Revokes the pending removal of the market defined by `id`.\n    /// @dev Does not revert if there is no pending market removal.\n    function revokePendingMarketRemoval(Id id) external;\n\n    /// @notice Sets the name of the vault.\n    function setName(string memory newName) external;\n\n    /// @notice Sets the symbol of the vault.\n    function setSymbol(string memory newSymbol) external;\n\n    /// @notice Submits a `newGuardian`.\n    /// @notice Warning: a malicious guardian could disrupt the vault's operation, and would have the power to revoke\n    /// any pending guardian.\n    /// @dev In case there is no guardian, the gardian is set immediately.\n    /// @dev Warning: Submitting a gardian will overwrite the current pending gardian.\n    function submitGuardian(address newGuardian) external;\n\n    /// @notice Accepts the pending guardian.\n    function acceptGuardian() external;\n\n    /// @notice Revokes the pending guardian.\n    function revokePendingGuardian() external;\n\n    /// @notice Skims the vault `token` balance to `skimRecipient`.\n    function skim(address) external;\n\n    /// @notice Sets `newAllocator` as an allocator or not (`newIsAllocator`).\n    function setIsAllocator(address newAllocator, bool newIsAllocator) external;\n\n    /// @notice Sets `curator` to `newCurator`.\n    function setCurator(address newCurator) external;\n\n    /// @notice Sets the `fee` to `newFee`.\n    function setFee(uint256 newFee) external;\n\n    /// @notice Sets `feeRecipient` to `newFeeRecipient`.\n    function setFeeRecipient(address newFeeRecipient) external;\n\n    /// @notice Sets `skimRecipient` to `newSkimRecipient`.\n    function setSkimRecipient(address newSkimRecipient) external;\n\n    /// @notice Sets `supplyQueue` to `newSupplyQueue`.\n    /// @param newSupplyQueue is an array of enabled markets, and can contain duplicate markets, but it would only\n    /// increase the cost of depositing to the vault.\n    function setSupplyQueue(Id[] calldata newSupplyQueue) external;\n\n    /// @notice Updates the withdraw queue. Some markets can be removed, but no market can be added.\n    /// @notice Removing a market requires the vault to have 0 supply on it, or to have previously submitted a removal\n    /// for this market (with the function `submitMarketRemoval`).\n    /// @notice Warning: Anyone can supply on behalf of the vault so the call to `updateWithdrawQueue` that expects a\n    /// market to be empty can be griefed by a front-run. To circumvent this, the allocator can simply bundle a\n    /// reallocation that withdraws max from this market with a call to `updateWithdrawQueue`.\n    /// @dev Warning: Removing a market with supply will decrease the fee accrued until one of the functions updating\n    /// `lastTotalAssets` is triggered (deposit/mint/withdraw/redeem/setFee/setFeeRecipient).\n    /// @dev Warning: `updateWithdrawQueue` is not idempotent. Submitting twice the same tx will change the queue twice.\n    /// @param indexes The indexes of each market in the previous withdraw queue, in the new withdraw queue's order.\n    function updateWithdrawQueue(uint256[] calldata indexes) external;\n\n    /// @notice Reallocates the vault's liquidity so as to reach a given allocation of assets on each given market.\n    /// @dev The behavior of the reallocation can be altered by state changes, including:\n    /// - Deposits on the vault that supplies to markets that are expected to be supplied to during reallocation.\n    /// - Withdrawals from the vault that withdraws from markets that are expected to be withdrawn from during\n    /// reallocation.\n    /// - Donations to the vault on markets that are expected to be supplied to during reallocation.\n    /// - Withdrawals from markets that are expected to be withdrawn from during reallocation.\n    /// @dev Sender is expected to pass `assets = type(uint256).max` with the last MarketAllocation of `allocations` to\n    /// supply all the remaining withdrawn liquidity, which would ensure that `totalWithdrawn` = `totalSupplied`.\n    /// @dev A supply in a reallocation step will make the reallocation revert if the amount is greater than the net\n    /// amount from previous steps (i.e. total withdrawn minus total supplied).\n    function reallocate(MarketAllocation[] calldata allocations) external;\n}\n\n/// @dev This interface is inherited by MetaMorphoV1_1 so that function signatures are checked by the compiler.\n/// @dev Consider using the IMetaMorphoV1_1 interface instead of this one.\ninterface IMetaMorphoV1_1StaticTyping is IMetaMorphoV1_1Base {\n    /// @notice Returns the current configuration of each market.\n    function config(Id) external view returns (uint184 cap, bool enabled, uint64 removableAt);\n\n    /// @notice Returns the pending guardian.\n    function pendingGuardian() external view returns (address guardian, uint64 validAt);\n\n    /// @notice Returns the pending cap for each market.\n    function pendingCap(Id) external view returns (uint192 value, uint64 validAt);\n\n    /// @notice Returns the pending timelock.\n    function pendingTimelock() external view returns (uint192 value, uint64 validAt);\n}\n\n/// @title IMetaMorphoV1_1\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @dev Use this interface for MetaMorphoV1_1 to have access to all the functions with the appropriate function\n/// signatures.\ninterface IMetaMorphoV1_1 is IMetaMorphoV1_1Base, IERC4626, IERC20Permit, IOwnable, IMulticall {\n    /// @notice Returns the current configuration of each market.\n    function config(Id) external view returns (MarketConfig memory);\n\n    /// @notice Returns the pending guardian.\n    function pendingGuardian() external view returns (PendingAddress memory);\n\n    /// @notice Returns the pending cap for each market.\n    function pendingCap(Id) external view returns (PendingUint192 memory);\n\n    /// @notice Returns the pending timelock.\n    function pendingTimelock() external view returns (PendingUint192 memory);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n    event Withdraw(\n        address indexed sender,\n        address indexed receiver,\n        address indexed owner,\n        uint256 assets,\n        uint256 shares\n    );\n\n    /**\n     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function asset() external view returns (address assetTokenAddress);\n\n    /**\n     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n     *\n     * - SHOULD include any compounding that occurs from yield.\n     * - MUST be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT revert.\n     */\n    function totalAssets() external view returns (uint256 totalManagedAssets);\n\n    /**\n     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n     * through a deposit call.\n     *\n     * - MUST return a limited value if receiver is subject to some deposit limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n     * - MUST NOT revert.\n     */\n    function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n     *   in the same transaction.\n     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   deposit execution, and are accounted for during deposit.\n     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n     * - MUST return a limited value if receiver is subject to some mint limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n     * - MUST NOT revert.\n     */\n    function maxMint(address receiver) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n     *   same transaction.\n     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n     *   would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by minting.\n     */\n    function previewMint(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n     *   execution, and are accounted for during mint.\n     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n     * Vault, through a withdraw call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n     *   called\n     *   in the same transaction.\n     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   withdraw execution, and are accounted for during withdraw.\n     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n     * through a redeem call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n     *   same transaction.\n     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n     *   redemption would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n     */\n    function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   redeem execution, and are accounted for during redeem.\n     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Muldiv operation overflow.\n     */\n    error MathOverflowedMulDiv();\n\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            return a / b;\n        }\n\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0 = x * y; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                revert MathOverflowedMulDiv();\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS\n    }\n\n    /**\n     * @dev The signature derives the `address(0)`.\n     */\n    error ECDSAInvalidSignature();\n\n    /**\n     * @dev The signature has an invalid length.\n     */\n    error ECDSAInvalidSignatureLength(uint256 length);\n\n    /**\n     * @dev The signature has an S value that is in the upper half order.\n     */\n    error ECDSAInvalidSignatureS(bytes32 s);\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n     * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n     * and a bytes32 providing additional information about the error.\n     *\n     * If no error is returned, then the address can be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     */\n    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {\n        unchecked {\n            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n            // We do not check for an overflow here since the shift operation results in 0 or 1.\n            uint8 v = uint8((uint256(vs) >> 255) + 27);\n            return tryRecover(hash, v, r, s);\n        }\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError, bytes32) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS, s);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature, bytes32(0));\n        }\n\n        return (signer, RecoverError.NoError, bytes32(0));\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n     */\n    function _throwError(RecoverError error, bytes32 errorArg) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert ECDSAInvalidSignature();\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert ECDSAInvalidSignatureLength(uint256(errorArg));\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert ECDSAInvalidSignatureS(errorArg);\n        }\n    }\n}\n"},{"file_path":"src/libraries/EventsLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {Id} from \"../../lib/morpho-blue/src/interfaces/IMorpho.sol\";\n\nimport {PendingAddress} from \"./PendingLib.sol\";\n\n/// @title EventsLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library exposing events.\nlibrary EventsLib {\n    /// @notice Emitted when the name of the vault is set.\n    event SetName(string name);\n\n    /// @notice Emitted when the symbol of the vault is set.\n    event SetSymbol(string symbol);\n\n    /// @notice Emitted when a pending `newTimelock` is submitted.\n    event SubmitTimelock(uint256 newTimelock);\n\n    /// @notice Emitted when `timelock` is set to `newTimelock`.\n    event SetTimelock(address indexed caller, uint256 newTimelock);\n\n    /// @notice Emitted when `skimRecipient` is set to `newSkimRecipient`.\n    event SetSkimRecipient(address indexed newSkimRecipient);\n\n    /// @notice Emitted `fee` is set to `newFee`.\n    event SetFee(address indexed caller, uint256 newFee);\n\n    /// @notice Emitted when a new `newFeeRecipient` is set.\n    event SetFeeRecipient(address indexed newFeeRecipient);\n\n    /// @notice Emitted when a pending `newGuardian` is submitted.\n    event SubmitGuardian(address indexed newGuardian);\n\n    /// @notice Emitted when `guardian` is set to `newGuardian`.\n    event SetGuardian(address indexed caller, address indexed guardian);\n\n    /// @notice Emitted when a pending `cap` is submitted for market identified by `id`.\n    event SubmitCap(address indexed caller, Id indexed id, uint256 cap);\n\n    /// @notice Emitted when a new `cap` is set for market identified by `id`.\n    event SetCap(address indexed caller, Id indexed id, uint256 cap);\n\n    /// @notice Emitted when the vault's last total assets is updated to `updatedTotalAssets`.\n    event UpdateLastTotalAssets(uint256 updatedTotalAssets);\n\n    /// @notice Emitted when the vault's lostAssets is updated to `newLostAssets`.\n    event UpdateLostAssets(uint256 newLostAssets);\n\n    /// @notice Emitted when the market identified by `id` is submitted for removal.\n    event SubmitMarketRemoval(address indexed caller, Id indexed id);\n\n    /// @notice Emitted when `curator` is set to `newCurator`.\n    event SetCurator(address indexed newCurator);\n\n    /// @notice Emitted when an `allocator` is set to `isAllocator`.\n    event SetIsAllocator(address indexed allocator, bool isAllocator);\n\n    /// @notice Emitted when a `pendingTimelock` is revoked.\n    event RevokePendingTimelock(address indexed caller);\n\n    /// @notice Emitted when a `pendingCap` for the market identified by `id` is revoked.\n    event RevokePendingCap(address indexed caller, Id indexed id);\n\n    /// @notice Emitted when a `pendingGuardian` is revoked.\n    event RevokePendingGuardian(address indexed caller);\n\n    /// @notice Emitted when a pending market removal is revoked.\n    event RevokePendingMarketRemoval(address indexed caller, Id indexed id);\n\n    /// @notice Emitted when the `supplyQueue` is set to `newSupplyQueue`.\n    event SetSupplyQueue(address indexed caller, Id[] newSupplyQueue);\n\n    /// @notice Emitted when the `withdrawQueue` is set to `newWithdrawQueue`.\n    event SetWithdrawQueue(address indexed caller, Id[] newWithdrawQueue);\n\n    /// @notice Emitted when a reallocation supplies assets to the market identified by `id`.\n    /// @param id The id of the market.\n    /// @param suppliedAssets The amount of assets supplied to the market.\n    /// @param suppliedShares The amount of shares minted.\n    event ReallocateSupply(address indexed caller, Id indexed id, uint256 suppliedAssets, uint256 suppliedShares);\n\n    /// @notice Emitted when a reallocation withdraws assets from the market identified by `id`.\n    /// @param id The id of the market.\n    /// @param withdrawnAssets The amount of assets withdrawn from the market.\n    /// @param withdrawnShares The amount of shares burned.\n    event ReallocateWithdraw(address indexed caller, Id indexed id, uint256 withdrawnAssets, uint256 withdrawnShares);\n\n    /// @notice Emitted when interest are accrued.\n    /// @param newTotalAssets The assets of the vault after accruing the interest but before the interaction.\n    /// @param feeShares The shares minted to the fee recipient.\n    event AccrueInterest(uint256 newTotalAssets, uint256 feeShares);\n\n    /// @notice Emitted when an `amount` of `token` is transferred to the skim recipient by `caller`.\n    event Skim(address indexed caller, address indexed token, uint256 amount);\n\n    /// @notice Emitted when a new MetaMorphoV1_1 vault is created.\n    /// @param metaMorpho The address of the MetaMorphoV1_1 vault.\n    /// @param caller The caller of the function.\n    /// @param initialOwner The initial owner of the MetaMorphoV1_1 vault.\n    /// @param initialTimelock The initial timelock of the MetaMorphoV1_1 vault.\n    /// @param asset The address of the underlying asset.\n    /// @param name The name of the MetaMorphoV1_1 vault.\n    /// @param symbol The symbol of the MetaMorphoV1_1 vault.\n    /// @param salt The salt used for the MetaMorphoV1_1 vault's CREATE2 address.\n    event CreateMetaMorpho(\n        address indexed metaMorpho,\n        address indexed caller,\n        address initialOwner,\n        uint256 initialTimelock,\n        address indexed asset,\n        string name,\n        string symbol,\n        bytes32 salt\n    );\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/SharesMathLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {MathLib} from \"./MathLib.sol\";\n\n/// @title SharesMathLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Shares management library.\n/// @dev This implementation mitigates share price manipulations, using OpenZeppelin's method of virtual shares:\n/// https://docs.openzeppelin.com/contracts/4.x/erc4626#inflation-attack.\nlibrary SharesMathLib {\n    using MathLib for uint256;\n\n    /// @dev The number of virtual shares has been chosen low enough to prevent overflows, and high enough to ensure\n    /// high precision computations.\n    /// @dev Virtual shares can never be redeemed for the assets they are entitled to, but it is assumed the share price\n    /// stays low enough not to inflate these assets to a significant value.\n    /// @dev Warning: The assets to which virtual borrow shares are entitled behave like unrealizable bad debt.\n    uint256 internal constant VIRTUAL_SHARES = 1e6;\n\n    /// @dev A number of virtual assets of 1 enforces a conversion rate between shares and assets when a market is\n    /// empty.\n    uint256 internal constant VIRTUAL_ASSETS = 1;\n\n    /// @dev Calculates the value of `assets` quoted in shares, rounding down.\n    function toSharesDown(uint256 assets, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) {\n        return assets.mulDivDown(totalShares + VIRTUAL_SHARES, totalAssets + VIRTUAL_ASSETS);\n    }\n\n    /// @dev Calculates the value of `shares` quoted in assets, rounding down.\n    function toAssetsDown(uint256 shares, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) {\n        return shares.mulDivDown(totalAssets + VIRTUAL_ASSETS, totalShares + VIRTUAL_SHARES);\n    }\n\n    /// @dev Calculates the value of `assets` quoted in shares, rounding up.\n    function toSharesUp(uint256 assets, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) {\n        return assets.mulDivUp(totalShares + VIRTUAL_SHARES, totalAssets + VIRTUAL_ASSETS);\n    }\n\n    /// @dev Calculates the value of `shares` quoted in assets, rounding up.\n    function toAssetsUp(uint256 shares, uint256 totalAssets, uint256 totalShares) internal pure returns (uint256) {\n        return shares.mulDivUp(totalAssets + VIRTUAL_ASSETS, totalShares + VIRTUAL_SHARES);\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |\n// | length  | 0x                                                              BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n *     using ShortStrings for *;\n *\n *     ShortString private immutable _name;\n *     string private _nameFallback;\n *\n *     constructor(string memory contractName) {\n *         _name = contractName.toShortStringWithFallback(_nameFallback);\n *     }\n *\n *     function name() external view returns (string memory) {\n *         return _name.toStringWithFallback(_nameFallback);\n *     }\n * }\n * ```\n */\nlibrary ShortStrings {\n    // Used as an identifier for strings longer than 31 bytes.\n    bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n    error StringTooLong(string str);\n    error InvalidShortString();\n\n    /**\n     * @dev Encode a string of at most 31 chars into a `ShortString`.\n     *\n     * This will trigger a `StringTooLong` error is the input string is too long.\n     */\n    function toShortString(string memory str) internal pure returns (ShortString) {\n        bytes memory bstr = bytes(str);\n        if (bstr.length > 31) {\n            revert StringTooLong(str);\n        }\n        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n    }\n\n    /**\n     * @dev Decode a `ShortString` back to a \"normal\" string.\n     */\n    function toString(ShortString sstr) internal pure returns (string memory) {\n        uint256 len = byteLength(sstr);\n        // using `new string(len)` would work locally but is not memory safe.\n        string memory str = new string(32);\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(str, len)\n            mstore(add(str, 0x20), sstr)\n        }\n        return str;\n    }\n\n    /**\n     * @dev Return the length of a `ShortString`.\n     */\n    function byteLength(ShortString sstr) internal pure returns (uint256) {\n        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n        if (result > 31) {\n            revert InvalidShortString();\n        }\n        return result;\n    }\n\n    /**\n     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n     */\n    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n        if (bytes(value).length < 32) {\n            return toShortString(value);\n        } else {\n            StorageSlot.getStringSlot(store).value = value;\n            return ShortString.wrap(FALLBACK_SENTINEL);\n        }\n    }\n\n    /**\n     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n     */\n    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n            return toString(value);\n        } else {\n            return store;\n        }\n    }\n\n    /**\n     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n     * {setWithFallback}.\n     *\n     * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n     */\n    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n            return byteLength(value);\n        } else {\n            return bytes(store).length;\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.20;\n\nimport {Ownable} from \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is specified at deployment time in the constructor for `Ownable`. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n    address private _pendingOwner;\n\n    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Returns the address of the pending owner.\n     */\n    function pendingOwner() public view virtual returns (address) {\n        return _pendingOwner;\n    }\n\n    /**\n     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual override onlyOwner {\n        _pendingOwner = newOwner;\n        emit OwnershipTransferStarted(owner(), newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual override {\n        delete _pendingOwner;\n        super._transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev The new owner accepts the ownership transfer.\n     */\n    function acceptOwnership() public virtual {\n        address sender = _msgSender();\n        if (pendingOwner() != sender) {\n            revert OwnableUnauthorizedAccount(sender);\n        }\n        _transferOwnership(sender);\n    }\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/periphery/MorphoLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {IMorpho, Id} from \"../../interfaces/IMorpho.sol\";\nimport {MorphoStorageLib} from \"./MorphoStorageLib.sol\";\n\n/// @title MorphoLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Helper library to access Morpho storage variables.\n/// @dev Warning: Supply and borrow getters may return outdated values that do not include accrued interest.\nlibrary MorphoLib {\n    function supplyShares(IMorpho morpho, Id id, address user) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.positionSupplySharesSlot(id, user));\n        return uint256(morpho.extSloads(slot)[0]);\n    }\n\n    function borrowShares(IMorpho morpho, Id id, address user) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.positionBorrowSharesAndCollateralSlot(id, user));\n        return uint128(uint256(morpho.extSloads(slot)[0]));\n    }\n\n    function collateral(IMorpho morpho, Id id, address user) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.positionBorrowSharesAndCollateralSlot(id, user));\n        return uint256(morpho.extSloads(slot)[0] >> 128);\n    }\n\n    function totalSupplyAssets(IMorpho morpho, Id id) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.marketTotalSupplyAssetsAndSharesSlot(id));\n        return uint128(uint256(morpho.extSloads(slot)[0]));\n    }\n\n    function totalSupplyShares(IMorpho morpho, Id id) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.marketTotalSupplyAssetsAndSharesSlot(id));\n        return uint256(morpho.extSloads(slot)[0] >> 128);\n    }\n\n    function totalBorrowAssets(IMorpho morpho, Id id) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.marketTotalBorrowAssetsAndSharesSlot(id));\n        return uint128(uint256(morpho.extSloads(slot)[0]));\n    }\n\n    function totalBorrowShares(IMorpho morpho, Id id) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.marketTotalBorrowAssetsAndSharesSlot(id));\n        return uint256(morpho.extSloads(slot)[0] >> 128);\n    }\n\n    function lastUpdate(IMorpho morpho, Id id) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.marketLastUpdateAndFeeSlot(id));\n        return uint128(uint256(morpho.extSloads(slot)[0]));\n    }\n\n    function fee(IMorpho morpho, Id id) internal view returns (uint256) {\n        bytes32[] memory slot = _array(MorphoStorageLib.marketLastUpdateAndFeeSlot(id));\n        return uint256(morpho.extSloads(slot)[0] >> 128);\n    }\n\n    function _array(bytes32 x) private pure returns (bytes32[] memory) {\n        bytes32[] memory res = new bytes32[](1);\n        res[0] = x;\n        return res;\n    }\n}\n"},{"file_path":"src/libraries/ErrorsLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {Id} from \"../../lib/morpho-blue/src/interfaces/IMorpho.sol\";\n\n/// @title ErrorsLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library exposing error messages.\nlibrary ErrorsLib {\n    /// @notice Thrown when the address passed is the zero address.\n    error ZeroAddress();\n\n    /// @notice Thrown when the caller doesn't have the curator role.\n    error NotCuratorRole();\n\n    /// @notice Thrown when the caller doesn't have the allocator role.\n    error NotAllocatorRole();\n\n    /// @notice Thrown when the caller doesn't have the guardian role.\n    error NotGuardianRole();\n\n    /// @notice Thrown when the caller doesn't have the curator nor the guardian role.\n    error NotCuratorNorGuardianRole();\n\n    /// @notice Thrown when the market `id` cannot be set in the supply queue.\n    error UnauthorizedMarket(Id id);\n\n    /// @notice Thrown when submitting a cap for a market `id` whose loan token does not correspond to the underlying.\n    /// asset.\n    error InconsistentAsset(Id id);\n\n    /// @notice Thrown when the supply cap has been exceeded on market `id` during a reallocation of funds.\n    error SupplyCapExceeded(Id id);\n\n    /// @notice Thrown when the fee to set exceeds the maximum fee.\n    error MaxFeeExceeded();\n\n    /// @notice Thrown when the value is already set.\n    error AlreadySet();\n\n    /// @notice Thrown when a value is already pending.\n    error AlreadyPending();\n\n    /// @notice Thrown when submitting the removal of a market when there is a cap already pending on that market.\n    error PendingCap(Id id);\n\n    /// @notice Thrown when submitting a cap for a market with a pending removal.\n    error PendingRemoval();\n\n    /// @notice Thrown when submitting a market removal for a market with a non zero cap.\n    error NonZeroCap();\n\n    /// @notice Thrown when market `id` is a duplicate in the new withdraw queue to set.\n    error DuplicateMarket(Id id);\n\n    /// @notice Thrown when market `id` is missing in the updated withdraw queue and the market has a non-zero cap set.\n    error InvalidMarketRemovalNonZeroCap(Id id);\n\n    /// @notice Thrown when market `id` is missing in the updated withdraw queue and the market has a non-zero supply.\n    error InvalidMarketRemovalNonZeroSupply(Id id);\n\n    /// @notice Thrown when market `id` is missing in the updated withdraw queue and the market is not yet disabled.\n    error InvalidMarketRemovalTimelockNotElapsed(Id id);\n\n    /// @notice Thrown when there's no pending value to set.\n    error NoPendingValue();\n\n    /// @notice Thrown when the requested liquidity cannot be withdrawn from Morpho.\n    error NotEnoughLiquidity();\n\n    /// @notice Thrown when submitting a cap for a market which does not exist.\n    error MarketNotCreated();\n\n    /// @notice Thrown when interacting with a non previously enabled market `id`.\n    error MarketNotEnabled(Id id);\n\n    /// @notice Thrown when the submitted timelock is above the max timelock.\n    error AboveMaxTimelock();\n\n    /// @notice Thrown when the submitted timelock is below the min timelock.\n    error BelowMinTimelock();\n\n    /// @notice Thrown when the timelock is not elapsed.\n    error TimelockNotElapsed();\n\n    /// @notice Thrown when too many markets are in the withdraw queue.\n    error MaxQueueLengthExceeded();\n\n    /// @notice Thrown when setting the fee to a non zero value while the fee recipient is the zero address.\n    error ZeroFeeRecipient();\n\n    /// @notice Thrown when the amount withdrawn is not exactly the amount supplied.\n    error InconsistentReallocation();\n\n    /// @notice Thrown when all caps have been reached.\n    error AllCapsReached();\n}\n"},{"file_path":"lib/morpho-blue/src/interfaces/IIrm.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport {MarketParams, Market} from \"./IMorpho.sol\";\n\n/// @title IIrm\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Interface that Interest Rate Models (IRMs) used by Morpho must implement.\ninterface IIrm {\n    /// @notice Returns the borrow rate per second (scaled by WAD) of the market `marketParams`.\n    /// @dev Assumes that `market` corresponds to `marketParams`.\n    function borrowRate(MarketParams memory marketParams, Market memory market) external returns (uint256);\n\n    /// @notice Returns the borrow rate per second (scaled by WAD) of the market `marketParams` without modifying any\n    /// storage.\n    /// @dev Assumes that `market` corresponds to `marketParams`.\n    function borrowRateView(MarketParams memory marketParams, Market memory market) external view returns (uint256);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/UtilsLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {ErrorsLib} from \"../libraries/ErrorsLib.sol\";\n\n/// @title UtilsLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library exposing helpers.\n/// @dev Inspired by https://github.com/morpho-org/morpho-utils.\nlibrary UtilsLib {\n    /// @dev Returns true if there is exactly one zero among `x` and `y`.\n    function exactlyOneZero(uint256 x, uint256 y) internal pure returns (bool z) {\n        assembly {\n            z := xor(iszero(x), iszero(y))\n        }\n    }\n\n    /// @dev Returns the min of `x` and `y`.\n    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        assembly {\n            z := xor(x, mul(xor(x, y), lt(y, x)))\n        }\n    }\n\n    /// @dev Returns `x` safely cast to uint128.\n    function toUint128(uint256 x) internal pure returns (uint128) {\n        require(x <= type(uint128).max, ErrorsLib.MAX_UINT128_EXCEEDED);\n        return uint128(x);\n    }\n\n    /// @dev Returns max(0, x - y).\n    function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        assembly {\n            z := mul(gt(x, y), sub(x, y))\n        }\n    }\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/ErrorsLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\n/// @title ErrorsLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library exposing error messages.\nlibrary ErrorsLib {\n    /// @notice Thrown when the caller is not the owner.\n    string internal constant NOT_OWNER = \"not owner\";\n\n    /// @notice Thrown when the LLTV to enable exceeds the maximum LLTV.\n    string internal constant MAX_LLTV_EXCEEDED = \"max LLTV exceeded\";\n\n    /// @notice Thrown when the fee to set exceeds the maximum fee.\n    string internal constant MAX_FEE_EXCEEDED = \"max fee exceeded\";\n\n    /// @notice Thrown when the value is already set.\n    string internal constant ALREADY_SET = \"already set\";\n\n    /// @notice Thrown when the IRM is not enabled at market creation.\n    string internal constant IRM_NOT_ENABLED = \"IRM not enabled\";\n\n    /// @notice Thrown when the LLTV is not enabled at market creation.\n    string internal constant LLTV_NOT_ENABLED = \"LLTV not enabled\";\n\n    /// @notice Thrown when the market is already created.\n    string internal constant MARKET_ALREADY_CREATED = \"market already created\";\n\n    /// @notice Thrown when a token to transfer doesn't have code.\n    string internal constant NO_CODE = \"no code\";\n\n    /// @notice Thrown when the market is not created.\n    string internal constant MARKET_NOT_CREATED = \"market not created\";\n\n    /// @notice Thrown when not exactly one of the input amount is zero.\n    string internal constant INCONSISTENT_INPUT = \"inconsistent input\";\n\n    /// @notice Thrown when zero assets is passed as input.\n    string internal constant ZERO_ASSETS = \"zero assets\";\n\n    /// @notice Thrown when a zero address is passed as input.\n    string internal constant ZERO_ADDRESS = \"zero address\";\n\n    /// @notice Thrown when the caller is not authorized to conduct an action.\n    string internal constant UNAUTHORIZED = \"unauthorized\";\n\n    /// @notice Thrown when the collateral is insufficient to `borrow` or `withdrawCollateral`.\n    string internal constant INSUFFICIENT_COLLATERAL = \"insufficient collateral\";\n\n    /// @notice Thrown when the liquidity is insufficient to `withdraw` or `borrow`.\n    string internal constant INSUFFICIENT_LIQUIDITY = \"insufficient liquidity\";\n\n    /// @notice Thrown when the position to liquidate is healthy.\n    string internal constant HEALTHY_POSITION = \"position is healthy\";\n\n    /// @notice Thrown when the authorization signature is invalid.\n    string internal constant INVALID_SIGNATURE = \"invalid signature\";\n\n    /// @notice Thrown when the authorization signature is expired.\n    string internal constant SIGNATURE_EXPIRED = \"signature expired\";\n\n    /// @notice Thrown when the nonce is invalid.\n    string internal constant INVALID_NONCE = \"invalid nonce\";\n\n    /// @notice Thrown when a token transfer reverted.\n    string internal constant TRANSFER_REVERTED = \"transfer reverted\";\n\n    /// @notice Thrown when a token transfer returned false.\n    string internal constant TRANSFER_RETURNED_FALSE = \"transfer returned false\";\n\n    /// @notice Thrown when a token transferFrom reverted.\n    string internal constant TRANSFER_FROM_REVERTED = \"transferFrom reverted\";\n\n    /// @notice Thrown when a token transferFrom returned false\n    string internal constant TRANSFER_FROM_RETURNED_FALSE = \"transferFrom returned false\";\n\n    /// @notice Thrown when the maximum uint128 is exceeded.\n    string internal constant MAX_UINT128_EXCEEDED = \"max uint128 exceeded\";\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/MathLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nuint256 constant WAD = 1e18;\n\n/// @title MathLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library to manage fixed-point arithmetic.\nlibrary MathLib {\n    /// @dev Returns (`x` * `y`) / `WAD` rounded down.\n    function wMulDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, y, WAD);\n    }\n\n    /// @dev Returns (`x` * `WAD`) / `y` rounded down.\n    function wDivDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, WAD, y);\n    }\n\n    /// @dev Returns (`x` * `WAD`) / `y` rounded up.\n    function wDivUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, WAD, y);\n    }\n\n    /// @dev Returns (`x` * `y`) / `d` rounded down.\n    function mulDivDown(uint256 x, uint256 y, uint256 d) internal pure returns (uint256) {\n        return (x * y) / d;\n    }\n\n    /// @dev Returns (`x` * `y`) / `d` rounded up.\n    function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256) {\n        return (x * y + (d - 1)) / d;\n    }\n\n    /// @dev Returns the sum of the first three non-zero terms of a Taylor expansion of e^(nx) - 1, to approximate a\n    /// continuous compound interest rate.\n    function wTaylorCompounded(uint256 x, uint256 n) internal pure returns (uint256) {\n        uint256 firstTerm = x * n;\n        uint256 secondTerm = mulDivDown(firstTerm, firstTerm, 2 * WAD);\n        uint256 thirdTerm = mulDivDown(secondTerm, firstTerm, 3 * WAD);\n\n        return firstTerm + secondTerm + thirdTerm;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(newImplementation.code.length > 0);\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Nonces.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides tracking nonces for addresses. Nonces will only increment.\n */\nabstract contract Nonces {\n    /**\n     * @dev The nonce used for an `account` is not the expected current nonce.\n     */\n    error InvalidAccountNonce(address account, uint256 currentNonce);\n\n    mapping(address account => uint256) private _nonces;\n\n    /**\n     * @dev Returns the next unused nonce for an address.\n     */\n    function nonces(address owner) public view virtual returns (uint256) {\n        return _nonces[owner];\n    }\n\n    /**\n     * @dev Consumes a nonce.\n     *\n     * Returns the current value and increments nonce.\n     */\n    function _useNonce(address owner) internal virtual returns (uint256) {\n        // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be\n        // decremented or reset. This guarantees that the nonce never overflows.\n        unchecked {\n            // It is important to do x++ and not ++x here.\n            return _nonces[owner]++;\n        }\n    }\n\n    /**\n     * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.\n     */\n    function _useCheckedNonce(address owner, uint256 nonce) internal virtual {\n        uint256 current = _useNonce(owner);\n        if (nonce != current) {\n            revert InvalidAccountNonce(owner, current);\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC4626.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20, IERC20Metadata, ERC20} from \"../ERC20.sol\";\nimport {SafeERC20} from \"../utils/SafeERC20.sol\";\nimport {IERC4626} from \"../../../interfaces/IERC4626.sol\";\nimport {Math} from \"../../../utils/math/Math.sol\";\n\n/**\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\n *\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\n * contract and not the \"assets\" token which is an independent contract.\n *\n * [CAUTION]\n * ====\n * In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning\n * with a \"donation\" to the vault that inflates the price of a share. This is variously known as a donation or inflation\n * attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial\n * deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may\n * similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by\n * verifying the amount received is as expected, using a wrapper that performs these checks such as\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\n *\n * Since v4.9, this implementation uses virtual assets and shares to mitigate that risk. The `_decimalsOffset()`\n * corresponds to an offset in the decimal representation between the underlying asset's decimals and the vault\n * decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which itself\n * determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default offset\n * (0) makes it non-profitable, as a result of the value being captured by the virtual shares (out of the attacker's\n * donation) matching the attacker's expected gains. With a larger offset, the attack becomes orders of magnitude more\n * expensive than it is profitable. More details about the underlying math can be found\n * xref:erc4626.adoc#inflation-attack[here].\n *\n * The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued\n * to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets\n * will cause the first user to exit to experience reduced losses in detriment to the last users that will experience\n * bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the\n * `_convertToShares` and `_convertToAssets` functions.\n *\n * To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide].\n * ====\n */\nabstract contract ERC4626 is ERC20, IERC4626 {\n    using Math for uint256;\n\n    IERC20 private immutable _asset;\n    uint8 private immutable _underlyingDecimals;\n\n    /**\n     * @dev Attempted to deposit more assets than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max);\n\n    /**\n     * @dev Attempted to mint more shares than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max);\n\n    /**\n     * @dev Attempted to withdraw more assets than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max);\n\n    /**\n     * @dev Attempted to redeem more shares than the max amount for `receiver`.\n     */\n    error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max);\n\n    /**\n     * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\n     */\n    constructor(IERC20 asset_) {\n        (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_);\n        _underlyingDecimals = success ? assetDecimals : 18;\n        _asset = asset_;\n    }\n\n    /**\n     * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way.\n     */\n    function _tryGetAssetDecimals(IERC20 asset_) private view returns (bool, uint8) {\n        (bool success, bytes memory encodedDecimals) = address(asset_).staticcall(\n            abi.encodeCall(IERC20Metadata.decimals, ())\n        );\n        if (success && encodedDecimals.length >= 32) {\n            uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256));\n            if (returnedDecimals <= type(uint8).max) {\n                return (true, uint8(returnedDecimals));\n            }\n        }\n        return (false, 0);\n    }\n\n    /**\n     * @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This\n     * \"original\" value is cached during construction of the vault contract. If this read operation fails (e.g., the\n     * asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals.\n     *\n     * See {IERC20Metadata-decimals}.\n     */\n    function decimals() public view virtual override(IERC20Metadata, ERC20) returns (uint8) {\n        return _underlyingDecimals + _decimalsOffset();\n    }\n\n    /** @dev See {IERC4626-asset}. */\n    function asset() public view virtual returns (address) {\n        return address(_asset);\n    }\n\n    /** @dev See {IERC4626-totalAssets}. */\n    function totalAssets() public view virtual returns (uint256) {\n        return _asset.balanceOf(address(this));\n    }\n\n    /** @dev See {IERC4626-convertToShares}. */\n    function convertToShares(uint256 assets) public view virtual returns (uint256) {\n        return _convertToShares(assets, Math.Rounding.Floor);\n    }\n\n    /** @dev See {IERC4626-convertToAssets}. */\n    function convertToAssets(uint256 shares) public view virtual returns (uint256) {\n        return _convertToAssets(shares, Math.Rounding.Floor);\n    }\n\n    /** @dev See {IERC4626-maxDeposit}. */\n    function maxDeposit(address) public view virtual returns (uint256) {\n        return type(uint256).max;\n    }\n\n    /** @dev See {IERC4626-maxMint}. */\n    function maxMint(address) public view virtual returns (uint256) {\n        return type(uint256).max;\n    }\n\n    /** @dev See {IERC4626-maxWithdraw}. */\n    function maxWithdraw(address owner) public view virtual returns (uint256) {\n        return _convertToAssets(balanceOf(owner), Math.Rounding.Floor);\n    }\n\n    /** @dev See {IERC4626-maxRedeem}. */\n    function maxRedeem(address owner) public view virtual returns (uint256) {\n        return balanceOf(owner);\n    }\n\n    /** @dev See {IERC4626-previewDeposit}. */\n    function previewDeposit(uint256 assets) public view virtual returns (uint256) {\n        return _convertToShares(assets, Math.Rounding.Floor);\n    }\n\n    /** @dev See {IERC4626-previewMint}. */\n    function previewMint(uint256 shares) public view virtual returns (uint256) {\n        return _convertToAssets(shares, Math.Rounding.Ceil);\n    }\n\n    /** @dev See {IERC4626-previewWithdraw}. */\n    function previewWithdraw(uint256 assets) public view virtual returns (uint256) {\n        return _convertToShares(assets, Math.Rounding.Ceil);\n    }\n\n    /** @dev See {IERC4626-previewRedeem}. */\n    function previewRedeem(uint256 shares) public view virtual returns (uint256) {\n        return _convertToAssets(shares, Math.Rounding.Floor);\n    }\n\n    /** @dev See {IERC4626-deposit}. */\n    function deposit(uint256 assets, address receiver) public virtual returns (uint256) {\n        uint256 maxAssets = maxDeposit(receiver);\n        if (assets > maxAssets) {\n            revert ERC4626ExceededMaxDeposit(receiver, assets, maxAssets);\n        }\n\n        uint256 shares = previewDeposit(assets);\n        _deposit(_msgSender(), receiver, assets, shares);\n\n        return shares;\n    }\n\n    /** @dev See {IERC4626-mint}.\n     *\n     * As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero.\n     * In this case, the shares will be minted without requiring any assets to be deposited.\n     */\n    function mint(uint256 shares, address receiver) public virtual returns (uint256) {\n        uint256 maxShares = maxMint(receiver);\n        if (shares > maxShares) {\n            revert ERC4626ExceededMaxMint(receiver, shares, maxShares);\n        }\n\n        uint256 assets = previewMint(shares);\n        _deposit(_msgSender(), receiver, assets, shares);\n\n        return assets;\n    }\n\n    /** @dev See {IERC4626-withdraw}. */\n    function withdraw(uint256 assets, address receiver, address owner) public virtual returns (uint256) {\n        uint256 maxAssets = maxWithdraw(owner);\n        if (assets > maxAssets) {\n            revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets);\n        }\n\n        uint256 shares = previewWithdraw(assets);\n        _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n        return shares;\n    }\n\n    /** @dev See {IERC4626-redeem}. */\n    function redeem(uint256 shares, address receiver, address owner) public virtual returns (uint256) {\n        uint256 maxShares = maxRedeem(owner);\n        if (shares > maxShares) {\n            revert ERC4626ExceededMaxRedeem(owner, shares, maxShares);\n        }\n\n        uint256 assets = previewRedeem(shares);\n        _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n        return assets;\n    }\n\n    /**\n     * @dev Internal conversion function (from assets to shares) with support for rounding direction.\n     */\n    function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) {\n        return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding);\n    }\n\n    /**\n     * @dev Internal conversion function (from shares to assets) with support for rounding direction.\n     */\n    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) {\n        return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding);\n    }\n\n    /**\n     * @dev Deposit/mint common workflow.\n     */\n    function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual {\n        // If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the\n        // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\n        // calls the vault, which is assumed not malicious.\n        //\n        // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\n        // assets are transferred and before the shares are minted, which is a valid state.\n        // slither-disable-next-line reentrancy-no-eth\n        SafeERC20.safeTransferFrom(_asset, caller, address(this), assets);\n        _mint(receiver, shares);\n\n        emit Deposit(caller, receiver, assets, shares);\n    }\n\n    /**\n     * @dev Withdraw/redeem common workflow.\n     */\n    function _withdraw(\n        address caller,\n        address receiver,\n        address owner,\n        uint256 assets,\n        uint256 shares\n    ) internal virtual {\n        if (caller != owner) {\n            _spendAllowance(owner, caller, shares);\n        }\n\n        // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\n        // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\n        // calls the vault, which is assumed not malicious.\n        //\n        // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\n        // shares are burned and after the assets are transferred, which is a valid state.\n        _burn(owner, shares);\n        SafeERC20.safeTransfer(_asset, receiver, assets);\n\n        emit Withdraw(caller, receiver, owner, assets, shares);\n    }\n\n    function _decimalsOffset() internal view virtual returns (uint8) {\n        return 0;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Strings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     * ```\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20Permit} from \"./IERC20Permit.sol\";\nimport {ERC20} from \"../ERC20.sol\";\nimport {ECDSA} from \"../../../utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"../../../utils/cryptography/EIP712.sol\";\nimport {Nonces} from \"../../../utils/Nonces.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {\n    bytes32 private constant PERMIT_TYPEHASH =\n        keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n    /**\n     * @dev Permit deadline has expired.\n     */\n    error ERC2612ExpiredSignature(uint256 deadline);\n\n    /**\n     * @dev Mismatched signature.\n     */\n    error ERC2612InvalidSigner(address signer, address owner);\n\n    /**\n     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n     *\n     * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n     */\n    constructor(string memory name) EIP712(name, \"1\") {}\n\n    /**\n     * @inheritdoc IERC20Permit\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public virtual {\n        if (block.timestamp > deadline) {\n            revert ERC2612ExpiredSignature(deadline);\n        }\n\n        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n        bytes32 hash = _hashTypedDataV4(structHash);\n\n        address signer = ECDSA.recover(hash, v, r, s);\n        if (signer != owner) {\n            revert ERC2612InvalidSigner(signer, owner);\n        }\n\n        _approve(owner, spender, value);\n    }\n\n    /**\n     * @inheritdoc IERC20Permit\n     */\n    function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) {\n        return super.nonces(owner);\n    }\n\n    /**\n     * @inheritdoc IERC20Permit\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.20;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n    using ShortStrings for *;\n\n    bytes32 private constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _cachedDomainSeparator;\n    uint256 private immutable _cachedChainId;\n    address private immutable _cachedThis;\n\n    bytes32 private immutable _hashedName;\n    bytes32 private immutable _hashedVersion;\n\n    ShortString private immutable _name;\n    ShortString private immutable _version;\n    string private _nameFallback;\n    string private _versionFallback;\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    constructor(string memory name, string memory version) {\n        _name = name.toShortStringWithFallback(_nameFallback);\n        _version = version.toShortStringWithFallback(_versionFallback);\n        _hashedName = keccak256(bytes(name));\n        _hashedVersion = keccak256(bytes(version));\n\n        _cachedChainId = block.chainid;\n        _cachedDomainSeparator = _buildDomainSeparator();\n        _cachedThis = address(this);\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n            return _cachedDomainSeparator;\n        } else {\n            return _buildDomainSeparator();\n        }\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /**\n     * @dev See {IERC-5267}.\n     */\n    function eip712Domain()\n        public\n        view\n        virtual\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: By default this function reads _name which is an immutable value.\n     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function _EIP712Name() internal view returns (string memory) {\n        return _name.toStringWithFallback(_nameFallback);\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: By default this function reads _version which is an immutable value.\n     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function _EIP712Version() internal view returns (string memory) {\n        return _version.toStringWithFallback(_versionFallback);\n    }\n}\n"},{"file_path":"src/libraries/PendingLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nstruct MarketConfig {\n    /// @notice The maximum amount of assets that can be allocated to the market.\n    uint184 cap;\n    /// @notice Whether the market is in the withdraw queue.\n    bool enabled;\n    /// @notice The timestamp at which the market can be instantly removed from the withdraw queue.\n    uint64 removableAt;\n}\n\nstruct PendingUint192 {\n    /// @notice The pending value to set.\n    uint192 value;\n    /// @notice The timestamp at which the pending value becomes valid.\n    uint64 validAt;\n}\n\nstruct PendingAddress {\n    /// @notice The pending value to set.\n    address value;\n    /// @notice The timestamp at which the pending value becomes valid.\n    uint64 validAt;\n}\n\n/// @title PendingLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library to manage pending values and their validity timestamp.\nlibrary PendingLib {\n    /// @dev Updates `pending`'s value to `newValue` and its corresponding `validAt` timestamp.\n    /// @dev Assumes `timelock` <= `MAX_TIMELOCK`.\n    function update(PendingUint192 storage pending, uint184 newValue, uint256 timelock) internal {\n        pending.value = newValue;\n        // Safe \"unchecked\" cast because timelock <= MAX_TIMELOCK.\n        pending.validAt = uint64(block.timestamp + timelock);\n    }\n\n    /// @dev Updates `pending`'s value to `newValue` and its corresponding `validAt` timestamp.\n    /// @dev Assumes `timelock` <= `MAX_TIMELOCK`.\n    function update(PendingAddress storage pending, address newValue, uint256 timelock) internal {\n        pending.value = newValue;\n        // Safe \"unchecked\" cast because timelock <= MAX_TIMELOCK.\n        pending.validAt = uint64(block.timestamp + timelock);\n    }\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/periphery/MorphoBalancesLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {Id, MarketParams, Market, IMorpho} from \"../../interfaces/IMorpho.sol\";\nimport {IIrm} from \"../../interfaces/IIrm.sol\";\n\nimport {MathLib} from \"../MathLib.sol\";\nimport {UtilsLib} from \"../UtilsLib.sol\";\nimport {MorphoLib} from \"./MorphoLib.sol\";\nimport {SharesMathLib} from \"../SharesMathLib.sol\";\nimport {MarketParamsLib} from \"../MarketParamsLib.sol\";\n\n/// @title MorphoBalancesLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Helper library exposing getters with the expected value after interest accrual.\n/// @dev This library is not used in Morpho itself and is intended to be used by integrators.\n/// @dev The getter to retrieve the expected total borrow shares is not exposed because interest accrual does not apply\n/// to it. The value can be queried directly on Morpho using `totalBorrowShares`.\nlibrary MorphoBalancesLib {\n    using MathLib for uint256;\n    using MathLib for uint128;\n    using UtilsLib for uint256;\n    using MorphoLib for IMorpho;\n    using SharesMathLib for uint256;\n    using MarketParamsLib for MarketParams;\n\n    /// @notice Returns the expected market balances of a market after having accrued interest.\n    /// @return The expected total supply assets.\n    /// @return The expected total supply shares.\n    /// @return The expected total borrow assets.\n    /// @return The expected total borrow shares.\n    function expectedMarketBalances(IMorpho morpho, MarketParams memory marketParams)\n        internal\n        view\n        returns (uint256, uint256, uint256, uint256)\n    {\n        Id id = marketParams.id();\n        Market memory market = morpho.market(id);\n\n        uint256 elapsed = block.timestamp - market.lastUpdate;\n\n        // Skipped if elapsed == 0 or totalBorrowAssets == 0 because interest would be null, or if irm == address(0).\n        if (elapsed != 0 && market.totalBorrowAssets != 0 && marketParams.irm != address(0)) {\n            uint256 borrowRate = IIrm(marketParams.irm).borrowRateView(marketParams, market);\n            uint256 interest = market.totalBorrowAssets.wMulDown(borrowRate.wTaylorCompounded(elapsed));\n            market.totalBorrowAssets += interest.toUint128();\n            market.totalSupplyAssets += interest.toUint128();\n\n            if (market.fee != 0) {\n                uint256 feeAmount = interest.wMulDown(market.fee);\n                // The fee amount is subtracted from the total supply in this calculation to compensate for the fact\n                // that total supply is already updated.\n                uint256 feeShares =\n                    feeAmount.toSharesDown(market.totalSupplyAssets - feeAmount, market.totalSupplyShares);\n                market.totalSupplyShares += feeShares.toUint128();\n            }\n        }\n\n        return (market.totalSupplyAssets, market.totalSupplyShares, market.totalBorrowAssets, market.totalBorrowShares);\n    }\n\n    /// @notice Returns the expected total supply assets of a market after having accrued interest.\n    function expectedTotalSupplyAssets(IMorpho morpho, MarketParams memory marketParams)\n        internal\n        view\n        returns (uint256 totalSupplyAssets)\n    {\n        (totalSupplyAssets,,,) = expectedMarketBalances(morpho, marketParams);\n    }\n\n    /// @notice Returns the expected total borrow assets of a market after having accrued interest.\n    function expectedTotalBorrowAssets(IMorpho morpho, MarketParams memory marketParams)\n        internal\n        view\n        returns (uint256 totalBorrowAssets)\n    {\n        (,, totalBorrowAssets,) = expectedMarketBalances(morpho, marketParams);\n    }\n\n    /// @notice Returns the expected total supply shares of a market after having accrued interest.\n    function expectedTotalSupplyShares(IMorpho morpho, MarketParams memory marketParams)\n        internal\n        view\n        returns (uint256 totalSupplyShares)\n    {\n        (, totalSupplyShares,,) = expectedMarketBalances(morpho, marketParams);\n    }\n\n    /// @notice Returns the expected supply assets balance of `user` on a market after having accrued interest.\n    /// @dev Warning: Wrong for `feeRecipient` because their supply shares increase is not taken into account.\n    /// @dev Warning: Withdrawing using the expected supply assets can lead to a revert due to conversion roundings from\n    /// assets to shares.\n    function expectedSupplyAssets(IMorpho morpho, MarketParams memory marketParams, address user)\n        internal\n        view\n        returns (uint256)\n    {\n        Id id = marketParams.id();\n        uint256 supplyShares = morpho.supplyShares(id, user);\n        (uint256 totalSupplyAssets, uint256 totalSupplyShares,,) = expectedMarketBalances(morpho, marketParams);\n\n        return supplyShares.toAssetsDown(totalSupplyAssets, totalSupplyShares);\n    }\n\n    /// @notice Returns the expected borrow assets balance of `user` on a market after having accrued interest.\n    /// @dev Warning: The expected balance is rounded up, so it may be greater than the market's expected total borrow\n    /// assets.\n    function expectedBorrowAssets(IMorpho morpho, MarketParams memory marketParams, address user)\n        internal\n        view\n        returns (uint256)\n    {\n        Id id = marketParams.id();\n        uint256 borrowShares = morpho.borrowShares(id, user);\n        (,, uint256 totalBorrowAssets, uint256 totalBorrowShares) = expectedMarketBalances(morpho, marketParams);\n\n        return borrowShares.toAssetsUp(totalBorrowAssets, totalBorrowShares);\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/access/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Multicall.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Multicall.sol)\n\npragma solidity ^0.8.20;\n\nimport {Address} from \"./Address.sol\";\n\n/**\n * @dev Provides a function to batch together multiple calls in a single external call.\n */\nabstract contract Multicall {\n    /**\n     * @dev Receives and executes a batch of function calls on this contract.\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {\n        results = new bytes[](data.length);\n        for (uint256 i = 0; i < data.length; i++) {\n            results[i] = Address.functionDelegateCall(address(this), data[i]);\n        }\n        return results;\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},{"file_path":"lib/morpho-blue/src/libraries/MarketParamsLib.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\nimport {Id, MarketParams} from \"../interfaces/IMorpho.sol\";\n\n/// @title MarketParamsLib\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @notice Library to convert a market to its id.\nlibrary MarketParamsLib {\n    /// @notice The length of the data used to compute the id of a market.\n    /// @dev The length is 5 * 32 because `MarketParams` has 5 variables of 32 bytes each.\n    uint256 internal constant MARKET_PARAMS_BYTES_LENGTH = 5 * 32;\n\n    /// @notice Returns the id of the market `marketParams`.\n    function id(MarketParams memory marketParams) internal pure returns (Id marketParamsId) {\n        assembly (\"memory-safe\") {\n            marketParamsId := keccak256(marketParams, MARKET_PARAMS_BYTES_LENGTH)\n        }\n    }\n}\n"},{"file_path":"lib/morpho-blue/src/interfaces/IMorpho.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\ntype Id is bytes32;\n\nstruct MarketParams {\n    address loanToken;\n    address collateralToken;\n    address oracle;\n    address irm;\n    uint256 lltv;\n}\n\n/// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest\n/// accrual.\nstruct Position {\n    uint256 supplyShares;\n    uint128 borrowShares;\n    uint128 collateral;\n}\n\n/// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual.\n/// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual.\n/// @dev Warning: `totalSupplyShares` does not contain the additional shares accrued by `feeRecipient` since the last\n/// interest accrual.\nstruct Market {\n    uint128 totalSupplyAssets;\n    uint128 totalSupplyShares;\n    uint128 totalBorrowAssets;\n    uint128 totalBorrowShares;\n    uint128 lastUpdate;\n    uint128 fee;\n}\n\nstruct Authorization {\n    address authorizer;\n    address authorized;\n    bool isAuthorized;\n    uint256 nonce;\n    uint256 deadline;\n}\n\nstruct Signature {\n    uint8 v;\n    bytes32 r;\n    bytes32 s;\n}\n\n/// @dev This interface is used for factorizing IMorphoStaticTyping and IMorpho.\n/// @dev Consider using the IMorpho interface instead of this one.\ninterface IMorphoBase {\n    /// @notice The EIP-712 domain separator.\n    /// @dev Warning: Every EIP-712 signed message based on this domain separator can be reused on chains sharing the\n    /// same chain id and on forks because the domain separator would be the same.\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n    /// @notice The owner of the contract.\n    /// @dev It has the power to change the owner.\n    /// @dev It has the power to set fees on markets and set the fee recipient.\n    /// @dev It has the power to enable but not disable IRMs and LLTVs.\n    function owner() external view returns (address);\n\n    /// @notice The fee recipient of all markets.\n    /// @dev The recipient receives the fees of a given market through a supply position on that market.\n    function feeRecipient() external view returns (address);\n\n    /// @notice Whether the `irm` is enabled.\n    function isIrmEnabled(address irm) external view returns (bool);\n\n    /// @notice Whether the `lltv` is enabled.\n    function isLltvEnabled(uint256 lltv) external view returns (bool);\n\n    /// @notice Whether `authorized` is authorized to modify `authorizer`'s position on all markets.\n    /// @dev Anyone is authorized to modify their own positions, regardless of this variable.\n    function isAuthorized(address authorizer, address authorized) external view returns (bool);\n\n    /// @notice The `authorizer`'s current nonce. Used to prevent replay attacks with EIP-712 signatures.\n    function nonce(address authorizer) external view returns (uint256);\n\n    /// @notice Sets `newOwner` as `owner` of the contract.\n    /// @dev Warning: No two-step transfer ownership.\n    /// @dev Warning: The owner can be set to the zero address.\n    function setOwner(address newOwner) external;\n\n    /// @notice Enables `irm` as a possible IRM for market creation.\n    /// @dev Warning: It is not possible to disable an IRM.\n    function enableIrm(address irm) external;\n\n    /// @notice Enables `lltv` as a possible LLTV for market creation.\n    /// @dev Warning: It is not possible to disable a LLTV.\n    function enableLltv(uint256 lltv) external;\n\n    /// @notice Sets the `newFee` for the given market `marketParams`.\n    /// @param newFee The new fee, scaled by WAD.\n    /// @dev Warning: The recipient can be the zero address.\n    function setFee(MarketParams memory marketParams, uint256 newFee) external;\n\n    /// @notice Sets `newFeeRecipient` as `feeRecipient` of the fee.\n    /// @dev Warning: If the fee recipient is set to the zero address, fees will accrue there and will be lost.\n    /// @dev Modifying the fee recipient will allow the new recipient to claim any pending fees not yet accrued. To\n    /// ensure that the current recipient receives all due fees, accrue interest manually prior to making any changes.\n    function setFeeRecipient(address newFeeRecipient) external;\n\n    /// @notice Creates the market `marketParams`.\n    /// @dev Here is the list of assumptions on the market's dependencies (tokens, IRM and oracle) that guarantees\n    /// Morpho behaves as expected:\n    /// - The token should be ERC-20 compliant, except that it can omit return values on `transfer` and `transferFrom`.\n    /// - The token balance of Morpho should only decrease on `transfer` and `transferFrom`. In particular, tokens with\n    /// burn functions are not supported.\n    /// - The token should not re-enter Morpho on `transfer` nor `transferFrom`.\n    /// - The token balance of the sender (resp. receiver) should decrease (resp. increase) by exactly the given amount\n    /// on `transfer` and `transferFrom`. In particular, tokens with fees on transfer are not supported.\n    /// - The IRM should not re-enter Morpho.\n    /// - The oracle should return a price with the correct scaling.\n    /// @dev Here is a list of assumptions on the market's dependencies which, if broken, could break Morpho's liveness\n    /// properties (funds could get stuck):\n    /// - The token should not revert on `transfer` and `transferFrom` if balances and approvals are right.\n    /// - The amount of assets supplied and borrowed should not go above ~1e35 (otherwise the computation of\n    /// `toSharesUp` and `toSharesDown` can overflow).\n    /// - The IRM should not revert on `borrowRate`.\n    /// - The IRM should not return a very high borrow rate (otherwise the computation of `interest` in\n    /// `_accrueInterest` can overflow).\n    /// - The oracle should not revert `price`.\n    /// - The oracle should not return a very high price (otherwise the computation of `maxBorrow` in `_isHealthy` or of\n    /// `assetsRepaid` in `liquidate` can overflow).\n    /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to\n    /// the point where `totalBorrowShares` is very large and borrowing overflows.\n    function createMarket(MarketParams memory marketParams) external;\n\n    /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's\n    /// `onMorphoSupply` function with the given `data`.\n    /// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the\n    /// caller is guaranteed to have `assets` tokens pulled from their balance, but the possibility to mint a specific\n    /// amount of shares is given for full compatibility and precision.\n    /// @dev Supplying a large amount can revert for overflow.\n    /// @dev Supplying an amount of shares may lead to supply more or fewer assets than expected due to slippage.\n    /// Consider using the `assets` parameter to avoid this.\n    /// @param marketParams The market to supply assets to.\n    /// @param assets The amount of assets to supply.\n    /// @param shares The amount of shares to mint.\n    /// @param onBehalf The address that will own the increased supply position.\n    /// @param data Arbitrary data to pass to the `onMorphoSupply` callback. Pass empty data if not needed.\n    /// @return assetsSupplied The amount of assets supplied.\n    /// @return sharesSupplied The amount of shares minted.\n    function supply(\n        MarketParams memory marketParams,\n        uint256 assets,\n        uint256 shares,\n        address onBehalf,\n        bytes memory data\n    ) external returns (uint256 assetsSupplied, uint256 sharesSupplied);\n\n    /// @notice Withdraws `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`.\n    /// @dev Either `assets` or `shares` should be zero. To withdraw max, pass the `shares`'s balance of `onBehalf`.\n    /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.\n    /// @dev Withdrawing an amount corresponding to more shares than supplied will revert for underflow.\n    /// @dev It is advised to use the `shares` input when withdrawing the full position to avoid reverts due to\n    /// conversion roundings between shares and assets.\n    /// @param marketParams The market to withdraw assets from.\n    /// @param assets The amount of assets to withdraw.\n    /// @param shares The amount of shares to burn.\n    /// @param onBehalf The address of the owner of the supply position.\n    /// @param receiver The address that will receive the withdrawn assets.\n    /// @return assetsWithdrawn The amount of assets withdrawn.\n    /// @return sharesWithdrawn The amount of shares burned.\n    function withdraw(\n        MarketParams memory marketParams,\n        uint256 assets,\n        uint256 shares,\n        address onBehalf,\n        address receiver\n    ) external returns (uint256 assetsWithdrawn, uint256 sharesWithdrawn);\n\n    /// @notice Borrows `assets` or `shares` on behalf of `onBehalf` and sends the assets to `receiver`.\n    /// @dev Either `assets` or `shares` should be zero. Most use cases should rely on `assets` as an input so the\n    /// caller is guaranteed to borrow `assets` of tokens, but the possibility to mint a specific amount of shares is\n    /// given for full compatibility and precision.\n    /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.\n    /// @dev Borrowing a large amount can revert for overflow.\n    /// @dev Borrowing an amount of shares may lead to borrow fewer assets than expected due to slippage.\n    /// Consider using the `assets` parameter to avoid this.\n    /// @param marketParams The market to borrow assets from.\n    /// @param assets The amount of assets to borrow.\n    /// @param shares The amount of shares to mint.\n    /// @param onBehalf The address that will own the increased borrow position.\n    /// @param receiver The address that will receive the borrowed assets.\n    /// @return assetsBorrowed The amount of assets borrowed.\n    /// @return sharesBorrowed The amount of shares minted.\n    function borrow(\n        MarketParams memory marketParams,\n        uint256 assets,\n        uint256 shares,\n        address onBehalf,\n        address receiver\n    ) external returns (uint256 assetsBorrowed, uint256 sharesBorrowed);\n\n    /// @notice Repays `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's\n    /// `onMorphoRepay` function with the given `data`.\n    /// @dev Either `assets` or `shares` should be zero. To repay max, pass the `shares`'s balance of `onBehalf`.\n    /// @dev Repaying an amount corresponding to more shares than borrowed will revert for underflow.\n    /// @dev It is advised to use the `shares` input when repaying the full position to avoid reverts due to conversion\n    /// roundings between shares and assets.\n    /// @dev An attacker can front-run a repay with a small repay making the transaction revert for underflow.\n    /// @param marketParams The market to repay assets to.\n    /// @param assets The amount of assets to repay.\n    /// @param shares The amount of shares to burn.\n    /// @param onBehalf The address of the owner of the debt position.\n    /// @param data Arbitrary data to pass to the `onMorphoRepay` callback. Pass empty data if not needed.\n    /// @return assetsRepaid The amount of assets repaid.\n    /// @return sharesRepaid The amount of shares burned.\n    function repay(\n        MarketParams memory marketParams,\n        uint256 assets,\n        uint256 shares,\n        address onBehalf,\n        bytes memory data\n    ) external returns (uint256 assetsRepaid, uint256 sharesRepaid);\n\n    /// @notice Supplies `assets` of collateral on behalf of `onBehalf`, optionally calling back the caller's\n    /// `onMorphoSupplyCollateral` function with the given `data`.\n    /// @dev Interest are not accrued since it's not required and it saves gas.\n    /// @dev Supplying a large amount can revert for overflow.\n    /// @param marketParams The market to supply collateral to.\n    /// @param assets The amount of collateral to supply.\n    /// @param onBehalf The address that will own the increased collateral position.\n    /// @param data Arbitrary data to pass to the `onMorphoSupplyCollateral` callback. Pass empty data if not needed.\n    function supplyCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, bytes memory data)\n        external;\n\n    /// @notice Withdraws `assets` of collateral on behalf of `onBehalf` and sends the assets to `receiver`.\n    /// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.\n    /// @dev Withdrawing an amount corresponding to more collateral than supplied will revert for underflow.\n    /// @param marketParams The market to withdraw collateral from.\n    /// @param assets The amount of collateral to withdraw.\n    /// @param onBehalf The address of the owner of the collateral position.\n    /// @param receiver The address that will receive the collateral assets.\n    function withdrawCollateral(MarketParams memory marketParams, uint256 assets, address onBehalf, address receiver)\n        external;\n\n    /// @notice Liquidates the given `repaidShares` of debt asset or seize the given `seizedAssets` of collateral on the\n    /// given market `marketParams` of the given `borrower`'s position, optionally calling back the caller's\n    /// `onMorphoLiquidate` function with the given `data`.\n    /// @dev Either `seizedAssets` or `repaidShares` should be zero.\n    /// @dev Seizing more than the collateral balance will underflow and revert without any error message.\n    /// @dev Repaying more than the borrow balance will underflow and revert without any error message.\n    /// @dev An attacker can front-run a liquidation with a small repay making the transaction revert for underflow.\n    /// @param marketParams The market of the position.\n    /// @param borrower The owner of the position.\n    /// @param seizedAssets The amount of collateral to seize.\n    /// @param repaidShares The amount of shares to repay.\n    /// @param data Arbitrary data to pass to the `onMorphoLiquidate` callback. Pass empty data if not needed.\n    /// @return The amount of assets seized.\n    /// @return The amount of assets repaid.\n    function liquidate(\n        MarketParams memory marketParams,\n        address borrower,\n        uint256 seizedAssets,\n        uint256 repaidShares,\n        bytes memory data\n    ) external returns (uint256, uint256);\n\n    /// @notice Executes a flash loan.\n    /// @dev Flash loans have access to the whole balance of the contract (the liquidity and deposited collateral of all\n    /// markets combined, plus donations).\n    /// @dev Warning: Not ERC-3156 compliant but compatibility is easily reached:\n    /// - `flashFee` is zero.\n    /// - `maxFlashLoan` is the token's balance of this contract.\n    /// - The receiver of `assets` is the caller.\n    /// @param token The token to flash loan.\n    /// @param assets The amount of assets to flash loan.\n    /// @param data Arbitrary data to pass to the `onMorphoFlashLoan` callback.\n    function flashLoan(address token, uint256 assets, bytes calldata data) external;\n\n    /// @notice Sets the authorization for `authorized` to manage `msg.sender`'s positions.\n    /// @param authorized The authorized address.\n    /// @param newIsAuthorized The new authorization status.\n    function setAuthorization(address authorized, bool newIsAuthorized) external;\n\n    /// @notice Sets the authorization for `authorization.authorized` to manage `authorization.authorizer`'s positions.\n    /// @dev Warning: Reverts if the signature has already been submitted.\n    /// @dev The signature is malleable, but it has no impact on the security here.\n    /// @dev The nonce is passed as argument to be able to revert with a different error message.\n    /// @param authorization The `Authorization` struct.\n    /// @param signature The signature.\n    function setAuthorizationWithSig(Authorization calldata authorization, Signature calldata signature) external;\n\n    /// @notice Accrues interest for the given market `marketParams`.\n    function accrueInterest(MarketParams memory marketParams) external;\n\n    /// @notice Returns the data stored on the different `slots`.\n    function extSloads(bytes32[] memory slots) external view returns (bytes32[] memory);\n}\n\n/// @dev This interface is inherited by Morpho so that function signatures are checked by the compiler.\n/// @dev Consider using the IMorpho interface instead of this one.\ninterface IMorphoStaticTyping is IMorphoBase {\n    /// @notice The state of the position of `user` on the market corresponding to `id`.\n    /// @dev Warning: For `feeRecipient`, `supplyShares` does not contain the accrued shares since the last interest\n    /// accrual.\n    function position(Id id, address user)\n        external\n        view\n        returns (uint256 supplyShares, uint128 borrowShares, uint128 collateral);\n\n    /// @notice The state of the market corresponding to `id`.\n    /// @dev Warning: `totalSupplyAssets` does not contain the accrued interest since the last interest accrual.\n    /// @dev Warning: `totalBorrowAssets` does not contain the accrued interest since the last interest accrual.\n    /// @dev Warning: `totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last interest\n    /// accrual.\n    function market(Id id)\n        external\n        view\n        returns (\n            uint128 totalSupplyAssets,\n            uint128 totalSupplyShares,\n            uint128 totalBorrowAssets,\n            uint128 totalBorrowShares,\n            uint128 lastUpdate,\n            uint128 fee\n        );\n\n    /// @notice The market params corresponding to `id`.\n    /// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer\n    /// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`.\n    function idToMarketParams(Id id)\n        external\n        view\n        returns (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv);\n}\n\n/// @title IMorpho\n/// @author Morpho Labs\n/// @custom:contact security@morpho.org\n/// @dev Use this interface for Morpho to have access to all the functions with the appropriate function signatures.\ninterface IMorpho is IMorphoBase {\n    /// @notice The state of the position of `user` on the market corresponding to `id`.\n    /// @dev Warning: For `feeRecipient`, `p.supplyShares` does not contain the accrued shares since the last interest\n    /// accrual.\n    function position(Id id, address user) external view returns (Position memory p);\n\n    /// @notice The state of the market corresponding to `id`.\n    /// @dev Warning: `m.totalSupplyAssets` does not contain the accrued interest since the last interest accrual.\n    /// @dev Warning: `m.totalBorrowAssets` does not contain the accrued interest since the last interest accrual.\n    /// @dev Warning: `m.totalSupplyShares` does not contain the accrued shares by `feeRecipient` since the last\n    /// interest accrual.\n    function market(Id id) external view returns (Market memory m);\n\n    /// @notice The market params corresponding to `id`.\n    /// @dev This mapping is not used in Morpho. It is there to enable reducing the cost associated to calldata on layer\n    /// 2s by creating a wrapper contract with functions that take `id` as input instead of `marketParams`.\n    function idToMarketParams(Id id) external view returns (MarketParams memory);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/Address.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert FailedInnerCall();\n        }\n    }\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n    /**\n     * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing a bytes32 `messageHash` with\n     * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n     * keccak256, although any bytes32 value can be safely used because the final digest will\n     * be re-hashed.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing an arbitrary `message` with\n     * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n        return\n            keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n     * `0x00` (data with intended validator).\n     *\n     * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n     * `validator` address. Then hashing the result.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).\n     *\n     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, hex\"19_01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            digest := keccak256(ptr, 0x42)\n        }\n    }\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"morpho","type":"address"},{"internalType":"uint256","name":"initialTimelock","type":"uint256"},{"internalType":"address","name":"_asset","type":"address"},{"internalType":"string","name":"__name","type":"string"},{"internalType":"string","name":"__symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AboveMaxTimelock","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AllCapsReached","type":"error"},{"inputs":[],"name":"AlreadyPending","type":"error"},{"inputs":[],"name":"AlreadySet","type":"error"},{"inputs":[],"name":"BelowMinTimelock","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"DuplicateMarket","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxDeposit","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxMint","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxRedeem","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxWithdraw","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"InconsistentAsset","type":"error"},{"inputs":[],"name":"InconsistentReallocation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"InvalidMarketRemovalNonZeroCap","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"InvalidMarketRemovalNonZeroSupply","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"InvalidMarketRemovalTimelockNotElapsed","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"MarketNotCreated","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"MarketNotEnabled","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"MaxFeeExceeded","type":"error"},{"inputs":[],"name":"MaxQueueLengthExceeded","type":"error"},{"inputs":[],"name":"NoPendingValue","type":"error"},{"inputs":[],"name":"NonZeroCap","type":"error"},{"inputs":[],"name":"NotAllocatorRole","type":"error"},{"inputs":[],"name":"NotCuratorNorGuardianRole","type":"error"},{"inputs":[],"name":"NotCuratorRole","type":"error"},{"inputs":[],"name":"NotEnoughLiquidity","type":"error"},{"inputs":[],"name":"NotGuardianRole","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"PendingCap","type":"error"},{"inputs":[],"name":"PendingRemoval","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"SupplyCapExceeded","type":"error"},{"inputs":[],"name":"TimelockNotElapsed","type":"error"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"UnauthorizedMarket","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroFeeRecipient","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTotalAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeShares","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"suppliedAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"suppliedShares","type":"uint256"}],"name":"ReallocateSupply","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"withdrawnAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withdrawnShares","type":"uint256"}],"name":"ReallocateWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"}],"name":"RevokePendingCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"RevokePendingGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"}],"name":"RevokePendingMarketRemoval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"RevokePendingTimelock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"cap","type":"uint256"}],"name":"SetCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurator","type":"address"}],"name":"SetCurator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"SetFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newFeeRecipient","type":"address"}],"name":"SetFeeRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"guardian","type":"address"}],"name":"SetGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"allocator","type":"address"},{"indexed":false,"internalType":"bool","name":"isAllocator","type":"bool"}],"name":"SetIsAllocator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"SetName","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newSkimRecipient","type":"address"}],"name":"SetSkimRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"Id[]","name":"newSupplyQueue","type":"bytes32[]"}],"name":"SetSupplyQueue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"symbol","type":"string"}],"name":"SetSymbol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"newTimelock","type":"uint256"}],"name":"SetTimelock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"Id[]","name":"newWithdrawQueue","type":"bytes32[]"}],"name":"SetWithdrawQueue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Skim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"cap","type":"uint256"}],"name":"SubmitCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newGuardian","type":"address"}],"name":"SubmitGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"Id","name":"id","type":"bytes32"}],"name":"SubmitMarketRemoval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTimelock","type":"uint256"}],"name":"SubmitTimelock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"updatedTotalAssets","type":"uint256"}],"name":"UpdateLastTotalAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newLostAssets","type":"uint256"}],"name":"UpdateLostAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DECIMALS_OFFSET","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MORPHO","outputs":[{"internalType":"contract IMorpho","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"}],"name":"acceptCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Id","name":"","type":"bytes32"}],"name":"config","outputs":[{"internalType":"uint184","name":"cap","type":"uint184"},{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint64","name":"removableAt","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAllocator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTotalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lostAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Id","name":"","type":"bytes32"}],"name":"pendingCap","outputs":[{"internalType":"uint192","name":"value","type":"uint192"},{"internalType":"uint64","name":"validAt","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingGuardian","outputs":[{"internalType":"address","name":"value","type":"address"},{"internalType":"uint64","name":"validAt","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingTimelock","outputs":[{"internalType":"uint192","name":"value","type":"uint192"},{"internalType":"uint64","name":"validAt","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"assets","type":"uint256"}],"internalType":"struct MarketAllocation[]","name":"allocations","type":"tuple[]"}],"name":"reallocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"revokePendingCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokePendingGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"Id","name":"id","type":"bytes32"}],"name":"revokePendingMarketRemoval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokePendingTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newCurator","type":"address"}],"name":"setCurator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newFeeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAllocator","type":"address"},{"internalType":"bool","name":"newIsAllocator","type":"bool"}],"name":"setIsAllocator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newName","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSkimRecipient","type":"address"}],"name":"setSkimRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"Id[]","name":"newSupplyQueue","type":"bytes32[]"}],"name":"setSupplyQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newSymbol","type":"string"}],"name":"setSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"skim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"skimRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"},{"internalType":"uint256","name":"newSupplyCap","type":"uint256"}],"name":"submitCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newGuardian","type":"address"}],"name":"submitGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"loanToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"irm","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"}],"internalType":"struct MarketParams","name":"marketParams","type":"tuple"}],"name":"submitMarketRemoval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newTimelock","type":"uint256"}],"name":"submitTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"supplyQueue","outputs":[{"internalType":"Id","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supplyQueueLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"name":"updateWithdrawQueue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdrawQueue","outputs":[{"internalType":"Id","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawQueueLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":true,"package_name":null,"constructor_args":"0000000000000000000000005a4e19842e09000a582c20a4f524c26fb48dd4d00000000000000000000000006c247b1f6182318877311737bac0844baa518f5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e583100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000005785553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057855534443000000000000000000000000000000000000000000000000000000"}