File tree 3 files changed +26
-3
lines changed
3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,11 @@ contract Dashboard is Permissions {
166
166
}
167
167
168
168
/**
169
- * @notice Returns the overall capacity of stETH shares that can be minted by the vault bound by valuation and vault share limit.
169
+ * @notice Returns the overall capacity of stETH shares that can be minted by the vault bound by valuation, unmintable valuation and vault share limit.
170
170
* @return The maximum number of mintable stETH shares not counting already minted ones.
171
171
*/
172
172
function totalMintableShares () public view returns (uint256 ) {
173
- return _totalMintableShares (stakingVault ().valuation ());
173
+ return _totalMintableShares (stakingVault ().valuation () - _unmintableValuation () );
174
174
}
175
175
176
176
/**
@@ -179,7 +179,7 @@ contract Dashboard is Permissions {
179
179
* @return the maximum number of shares that can be minted by ether
180
180
*/
181
181
function projectedNewMintableShares (uint256 _etherToFund ) external view returns (uint256 ) {
182
- uint256 _totalShares = _totalMintableShares (stakingVault ().valuation () + _etherToFund);
182
+ uint256 _totalShares = _totalMintableShares (stakingVault ().valuation () + _etherToFund - _unmintableValuation () );
183
183
uint256 _sharesMinted = vaultSocket ().sharesMinted;
184
184
185
185
if (_totalShares < _sharesMinted) return 0 ;
Original file line number Diff line number Diff line change @@ -217,6 +217,10 @@ contract Delegation is Dashboard {
217
217
super ._withdraw (_recipient, _ether);
218
218
}
219
219
220
+ function _unmintableValuation () internal view override returns (uint256 ) {
221
+ return nodeOperatorUnclaimedFee ();
222
+ }
223
+
220
224
/**
221
225
* @dev Emitted when the node operator fee is set.
222
226
* @param oldNodeOperatorFeeBP The old node operator fee.
Original file line number Diff line number Diff line change @@ -199,6 +199,7 @@ abstract contract Permissions is AccessControlConfirmable {
199
199
*/
200
200
function _mintShares (address _recipient , uint256 _shares ) internal onlyRole (MINT_ROLE) {
201
201
vaultHub.mintShares (address (stakingVault ()), _recipient, _shares);
202
+ _ensureUnmintableValuation ();
202
203
}
203
204
204
205
/**
@@ -286,6 +287,19 @@ abstract contract Permissions is AccessControlConfirmable {
286
287
}
287
288
}
288
289
290
+ function _unmintableValuation () internal view virtual returns (uint256 ) {
291
+ return 0 ;
292
+ }
293
+
294
+ function _ensureUnmintableValuation () internal view {
295
+ uint256 locked = stakingVault ().locked ();
296
+ uint256 valuation = stakingVault ().valuation ();
297
+
298
+ if (locked > valuation - _unmintableValuation ()) {
299
+ revert UnmintableValuationBreached (locked, valuation, _unmintableValuation ());
300
+ }
301
+ }
302
+
289
303
/**
290
304
* @notice Emitted when the contract is initialized
291
305
*/
@@ -306,4 +320,9 @@ abstract contract Permissions is AccessControlConfirmable {
306
320
* @param argument Name of the argument
307
321
*/
308
322
error ZeroArgument (string argument );
323
+
324
+ /**
325
+ * @notice Error when unmintable valuation is breached
326
+ */
327
+ error UnmintableValuationBreached (uint256 locked , uint256 valuation , uint256 unmintableValuation );
309
328
}
You can’t perform that action at this time.
0 commit comments