{"sources":{"contracts/CgUSD.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport { Initializable } from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { IBurner } from \"./interfaces/IBurner.sol\";\nimport { ILocator } from \"./interfaces/ILocator.sol\";\nimport { IOracleReportSanityChecker } from \"./interfaces/IOracleReportSanityChecker.sol\";\nimport { IWithdrawVault } from \"./interfaces/IWithdrawVault.sol\";\nimport { IWithdrawQueueERC721 } from \"./interfaces/IWithdrawQueueERC721.sol\";\nimport { ICgUSD } from \"./interfaces/ICgUSD.sol\";\nimport { IPausable } from \"./interfaces/IPausable.sol\";\nimport { UnstructuredStorage } from \"./lib/UnstructuredStorage.sol\";\nimport { StToken } from \"./StToken.sol\";\n\ncontract CgUSD is StToken, Ownable, Initializable, ICgUSD, IPausable {\n    using SafeERC20 for IERC20;\n    using UnstructuredStorage for bytes32;\n\n    address public asset;\n\n    bytes32 internal constant LOCATOR_POSITION =\n        0x1718d90604c88f478732e809519e74c5c9a3a2b5dc95162ccc63d61800e42625; // keccak256(\"cygnus.CgUSD.locator\")\n\n    bytes32 internal constant BUFFERED_ASSET_POSITION =\n        0x0afc87acedeee8c4193ad63118c06a9f961d4d6f3e34515e102d41596851b1a6; // keccak256(\"cygnus.CgUSD.bufferedAsset\");\n\n    bytes32 internal constant INVESTED_ASSET_POSITION =\n        0x2c852a3a34b8266c1f4cf623581e3b3686edf6412c376db5da52f02d19ef925b; // keccak256(\"cygnus.CgUSD.investedAsset\");\n\n    struct OracleReportedData {\n        uint256 reportTimestamp;\n        uint256 timeElapsed;\n        uint256 newInvestedAssets;\n        uint256 withdrawalVaultBalance;\n        uint256 sharesRequestedToBurn;\n        uint256[] withdrawalFinalizationBatches;\n        uint256 simulatedShareRate;\n    }\n\n    struct OracleReportContracts {\n        address accountingOracle;\n        address oracleReportSanityChecker;\n        address burner;\n        address withdrawQueue;\n        address withdrawVault;\n    }\n\n    struct OracleReportContext {\n        uint256 preTotalPooledAssets;\n        uint256 preTotalShares;\n        uint256 assetsToLockOnWithdrawalQueue;\n        uint256 sharesToBurnFromWithdrawalQueue;\n        uint256 simulatedSharesToBurn;\n        uint256 sharesToBurn;\n    }\n\n    event AssetsDistributed(\n        uint256 indexed reportTimestamp,\n        uint256 withdrawalsWithdrawn,\n        uint256 postBufferedAssets,\n        uint256 postInvestedAssets\n    );\n\n    event TokenRebased(\n        uint256 indexed reportTimestamp,\n        uint256 timeElapsed,\n        uint256 preTotalShares,\n        uint256 preTotalAssets,\n        uint256 postTotalShares,\n        uint256 postTotalAssets\n    );\n\n    event LocatorSet(address locator);\n\n    event WithdrawalsReceived(uint256 amount);\n\n    event Submitted(address indexed sender, uint256 amount, address referral);\n\n    event Invested(uint256 amount, uint256 postBufferedAssets, uint256 postInvestedAssets);\n\n    constructor(\n        address _asset,\n        address _owner\n    ) Ownable(_owner) {\n        asset = _asset;\n    }\n\n    function initialize(address _locator) external initializer {\n        _bootstrapInitialHolder();\n\n        LOCATOR_POSITION.setStorageAddress(_locator);\n        _approve(\n            ILocator(_locator).withdrawQueue(),\n            ILocator(_locator).burner(),\n            INFINITE_ALLOWANCE\n        );\n\n        emit LocatorSet(_locator);\n    }\n\n    function decimals() external view override returns (uint8) {\n        return IERC20Metadata(asset).decimals();\n    }\n\n    function resume() external onlyOwner {\n        _unpause();\n    }\n\n    function pause() external onlyOwner {\n        _pause();\n    }\n\n    function _getTotalPooledAssets() internal view override returns (uint256) {\n        return _getBufferedAssets() + _getInvestedAssets();\n    }\n\n    function getTotalAssets() external view returns (uint256, uint256) {\n        return (_getBufferedAssets(), _getInvestedAssets());\n    }\n\n    function canDeposit() public view returns (bool) {\n        return !_withdrawalQueue().isBunkerModeActive() && !paused();\n    }\n\n    function mint(address _referral, uint256 _assetsAmount)\n        external\n        returns (uint256 sharesAmount)\n    {\n        require((sharesAmount = previewDeposit(_assetsAmount)) != 0, \"ZERO_SHARES\");\n\n        // TODO: check if oracle price deviated\n\n        IERC20(asset).safeTransferFrom(msg.sender, address(this), _assetsAmount);\n\n        _mintShares(msg.sender, sharesAmount);\n\n        _setBufferedAssets(_getBufferedAssets() + _assetsAmount);\n        emit Submitted(msg.sender, _assetsAmount, _referral);\n\n        _emitTransferAfterMintingShares(msg.sender, sharesAmount);\n    }\n\n    function invest(address _to, uint256 _assetsAmount) external onlyOwner {\n        require(canDeposit(), \"CAN_NOT_INVEST\");\n\n        IERC20(asset).safeTransfer(_to, _assetsAmount);\n\n        uint256 postBufferedAssets = _getBufferedAssets() - _assetsAmount;\n        uint256 postInvestedAssets = _getInvestedAssets() + _assetsAmount;\n        _setBufferedAssets(postBufferedAssets);\n        _setInvestedAssets(postInvestedAssets);\n        emit Invested(_assetsAmount, postBufferedAssets, postInvestedAssets);\n    }\n\n    function handleOracleReport(\n        uint256 _reportTimestamp,\n        uint256 _timeElapsed,\n        uint256 _newInvestedAssets,\n        uint256 _withdrawalVaultBalance,\n        uint256 _sharesRequestedToBurn,\n        uint256[] calldata _withdrawalFinalizationBatches,\n        uint256 _simulatedShareRate\n    ) external whenNotPaused returns (uint256[3] memory postRebaseAmounts) {\n        return _handleOracleReport(\n            OracleReportedData(\n                _reportTimestamp,\n                _timeElapsed,\n                _newInvestedAssets,\n                _withdrawalVaultBalance,\n                _sharesRequestedToBurn,\n                _withdrawalFinalizationBatches,\n                _simulatedShareRate\n            )\n        );\n    }\n\n    function _handleOracleReport(OracleReportedData memory _reportedData) internal returns (uint256[3] memory) {\n        OracleReportContracts memory contracts = _loadOracleReportContracts();\n\n        require(msg.sender == contracts.accountingOracle, \"APP_AUTH_FAILED\");\n        require(_reportedData.reportTimestamp <= block.timestamp, \"INVALID_REPORT_TIMESTAMP\");\n\n        OracleReportContext memory reportContext;\n\n        // Step 1.\n        // Take a snapshot of the current (pre-) state\n        reportContext.preTotalPooledAssets = _getTotalPooledAssets();\n        reportContext.preTotalShares = _getTotalShares();\n\n        // Step 2.\n        // Pass the report data to sanity checker (reverts if malformed)\n        _checkAccountingOracleReport(contracts, _reportedData);\n\n        // Step 3.\n        // Pre-calculate the ether to lock for withdrawal queue and shares to be burnt\n        // due to withdrawal requests to finalize\n        if (_reportedData.withdrawalFinalizationBatches.length != 0) {\n            (\n                reportContext.assetsToLockOnWithdrawalQueue,\n                reportContext.sharesToBurnFromWithdrawalQueue\n            ) = _calculateWithdrawals(contracts, _reportedData);\n\n            if (reportContext.sharesToBurnFromWithdrawalQueue > 0) {\n                IBurner(contracts.burner).requestBurnShares(\n                    contracts.withdrawQueue,\n                    reportContext.sharesToBurnFromWithdrawalQueue\n                );\n            }\n        }\n\n        // Step 4.\n        // Pass the accounting values to sanity checker to smoothen positive token rebase\n\n        uint256 withdrawals;\n        (\n            withdrawals, reportContext.simulatedSharesToBurn, reportContext.sharesToBurn\n        ) = IOracleReportSanityChecker(contracts.oracleReportSanityChecker).smoothenTokenRebase(\n            reportContext.preTotalPooledAssets,\n            reportContext.preTotalShares,\n            _reportedData.withdrawalVaultBalance,\n            _reportedData.sharesRequestedToBurn,\n            reportContext.assetsToLockOnWithdrawalQueue,\n            reportContext.sharesToBurnFromWithdrawalQueue\n        );\n\n        // Step 5.\n        // Invoke finalization of the withdrawal requests (send ether to withdrawal queue, assign shares to be burnt)\n        _collectRewardsAndProcessWithdrawals(\n            contracts,\n            withdrawals,\n            _reportedData.withdrawalFinalizationBatches,\n            _reportedData.simulatedShareRate,\n            reportContext.assetsToLockOnWithdrawalQueue\n        );\n\n        // Step 6.\n        // Update invested assets\n        _setInvestedAssets(_reportedData.newInvestedAssets);\n\n        emit AssetsDistributed(\n            _reportedData.reportTimestamp,\n            withdrawals,\n            _getBufferedAssets(),\n            _getInvestedAssets()\n        );\n\n        // Step 7.\n        // Burn the previously requested shares\n        if (reportContext.sharesToBurn > 0) {\n            IBurner(contracts.burner).commitSharesToBurn(reportContext.sharesToBurn);\n            _burnShares(contracts.burner, reportContext.sharesToBurn);\n        }\n\n        // Step 8.\n        // Complete token rebase (emit an event)\n        (\n            uint256 postTotalShares,\n            uint256 postTotalPooledAssets\n        ) = _completeTokenRebase(\n            _reportedData,\n            reportContext\n        );\n\n        // Step 9. Sanity check for the provided simulated share rate\n        if (_reportedData.withdrawalFinalizationBatches.length != 0) {\n            IOracleReportSanityChecker(contracts.oracleReportSanityChecker).checkSimulatedShareRate(\n                postTotalPooledAssets,\n                postTotalShares,\n                reportContext.assetsToLockOnWithdrawalQueue,\n                reportContext.sharesToBurn - reportContext.simulatedSharesToBurn,\n                _reportedData.simulatedShareRate\n            );\n        }\n\n        return [postTotalPooledAssets, postTotalShares, withdrawals];\n    }\n\n    function _collectRewardsAndProcessWithdrawals(\n        OracleReportContracts memory _contracts,\n        uint256 _withdrawalsToWithdraw,\n        uint256[] memory _withdrawalFinalizationBatches,\n        uint256 _simulatedShareRate,\n        uint256 _assetsToLockOnWithdrawalQueue\n    ) internal {\n        // withdraw withdrawals and put them to the buffer\n        if (_withdrawalsToWithdraw > 0) {\n            IWithdrawVault(_contracts.withdrawVault).withdrawWithdrawals(_withdrawalsToWithdraw);\n        }\n\n        // finalize withdrawals (send ether, assign shares for burning)\n        if (_assetsToLockOnWithdrawalQueue > 0) { // TODO\n            IWithdrawQueueERC721 withdrawalQueue = IWithdrawQueueERC721(_contracts.withdrawQueue);\n            IERC20(asset).safeTransfer(_contracts.withdrawQueue, _assetsToLockOnWithdrawalQueue);\n            withdrawalQueue.finalize(\n                _withdrawalFinalizationBatches[_withdrawalFinalizationBatches.length - 1],\n                _simulatedShareRate,\n                _assetsToLockOnWithdrawalQueue\n            );\n        }\n\n        uint256 postBufferedAssets = _getBufferedAssets() + _withdrawalsToWithdraw - _assetsToLockOnWithdrawalQueue;\n\n        _setBufferedAssets(postBufferedAssets);\n    }\n\n    function _calculateWithdrawals(\n        OracleReportContracts memory _contracts,\n        OracleReportedData memory _reportedData\n    ) internal view returns (\n        uint256 assetsToLock, uint256 sharesToBurn\n    ) {\n        IWithdrawQueueERC721 withdrawalQueue = IWithdrawQueueERC721(_contracts.withdrawQueue);\n\n        //if (!withdrawalQueue.isPaused()) { TODO\n        {\n            IOracleReportSanityChecker(_contracts.oracleReportSanityChecker).checkWithdrawalQueueOracleReport(\n                _reportedData.withdrawalFinalizationBatches[_reportedData.withdrawalFinalizationBatches.length - 1],\n                _reportedData.reportTimestamp\n            );\n\n            (assetsToLock, sharesToBurn) = withdrawalQueue.prefinalize(\n                _reportedData.withdrawalFinalizationBatches,\n                _reportedData.simulatedShareRate\n            );\n        }\n    }\n\n    function _checkAccountingOracleReport(\n        OracleReportContracts memory _contracts,\n        OracleReportedData memory _reportedData\n    ) internal view {\n        IOracleReportSanityChecker(_contracts.oracleReportSanityChecker).checkAccountingOracleReport(\n            _reportedData.timeElapsed,\n            _reportedData.withdrawalVaultBalance,\n            _reportedData.sharesRequestedToBurn\n        );\n    }\n\n    function _completeTokenRebase(\n        OracleReportedData memory _reportedData,\n        OracleReportContext memory _reportContext\n    ) internal returns (uint256 postTotalShares, uint256 postTotalPooledAssets) {\n        postTotalShares = _getTotalShares();\n        postTotalPooledAssets = _getTotalPooledAssets();\n\n        emit TokenRebased(\n            _reportedData.reportTimestamp,\n            _reportedData.timeElapsed,\n            _reportContext.preTotalShares,\n            _reportContext.preTotalPooledAssets,\n            postTotalShares,\n            postTotalPooledAssets\n        );\n    }\n\n    function _loadOracleReportContracts() internal view returns (OracleReportContracts memory ret) {\n        (\n            ret.accountingOracle,\n            ret.oracleReportSanityChecker,\n            ret.burner,\n            ret.withdrawQueue,\n            ret.withdrawVault\n        ) = getLocator().oracleReportComponents();\n    }\n\n    function getLocator() public view returns (ILocator) {\n        return ILocator(LOCATOR_POSITION.getStorageAddress());\n    }\n\n    function _withdrawalQueue() internal view returns (IWithdrawQueueERC721) {\n        return IWithdrawQueueERC721(getLocator().withdrawQueue());\n    }\n\n    function _getBufferedAssets() internal view returns (uint256) {\n        return BUFFERED_ASSET_POSITION.getStorageUint256();\n    }\n\n    function _setBufferedAssets(uint256 _newBufferedAssets) internal {\n        BUFFERED_ASSET_POSITION.setStorageUint256(_newBufferedAssets);\n    }\n\n    function _getInvestedAssets() internal view returns (uint256) {\n        return INVESTED_ASSET_POSITION.getStorageUint256();\n    }\n\n    function _setInvestedAssets(uint256 _newInvestedAssets) internal {\n        INVESTED_ASSET_POSITION.setStorageUint256(_newInvestedAssets);\n    }\n\n    function _bootstrapInitialHolder() internal {\n        uint256 balance = IERC20(asset).balanceOf(address(this));\n        assert(balance != 0);\n\n        if (_getTotalShares() == 0) {\n            _setBufferedAssets(balance);\n            emit Submitted(INITIAL_TOKEN_HOLDER, balance, address(0));\n            _mintInitialShares(balance);\n        }\n    }\n}"},"contracts/StToken.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { Pausable } from \"@openzeppelin/contracts/utils/Pausable.sol\";\nimport { FixedPointMathLib } from \"solmate/src/utils/FixedPointMathLib.sol\";\nimport { UnstructuredStorage } from \"./lib/UnstructuredStorage.sol\";\n\nabstract contract StToken is IERC20, Pausable {\n    using FixedPointMathLib for uint256;\n    using UnstructuredStorage for bytes32;\n\n    address constant internal INITIAL_TOKEN_HOLDER = address(0xDEAD);\n    uint256 constant internal INFINITE_ALLOWANCE = type(uint256).max;\n\n    mapping (address => uint256) private shares;\n\n    mapping (address => mapping (address => uint256)) private allowances;\n\n    bytes32 internal constant TOTAL_SHARES_POSITION =\n        0x83da5a14a875cd105129c6639940ca67c63bf644cb010f348eec1dbad1a679be; // keccak256('cygnus.StToken.totalShares')\n\n    event TransferShares(\n        address indexed from,\n        address indexed to,\n        uint256 sharesValue\n    );\n\n    event SharesBurnt(\n        address indexed account,\n        uint256 preRebaseTokenAmount,\n        uint256 postRebaseTokenAmount,\n        uint256 sharesAmount\n    );\n\n    function name() external pure returns (string memory) {\n        return \"Cygnus Global USD\";\n    }\n\n    function symbol() external pure returns (string memory) {\n        return \"cgUSD\";\n    }\n\n    function decimals() external view virtual returns (uint8);\n\n    function totalSupply() external view returns (uint256) {\n        return _getTotalPooledAssets();\n    }\n\n    function getTotalPooledAssets() external view returns (uint256) {\n        return _getTotalPooledAssets();\n    }\n\n    function balanceOf(address _account) external view returns (uint256) {\n        return convertToAssets(_sharesOf(_account));\n    }\n\n    function transfer(address _recipient, uint256 _amount) external returns (bool) {\n        _transfer(msg.sender, _recipient, _amount);\n        return true;\n    }\n\n    function allowance(address _owner, address _spender) external view returns (uint256) {\n        return allowances[_owner][_spender];\n    }\n\n    function approve(address _spender, uint256 _amount) external returns (bool) {\n        _approve(msg.sender, _spender, _amount);\n        return true;\n    }\n\n    function transferFrom(address _sender, address _recipient, uint256 _amount) external returns (bool) {\n        _spendAllowance(_sender, msg.sender, _amount);\n        _transfer(_sender, _recipient, _amount);\n        return true;\n    }\n\n    function increaseAllowance(address _spender, uint256 _addedValue) external returns (bool) {\n        _approve(msg.sender, _spender, allowances[msg.sender][_spender] + _addedValue);\n        return true;\n    }\n\n    function decreaseAllowance(address _spender, uint256 _subtractedValue) external returns (bool) {\n        uint256 currentAllowance = allowances[msg.sender][_spender];\n        require(currentAllowance >= _subtractedValue, \"ALLOWANCE_BELOW_ZERO\");\n        _approve(msg.sender, _spender, currentAllowance - _subtractedValue);\n        return true;\n    }\n\n    function getTotalShares() external view returns (uint256) {\n        return _getTotalShares();\n    }\n\n    function sharesOf(address _account) external view returns (uint256) {\n        return _sharesOf(_account);\n    }\n\n    function transferShares(address _recipient, uint256 _sharesAmount) external returns (uint256) {\n        _transferShares(msg.sender, _recipient, _sharesAmount);\n        uint256 tokensAmount = convertToAssets(_sharesAmount);\n        _emitTransferEvents(msg.sender, _recipient, tokensAmount, _sharesAmount);\n        return tokensAmount;\n    }\n\n    function transferSharesFrom(\n        address _sender, address _recipient, uint256 _sharesAmount\n    ) external returns (uint256) {\n        uint256 tokensAmount = convertToAssets(_sharesAmount);\n        _spendAllowance(_sender, msg.sender, tokensAmount);\n        _transferShares(_sender, _recipient, _sharesAmount);\n        _emitTransferEvents(_sender, _recipient, tokensAmount, _sharesAmount);\n        return tokensAmount;\n    }\n\n    function _getTotalPooledAssets() internal view virtual returns (uint256);\n\n    function _transfer(address _sender, address _recipient, uint256 _amount) internal {\n        uint256 _sharesToTransfer = convertToShares(_amount);\n        _transferShares(_sender, _recipient, _sharesToTransfer);\n        _emitTransferEvents(_sender, _recipient, _amount, _sharesToTransfer);\n    }\n\n    function _approve(address _owner, address _spender, uint256 _amount) internal {\n        require(_owner != address(0), \"APPROVE_FROM_ZERO_ADDR\");\n        require(_spender != address(0), \"APPROVE_TO_ZERO_ADDR\");\n\n        allowances[_owner][_spender] = _amount;\n        emit Approval(_owner, _spender, _amount);\n    }\n\n    function _spendAllowance(address _owner, address _spender, uint256 _amount) internal {\n        uint256 currentAllowance = allowances[_owner][_spender];\n        if (currentAllowance != INFINITE_ALLOWANCE) {\n            require(currentAllowance >= _amount, \"ALLOWANCE_EXCEEDED\");\n            _approve(_owner, _spender, currentAllowance - _amount);\n        }\n    }\n\n    function _getTotalShares() internal view returns (uint256) {\n        return TOTAL_SHARES_POSITION.getStorageUint256();\n    }\n\n    function _sharesOf(address _account) internal view returns (uint256) {\n        return shares[_account];\n    }\n\n    function _transferShares(address _sender, address _recipient, uint256 _sharesAmount) internal {\n        _requireNotPaused();\n        require(_sender != address(0), \"TRANSFER_FROM_ZERO_ADDR\");\n        require(_recipient != address(0), \"TRANSFER_TO_ZERO_ADDR\");\n        require(_recipient != address(this), \"TRANSFER_TO_STETH_CONTRACT\");\n\n        uint256 currentSenderShares = shares[_sender];\n        require(_sharesAmount <= currentSenderShares, \"BALANCE_EXCEEDED\");\n\n        shares[_sender] = currentSenderShares - _sharesAmount;\n        shares[_recipient] = shares[_recipient] + _sharesAmount;\n    }\n\n    function _mintShares(address _recipient, uint256 _sharesAmount) internal returns (uint256 newTotalShares) {\n        require(_recipient != address(0), \"MINT_TO_ZERO_ADDR\");\n\n        newTotalShares = _getTotalShares() + _sharesAmount;\n        TOTAL_SHARES_POSITION.setStorageUint256(newTotalShares);\n\n        shares[_recipient] = shares[_recipient] + _sharesAmount;\n    }\n\n    function _burnShares(address _account, uint256 _sharesAmount) internal returns (uint256 newTotalShares) {\n        require(_account != address(0), \"BURN_FROM_ZERO_ADDR\");\n\n        uint256 accountShares = shares[_account];\n        require(_sharesAmount <= accountShares, \"BALANCE_EXCEEDED\");\n\n        uint256 preRebaseTokenAmount = convertToAssets(_sharesAmount);\n\n        newTotalShares = _getTotalShares() - _sharesAmount;\n        TOTAL_SHARES_POSITION.setStorageUint256(newTotalShares);\n\n        shares[_account] = accountShares - _sharesAmount;\n\n        uint256 postRebaseTokenAmount = convertToAssets(_sharesAmount);\n\n        emit SharesBurnt(_account, preRebaseTokenAmount, postRebaseTokenAmount, _sharesAmount);\n    }\n\n    function convertToShares(uint256 _assetsAmount) public view virtual returns (uint256) {\n        return _assetsAmount.mulDivDown(_getTotalShares(), _getTotalPooledAssets());\n    }\n\n    function convertToAssets(uint256 _sharesAmount) public view virtual returns (uint256) {\n        return _sharesAmount.mulDivDown(_getTotalPooledAssets(), _getTotalShares());\n    }\n\n    function _emitTransferEvents(address _from, address _to, uint _tokenAmount, uint256 _sharesAmount) internal {\n        emit Transfer(_from, _to, _tokenAmount);\n        emit TransferShares(_from, _to, _sharesAmount);\n    }\n\n    function _emitTransferAfterMintingShares(address _to, uint256 _sharesAmount) internal {\n        _emitTransferEvents(address(0), _to, convertToAssets(_sharesAmount), _sharesAmount);\n    }\n\n    function _mintInitialShares(uint256 _sharesAmount) internal {\n        _mintShares(INITIAL_TOKEN_HOLDER, _sharesAmount);\n        _emitTransferAfterMintingShares(INITIAL_TOKEN_HOLDER, _sharesAmount);\n    }\n\n    function previewDeposit(uint256 _assetsAmount) public view virtual returns (uint256) {\n        return convertToShares(_assetsAmount);\n    }\n\n    function previewMint(uint256 _sharesAmount) public view virtual returns (uint256) {\n        return _sharesAmount.mulDivUp(_getTotalPooledAssets(), _getTotalShares());\n    }\n\n    function previewWithdraw(uint256 _assetsAmount) public view virtual returns (uint256) {\n        return _assetsAmount.mulDivUp(_getTotalShares(), _getTotalPooledAssets());\n    }\n\n    function previewRedeem(uint256 _sharesAmount) public view virtual returns (uint256) {\n        return convertToAssets(_sharesAmount);\n    }\n}"},"contracts/interfaces/ICgUSD.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ICgUSD {\n    function asset() external view returns (address);\n\n    function getTotalAssets() external view returns (uint256, uint256);\n\n    function mint(address _referral, uint256 _assetsAmount)\n        external\n        returns (uint256);\n\n    function invest(address _to, uint256 _assetsAmount) external;\n\n    function handleOracleReport(\n        uint256 _reportTimestamp,\n        uint256 _timeElapsed,\n        uint256 _newInvestedAssets,\n        uint256 _withdrawalVaultBalance,\n        uint256 _sharesRequestedToBurn,\n        uint256[] calldata _withdrawalFinalizationBatches,\n        uint256 _simulatedShareRate\n    ) external returns (uint256[3] memory);\n}"},"contracts/interfaces/IBurner.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IBurner {\n    function commitSharesToBurn(uint256 _stETHSharesToBurn) external;\n\n    function requestBurnShares(address _from, uint256 _sharesAmount) external;\n\n    function getSharesRequestedToBurn() external view returns (uint256 coverShares, uint256 nonCoverShares);\n\n    function getCoverSharesBurnt() external view returns (uint256);\n\n    function getNonCoverSharesBurnt() external view returns (uint256);\n}"},"contracts/interfaces/ILocator.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface ILocator {\n    function accountingOracle() external view returns (address);\n    function burner() external view returns (address);\n    function priceOracle() external view returns (address);\n    function withdrawQueue() external view returns (address);\n    function withdrawVault() external view returns (address);\n    function underlyingToken() external view returns (address);\n    function stToken() external view returns (address);\n    function treasury() external view returns (address);\n    function oracleReportSanityChecker() external view returns (address);\n\n    function coreComponents() external view returns (\n        address oracleReportSanityChecker,\n        address treasury,\n        address withdrawalQueue,\n        address withdrawalVault\n    );\n\n    function oracleReportComponents() external view returns (\n        address accountingOracle,\n        address oracleReportSanityChecker,\n        address burner,\n        address withdrawalQueue,\n        address withdrawalVault\n    );\n}"},"contracts/interfaces/IPausable.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IPausable {\n    function pause() external;\n\n    function resume() external;\n}"},"contracts/lib/UnstructuredStorage.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nlibrary UnstructuredStorage {\n    function getStorageBool(bytes32 position) internal view returns (bool data) {\n        assembly { data := sload(position) }\n    }\n\n    function getStorageAddress(bytes32 position) internal view returns (address data) {\n        assembly { data := sload(position) }\n    }\n\n    function getStorageBytes32(bytes32 position) internal view returns (bytes32 data) {\n        assembly { data := sload(position) }\n    }\n\n    function getStorageUint256(bytes32 position) internal view returns (uint256 data) {\n        assembly { data := sload(position) }\n    }\n\n    function setStorageBool(bytes32 position, bool data) internal {\n        assembly { sstore(position, data) }\n    }\n\n    function setStorageAddress(bytes32 position, address data) internal {\n        assembly { sstore(position, data) }\n    }\n\n    function setStorageBytes32(bytes32 position, bytes32 data) internal {\n        assembly { sstore(position, data) }\n    }\n\n    function setStorageUint256(bytes32 position, uint256 data) internal {\n        assembly { sstore(position, data) }\n    }\n}"},"contracts/interfaces/IWithdrawQueue.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IWithdrawQueueBase } from \"./IWithdrawQueueBase.sol\";\n\ninterface IWithdrawQueue is IWithdrawQueueBase {\n    struct PermitInput {\n        uint256 value;\n        uint256 deadline;\n        uint8 v;\n        bytes32 r;\n        bytes32 s;\n    }\n\n    function requestWithdrawals(\n        uint256[] calldata _amounts,\n        address _owner\n    ) external returns (uint256[] memory);\n\n    function requestWithdrawalsWstToken(\n        uint256[] calldata _amounts,\n        address _owner\n    ) external returns (uint256[] memory);\n\n    function requestWithdrawalsWithPermit(\n        uint256[] calldata _amounts,\n        address _owner,\n        PermitInput calldata _permit\n    ) external returns (uint256[] memory);\n\n    function requestWithdrawalsWstTokenWithPermit(\n        uint256[] calldata _amounts,\n        address _owner,\n        PermitInput calldata _permit\n    ) external returns (uint256[] memory);\n\n    function getWithdrawalRequests(address _owner) external view returns (uint256[] memory);\n\n    function getWithdrawalStatus(uint256[] calldata _requestIds)\n        external\n        view\n        returns (WithdrawalRequestStatus[] memory);\n\n    function getClaimableAssets(uint256[] calldata _requestIds, uint256[] calldata _hints)\n        external\n        view\n        returns (uint256[] memory);\n\n    function claimWithdrawalsTo(\n        uint256[] calldata _requestIds,\n        uint256[] calldata _hints,\n        address _recipient\n    ) external;\n\n    function claimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external;\n\n    function claimWithdrawal(uint256 _requestId) external;\n\n    function findCheckpointHints(uint256[] calldata _requestIds, uint256 _firstIndex, uint256 _lastIndex)\n        external\n        view\n        returns (uint256[] memory);\n\n    function onOracleReport(\n        bool _isBunkerModeNow,\n        uint256 _bunkerStartTimestamp,\n        uint256 _currentReportTimestamp\n    ) external;\n\n    function isBunkerModeActive() external view returns (bool);\n\n    function bunkerModeSinceTimestamp() external view returns (uint256);\n}"},"contracts/interfaces/IWithdrawVault.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IWithdrawVault {\n    function asset() external view returns (address);\n    function withdrawWithdrawals(uint256 _amount) external;\n}"},"solmate/src/utils/FixedPointMathLib.sol":{"content":"// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n    /*//////////////////////////////////////////////////////////////\n                    SIMPLIFIED FIXED POINT OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 internal constant MAX_UINT256 = 2**256 - 1;\n\n    uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n    function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n    }\n\n    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n    }\n\n    function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n    }\n\n    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    LOW LEVEL FIXED POINT OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function mulDivDown(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n                revert(0, 0)\n            }\n\n            // Divide x * y by the denominator.\n            z := div(mul(x, y), denominator)\n        }\n    }\n\n    function mulDivUp(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n                revert(0, 0)\n            }\n\n            // If x * y modulo the denominator is strictly greater than 0,\n            // 1 is added to round up the division of x * y by the denominator.\n            z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\n        }\n    }\n\n    function rpow(\n        uint256 x,\n        uint256 n,\n        uint256 scalar\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            switch x\n            case 0 {\n                switch n\n                case 0 {\n                    // 0 ** 0 = 1\n                    z := scalar\n                }\n                default {\n                    // 0 ** n = 0\n                    z := 0\n                }\n            }\n            default {\n                switch mod(n, 2)\n                case 0 {\n                    // If n is even, store scalar in z for now.\n                    z := scalar\n                }\n                default {\n                    // If n is odd, store x in z for now.\n                    z := x\n                }\n\n                // Shifting right by 1 is like dividing by 2.\n                let half := shr(1, scalar)\n\n                for {\n                    // Shift n right by 1 before looping to halve it.\n                    n := shr(1, n)\n                } n {\n                    // Shift n right by 1 each iteration to halve it.\n                    n := shr(1, n)\n                } {\n                    // Revert immediately if x ** 2 would overflow.\n                    // Equivalent to iszero(eq(div(xx, x), x)) here.\n                    if shr(128, x) {\n                        revert(0, 0)\n                    }\n\n                    // Store x squared.\n                    let xx := mul(x, x)\n\n                    // Round to the nearest number.\n                    let xxRound := add(xx, half)\n\n                    // Revert if xx + half overflowed.\n                    if lt(xxRound, xx) {\n                        revert(0, 0)\n                    }\n\n                    // Set x to scaled xxRound.\n                    x := div(xxRound, scalar)\n\n                    // If n is even:\n                    if mod(n, 2) {\n                        // Compute z * x.\n                        let zx := mul(z, x)\n\n                        // If z * x overflowed:\n                        if iszero(eq(div(zx, x), z)) {\n                            // Revert if x is non-zero.\n                            if iszero(iszero(x)) {\n                                revert(0, 0)\n                            }\n                        }\n\n                        // Round to the nearest number.\n                        let zxRound := add(zx, half)\n\n                        // Revert if zx + half overflowed.\n                        if lt(zxRound, zx) {\n                            revert(0, 0)\n                        }\n\n                        // Return properly scaled zxRound.\n                        z := div(zxRound, scalar)\n                    }\n                }\n            }\n        }\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        GENERAL NUMBER UTILITIES\n    //////////////////////////////////////////////////////////////*/\n\n    function sqrt(uint256 x) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let y := x // We start y at x, which will help us make our initial estimate.\n\n            z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n            // We check y >= 2^(k + 8) but shift right by k bits\n            // each branch to ensure that if x >= 256, then y >= 256.\n            if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n                y := shr(128, y)\n                z := shl(64, z)\n            }\n            if iszero(lt(y, 0x1000000000000000000)) {\n                y := shr(64, y)\n                z := shl(32, z)\n            }\n            if iszero(lt(y, 0x10000000000)) {\n                y := shr(32, y)\n                z := shl(16, z)\n            }\n            if iszero(lt(y, 0x1000000)) {\n                y := shr(16, y)\n                z := shl(8, z)\n            }\n\n            // Goal was to get z*z*y within a small factor of x. More iterations could\n            // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n            // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n            // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n            // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n            // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n            // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n            // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n            // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n            // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n            // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n            // There is no overflow risk here since y < 2^136 after the first branch above.\n            z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n\n            // If x+1 is a perfect square, the Babylonian method cycles between\n            // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n            // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n            // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n            z := sub(z, lt(div(x, z), z))\n        }\n    }\n\n    function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Mod x by y. Note this will return\n            // 0 instead of reverting if y is zero.\n            z := mod(x, y)\n        }\n    }\n\n    function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Divide x by y. Note this will return\n            // 0 instead of reverting if y is zero.\n            r := div(x, y)\n        }\n    }\n\n    function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Add 1 to x * y if x % y > 0. Note this will\n            // return 0 instead of reverting if y is zero.\n            z := add(gt(mod(x, y), 0), div(x, y))\n        }\n    }\n}\n"},"@openzeppelin/contracts/utils/Address.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert FailedInnerCall();\n        }\n    }\n}\n"},"@openzeppelin/contracts/utils/Context.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.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"},"@openzeppelin/contracts/access/Ownable.sol":{"content":"// 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"},"@openzeppelin/contracts/utils/Pausable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n    bool private _paused;\n\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    /**\n     * @dev The operation failed because the contract is paused.\n     */\n    error EnforcedPause();\n\n    /**\n     * @dev The operation failed because the contract is not paused.\n     */\n    error ExpectedPause();\n\n    /**\n     * @dev Initializes the contract in unpaused state.\n     */\n    constructor() {\n        _paused = false;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        _requireNotPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        _requirePaused();\n        _;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Throws if the contract is paused.\n     */\n    function _requireNotPaused() internal view virtual {\n        if (paused()) {\n            revert EnforcedPause();\n        }\n    }\n\n    /**\n     * @dev Throws if the contract is not paused.\n     */\n    function _requirePaused() internal view virtual {\n        if (!paused()) {\n            revert ExpectedPause();\n        }\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n}\n"},"contracts/interfaces/IWithdrawQueueBase.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IWithdrawQueueBase {\n    struct WithdrawalRequestStatus {\n        uint256 amountOfAssets;\n        uint256 amountOfShares;\n        address owner;\n        uint256 timestamp;\n        bool isFinalized;\n        bool isClaimed;\n    }\n\n    struct BatchesCalculationState {\n        uint256 remainingAssetsBudget;\n        bool finished;\n        uint256[36] batches;\n        uint256 batchesLength;\n    }\n\n    function getLastRequestId() external view returns (uint256);\n\n    function getLastFinalizedRequestId() external view returns (uint256);\n\n    function getLockedAssetsAmount() external view returns (uint256);\n\n    function getLastCheckpointIndex() external view returns (uint256);\n\n    function unfinalizedRequestNumber() external view returns (uint256);\n\n    function unfinalizedAssets() external view returns (uint256);\n\n    function calculateFinalizationBatches(\n        uint256 _maxShareRate,\n        uint256 _maxTimestamp,\n        uint256 _maxRequestsPerCall,\n        BatchesCalculationState memory _state\n    ) external view returns (BatchesCalculationState memory);\n\n    function prefinalize(uint256[] calldata _batches, uint256 _maxShareRate)\n        external\n        view\n        returns (uint256 assetsToLock, uint256 sharesToBurn);\n}"},"contracts/interfaces/IWithdrawQueueERC721.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IWithdrawQueue } from \"./IWithdrawQueue.sol\";\n\ninterface IWithdrawQueueERC721 is IWithdrawQueue {\n    function finalize(\n        uint256 _lastRequestIdToBeFinalized,\n        uint256 _maxShareRate,\n        uint256 _amount\n    ) external;\n}"},"@openzeppelin/contracts/token/ERC20/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"},"contracts/interfaces/IOracleReportSanityChecker.sol":{"content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IOracleReportSanityChecker {\n    function checkAccountingOracleReport(\n        uint256 _timeElapsed,\n        uint256 _withdrawalVaultBalance,\n        uint256 _sharesRequestedToBurn\n    ) external view;\n\n    function smoothenTokenRebase(\n        uint256 _preTotalPooledAssets,\n        uint256 _preTotalShares,\n        uint256 _withdrawalVaultBalance,\n        uint256 _sharesRequestedToBurn,\n        uint256 _assetsToLockForWithdrawals,\n        uint256 _newSharesToBurnForWithdrawals\n    ) external view returns (\n        uint256 withdrawals,\n        uint256 simulatedSharesToBurn,\n        uint256 sharesToBurn\n    );\n\n    function checkWithdrawalQueueOracleReport(\n        uint256 _lastFinalizableRequestId,\n        uint256 _reportTimestamp\n    ) external view;\n\n    function checkSimulatedShareRate(\n        uint256 _postTotalPooledAssets,\n        uint256 _postTotalShares,\n        uint256 _assetsLockedOnWithdrawalQueue,\n        uint256 _sharesBurntDueToWithdrawals,\n        uint256 _simulatedShareRate\n    ) external view;\n}"},"@openzeppelin/contracts/proxy/utils/Initializable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Storage of the initializable contract.\n     *\n     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n     * when using with upgradeable contracts.\n     *\n     * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n     */\n    struct InitializableStorage {\n        /**\n         * @dev Indicates that the contract has been initialized.\n         */\n        uint64 _initialized;\n        /**\n         * @dev Indicates that the contract is in the process of being initialized.\n         */\n        bool _initializing;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n    /**\n     * @dev The contract is already initialized.\n     */\n    error InvalidInitialization();\n\n    /**\n     * @dev The contract is not initializing.\n     */\n    error NotInitializing();\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint64 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n     * production.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        // Cache values to avoid duplicated sloads\n        bool isTopLevelCall = !$._initializing;\n        uint64 initialized = $._initialized;\n\n        // Allowed calls:\n        // - initialSetup: the contract is not in the initializing state and no previous version was\n        //                 initialized\n        // - construction: the contract is initialized at version 1 (no reininitialization) and the\n        //                 current contract is just being deployed\n        bool initialSetup = initialized == 0 && isTopLevelCall;\n        bool construction = initialized == 1 && address(this).code.length == 0;\n\n        if (!initialSetup && !construction) {\n            revert InvalidInitialization();\n        }\n        $._initialized = 1;\n        if (isTopLevelCall) {\n            $._initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            $._initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint64 version) {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing || $._initialized >= version) {\n            revert InvalidInitialization();\n        }\n        $._initialized = version;\n        $._initializing = true;\n        _;\n        $._initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        _checkInitializing();\n        _;\n    }\n\n    /**\n     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n     */\n    function _checkInitializing() internal view virtual {\n        if (!_isInitializing()) {\n            revert NotInitializing();\n        }\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing) {\n            revert InvalidInitialization();\n        }\n        if ($._initialized != type(uint64).max) {\n            $._initialized = type(uint64).max;\n            emit Initialized(type(uint64).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint64) {\n        return _getInitializableStorage()._initialized;\n    }\n\n    /**\n     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _getInitializableStorage()._initializing;\n    }\n\n    /**\n     * @dev Returns a pointer to the storage namespace.\n     */\n    // solhint-disable-next-line var-name-mixedcase\n    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n        assembly {\n            $.slot := INITIALIZABLE_STORAGE\n        }\n    }\n}\n"},"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"},"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"}},"matchId":"1355363","creationMatch":"exact_match","runtimeMatch":"exact_match","verifiedAt":"2024-08-08T12:59:30Z","match":"exact_match","chainId":"8453","address":"0xCa72827a3D211CfD8F6b00Ac98824872b72CAb49"}