@@ -405,12 +405,7 @@ abstract contract VaultHub is PausableUntilWithRoles {
405
405
uint256 _preTotalShares ,
406
406
uint256 _preTotalPooledEther ,
407
407
uint256 _sharesToMintAsFees
408
- ) internal view returns (
409
- uint256 [] memory lockedEther ,
410
- uint256 [] memory thresholdEther ,
411
- uint256 [] memory treasuryFeeShares ,
412
- uint256 totalTreasuryFeeShares
413
- ) {
408
+ ) internal view returns (uint256 [] memory lockedEther , uint256 [] memory treasuryFeeShares , uint256 totalTreasuryFeeShares ) {
414
409
/// HERE WILL BE ACCOUNTING DRAGON
415
410
416
411
// \||/
@@ -431,7 +426,6 @@ abstract contract VaultHub is PausableUntilWithRoles {
431
426
432
427
treasuryFeeShares = new uint256 [](length);
433
428
lockedEther = new uint256 [](length);
434
- thresholdEther = new uint256 [](length);
435
429
436
430
for (uint256 i = 0 ; i < length; ++ i) {
437
431
VaultSocket memory socket = $.sockets[i + 1 ];
@@ -452,9 +446,6 @@ abstract contract VaultHub is PausableUntilWithRoles {
452
446
(mintedStETH * TOTAL_BASIS_POINTS) / (TOTAL_BASIS_POINTS - socket.reserveRatioBP),
453
447
CONNECT_DEPOSIT
454
448
);
455
-
456
- // Minimum amount of ether that should be in the vault to avoid unbalanced state
457
- thresholdEther[i] = (mintedStETH * TOTAL_BASIS_POINTS) / (TOTAL_BASIS_POINTS - socket.reserveRatioThresholdBP);
458
449
}
459
450
}
460
451
}
@@ -493,8 +484,9 @@ abstract contract VaultHub is PausableUntilWithRoles {
493
484
uint256 [] memory _valuations ,
494
485
int256 [] memory _inOutDeltas ,
495
486
uint256 [] memory _locked ,
496
- uint256 [] memory _thresholds ,
497
- uint256 [] memory _treasureFeeShares
487
+ uint256 [] memory _treasureFeeShares ,
488
+ uint256 _postTotalPooledEther ,
489
+ uint256 _postTotalShares
498
490
) internal {
499
491
VaultHubStorage storage $ = _getVaultHubStorage ();
500
492
@@ -508,7 +500,9 @@ abstract contract VaultHub is PausableUntilWithRoles {
508
500
socket.sharesMinted += uint96 (treasuryFeeShares);
509
501
}
510
502
511
- _epicrisis (_valuations[i], _thresholds[i], socket);
503
+ uint256 mintedStETH = (socket.sharesMinted * _postTotalPooledEther) / _postTotalShares; //TODO: check rounding
504
+ uint256 threshold = (mintedStETH * TOTAL_BASIS_POINTS) / (TOTAL_BASIS_POINTS - socket.reserveRatioThresholdBP);
505
+ _epicrisis (_valuations[i], threshold, socket);
512
506
513
507
514
508
IStakingVault (socket.vault).report (_valuations[i], _inOutDeltas[i], _locked[i]);
0 commit comments