diff --git a/contracts/src/internal/HyperdriveShort.sol b/contracts/src/internal/HyperdriveShort.sol index 38f9171a4..ea708ed86 100644 --- a/contracts/src/internal/HyperdriveShort.sol +++ b/contracts/src/internal/HyperdriveShort.sol @@ -629,6 +629,20 @@ abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP { // accounting updates. shareReservesDelta -= totalGovernanceFee; + // Ensure that the ending spot price is less than 1. + if ( + HyperdriveMath.calculateSpotPrice( + _effectiveShareReserves() + shareCurveDelta, + _marketState.bondReserves - bondReservesDelta, + _initialVaultSharePrice, + _timeStretch + ) > ONE + ) { + Errors.throwInsufficientLiquidityError( + IHyperdrive.InsufficientLiquidityReason.NegativeInterest + ); + } + // Adjust the computed proceeds and delta for negative interest. // We also compute the share adjustment delta at this step to ensure // that we don't break our AMM invariant when we account for negative @@ -649,19 +663,5 @@ abstract contract HyperdriveShort is IHyperdriveEvents, HyperdriveLP { false ); } - - // Ensure that the ending spot price is less than 1. - if ( - HyperdriveMath.calculateSpotPrice( - _effectiveShareReserves() + shareCurveDelta, - _marketState.bondReserves - bondReservesDelta, - _initialVaultSharePrice, - _timeStretch - ) > ONE - ) { - Errors.throwInsufficientLiquidityError( - IHyperdrive.InsufficientLiquidityReason.NegativeInterest - ); - } } }