creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\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        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` 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 amount) 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 `amount` as the allowance of `spender` over the 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 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` 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 amount) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\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"
      },
      "contracts/interface/ITreasury.sol": {
        "content": "pragma solidity >=0.7.5;\n\ninterface ITreasury {\n    function mint(address _to, uint256 _amount) external;\n\n    function valueOfToken(\n        address _token,\n        uint _amount\n    ) external view returns (uint value_);\n\n    function VEC() external view returns (address);\n\n    function vETH() external view returns (address);\n\n    function LP() external view returns (address);\n\n    function excessReserves() external view returns (uint256);\n\n    function RESERVE_BACKING() external view returns (uint256);\n\n    function transferFromTreasury(\n        address _token,\n        address _to,\n        uint256 _amount\n    ) external;\n}\n"
      },
      "contracts/interface/IvETH.sol": {
        "content": "import \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\npragma solidity 0.8.19;\n\ninterface IvETH is IERC20Metadata {\n    function currentBalance() external view returns (uint256);\n\n    function deposit(\n        address _restakedLST,\n        address _to,\n        uint256 _amount\n    ) external;\n\n    function redeem(\n        address _restakedLSTToReceive,\n        address _to,\n        uint256 _vETHToRedeem\n    ) external;\n\n    function addRestakedLST(\n        address _restakedLST,\n        uint256 _vETHPerLST\n    ) external;\n\n    function removeRestakedLST(address _restakedLST) external;\n\n    function updatevETHPerLST(\n        address _restakedLST,\n        uint256 _vETHPerLST\n    ) external;\n\n    function updateRouteRestakedLSTTo(\n        address _restakedLST,\n        address _where\n    ) external;\n\n    function setRedemtionActive() external;\n\n    function setRedemtionUnactive() external;\n\n    function addApprovedManager(address _manager) external;\n\n    function removeApprovedManager(address _manager) external;\n\n    function recoverTokens(\n        address _to,\n        address _token,\n        uint256 _amount\n    ) external;\n\n    function transferOwnership(address newOwner) external;\n}"
      },
      "contracts/interface/IvETHManagement.sol": {
        "content": "pragma solidity 0.8.19;\n\ninterface IvETHManagement {\n    function redeem(\n        address _restakedLSTToReceive,\n        address _to,\n        uint256 _vETHToRedeem\n    ) external;\n\n}"
      },
      "contracts/interface/curve/ICurveStableSwapNG.sol": {
        "content": "pragma solidity ^0.8.0;\n\ninterface ICurveStableSwapNG {\n    function exchange(int128 i, int128 j, uint256 _dx, uint256 _mint_dy) external;\n    function add_liquidity(uint256[2] memory _amounts, uint256 _min_mint_amount, address _receiver) external;\n}\n"
      },
      "contracts/rebalance/vETHManagementCurveRebalancer.sol": {
        "content": "pragma solidity 0.8.19;\n\nimport \"../interface/curve/ICurveStableSwapNG.sol\";\nimport \"../interface/IvETHManagement.sol\";\nimport \"../interface/IvETH.sol\";\nimport \"../interface/ITreasury.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract vETHManagementCurveRebalancer is Ownable {\n\n    /// EVENTS ///\n\n    event PoolBalanced (uint256 _amountRedeemed, uint256 _vETHReceived, uint256 _amountProfit);\n\n    /// STATE VARIABLES ///\n\n    /// @notice Address of Vector treasury\n    address public constant treasury = 0x2dD568028682FF2961cC341a4849F1b32f371064;\n    /// @notice Address of Curve vETH/ETH\n    address public constant vETHETH = 0x6685fcFCe05e7502bf9f0AA03B36025b09374726;\n    /// @notice Address of WETH\n    address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n    /// @notice Address of vETH\n    address public constant vETH = 0x38D64ce1Bdf1A9f24E0Ec469C9cAde61236fB4a0;\n    /// @notice Address of vETH Management\n    address public constant vETHManagement = 0x2D476BE2269DedaAa99D9c50686A8e1000476bcf;\n\n    /// @notice Total amount of profit treasury has accumuluated from rebalancing\n    uint256 public totalProfitForTreasury;\n\n    /// MUTATIVE FUNCTIONS ///\n\n    /// @notice                 Rebalance vETH/ETH with `_amountToRedeem` WETH, receive the minimum `_minvETH` back\n    /// @param _amountToRedeem  Amount of vETH to redeem for WETH to rebalance with\n    /// @param _minvETH         Min amount of vETH to receive out\n    function rebalance(uint256 _amountToRedeem, uint256 _minvETH) external onlyOwner {\n        ITreasury(treasury).transferFromTreasury(vETH, address(this), _amountToRedeem);\n        IERC20(vETH).approve(vETHManagement, _amountToRedeem);\n        IvETHManagement(vETHManagement).redeem(WETH, address(this), _amountToRedeem);\n        IERC20(WETH).approve(vETHETH, _amountToRedeem);\n        ICurveStableSwapNG(vETHETH).exchange(1, 0, _amountToRedeem, _minvETH);\n\n        uint256 vETHBalance = IERC20(vETH).balanceOf(address(this)) ;\n        uint256 profit = vETHBalance - _amountToRedeem;\n\n        totalProfitForTreasury += profit;\n\n        IvETH(vETH).transfer(treasury, IERC20(vETH).balanceOf(address(this)));\n\n        emit PoolBalanced(_amountToRedeem, vETHBalance, profit);\n    }\n\n    /// @notice Withdraw token from contract\n    function withdrawToken(address _token, address _to, uint256 _amount) external onlyOwner {\n        IERC20(_token).transfer(_to, _amount);\n    }\n}"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 1000
      },
      "evmVersion": "paris",
      "remappings": [],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}