MEDIUM severity: The vulnerability assessment highlights the re-entrancy risks associated with external calls made by. The vulnerability assessment highlights the re-entrancy risks associated with external calls made by the Lybra Protocol vaults to Liquid Staking systems. Specifically, the `depositEtherToMint` function in the vaults makes external calls to deposit Ether and receive LSD tokens back. These calls are m...

Vulnerable code:
```\ncontract LybraWstETHVault is LybraPeUSDVaultBase {\n    address immutable lido;\n\n    constructor(address _lido, address _asset, address _oracle, address _config) LybraPeUSDVaultBase(_asset, _oracle, _config) {\n        lido = Ilido(_lido);\n    }\n\n    function depositEtherToMint(uint256 mintAmount) external payable override {\n        require(msg.value >= 1 ether, "DNL");\n        uint256 sharesAmount = lido.submit{value: msg.value}(address(configurator));\n        require(sharesAmount!= 0, "ZERO_DEPOSIT");\n        lido.approve(address(collateralAsset), msg.value);\n        uint256 wstETHAmount = IWstETH(address(collateralAsset)).wrap(msg.value);\n        depositedAsset[msg.sender] += wstETHAmount;\n        if (mintAmount > 0) {\n            _mintPeUSD(msg.sender, msg.sender, mintAmount, getAssetPrice());\n        }\n        emit DepositEther(msg.sender, address(collateralAsset), msg.value, wstETHAmount, block.timestamp);\n    }\n}\n```\n```\ncontract LybraWBETHVault is LybraPeUSDVaultBase {\n    // WBETH = 0xa2e3356610840701bdf5611a53974510ae27e2e1\n\n    constructor(address _asset, address _oracle, address _config)\n        LybraPeUSDVaultBase(_asset, _oracle, _config)\n    {}\n\n    function depositEtherToMint(uint256 mintAmount) external payable override {\n        require(msg.value >= 1 ether, "DNL");\n        uint256 preBalance = collateralAsset.balanceOf(address(this));\n        IWBETH(address(collateralAsset)).deposit{value: msg.value}(address(configurator));\n        uint256 balance = collateralAsset.balanceOf(address(this));\n        depositedAsset[msg.sender] += balance - preBalance;\n\n        if (mintAmount > 0) {\n            _mintPeUSD(msg.sender, msg.sender, mintAmount, getAssetPrice());\n        }\n\n        emit DepositEther(msg.sender, address(collateralAsset), msg.value, balance - preBalance, block.timestamp);\n    }\n}\n```\n```\nconstructor(address _rocketStorageAddress, address _rETH, address _oracle, address _config) {\n    LybraPeUSDVaultBase(_rETH, _oracle, _config) {\n        rocketStorage = IRocketStorageInterface(_rocketStorageAddress);\n    }\n}\n\nfunction depositEtherToMint(uint256 mintAmount) external payable override {\n    require(msg.value >= 1 ether, "DNL");\n    uint256 preBalance = collateralAsset.balanceOf(address(this));\n    IRocketDepositPool(rocketStorage.getAddress(keccak256(abi.encodePacked("contract.address", "rocketDepositPool")))).deposit{value: msg.value}();\n    uint256 balance = collateralAsset.balanceOf(address(this));\n    depositedAsset[msg.sender] += balance - preBalance;\n\n    if (mintAmount > 0) {\n        _mintPeUSD(msg.sender, msg.sender, mintAmount, getAssetPrice());\n    }\n\n    emit DepositEther(msg.sender, address(collateralAsset), msg.value, balance - preBalance, block.timestamp);\n}\n```