diff --git a/contracts/0.8.25/Accounting.sol b/contracts/0.8.25/Accounting.sol index 86c25b854..ea46cae6a 100644 --- a/contracts/0.8.25/Accounting.sol +++ b/contracts/0.8.25/Accounting.sol @@ -69,8 +69,6 @@ contract Accounting is VaultHub { uint256 postTotalPooledEther; /// @notice amount of ether to be locked in the vaults uint256[] vaultsLockedEther; - /// @notice amount of ether to be locked in the vaults - uint256[] vaultsThresholdEther; /// @notice amount of shares to be minted as vault fees to the treasury uint256[] vaultsTreasuryFeeShares; /// @notice total amount of shares to be minted as vault fees to the treasury @@ -227,12 +225,7 @@ contract Accounting is VaultHub { // Calculate the amount of ether locked in the vaults to back external balance of stETH // and the amount of shares to mint as fees to the treasury for each vaults - ( - update.vaultsLockedEther, - update.vaultsThresholdEther, - update.vaultsTreasuryFeeShares, - update.totalVaultsTreasuryFeeShares - ) = + (update.vaultsLockedEther, update.vaultsTreasuryFeeShares, update.totalVaultsTreasuryFeeShares) = _calculateVaultsRebase( update.postTotalShares, update.postTotalPooledEther, @@ -346,8 +339,9 @@ contract Accounting is VaultHub { _report.vaultValues, _report.inOutDeltas, _update.vaultsLockedEther, - _update.vaultsThresholdEther, - _update.vaultsTreasuryFeeShares + _update.vaultsTreasuryFeeShares, + _update.postTotalPooledEther, + _update.postTotalShares ); if (_update.totalVaultsTreasuryFeeShares > 0) { diff --git a/contracts/0.8.25/vaults/VaultHub.sol b/contracts/0.8.25/vaults/VaultHub.sol index 8159a0dd4..f37755bb8 100644 --- a/contracts/0.8.25/vaults/VaultHub.sol +++ b/contracts/0.8.25/vaults/VaultHub.sol @@ -405,12 +405,7 @@ abstract contract VaultHub is PausableUntilWithRoles { uint256 _preTotalShares, uint256 _preTotalPooledEther, uint256 _sharesToMintAsFees - ) internal view returns ( - uint256[] memory lockedEther, - uint256[] memory thresholdEther, - uint256[] memory treasuryFeeShares, - uint256 totalTreasuryFeeShares - ) { + ) internal view returns (uint256[] memory lockedEther, uint256[] memory treasuryFeeShares, uint256 totalTreasuryFeeShares) { /// HERE WILL BE ACCOUNTING DRAGON // \||/ @@ -431,7 +426,6 @@ abstract contract VaultHub is PausableUntilWithRoles { treasuryFeeShares = new uint256[](length); lockedEther = new uint256[](length); - thresholdEther = new uint256[](length); for (uint256 i = 0; i < length; ++i) { VaultSocket memory socket = $.sockets[i + 1]; @@ -452,9 +446,6 @@ abstract contract VaultHub is PausableUntilWithRoles { (mintedStETH * TOTAL_BASIS_POINTS) / (TOTAL_BASIS_POINTS - socket.reserveRatioBP), CONNECT_DEPOSIT ); - - // Minimum amount of ether that should be in the vault to avoid unbalanced state - thresholdEther[i] = (mintedStETH * TOTAL_BASIS_POINTS) / (TOTAL_BASIS_POINTS - socket.reserveRatioThresholdBP); } } } @@ -493,8 +484,9 @@ abstract contract VaultHub is PausableUntilWithRoles { uint256[] memory _valuations, int256[] memory _inOutDeltas, uint256[] memory _locked, - uint256[] memory _thresholds, - uint256[] memory _treasureFeeShares + uint256[] memory _treasureFeeShares, + uint256 _postTotalPooledEther, + uint256 _postTotalShares ) internal { VaultHubStorage storage $ = _getVaultHubStorage(); @@ -508,7 +500,9 @@ abstract contract VaultHub is PausableUntilWithRoles { socket.sharesMinted += uint96(treasuryFeeShares); } - _epicrisis(_valuations[i], _thresholds[i], socket); + uint256 mintedStETH = (socket.sharesMinted * _postTotalPooledEther) / _postTotalShares; //TODO: check rounding + uint256 threshold = (mintedStETH * TOTAL_BASIS_POINTS) / (TOTAL_BASIS_POINTS - socket.reserveRatioThresholdBP); + _epicrisis(_valuations[i], threshold, socket); IStakingVault(socket.vault).report(_valuations[i], _inOutDeltas[i], _locked[i]);