@@ -76,7 +76,7 @@ contract OperatorStaking is ERC1363Upgradeable, ReentrancyGuardTransient, UUPSUp
7676 error InvalidController ();
7777
7878 /// @dev Thrown when liquid asset balance is insufficient to cover pending redemptions in {stakeExcess}.
79- error InsufficientLiquidBalance (uint256 liquidBalance , uint256 assetsPendingRedemption );
79+ error NoExcessBalance (uint256 liquidBalance , uint256 assetsPendingRedemption );
8080
8181 modifier onlyOwner () {
8282 require (msg .sender == owner (), CallerNotProtocolStakingOwner (msg .sender ));
@@ -242,17 +242,15 @@ contract OperatorStaking is ERC1363Upgradeable, ReentrancyGuardTransient, UUPSUp
242242 *
243243 * NOTE: Excess tokens will be in the `OperatorStaking` contract the operator is slashed
244244 * during a redemption flow or if donations are made to it. Anyone can call this function to
245- * restake those tokens.
245+ * restake those tokens. This function will revert if the liquid balance is less than or equal
246+ * to the amount of assets in pending redemption .
246247 */
247248 function stakeExcess () public virtual {
248249 ProtocolStaking protocolStaking_ = protocolStaking ();
249250 protocolStaking_.release (address (this ));
250251 uint256 liquidBalance = IERC20 (asset ()).balanceOf (address (this ));
251252 uint256 assetsPendingRedemption = previewRedeem (totalSharesInRedemption ());
252- require (
253- liquidBalance >= assetsPendingRedemption,
254- InsufficientLiquidBalance (liquidBalance, assetsPendingRedemption)
255- );
253+ require (liquidBalance > assetsPendingRedemption, NoExcessBalance (liquidBalance, assetsPendingRedemption));
256254 uint256 amountToRestake = liquidBalance - assetsPendingRedemption;
257255 protocolStaking_.stake (amountToRestake);
258256 }
0 commit comments