diff --git a/crates/hyperdrive-math/src/lib.rs b/crates/hyperdrive-math/src/lib.rs index 887fa86b..c5600c43 100644 --- a/crates/hyperdrive-math/src/lib.rs +++ b/crates/hyperdrive-math/src/lib.rs @@ -161,7 +161,7 @@ impl State { /// Calculates the pool reserve levels to achieve a target interest rate. /// This calculation does not take into account Hyperdrive's solvency - /// constraints, share adjustments, or exposure and shouldn't be used + /// constraints or exposure and shouldn't be used /// directly. /// /// The price for a given fixed-rate is given by @@ -177,7 +177,7 @@ impl State { /// For a target rate, `$r_t$`, the pool share reserves, `$z_t$`, must be: /// /// ```math - /// z_t = \frac{1}{\mu} \left( + /// z_t = \zeta + \frac{1}{\mu} \left( /// \frac{k}{\frac{c}{\mu} + \left( /// (r_t \cdot t + 1)^{\frac{1}{t_s}} /// \right)^{1 - t_{s}}} @@ -208,7 +208,10 @@ impl State { let inner = (self.k_down()? / (c_over_mu + scaled_rate.pow(fixed!(1e18) - self.time_stretch())?)) .pow(fixed!(1e18) / (fixed!(1e18) - self.time_stretch()))?; - let target_share_reserves = inner / self.initial_vault_share_price(); + let target_effective_share_reserves = inner / self.initial_vault_share_price(); + let target_share_reserves = FixedPoint::try_from( + I256::try_from(target_effective_share_reserves)? + self.share_adjustment(), + )?; // Then get the target bond reserves. let target_bond_reserves = inner * scaled_rate; diff --git a/crates/hyperdrive-math/src/long/targeted.rs b/crates/hyperdrive-math/src/long/targeted.rs index 9a7863d3..3d9b9f77 100644 --- a/crates/hyperdrive-math/src/long/targeted.rs +++ b/crates/hyperdrive-math/src/long/targeted.rs @@ -51,7 +51,7 @@ impl State { let checkpoint_exposure = checkpoint_exposure.into(); let allowable_error = match maybe_allowable_error { Some(allowable_error) => allowable_error.into(), - None => fixed!(1e14), + None => fixed!(1e15), }; let current_rate = self.calculate_spot_rate()?; if target_rate >= current_rate {