creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/Aggregator.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.24;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {ERC1967Utils} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {Ownable2StepUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport {EGETH} from \"src/EGETH.sol\";\nimport {IAggregator, IAssetInfo, IAssets, IConfigAggregator} from \"src/interfaces/IAggregator.sol\";\nimport {LRTProtocolsManager} from \"src/LRTProtocolsManager.sol\";\nimport {IKelpLRTDepositPool} from \"src/interfaces/kelp/IKelpLRTDepositPool.sol\";\nimport {IRSETH} from \"src/interfaces/kelp/IRSETH.sol\";\n\n/**\n * @title Builda ETH Restaking Aggregator\n *\n * Builda Aggregator is a restaking ETH aggregator that allows users to deposit ETH and LRT tokens to receive egETH in return.\n * The aggregator restake ETH into different Liquid Restaking protocols.\n * EgETH is a rebasing token that represents the user's share of the total value locked in the aggregator.\n * The token's main utility is to participate in crowdfundings on Builda.\n */\ncontract Aggregator is\n    Initializable,\n    UUPSUpgradeable,\n    ReentrancyGuardUpgradeable,\n    Ownable2StepUpgradeable,\n    IAggregator\n{\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  EVENTS  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    event Deposit(address indexed account, uint256 amount, address indexed token);\n    event Withdraw(address indexed account, uint256 amount, address indexed token);\n    event TargetWeightsUpdated(uint256 etherFiWeight, uint256 renzoWeight, uint256 kelpWeight);\n    event Paused(address indexed account);\n    event UnPaused(address indexed account);\n    event EthTokenAddressUpdated(address ethAddress);\n    event CurrentPooledEtherUpdated(uint256 totalPooledEther);\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  ERRORS  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    error Aggregator__NoDirectETHTransfer();\n    error Aggregator__TokenNotAllowed();\n    error Aggregator__AmountMustBeGreaterThanZero();\n    error Aggregator__AmountExceedsMaxWithdrawal();\n    error Aggregator__InsufficientAllowance();\n    error Aggregator__InsufficientAmount();\n    error Aggregator__InsufficientSharesAmount();\n    error Aggregator__InvalidAmount();\n    error Aggregator__MinimumDepositAmount();\n    error Aggregator__InvalidAmountToMint();\n    error Aggregator__BelowMinETHDeposit();\n    error Aggregator__InvalidTotalWeight();\n    error Aggregator__InvalidAddress();\n    error Aggregator__ContractPaused();\n    error Aggregator__OnlyAdmin();\n\n    //--------------------------------------------------------------------------------------\n    //---------------------------------  STATE-VARIABLES  ----------------------------------\n    //--------------------------------------------------------------------------------------\n\n    // native ETH as ERC20 for KelpDAO deposit\n    address public ETH_TOKEN;\n\n    // used to scale the weight of the LRT tokens & adjustement for calculations\n    uint256 private constant SCALE_FACTOR = 1e18;\n    uint256 private constant TOTAL_WEIGHT_BASIS = 1e3; // weight total\n\n    /// @dev flag to control whether deposits/withdrawal are paused\n    bool public paused;\n\n    mapping(address => bool) public admins;\n\n    EGETH public egETH;\n    LRTProtocolsManager public lrtManager;\n    address public bldTreasury;\n\n    // LRT tokens currently allowed in the aggregator\n    mapping(address token => bool isAllowed) public allowedTokens;\n\n    /// @dev LRT tokens\n    IAssetInfo public etherFiEETH;\n    IAssetInfo public renzoEzETH;\n    IAssetInfo public kelpRsETH;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    //--------------------------------------------------------------------------------------\n    //------------------------------------  MODIFIERS  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /// @dev Only allows execution if token is allowed\n    modifier isAllowed(address _token) {\n        if (!allowedTokens[_token]) {\n            revert Aggregator__TokenNotAllowed();\n        }\n        _;\n    }\n\n    /// @dev Only allows execution if contract is not paused\n    modifier notPaused() {\n        if (paused) revert Aggregator__ContractPaused();\n        _;\n    }\n\n    /// @dev Only allows execution if caller is an admin\n    modifier onlyAdmin() {\n        if (!admins[msg.sender]) revert Aggregator__OnlyAdmin();\n        _;\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  EXTERNAL  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /// @dev prohibit direct transfer to contract\n    receive() external payable {\n        revert Aggregator__NoDirectETHTransfer();\n    }\n\n    /// @dev prohibit direct transfer to contract\n    fallback() external payable {\n        revert Aggregator__NoDirectETHTransfer();\n    }\n\n    /**\n     * @dev proxy initialization\n     *\n     * @param _configAggregator containing admin, treasury and egETH addresses\n     * @param _lrtManager LRT protocols manager address\n     * @param _assets containing etherFiEETH, renzoEzETH and kelpRsETH with their corresponding weights\n     */\n    function initialize(IConfigAggregator memory _configAggregator, address _lrtManager, IAssets memory _assets)\n        external\n        payable\n        initializer\n    {\n        uint256 initialAmount = msg.value;\n        if (initialAmount == 0) {\n            revert Aggregator__AmountMustBeGreaterThanZero();\n        }\n        __Ownable_init(msg.sender);\n        __ReentrancyGuard_init();\n        __UUPSUpgradeable_init();\n        bldTreasury = _configAggregator.treasury;\n        egETH = EGETH(_configAggregator.egETH);\n        lrtManager = LRTProtocolsManager(_lrtManager);\n        etherFiEETH = _assets.etherFieEth;\n        renzoEzETH = _assets.renzoEzEth;\n        kelpRsETH = _assets.kelpRsETH;\n        allowedTokens[address(_assets.etherFieEth.asset)] = true;\n        allowedTokens[address(_assets.renzoEzEth.asset)] = true;\n        allowedTokens[address(_assets.kelpRsETH.asset)] = true;\n        admins[_configAggregator.admin] = true;\n\n        // set the ETH token address\n        ETH_TOKEN = _configAggregator.ethTokenAddress;\n\n        // deposit ETH to LRT protocols\n        _depositOnLRTProtocols(initialAmount);\n\n        _mintInitialShares();\n    }\n\n    /**\n     * @notice Deposits ETH to the aggregator and mints egETH, min: 0.01 ETH\n     * ETH will be distributed to the different LRT protocols based on their target weights\n     * LRT protocols will mint their respective LRT tokens and deposit them to the aggregator\n     *\n     * Requirements:\n     *\n     * - `msg.value` cannot be zero.\n     * - `msg.value` must be equal or higher than the minimum deposit amount of ETH.\n     */\n    function depositETH() external payable nonReentrant notPaused {\n        uint256 amount = msg.value;\n\n        if (amount < minDepositETH()) {\n            revert Aggregator__BelowMinETHDeposit();\n        }\n\n        // deposit ETH to LRT protocols relative to their target weight to mint their respective LRT tokens\n        _depositOnLRTProtocols(amount);\n\n        // mint egETH to the user\n        egETH.mint(msg.sender, amount);\n    }\n\n    /**\n     * @notice Deposits LRT to the aggregator and mints egETH\n     *\n     * @param asset LRT token address\n     * @param amount LRT amount\n     * @param minEgETHAmount Minimum egETH amount to mint\n     *\n     * Requirements:\n     *\n     * - `amount` cannot be zero.\n     * - `asset` must be an allowed asset.\n     * - `asset` allowance must be equal or higher than amount.\n     * - Amount minted should be equal or higher than `minEgETHAmount`\n     */\n    function depositLRT(address asset, uint256 amount, uint256 minEgETHAmount)\n        external\n        nonReentrant\n        isAllowed(asset)\n        notPaused\n    {\n        if (amount == 0) {\n            revert Aggregator__AmountMustBeGreaterThanZero();\n        }\n\n        if (IERC20(asset).allowance(msg.sender, address(this)) < amount) {\n            revert Aggregator__InsufficientAllowance();\n        }\n\n        // update the price of rsETH\n        lrtManager.updateRsETHPrice();\n\n        uint256 previewEgETHAmount = _previewDepositLRT(asset, amount);\n\n        uint256 rounding = 1e2;\n\n        if ((previewEgETHAmount + rounding) < minEgETHAmount) {\n            revert Aggregator__InvalidAmountToMint();\n        }\n\n        IERC20 _asset = IERC20(asset);\n\n        // slither-disable-next-line reentrancy-no-eth\n        SafeERC20.safeTransferFrom(_asset, msg.sender, address(this), amount);\n\n        uint256 ethDeposited = convertLRTSharesToEth(asset, amount);\n        emit Deposit(msg.sender, ethDeposited, asset);\n\n        // update the total pooled ETH\n        egETH.mint(msg.sender, previewEgETHAmount);\n    }\n\n    /**\n     * @notice Withdraws LRT from the aggregator and burns egETH\n     *\n     * @param assetToWithdraw LRT token address\n     * @param egShares egETH amount to burn\n     *\n     * Requirements:\n     *\n     * - `egShares` cannot be zero.\n     * - `assetToWithdraw` must be an allowed asset.\n     * - Balance of egETH must be equal or higher than `egShares`.\n     * - egETH allowance must be equal or higher than amount of `egShares`.\n     * - `egShares` must be equal or lower than the maximum amount of egETH that can be used to withdraw the given LRT token.\n     */\n    function withdrawLRT(address assetToWithdraw, uint256 egShares)\n        external\n        payable\n        nonReentrant\n        isAllowed(assetToWithdraw)\n    {\n        if (egShares == 0) {\n            revert Aggregator__AmountMustBeGreaterThanZero();\n        }\n        // check if the user has enough egETH to withdraw\n        if (balanceOf(msg.sender) < egShares) {\n            revert Aggregator__InsufficientAmount();\n        }\n\n        // update the price of rsETH\n        lrtManager.updateRsETHPrice();\n\n        // check if the amount of egETH to withdraw is within the limit\n        if (egShares > maxLRTWithdrawInEgETH(assetToWithdraw)) {\n            revert Aggregator__AmountExceedsMaxWithdrawal();\n        }\n        // check if the user has enough allowance to withdraw\n        if (egETH.allowance(msg.sender, address(this)) < egShares) {\n            revert Aggregator__InsufficientAllowance();\n        }\n\n        IERC20 _asset = IERC20(assetToWithdraw);\n\n        uint256 assetShares = convertEgETHToLRTShares(assetToWithdraw, egShares);\n\n        egETH.burn(msg.sender, egShares);\n\n        SafeERC20.safeTransfer(_asset, msg.sender, assetShares);\n        emit Withdraw(msg.sender, egShares, assetToWithdraw);\n    }\n\n    /**\n     * @notice Sets the target weights for the LRT tokens\n     *\n     * DAO will be able to adjust the target weights to rebalance the LRT tokens in the aggregator\n     *\n     * @param etherFiWeight EtherFi target weight\n     * @param renzoWeight Renzo target weight\n     * @param kelpWeight Kelp target weight\n     *\n     * Requirements:\n     *\n     * - `etherFiWeight`, `renzoWeight`, `kelpWeight` addition must be equal to 100%.\n     */\n    function setTargetWeights(uint256 etherFiWeight, uint256 renzoWeight, uint256 kelpWeight) external onlyAdmin {\n        // check if the total weight is equal to 100%\n        if (etherFiWeight + renzoWeight + kelpWeight != TOTAL_WEIGHT_BASIS) {\n            revert Aggregator__InvalidTotalWeight();\n        }\n        etherFiEETH.targetWeight = etherFiWeight;\n        renzoEzETH.targetWeight = renzoWeight;\n        kelpRsETH.targetWeight = kelpWeight;\n        emit TargetWeightsUpdated(etherFiWeight, renzoWeight, kelpWeight);\n    }\n\n    /**\n     * @notice Sets the paused flag\n     *\n     * @param _paused Paused boolean flag\n     */\n    function setPaused(bool _paused) external onlyAdmin {\n        paused = _paused;\n        if (_paused) {\n            emit Paused(msg.sender);\n        } else {\n            emit UnPaused(msg.sender);\n        }\n    }\n\n    /**\n     * @notice Change the EthTokenAddress for KelpDAO\n     * @param ethAddress the ETH token address\n     */\n    function setEthTokenAddress(address ethAddress) external onlyOwner {\n        if (ethAddress == address(0)) {\n            revert Aggregator__InvalidAddress();\n        }\n        ETH_TOKEN = ethAddress;\n        emit EthTokenAddressUpdated(ethAddress);\n    }\n\n    /**\n     * @notice Get the implementation address\n     * @return Implementation address\n     */\n    function getImplementation() external view returns (address) {\n        return ERC1967Utils.getImplementation();\n    }\n\n    /**\n     * @notice Preview the amount of egETH to mint for a given amount of ETH\n     *\n     * @param amount Amount of ETH to deposit\n     * @return Amount of egETH to mint\n     *\n     * Requirements:\n     *\n     * - `amount` must be higher than zero.\n     */\n    function previewDepositETH(uint256 amount) external view returns (uint256) {\n        return convertEthToEgETH(amount);\n    }\n\n    /**\n     * @notice Preview the amount of egETH to mint for a given amount of LRT\n     *\n     * @param asset LRT token address\n     * @param amount Amount of LRT to deposit\n     * @return Amount of egETH to mint\n     *\n     * Requirements:\n     *\n     * - `amount` must be higher than zero.\n     */\n    function previewDepositLRT(address asset, uint256 amount) external view isAllowed(asset) returns (uint256) {\n        return _previewDepositLRT(asset, amount);\n    }\n\n    /**\n     * @notice Preview the amount of LRT to withdraw for a given amount of egETH\n     *\n     * @param asset LRT token address to withdraw\n     * @param shares Amount of egETH\n     * @return Amount of LRT to withdraw\n     *\n     * Requirements:\n     *\n     * - `shares` must be higher than zero.\n     * - `shares` must be lower than the maximum amount of egETH that can be used to withdraw the given LRT token.\n     */\n    function previewWithdrawLRT(address asset, uint256 shares) external view isAllowed(asset) returns (uint256) {\n        if (shares == 0) {\n            return 0;\n        }\n        if (shares > maxLRTWithdrawInEgETH(asset)) {\n            revert Aggregator__AmountExceedsMaxWithdrawal();\n        }\n\n        uint256 assetShares = convertEgETHToLRTShares(asset, shares);\n\n        return assetShares;\n    }\n\n    /**\n     * @notice Get the total amount of egETH minted\n     * @return Total ETH\n     */\n    function totalPooledEther() external view returns (uint256) {\n        return _totalPooledEther();\n    }\n\n    /**\n     * @notice Get the current target weights\n     * @return EtherFi target weight\n     * @return Renzo target weight\n     * @return Kelp target weight\n     */\n    function targetWeights() external view returns (uint256, uint256, uint256) {\n        return (etherFiEETH.targetWeight, renzoEzETH.targetWeight, kelpRsETH.targetWeight);\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  PUBLIC  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @notice Get the minimum deposit amount of ETH\n     * @return Minimum deposit amount\n     */\n    function minDepositETH() public pure returns (uint256) {\n        return 1e16;\n    }\n\n    /**\n     * @notice Get the maximum amount of egETH that can be used to withdraw a given LRT token\n     *\n     * @param _asset LRT token address\n     * @return Maximum amount of egETH that can be used to withdraw\n     *\n     */\n    function maxLRTWithdrawInEgETH(address _asset) public view returns (uint256) {\n        (uint256 eETHBalance, uint256 ezETHBalance, uint256 rsETHBalance) = totalAssets();\n        if (_asset == address(etherFiEETH.asset)) {\n            return convertLRTSharesToEgETH(_asset, eETHBalance);\n        } else if (_asset == address(renzoEzETH.asset)) {\n            return convertLRTSharesToEgETH(_asset, ezETHBalance);\n        }\n        return convertLRTSharesToEgETH(_asset, rsETHBalance);\n    }\n\n    /**\n     * @notice Get the current egETH balance of an account\n     *\n     * @param _account Account address\n     * @return egETH balance\n     */\n    function balanceOf(address _account) public view returns (uint256) {\n        return egETH.balanceOf(_account);\n    }\n\n    /**\n     * @notice Get the total amount of LRT tokens held by the aggregator\n     *\n     * @return EtherFi balance\n     * @return Renzo balance\n     * @return Kelp balance\n     */\n    function totalAssets() public view returns (uint256, uint256, uint256) {\n        return (\n            etherFiEETH.asset.balanceOf(address(this)),\n            renzoEzETH.asset.balanceOf(address(this)),\n            kelpRsETH.asset.balanceOf(address(this))\n        );\n    }\n\n    /**\n     * @notice Get the total amount of Ether backed by each LRT tokens held by the aggregator\n     *\n     * @return EtherFi balance\n     * @return Renzo balance\n     * @return Kelp balance\n     */\n    function totalCurrentTVLs() public view returns (uint256, uint256, uint256) {\n        (uint256 etherFiShares, uint256 renzoShares, uint256 kelpShares) = totalAssets();\n        return lrtManager.totalProtocolsEther(etherFiShares, kelpShares, renzoShares, renzoEzETH.asset.totalSupply());\n    }\n\n    /**\n     * @notice ETH to egETH converter\n     *\n     * @param _amount ETH amount\n     * @return egETH amount\n     *\n     * Requirements:\n     *\n     * - `_amount` must be higher than zero.\n     */\n    function convertEthToEgETH(uint256 _amount) public view returns (uint256) {\n        if (_amount == 0) {\n            return 0;\n        }\n        return _convertEthToEgETH(_amount);\n    }\n\n    /**\n     * @notice ETH to LRT shares converter\n     *\n     * @param asset LRT token address\n     * @param ethAmount ETH amount\n     * @return LRT shares\n     *\n     * Requirements:\n     *\n     * - `ethAmount` must be higher than zero.\n     * - `asset` must be an allowed asset.\n     */\n    function convertEthToLRTShares(address asset, uint256 ethAmount) public view isAllowed(asset) returns (uint256) {\n        if (ethAmount == 0) {\n            return 0;\n        }\n\n        if (asset == address(etherFiEETH.asset)) {\n            return lrtManager.etherFiEthAndAmount(ethAmount);\n        } else if (asset == address(renzoEzETH.asset)) {\n            return lrtManager.ethToRenzoEth(ethAmount, renzoEzETH.asset.totalSupply());\n        }\n        return lrtManager.ethToKelpEth(ethAmount);\n    }\n\n    /**\n     * @notice LRT shares to ETH converter\n     *\n     * @param asset LRT token address\n     * @param shares LRT shares\n     * @return ETH amount\n     *\n     * Requirements:\n     *\n     * - `shares` must be higher than zero.\n     * - `asset` must be an allowed asset.\n     */\n    function convertLRTSharesToEth(address asset, uint256 shares) public view isAllowed(asset) returns (uint256) {\n        if (shares == 0) {\n            return 0;\n        }\n\n        if (asset == address(etherFiEETH.asset)) {\n            return lrtManager.etherFiEthAndAmount(shares);\n        } else if (asset == address(renzoEzETH.asset)) {\n            return lrtManager.renzoEthAmount(shares, renzoEzETH.asset.totalSupply());\n        }\n        return lrtManager.kelpEthAmount(shares);\n    }\n\n    /**\n     * @notice LRT shares to egETH converter\n     *\n     * @param asset LRT token address\n     * @param shares LRT shares\n     * @return egETH amount\n     *\n     * Requirements:\n     *\n     * - `shares` must be higher than zero.\n     * - `asset` must be an allowed asset.\n     */\n    function convertLRTSharesToEgETH(address asset, uint256 shares) public view isAllowed(asset) returns (uint256) {\n        if (shares == 0) {\n            return 0;\n        }\n        uint256 amount = convertLRTSharesToEth(asset, shares);\n        return amount;\n        // return convertEthToEgETH(ethAmount);\n    }\n\n    /**\n     * @notice egETH to LRT shares converter\n     *\n     * @param asset LRT token address\n     * @param egShares egETH amount\n     * @return LRT shares\n     *\n     * Requirements:\n     *\n     * - `egShares` must be higher than zero.\n     * - `asset` must be an allowed asset.\n     */\n    function convertEgETHToLRTShares(address asset, uint256 egShares) public view isAllowed(asset) returns (uint256) {\n        return convertEthToLRTShares(asset, egShares);\n    }\n\n    /**\n     * @notice Get the current weights of the LRT tokens in the aggregator\n     *\n     * @return Current EtherFi weight\n     * @return Current Renzo weight\n     * @return Current Kelp weight\n     */\n    function currentWeights() public view returns (uint256, uint256, uint256) {\n        (uint256 _etherFiShares, uint256 _renzoShares, uint256 _kelpShares) = totalAssets();\n        uint256 totalEth = _totalPooledEther();\n\n        // get individual weight for each LRT from shares\n        (uint256 etherFiWeight, uint256 renzoWeight, uint256 kelpWeight) =\n            _weightsFromShares(_etherFiShares, _renzoShares, _kelpShares, totalEth);\n\n        return (etherFiWeight, renzoWeight, kelpWeight);\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  INTERNAL  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    // @dev Allows only the owner to upgrade the contract\n    function _authorizeUpgrade(address _newImplementation) internal override onlyOwner {}\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  PRIVATE  --------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @notice Mint initial egETH shares to the deployer of the contract\n     * this is to avoid the initial minting of egETH to be gamed\n     */\n    function _mintInitialShares() private {\n        uint256 sharesAmount = _totalPooledEther();\n        egETH.mintInitialShares(msg.sender, sharesAmount);\n    }\n\n    /**\n     * @notice Deposit ETH to the LRT protocols\n     * The ETH amount is distributed to the LRT protocols based on their target weights\n     *\n     * @param _amount ETH amount\n     */\n    function _depositOnLRTProtocols(uint256 _amount) private {\n        bool isPausedEtherFi = lrtManager.etherFiDeposit().paused();\n        bool isPausedRenzo = lrtManager.renzoDeposit().paused();\n        bool isPausedKelp = lrtManager.kelpDeposit().paused();\n\n        if (isPausedEtherFi || isPausedRenzo || isPausedKelp) {\n            revert Aggregator__ContractPaused();\n        }\n\n        uint256 etherFiAmount = _amount * etherFiEETH.targetWeight / TOTAL_WEIGHT_BASIS;\n        uint256 renzoAmount = _amount * renzoEzETH.targetWeight / TOTAL_WEIGHT_BASIS;\n        uint256 kelpAmount = _amount * kelpRsETH.targetWeight / TOTAL_WEIGHT_BASIS;\n        lrtManager.etherFiDeposit().deposit{value: etherFiAmount}();\n        lrtManager.renzoDeposit().depositETH{value: renzoAmount}();\n        IKelpLRTDepositPool lrtKelpDeposit = lrtManager.kelpDeposit();\n        uint256 minReceiveFromDeposit = lrtKelpDeposit.getRsETHAmountToMint(address(ETH_TOKEN), kelpAmount);\n        lrtKelpDeposit.depositETH{value: kelpAmount}(minReceiveFromDeposit, \"0\");\n        emit Deposit(msg.sender, _amount, address(0));\n    }\n\n    /**\n     * @notice Get the total amount of ETH in the LRT protocols backed by LRT tokens in the aggregator\n     * @return Total ETH\n     */\n    function _totalProtocolsEther() private view returns (uint256) {\n        (uint256 etherFiShares, uint256 renzoShares, uint256 kelpShares) = totalAssets();\n        return lrtManager.totalEthAmount(etherFiShares, kelpShares, renzoShares, renzoEzETH.asset.totalSupply());\n    }\n\n    /**\n     * @notice Get the total amount of ETH in the LRT protocols backed by LRT tokens in the aggregator and ETH in the aggregator\n     * @return Total ETH\n     */\n    function _totalPooledEther() private view returns (uint256) {\n        return _totalProtocolsEther() + address(this).balance;\n    }\n\n    /**\n     * @notice Preview the amount of egETH to mint for a given amount of LRT\n     *\n     * @param asset LRT token address\n     * @param amount LRT amount\n     * @return egETH amount\n     */\n    function _previewDepositLRT(address asset, uint256 amount) private view returns (uint256) {\n        uint256 userAmountValue = convertLRTSharesToEth(asset, amount);\n        return _convertEthToEgETH(userAmountValue);\n    }\n\n    /**\n     * @notice Convert ETH to egETH\n     * @param newETHAmount ETH amount to convert\n     * @return egETH amount\n     */\n    function _convertEthToEgETH(uint256 newETHAmount) private view returns (uint256) {\n        uint256 shares = egETH.getSharesByPooledEth(newETHAmount);\n        uint256 ethAmount = egETH.getPooledEthByShares(shares);\n        return ethAmount;\n    }\n\n    /**\n     * @notice Preview the weights after a withdrawal\n     *\n     * @param asset LRT token address\n     * @param amount amount of egETH\n     * @return EtherFi after withdrawal weight\n     * @return Renzo after withdrawal weight\n     * @return Kelp after withdrawal weight\n     */\n    function _previewWeightsAfterWithdraw(address asset, uint256 amount)\n        private\n        view\n        returns (uint256, uint256, uint256)\n    {\n        (uint256 _etherFiShares, uint256 _renzoShares, uint256 _kelpShares) = totalAssets();\n        uint256 totalEth = _totalPooledEther();\n\n        uint256 assetShares = convertEthToLRTShares(asset, amount);\n        // uint256 assetShares = convertEgETHToLRTShares(asset, amount);\n\n        if (asset == address(etherFiEETH.asset)) {\n            _etherFiShares -= assetShares;\n        } else if (asset == address(renzoEzETH.asset)) {\n            _renzoShares -= assetShares;\n        } else if (asset == address(kelpRsETH.asset)) {\n            _kelpShares -= assetShares;\n        }\n        (uint256 etherFiWeight, uint256 renzoWeight, uint256 kelpWeight) =\n            _weightsFromShares(_etherFiShares, _renzoShares, _kelpShares, (totalEth - amount));\n\n        return (etherFiWeight, renzoWeight, kelpWeight);\n    }\n\n    /**\n     * @notice Calculate the weights from the LRT shares and a ETH value\n     *\n     * @param etherFiShares EtherFi shares\n     * @param renzoShares Renzo shares\n     * @param kelpShares Kelp shares\n     * @param totalEth Total ETH\n     * @return EtherFi weight\n     * @return Renzo weight\n     * @return Kelp weight\n     */\n    function _weightsFromShares(uint256 etherFiShares, uint256 renzoShares, uint256 kelpShares, uint256 totalEth)\n        private\n        view\n        returns (uint256, uint256, uint256)\n    {\n        // get individual eth value for each LRT\n        uint256 eETHValue = lrtManager.etherFiEthAndAmount(etherFiShares);\n        uint256 renzoValue = lrtManager.renzoEthAmount(renzoShares, renzoEzETH.asset.totalSupply());\n        uint256 kelpValue = lrtManager.kelpEthAmount(kelpShares);\n\n        // calculate weights based on a ETH value\n        // uint256 etherFiWeight = eETHValue * TOTAL_WEIGHT_BASIS / totalEth;\n        // uint256 renzoWeight = renzoValue * TOTAL_WEIGHT_BASIS / totalEth;\n        // uint256 kelpWeight = kelpValue * TOTAL_WEIGHT_BASIS / totalEth;\n\n        uint256 etherFiWeightRounded = roundedDiv(eETHValue * TOTAL_WEIGHT_BASIS, totalEth);\n        uint256 renzoWeightRounded = roundedDiv(renzoValue * TOTAL_WEIGHT_BASIS, totalEth);\n        uint256 kelpWeightRounded = roundedDiv(kelpValue * TOTAL_WEIGHT_BASIS, totalEth);\n\n        return (etherFiWeightRounded, renzoWeightRounded, kelpWeightRounded);\n    }\n\n    /**\n     * @dev Division, round to nearest integer (AKA round-half-up)\n     * @param a What to divide\n     * @param b Divide by this number\n     */\n    function roundedDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Solidity automatically throws, but please emit reason\n        require(b > 0, \"div by 0\");\n\n        uint256 halfB = (b % 2 == 0) ? (b / 2) : (b / 2 + 1);\n        return (a % b >= halfB) ? (a / b + 1) : (a / b);\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\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     * Skips emitting an {Approval} event indicating an allowance update. This is not\n     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\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     * ```solidity\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/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 ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/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 {IERC1363} from \"../../../interfaces/IERC1363.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 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 ERC-20 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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\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    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard\n    struct ReentrancyGuardStorage {\n        uint256 _status;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {\n        assembly {\n            $.slot := ReentrancyGuardStorageLocation\n        }\n    }\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    function __ReentrancyGuard_init() internal onlyInitializing {\n        __ReentrancyGuard_init_unchained();\n    }\n\n    function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        $._status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if ($._status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        $._status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        $._status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();\n        return $._status == ENTERED;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/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"
      },
      "lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.\n */\nlibrary ERC1967Utils {\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1.\n     */\n    // solhint-disable-next-line private-vars-leading-underscore\n    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev The `implementation` of the proxy is invalid.\n     */\n    error ERC1967InvalidImplementation(address implementation);\n\n    /**\n     * @dev The `admin` of the proxy is invalid.\n     */\n    error ERC1967InvalidAdmin(address admin);\n\n    /**\n     * @dev The `beacon` of the proxy is invalid.\n     */\n    error ERC1967InvalidBeacon(address beacon);\n\n    /**\n     * @dev An upgrade function sees `msg.value > 0` that may be lost.\n     */\n    error ERC1967NonPayable();\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function getImplementation() internal view returns (address) {\n        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the ERC-1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        if (newImplementation.code.length == 0) {\n            revert ERC1967InvalidImplementation(newImplementation);\n        }\n        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n     * to avoid stuck value in the contract.\n     *\n     * Emits an {IERC1967-Upgraded} event.\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n        _setImplementation(newImplementation);\n        emit IERC1967.Upgraded(newImplementation);\n\n        if (data.length > 0) {\n            Address.functionDelegateCall(newImplementation, data);\n        } else {\n            _checkNonPayable();\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1.\n     */\n    // solhint-disable-next-line private-vars-leading-underscore\n    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Returns the current admin.\n     *\n     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\n     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n     */\n    function getAdmin() internal view returns (address) {\n        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the ERC-1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        if (newAdmin == address(0)) {\n            revert ERC1967InvalidAdmin(address(0));\n        }\n        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {IERC1967-AdminChanged} event.\n     */\n    function changeAdmin(address newAdmin) internal {\n        emit IERC1967.AdminChanged(getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n     */\n    // solhint-disable-next-line private-vars-leading-underscore\n    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function getBeacon() internal view returns (address) {\n        return StorageSlot.getAddressSlot(BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the ERC-1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        if (newBeacon.code.length == 0) {\n            revert ERC1967InvalidBeacon(newBeacon);\n        }\n\n        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n        address beaconImplementation = IBeacon(newBeacon).implementation();\n        if (beaconImplementation.code.length == 0) {\n            revert ERC1967InvalidImplementation(beaconImplementation);\n        }\n    }\n\n    /**\n     * @dev Change the beacon and trigger a setup call if data is nonempty.\n     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n     * to avoid stuck value in the contract.\n     *\n     * Emits an {IERC1967-BeaconUpgraded} event.\n     *\n     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n     * efficiency.\n     */\n    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n        _setBeacon(newBeacon);\n        emit IERC1967.BeaconUpgraded(newBeacon);\n\n        if (data.length > 0) {\n            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n        } else {\n            _checkNonPayable();\n        }\n    }\n\n    /**\n     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n     * if an upgrade doesn't perform an initialization call.\n     */\n    function _checkNonPayable() private {\n        if (msg.value > 0) {\n            revert ERC1967NonPayable();\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC1822Proxiable} from \"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\";\nimport {ERC1967Utils} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\";\nimport {Initializable} from \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    address private immutable __self = address(this);\n\n    /**\n     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`\n     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n     * If the getter returns `\"5.0.0\"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must\n     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n     * during an upgrade.\n     */\n    string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n    /**\n     * @dev The call is from an unauthorized context.\n     */\n    error UUPSUnauthorizedCallContext();\n\n    /**\n     * @dev The storage `slot` is unsupported as a UUID.\n     */\n    error UUPSUnsupportedProxiableUUID(bytes32 slot);\n\n    /**\n     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        _checkProxy();\n        _;\n    }\n\n    /**\n     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n     * callable on the implementing contract but not through proxies.\n     */\n    modifier notDelegated() {\n        _checkNotDelegated();\n        _;\n    }\n\n    function __UUPSUpgradeable_init() internal onlyInitializing {\n    }\n\n    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n     */\n    function proxiableUUID() external view virtual notDelegated returns (bytes32) {\n        return ERC1967Utils.IMPLEMENTATION_SLOT;\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n     * encoded in `data`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, data);\n    }\n\n    /**\n     * @dev Reverts if the execution is not performed via delegatecall or the execution\n     * context is not of a proxy with an ERC1967-compliant implementation pointing to self.\n     * See {_onlyProxy}.\n     */\n    function _checkProxy() internal view virtual {\n        if (\n            address(this) == __self || // Must be called through delegatecall\n            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy\n        ) {\n            revert UUPSUnauthorizedCallContext();\n        }\n    }\n\n    /**\n     * @dev Reverts if the execution is performed via delegatecall.\n     * See {notDelegated}.\n     */\n    function _checkNotDelegated() internal view virtual {\n        if (address(this) != __self) {\n            // Must not be called through delegatecall\n            revert UUPSUnauthorizedCallContext();\n        }\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {upgradeToAndCall}.\n     *\n     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n     *\n     * ```solidity\n     * function _authorizeUpgrade(address) internal onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n\n    /**\n     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.\n     *\n     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value\n     * is expected to be the implementation slot in ERC1967.\n     *\n     * Emits an {IERC1967-Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {\n        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {\n                revert UUPSUnsupportedProxiableUUID(slot);\n            }\n            ERC1967Utils.upgradeToAndCall(newImplementation, data);\n        } catch {\n            // The implementation is not UUPS\n            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.20;\n\nimport {OwnableUpgradeable} from \"./OwnableUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.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 Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step\n    struct Ownable2StepStorage {\n        address _pendingOwner;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable2Step\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;\n\n    function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) {\n        assembly {\n            $.slot := Ownable2StepStorageLocation\n        }\n    }\n\n    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n    function __Ownable2Step_init() internal onlyInitializing {\n    }\n\n    function __Ownable2Step_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns the address of the pending owner.\n     */\n    function pendingOwner() public view virtual returns (address) {\n        Ownable2StepStorage storage $ = _getOwnable2StepStorage();\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        Ownable2StepStorage storage $ = _getOwnable2StepStorage();\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        Ownable2StepStorage storage $ = _getOwnable2StepStorage();\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"
      },
      "src/EGETH.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {Ownable2StepUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport {ERC1967Utils} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\";\n\nimport {IEGETH} from \"src/interfaces/IEGETH.sol\";\nimport {Aggregator} from \"src/Aggregator.sol\";\n\n/**\n * @title egETH\n * @dev ERC20 rebasing token representing the Builda Aggregator LRT tokens balance\n * @notice This contract is used to manage the egETH token\n * Only the aggregator contract can call the mint and burn functions\n */\ncontract EGETH is Initializable, UUPSUpgradeable, Ownable2StepUpgradeable, IEGETH {\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  EVENTS  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @notice An executed shares transfer from `sender` to `recipient`.\n     *\n     * @dev emitted in pair with an ERC20-defined `Transfer` event.\n     */\n    event TransferShares(address indexed from, address indexed to, uint256 sharesValue);\n    event Paused(address indexed account);\n    event UnPaused(address indexed account);\n\n    /**\n     * @notice An executed `burnShares` request\n     *\n     * @dev Reports simultaneously burnt shares amount\n     * and corresponding egETH amount.\n     * The egETH amount is calculated twice: before and after the burning incurred rebase.\n     *\n     * @param account holder of the burnt shares\n     * @param preRebaseTokenAmount amount of egETH the burnt shares corresponded to before the burn\n     * @param postRebaseTokenAmount amount of egETH the burnt shares corresponded to after the burn\n     * @param sharesAmount amount of burnt shares\n     */\n    event SharesBurnt(\n        address indexed account, uint256 preRebaseTokenAmount, uint256 postRebaseTokenAmount, uint256 sharesAmount\n    );\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  ERRORS  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    error EgETH__OnlyAdmin();\n    error EgETH__OnlyAggregator();\n    error EgETH__ContractPaused();\n\n    //--------------------------------------------------------------------------------------\n    //---------------------------------  STATE-VARIABLES  ----------------------------------\n    //--------------------------------------------------------------------------------------\n    uint256 internal constant INFINITE_ALLOWANCE = ~uint256(0);\n\n    /**\n     * @dev egETH balances are dynamic and are calculated based on the accounts' shares\n     * and the total amount of Ether controlled by the protocol. Account shares aren't\n     * normalized, so the contract also stores the sum of all shares to calculate\n     * each account's token balance which equals to:\n     *\n     *   shares[account] * _getTotalPooledEther() / _getTotalShares()\n     */\n    mapping(address => uint256) private shares;\n\n    /**\n     * @dev the total amount of shares in existence.\n     */\n    uint256 private totalShares;\n\n    /**\n     * @dev Allowances are nominated in tokens, not token shares.\n     */\n    mapping(address => mapping(address => uint256)) private allowances;\n\n    /**\n     * @dev Aggregator address\n     */\n    address public aggregator;\n\n    mapping(address => bool) public admins;\n    bool public paused;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    //--------------------------------------------------------------------------------------\n    //------------------------------------  MODIFIERS  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /// @dev Only allows execution if contract is not paused\n    modifier notPaused() {\n        if (paused) revert EgETH__ContractPaused();\n        _;\n    }\n\n    /// @dev Only allows execution if caller is an admin\n    modifier onlyAdmin() {\n        if (!admins[msg.sender]) revert EgETH__OnlyAdmin();\n        _;\n    }\n\n    /// @dev Only allows execution if caller is the aggregator\n    modifier onlyAggregator() {\n        if (msg.sender != aggregator) revert EgETH__OnlyAggregator();\n        _;\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  EXTERNAL  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @dev proxy initialization\n     * @param _aggregator Builda Aggregator address\n     * @param _admin Admin multisig address\n     */\n    function initialize(address _aggregator, address _admin) external initializer {\n        __Ownable_init(msg.sender);\n        __UUPSUpgradeable_init();\n        aggregator = _aggregator;\n        admins[_admin] = true;\n        totalShares = 0;\n\n        // call init\n    }\n\n    /**\n     * @notice Creates from `_etherAmount` new shares and assigns them to `_recipient`, increasing the total amount of shares.\n     * @dev This doesn't increase the token total supply.\n     *\n     * NB: The method doesn't check protocol pause relying on the aggregator.\n     *\n     * Requirements:\n     *\n     * - `_recipient` cannot be the zero address.\n     * - the contract must not be paused.\n     */\n    function mint(address _recipient, uint256 _etherAmount) external onlyAggregator {\n        uint256 sharesToMint = _etherAmount * _getTotalShares() / (_getTotalPooledEther() - _etherAmount);\n        _mintShares(_recipient, sharesToMint);\n    }\n\n    /**\n     * @notice Destroys shares from `_etherAmount` from `_account`'s holdings, decreasing the total amount of shares.\n     * @dev This doesn't decrease the token total supply.\n     *\n     * Requirements:\n     *\n     * - `_account` cannot be the zero address.\n     * - `_account` must hold at least `_sharesAmount` shares.\n     * - the contract must not be paused.\n     */\n    function burn(address _account, uint256 _etherAmount) external onlyAggregator {\n        uint256 sharesToBurn = getSharesByPooledEth(_etherAmount);\n        _burnShares(_account, sharesToBurn);\n    }\n\n    function mintInitialShares(address _sender, uint256 _sharesAmount) external onlyAggregator {\n        _mintShares(_sender, _sharesAmount);\n        _emitTransferAfterMintingShares(msg.sender, _sharesAmount);\n    }\n\n    /// @dev Sets the paused flag\n    function setPaused(bool _paused) external onlyAdmin {\n        paused = _paused;\n        if (_paused) {\n            emit Paused(msg.sender);\n        } else {\n            emit UnPaused(msg.sender);\n        }\n    }\n\n    /// @dev @dev Returns the name of the token\n    function name() external pure returns (string memory) {\n        return \"Builda egETH\";\n    }\n\n    /// @dev Returns the symbol of the token\n    function symbol() external pure returns (string memory) {\n        return \"egETH\";\n    }\n    /**\n     * @return the number of decimals for getting user representation of a token amount.\n     */\n\n    function decimals() external pure returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @return the amount of tokens in existence.\n     *\n     * @dev Always equals to `_getTotalPooledEther()` since token amount\n     * is pegged to the total amount of Ether controlled by the protocol.\n     */\n    function totalSupply() external view returns (uint256) {\n        return _getTotalPooledEther();\n    }\n\n    /**\n     * @return the amount of tokens owned by the `_account`.\n     *\n     * @dev Balances are dynamic and equal the `_account`'s share in the amount of the\n     * total Ether controlled by the protocol. See `sharesOf`.\n     */\n    function balanceOf(address _account) external view returns (uint256) {\n        return getPooledEthByShares(_sharesOf(_account));\n    }\n\n    /**\n     * @notice Moves `_amount` tokens from the caller's account to the `_recipient` account.\n     *\n     * @return a boolean value indicating whether the operation succeeded.\n     * Emits a `Transfer` event.\n     * Emits a `TransferShares` event.\n     *\n     * Requirements:\n     *\n     * - `_recipient` cannot be the zero address.\n     * - the caller must have a balance of at least `_amount`.\n     * - the contract must not be paused.\n     *\n     * @dev The `_amount` argument is the amount of tokens, not shares.\n     */\n    function transfer(address _recipient, uint256 _amount) external returns (bool) {\n        _transfer(msg.sender, _recipient, _amount);\n        return true;\n    }\n\n    /**\n     * @return the remaining number of tokens that `_spender` is allowed to spend\n     * on behalf of `_owner` through `transferFrom`. This is zero by default.\n     *\n     * @dev This value changes when `approve` or `transferFrom` is called.\n     */\n    function allowance(address _owner, address _spender) external view returns (uint256) {\n        return allowances[_owner][_spender];\n    }\n\n    /**\n     * @notice Sets `_amount` as the allowance of `_spender` over the caller's tokens.\n     *\n     * @return a boolean value indicating whether the operation succeeded.\n     * Emits an `Approval` event.\n     *\n     * Requirements:\n     *\n     * - `_spender` cannot be the zero address.\n     *\n     * @dev The `_amount` argument is the amount of tokens, not shares.\n     */\n    function approve(address _spender, uint256 _amount) external returns (bool) {\n        _approve(msg.sender, _spender, _amount);\n        return true;\n    }\n\n    /**\n     * @notice Moves `_amount` tokens from `_sender` to `_recipient` using the\n     * allowance mechanism. `_amount` is then deducted from the caller's\n     * allowance.\n     *\n     * @return a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a `Transfer` event.\n     * Emits a `TransferShares` event.\n     * Emits an `Approval` event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `_sender` and `_recipient` cannot be the zero addresses.\n     * - `_sender` must have a balance of at least `_amount`.\n     * - the caller must have allowance for `_sender`'s tokens of at least `_amount`.\n     * - the contract must not be paused.\n     *\n     * @dev The `_amount` argument is the amount of tokens, not shares.\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    /**\n     * @notice Atomically increases the allowance granted to `_spender` by the caller by `_addedValue`.\n     *\n     * This is an alternative to `approve` that can be used as a mitigation for\n     * problems described in:\n     * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/b709eae01d1da91902d06ace340df6b324e6f049/contracts/token/ERC20/IERC20.sol#L57\n     * Emits an `Approval` event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `_spender` cannot be the the zero address.\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    /**\n     * @notice Atomically decreases the allowance granted to `_spender` by the caller by `_subtractedValue`.\n     *\n     * This is an alternative to `approve` that can be used as a mitigation for\n     * problems described in:\n     * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/b709eae01d1da91902d06ace340df6b324e6f049/contracts/token/ERC20/IERC20.sol#L57\n     * Emits an `Approval` event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `_spender` cannot be the zero address.\n     * - `_spender` must have allowance for the caller of at least `_subtractedValue`.\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    /**\n     * @return the total amount of shares in existence.\n     *\n     * @dev The sum of all accounts' shares can be an arbitrary number, therefore\n     * it is necessary to store it in order to calculate each account's relative share.\n     */\n    function getTotalShares() external view returns (uint256) {\n        return _getTotalShares();\n    }\n\n    /**\n     * @return the amount of shares owned by `_account`.\n     */\n    function sharesOf(address _account) external view returns (uint256) {\n        return _sharesOf(_account);\n    }\n\n    /**\n     * @notice Moves `_sharesAmount` token shares from the caller's account to the `_recipient` account.\n     *\n     * @return amount of transferred tokens.\n     * Emits a `TransferShares` event.\n     * Emits a `Transfer` event.\n     *\n     * Requirements:\n     *\n     * - `_recipient` cannot be the zero address.\n     * - the caller must have at least `_sharesAmount` shares.\n     * - the contract must not be paused.\n     *\n     * @dev The `_sharesAmount` argument is the amount of shares, not tokens.\n     */\n    function transferShares(address _recipient, uint256 _sharesAmount) external returns (uint256) {\n        _transferShares(msg.sender, _recipient, _sharesAmount);\n        uint256 tokensAmount = getPooledEthByShares(_sharesAmount);\n        _emitTransferEvents(msg.sender, _recipient, tokensAmount, _sharesAmount);\n        return tokensAmount;\n    }\n\n    /**\n     * @notice Moves `_sharesAmount` token shares from the `_sender` account to the `_recipient` account.\n     *\n     * @return amount of transferred tokens.\n     * Emits a `TransferShares` event.\n     * Emits a `Transfer` event.\n     *\n     * Requirements:\n     *\n     * - `_sender` and `_recipient` cannot be the zero addresses.\n     * - `_sender` must have at least `_sharesAmount` shares.\n     * - the caller must have allowance for `_sender`'s tokens of at least `getPooledEthByShares(_sharesAmount)`.\n     * - the contract must not be paused.\n     *\n     * @dev The `_sharesAmount` argument is the amount of shares, not tokens.\n     */\n    function transferSharesFrom(address _sender, address _recipient, uint256 _sharesAmount)\n        external\n        returns (uint256)\n    {\n        uint256 tokensAmount = getPooledEthByShares(_sharesAmount);\n        _spendAllowance(_sender, msg.sender, tokensAmount);\n        _transferShares(_sender, _recipient, _sharesAmount);\n        _emitTransferEvents(_sender, _recipient, tokensAmount, _sharesAmount);\n        return tokensAmount;\n    }\n\n    /// @dev Returns the current implementation address\n    function getImplementation() external view returns (address) {\n        return ERC1967Utils.getImplementation();\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  PUBLIC  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @return the amount of shares that corresponds to `_ethAmount` protocol-controlled Ether.\n     */\n    function getSharesByPooledEth(uint256 _ethAmount) public view returns (uint256) {\n        return _ethAmount * _getTotalShares() / _getTotalPooledEther();\n    }\n\n    /**\n     * @return the amount of Ether that corresponds to `_sharesAmount` token shares.\n     */\n    function getPooledEthByShares(uint256 _sharesAmount) public view returns (uint256) {\n        return _sharesAmount * _getTotalPooledEther() / _getTotalShares();\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  INTERNAL  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /// @dev Allows the owner to upgrade the contract\n    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  PRIVATE  --------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @return the total amount (in wei) of Ether controlled by the protocol.\n     * @dev This is used for calculating tokens from shares and vice versa.\n     * @dev This function is required to be implemented in a derived contract.\n     */\n    function _getTotalPooledEther() private view returns (uint256) {\n        return Aggregator(payable(aggregator)).totalPooledEther();\n    }\n\n    /**\n     * @notice Moves `_amount` tokens from `_sender` to `_recipient`.\n     * Emits a `Transfer` event.\n     * Emits a `TransferShares` event.\n     */\n    function _transfer(address _sender, address _recipient, uint256 _amount) private notPaused {\n        uint256 _sharesToTransfer = getSharesByPooledEth(_amount);\n        _transferShares(_sender, _recipient, _sharesToTransfer);\n        _emitTransferEvents(_sender, _recipient, _amount, _sharesToTransfer);\n    }\n\n    /**\n     * @notice Sets `_amount` as the allowance of `_spender` over the `_owner` s tokens.\n     *\n     * Emits an `Approval` event.\n     *\n     * NB: the method can be invoked even if the protocol paused.\n     *\n     * Requirements:\n     *\n     * - `_owner` cannot be the zero address.\n     * - `_spender` cannot be the zero address.\n     */\n    function _approve(address _owner, address _spender, uint256 _amount) private {\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    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(address _owner, address _spender, uint256 _amount) private {\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    /**\n     * @return the total amount of shares in existence.\n     */\n    function _getTotalShares() private view returns (uint256) {\n        return totalShares;\n    }\n\n    /**\n     * @return the amount of shares owned by `_account`.\n     */\n    function _sharesOf(address _account) private view returns (uint256) {\n        return shares[_account];\n    }\n\n    /**\n     * @notice Moves `_sharesAmount` shares from `_sender` to `_recipient`.\n     *\n     * Requirements:\n     *\n     * - `_sender` cannot be the zero address.\n     * - `_recipient` cannot be the zero address or the `stETH` token contract itself\n     * - `_sender` must hold at least `_sharesAmount` shares.\n     * - the contract must not be paused.\n     */\n    function _transferShares(address _sender, address _recipient, uint256 _sharesAmount) private notPaused {\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_EGETH_CONTRACT\");\n\n        uint256 currentSenderShares = shares[_sender];\n        require(_sharesAmount <= currentSenderShares, \"BALANCE_EXCEEDED\");\n        shares[_sender] = currentSenderShares - _sharesAmount;\n        shares[_recipient] = shares[_recipient] + _sharesAmount;\n    }\n\n    /**\n     * @notice Creates `_sharesAmount` shares and assigns them to `_recipient`, increasing the total amount of shares.\n     * @dev This doesn't increase the token total supply.\n     *\n     * NB: The method doesn't check protocol pause relying on the aggregator.\n     *\n     * Requirements:\n     *\n     * - `_recipient` cannot be the zero address.\n     * - the contract must not be paused.\n     */\n    function _mintShares(address _recipient, uint256 _sharesAmount) private returns (uint256 newTotalShares) {\n        require(_recipient != address(0), \"MINT_TO_ZERO_ADDR\");\n\n        newTotalShares = _getTotalShares() + _sharesAmount;\n        totalShares = newTotalShares;\n\n        shares[_recipient] = shares[_recipient] + _sharesAmount;\n\n        // Notice: we're not emitting a Transfer event from the zero address here since shares mint\n        // works by taking the amount of tokens corresponding to the minted shares from all other\n        // token holders, proportionally to their share. The total supply of the token doesn't change\n        // as the result. This is equivalent to performing a send from each other token holder's\n        // address to `address`, but we cannot reflect this as it would require sending an unbounded\n        // number of events.\n    }\n\n    /**\n     * @notice Destroys `_sharesAmount` shares from `_account`'s holdings, decreasing the total amount of shares.\n     * @dev This doesn't decrease the token total supply.\n     *\n     * Requirements:\n     *\n     * - `_account` cannot be the zero address.\n     * - `_account` must hold at least `_sharesAmount` shares.\n     * - the contract must not be paused.\n     */\n    function _burnShares(address _account, uint256 _sharesAmount) private returns (uint256 newTotalShares) {\n        require(_account != address(0), \"BURN_FROM_ZERO_ADDR\");\n\n        uint256 accountShares = shares[_account];\n\n        require(_sharesAmount <= accountShares, \"BALANCE_EXCEEDED\");\n\n        uint256 preRebaseTokenAmount = getPooledEthByShares(_sharesAmount);\n\n        newTotalShares = _getTotalShares() - _sharesAmount;\n        totalShares = newTotalShares;\n\n        shares[_account] = accountShares - _sharesAmount;\n\n        uint256 postRebaseTokenAmount = getPooledEthByShares(_sharesAmount);\n\n        emit SharesBurnt(_account, preRebaseTokenAmount, postRebaseTokenAmount, _sharesAmount);\n\n        // Notice: we're not emitting a Transfer event to the zero address here since shares burn\n        // works by redistributing the amount of tokens corresponding to the burned shares between\n        // all other token holders. The total supply of the token doesn't change as the result.\n        // This is equivalent to performing a send from `address` to each other token holder address,\n        // but we cannot reflect this as it would require sending an unbounded number of events.\n\n        // We're emitting `SharesBurnt` event to provide an explicit rebase log record nonetheless.\n    }\n\n    /**\n     * @dev Emits {Transfer} and {TransferShares} events\n     */\n    function _emitTransferEvents(address _from, address _to, uint256 _tokenAmount, uint256 _sharesAmount) private {\n        emit Transfer(_from, _to, _tokenAmount);\n        emit TransferShares(_from, _to, _sharesAmount);\n    }\n\n    /**\n     * @dev Emits {Transfer} and {TransferShares} events where `from` is 0 address. Indicates mint events.\n     */\n    function _emitTransferAfterMintingShares(address _to, uint256 _sharesAmount) private {\n        _emitTransferEvents(address(0), _to, getPooledEthByShares(_sharesAmount), _sharesAmount);\n    }\n}\n"
      },
      "src/interfaces/IAggregator.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nstruct IAssetInfo {\n    IERC20 asset;\n    uint256 targetWeight; // Target weight in percentage (e.g., 450 for 45%)\n}\n\nstruct IConfigAggregator {\n    address admin;\n    address treasury;\n    address egETH;\n    address ethTokenAddress;\n}\n\nstruct IAssets {\n    IAssetInfo etherFieEth;\n    IAssetInfo renzoEzEth;\n    IAssetInfo kelpRsETH;\n}\n\ninterface IAggregator {\n    function depositETH() external payable;\n    function depositLRT(address asset, uint256 amount, uint256 minEgETHAmount) external;\n    function withdrawLRT(address assetToWithdraw, uint256 bldShares) external payable;\n    function setTargetWeights(uint256 etherFiWeight, uint256 renzoWeight, uint256 kelpWeight) external;\n    function setPaused(bool _paused) external;\n    function getImplementation() external view returns (address);\n    function previewDepositETH(uint256 amount) external view returns (uint256);\n    function previewDepositLRT(address asset, uint256 amount) external view returns (uint256);\n    function previewWithdrawLRT(address asset, uint256 shares) external view returns (uint256);\n    function totalPooledEther() external view returns (uint256);\n    function targetWeights() external view returns (uint256, uint256, uint256);\n    function maxLRTWithdrawInEgETH(address _asset) external view returns (uint256);\n    function balanceOf(address _account) external view returns (uint256);\n    function totalAssets() external view returns (uint256, uint256, uint256);\n    function convertEthToEgETH(uint256 _amount) external view returns (uint256);\n    function convertEthToLRTShares(address asset, uint256 ethAmount) external view returns (uint256);\n    function convertLRTSharesToEth(address asset, uint256 shares) external view returns (uint256);\n    function convertLRTSharesToEgETH(address asset, uint256 shares) external view returns (uint256);\n    function convertEgETHToLRTShares(address asset, uint256 bldShares) external view returns (uint256);\n    function currentWeights() external view returns (uint256, uint256, uint256);\n}\n"
      },
      "src/LRTProtocolsManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.24;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport {Ownable2StepUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\nimport {ERC1967Utils} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\";\n\nimport {ILiquidityPool} from \"src/interfaces/etherFi/ILiquidityPool.sol\";\nimport {IRestakeManager} from \"src/interfaces/renzo/IRestakeManager.sol\";\nimport {IRenzoOracle} from \"src/interfaces/renzo/IRenzoOracle.sol\";\nimport {IKelpLRTDepositPool} from \"src/interfaces/kelp/IKelpLRTDepositPool.sol\";\nimport {IKLRTOracle} from \"src/interfaces/kelp/IKLRTOracle.sol\";\n\nimport {ILRTProtocolsManager} from \"src/interfaces/ILRTProtocolsManager.sol\";\n\n/**\n * @title LRTProtocolsManager\n * @dev Manages interactions between the different LRT protocols\n * @notice This contract is used to manage the interactions between the different LRT protocols\n * Currently it supports EtherFi, Renzo and Kelp\n * Only the aggregator contract can call the functions in this contract\n */\ncontract LRTProtocolsManager is Initializable, UUPSUpgradeable, Ownable2StepUpgradeable, ILRTProtocolsManager {\n    //--------------------------------------------------------------------------------------\n    //--------------------------------------  ERRORS  --------------------------------------\n    //--------------------------------------------------------------------------------------\n    error OnlyAggregatorContract();\n\n    //--------------------------------------------------------------------------------------\n    //---------------------------------  STATE-VARIABLES  ----------------------------------\n    //--------------------------------------------------------------------------------------\n    uint256 private constant SCALE_FACTOR = 1e18;\n\n    address public aggregator;\n\n    // Protocols contracts\n    IRestakeManager public renzoDeposit;\n    ILiquidityPool public etherFiDeposit;\n    IKelpLRTDepositPool public kelpDeposit;\n\n    // Protocols oracles\n    IKLRTOracle public kelpOracle;\n    IRenzoOracle public renzoOracle;\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  MODIFIERS  ------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /// @dev Only allows execution if caller is the aggregator\n    modifier onlyAggregator() {\n        if (msg.sender != aggregator) revert OnlyAggregatorContract();\n        _;\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  EXTERNAL  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @dev proxy initialization\n     * @param _aggregator Aggregator contract address\n     * @param _etherFiDeposit EtherFi deposit contract address\n     * @param _renzoDeposit Renzo deposit contract address\n     * @param _kelpDeposit Kelp deposit contract address\n     * @param _kelpOracle Kelp oracle contract address\n     * @param _renzoOracle Renzo oracle contract address\n     */\n    function initialize(\n        address _aggregator,\n        address _etherFiDeposit,\n        address _renzoDeposit,\n        address _kelpDeposit,\n        address _kelpOracle,\n        address _renzoOracle\n    ) external initializer {\n        __Ownable_init(msg.sender);\n        __UUPSUpgradeable_init();\n\n        renzoDeposit = IRestakeManager(_renzoDeposit);\n        etherFiDeposit = ILiquidityPool(_etherFiDeposit);\n        kelpDeposit = IKelpLRTDepositPool(_kelpDeposit);\n\n        kelpOracle = IKLRTOracle(_kelpOracle);\n        renzoOracle = IRenzoOracle(_renzoOracle);\n        aggregator = _aggregator;\n    }\n\n    /**\n     * @dev Get the total TVL of all the protocols in ETH\n     * @param _etherFiShares EtherFi shares\n     * @param _renzoShares Renzo shares\n     * @param _kelpShares Kelp shares\n     * @return total TVL in ETH\n     */\n    function totalEthAmount(\n        uint256 _etherFiShares,\n        uint256 _kelpShares,\n        uint256 _renzoShares,\n        uint256 _ezETHTotalSupply\n    ) external view onlyAggregator returns (uint256) {\n        return etherFiEthAndAmount(_etherFiShares) + renzoEthAmount(_renzoShares, _ezETHTotalSupply)\n            + kelpEthAmount(_kelpShares);\n    }\n\n    /**\n     * @dev Get the total TVL of all the protocols in ETH\n     * @param _etherFiShares ezETH shares\n     * @param _kelpShares rsETH shares\n     * @param _renzoShares ezETH shares\n     * @param _ezETHTotalSupply ezETH total supply\n     * @return eETH ETH TVL\n     * @return ezETH ETH TVL\n     * @return rsETH ETH TVL\n     */\n    function totalProtocolsEther(\n        uint256 _etherFiShares,\n        uint256 _kelpShares,\n        uint256 _renzoShares,\n        uint256 _ezETHTotalSupply\n    ) external view onlyAggregator returns (uint256, uint256, uint256) {\n        return (\n            etherFiEthAndAmount(_etherFiShares),\n            renzoEthAmount(_renzoShares, _ezETHTotalSupply),\n            kelpEthAmount(_kelpShares)\n        );\n    }\n\n    /**\n     * @dev ETH to Renzo shares (ezETH) converter\n     * @param _ethAmount ETH amount\n     * @param _totalSupply Total supply of ezETH\n     * @return ezETH shares\n     */\n    function ethToRenzoEth(uint256 _ethAmount, uint256 _totalSupply) external view onlyAggregator returns (uint256) {\n        (,, uint256 ethTVL) = renzoDeposit.calculateTVLs();\n        uint256 shares = (_ethAmount * _totalSupply) / ethTVL;\n        return shares;\n    }\n\n    /**\n     * @dev ETH to Kelp shares (rsETH) converter\n     * @param _ethAmount ETH amount\n     * @return rsETH shares\n     */\n    function ethToKelpEth(uint256 _ethAmount) external view onlyAggregator returns (uint256) {\n        uint256 kelEthPrice = kelpOracle.rsETHPrice();\n        return (_ethAmount * SCALE_FACTOR) / kelEthPrice;\n    }\n\n    /**\n     * @dev Update Kelp shares price in ETH\n     */\n    function updateRsETHPrice() external onlyAggregator {\n        kelpOracle.updateRSETHPrice();\n    }\n\n    // @dev Get the current implementation address\n    function getImplementation() external view returns (address) {\n        return ERC1967Utils.getImplementation();\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  PUBLIC  ---------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /**\n     * @dev ETH to EtherFi shares (eETH) converter\n     * @param _ethAmount ETH amount\n     * @return eETH shares\n     */\n    function etherFiEthAndAmount(uint256 _ethAmount) public view onlyAggregator returns (uint256) {\n        uint256 shares = etherFiDeposit.sharesForAmount(_ethAmount);\n        uint256 eETHAmount = etherFiDeposit.amountForShare(shares);\n        return eETHAmount;\n    }\n\n    /**\n     * @dev Get ETH amount of Renzo shares (ezETH)\n     * @param shares Renzo shares\n     * @param _totalSupply Total supply of ezETH\n     * @return total TVL in ETH\n     */\n    function renzoEthAmount(uint256 shares, uint256 _totalSupply) public view onlyAggregator returns (uint256) {\n        (,, uint256 ethTVL) = renzoDeposit.calculateTVLs();\n        uint256 ethAmount = (ethTVL * shares) / _totalSupply;\n        return ethAmount;\n    }\n\n    /**\n     * @dev Get ETH amount of Kelp shares (rsETH)\n     * @param shares Kelp shares\n     * @return total TVL in ETH\n     */\n    function kelpEthAmount(uint256 shares) public view onlyAggregator returns (uint256) {\n        uint256 ethAmount = (kelpOracle.rsETHPrice() * shares) / SCALE_FACTOR;\n        return ethAmount;\n    }\n\n    //--------------------------------------------------------------------------------------\n    //-------------------------------------  INTERNAL  -------------------------------------\n    //--------------------------------------------------------------------------------------\n\n    /// @dev Allows the owner to upgrade the contract\n    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}\n}\n"
      },
      "src/interfaces/kelp/IKelpLRTDepositPool.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity 0.8.24;\n\nimport {IRSETH} from \"./IRSETH.sol\";\n\ninterface IKelpLRTDepositPool {\n    function initialize(IRSETH _rsETH) external;\n    function paused() external view returns (bool);\n    function depositETH(uint256 minRSETHAmountExpected, string calldata referralId) external payable;\n    function getRsETHAmountToMint(address asset, uint256 amount) external view returns (uint256);\n}\n"
      },
      "src/interfaces/kelp/IRSETH.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity 0.8.24;\n\nimport {IERC20} from \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\ninterface IRSETH is IERC20 {\n    function mint(address account, uint256 amount) external;\n\n    function burnFrom(address account, uint256 amount) external;\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 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 ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 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 ERC-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 ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\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 Errors.InsufficientBalance(address(this).balance, amount);\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert Errors.FailedCall();\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     * {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);\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 {Errors.FailedCall}) in case\n     * of an 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 {Errors.FailedCall} 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 {Errors.FailedCall}.\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 Errors.FailedCall();\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {UpgradeableBeacon} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Emitted when the beacon is changed.\n     */\n    event BeaconUpgraded(address indexed beacon);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.24;\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 ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\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 *\n * Since version 5.1, this library also support writing and reading value types to and from transient storage.\n *\n *  * Example using transient storage:\n * ```solidity\n * contract Lock {\n *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n *     bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;\n *\n *     modifier locked() {\n *         require(!_LOCK_SLOT.asBoolean().tload());\n *\n *         _LOCK_SLOT.asBoolean().tstore(true);\n *         _;\n *         _LOCK_SLOT.asBoolean().tstore(false);\n *     }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\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 Int256Slot {\n        int256 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 `Int256Slot` with member `value` located at `slot`.\n     */\n    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot 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    /**\n     * @dev UDVT that represent a slot holding a address.\n     */\n    type AddressSlotType is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a AddressSlotType.\n     */\n    function asAddress(bytes32 slot) internal pure returns (AddressSlotType) {\n        return AddressSlotType.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represent a slot holding a bool.\n     */\n    type BooleanSlotType is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a BooleanSlotType.\n     */\n    function asBoolean(bytes32 slot) internal pure returns (BooleanSlotType) {\n        return BooleanSlotType.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represent a slot holding a bytes32.\n     */\n    type Bytes32SlotType is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Bytes32SlotType.\n     */\n    function asBytes32(bytes32 slot) internal pure returns (Bytes32SlotType) {\n        return Bytes32SlotType.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represent a slot holding a uint256.\n     */\n    type Uint256SlotType is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Uint256SlotType.\n     */\n    function asUint256(bytes32 slot) internal pure returns (Uint256SlotType) {\n        return Uint256SlotType.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represent a slot holding a int256.\n     */\n    type Int256SlotType is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Int256SlotType.\n     */\n    function asInt256(bytes32 slot) internal pure returns (Int256SlotType) {\n        return Int256SlotType.wrap(slot);\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(AddressSlotType slot) internal view returns (address value) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(AddressSlotType slot, address value) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(BooleanSlotType slot) internal view returns (bool value) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(BooleanSlotType slot, bool value) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Bytes32SlotType slot) internal view returns (bytes32 value) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Bytes32SlotType slot, bytes32 value) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Uint256SlotType slot) internal view returns (uint256 value) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Uint256SlotType slot, uint256 value) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Int256SlotType slot) internal view returns (int256 value) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Int256SlotType slot, int256 value) internal {\n        /// @solidity memory-safe-assembly\n        assembly {\n            tstore(slot, value)\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.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 {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {\n    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable\n    struct OwnableStorage {\n        address _owner;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Ownable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;\n\n    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {\n        assembly {\n            $.slot := OwnableStorageLocation\n        }\n    }\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    function __Ownable_init(address initialOwner) internal onlyInitializing {\n        __Ownable_init_unchained(initialOwner);\n    }\n\n    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {\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        OwnableStorage storage $ = _getOwnableStorage();\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        OwnableStorage storage $ = _getOwnableStorage();\n        address oldOwner = $._owner;\n        $._owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "src/interfaces/IEGETH.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\ninterface IEGETH is IERC20, IERC20Metadata {\n    function mint(address _recipient, uint256 _sharesAmount) external;\n    function burn(address _account, uint256 _sharesAmount) external;\n    function approve(address _spender, uint256 _amount) external returns (bool);\n    function allowance(address _owner, address _spender) external view returns (uint256);\n    function increaseAllowance(address _spender, uint256 _addedValue) external returns (bool);\n    function decreaseAllowance(address _spender, uint256 _subtractedValue) external returns (bool);\n    function transfer(address _recipient, uint256 _amount) external returns (bool);\n    function transferFrom(address _sender, address _recipient, uint256 _amount) external returns (bool);\n    function balanceOf(address _account) external view returns (uint256);\n    function sharesOf(address _account) external view returns (uint256);\n    function totalSupply() external view returns (uint256);\n    function getTotalShares() external view returns (uint256);\n}\n"
      },
      "src/interfaces/etherFi/ILiquidityPool.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\ninterface ILiquidityPool {\n    struct PermitInput {\n        uint256 value;\n        uint256 deadline;\n        uint8 v;\n        bytes32 r;\n        bytes32 s;\n    }\n\n    function totalValueOutOfLp() external view returns (uint256);\n\n    function totalValueInLp() external view returns (uint256);\n\n    function paused() external view returns (bool);\n\n    function getTotalEtherClaimOf(address _user) external view returns (uint256);\n\n    function getTotalPooledEther() external view returns (uint256);\n\n    function sharesForAmount(uint256 _amount) external view returns (uint256);\n\n    function sharesForWithdrawalAmount(uint256 _amount) external view returns (uint256);\n\n    function amountForShare(uint256 _share) external view returns (uint256);\n\n    function deposit() external payable returns (uint256);\n\n    function deposit(address _referral) external payable returns (uint256);\n\n    function setTokenAddress(address _eETH) external;\n\n    function updateAdmin(address _newAdmin, bool _isAdmin) external;\n}\n"
      },
      "src/interfaces/renzo/IRestakeManager.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"./IDepositQueue.sol\";\n\ninterface IRestakeManager {\n    function depositQueue() external view returns (IDepositQueue);\n\n    function paused() external view returns (bool);\n\n    function depositETH() external payable;\n\n    function calculateTVLs() external view returns (uint256, uint256, uint256);\n}\n"
      },
      "src/interfaces/renzo/IRenzoOracle.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.24;\n\n/// @dev This contract will be responsible for looking up values via Chainlink\n/// Data retrieved will be verified for liveness via a max age on the oracle lookup.\n/// All tokens should be denominated in the same base currency and contain the same decimals on the price lookup.\ninterface IRenzoOracle {\n    /// @dev Given amount of current protocol value, new value being added, and supply of ezETH, determine amount to mint\n    /// Values should be denominated in the same underlying currency with the same decimal precision\n    function calculateMintAmount(uint256 _currentValueInProtocol, uint256 _newValueAdded, uint256 _existingEzETHSupply)\n        external\n        pure\n        returns (uint256);\n\n    // Given the amount of ezETH to burn, the supply of ezETH, and the total value in the protocol, determine amount of value to return to user\n    function calculateRedeemAmount(\n        uint256 _ezETHBeingBurned,\n        uint256 _existingEzETHSupply,\n        uint256 _currentValueInProtocol\n    ) external pure returns (uint256);\n}\n"
      },
      "src/interfaces/kelp/IKLRTOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\ninterface IKLRTOracle {\n    function rsETHPrice() external pure returns (uint256);\n    function updateRSETHPrice() external;\n}\n"
      },
      "src/interfaces/ILRTProtocolsManager.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.24;\n\ninterface ILRTProtocolsManager {\n    function totalEthAmount(\n        uint256 _etherFiShares,\n        uint256 _kelpShares,\n        uint256 _renzoShares,\n        uint256 _ezETHTotalSupply\n    ) external view returns (uint256);\n    function totalProtocolsEther(\n        uint256 _etherFiShares,\n        uint256 _kelpShares,\n        uint256 _renzoShares,\n        uint256 _ezETHTotalSupply\n    ) external view returns (uint256, uint256, uint256);\n\n    function etherFiEthAndAmount(uint256 _ethAmount) external view returns (uint256);\n\n    function ethToRenzoEth(uint256 _ethAmount, uint256 _totalSupply) external view returns (uint256);\n\n    function ethToKelpEth(uint256 _ethAmount) external view returns (uint256);\n\n    function getImplementation() external view returns (address);\n\n    function renzoEthAmount(uint256 shares, uint256 _totalSupply) external view returns (uint256);\n\n    function kelpEthAmount(uint256 shares) external view returns (uint256);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Errors.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of common custom errors used in multiple contracts\n *\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\n * It is recommended to avoid relying on the error API for critical functionality.\n */\nlibrary Errors {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error InsufficientBalance(uint256 balance, uint256 needed);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedCall();\n\n    /**\n     * @dev The deployment failed.\n     */\n    error FailedDeployment();\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "src/interfaces/renzo/IDepositQueue.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.24;\n\ninterface IDepositQueue {\n    function depositETHFromProtocol() external payable;\n\n    function totalEarned(address tokenAddress) external view returns (uint256);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
        "@openzeppelin/foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
        "@aave/protocol-v2/=lib/protocol-v2/",
        "@aave/core-v3/=lib/aave-v3-core/",
        "@uniswap/v3-core/=lib/v3-core/",
        "@uniswap/v3-periphery/=lib/v3-periphery/",
        "halmos-cheatcodes/=lib/halmos-cheatcodes/src/",
        "aave-v3-core/=lib/aave-v3-core/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/",
        "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
        "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
        "v3-core/=lib/v3-core/",
        "v3-periphery/=lib/v3-periphery/contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "cancun",
      "viaIR": false,
      "debug": {
        "revertStrings": "strip"
      },
      "libraries": {}
    }
  }}