File tree Expand file tree Collapse file tree 1 file changed +1
-14
lines changed
crates/hyperdrive-math/src/test_utils Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change @@ -134,23 +134,10 @@ pub fn get_max_short(
134134 maybe_max_num_tries : Option < usize > ,
135135) -> Result < FixedPoint < U256 > > {
136136 let max_num_tries = maybe_max_num_tries. unwrap_or ( 10 ) ;
137-
138137 // We linearly interpolate between the current spot price and the minimum
139138 // price that the pool can support. This is a conservative estimate of
140139 // the short's realized price.
141- let conservative_price = {
142- // We estimate the minimum price that short will pay by a
143- // weighted average of the spot price and the minimum possible
144- // spot price the pool can quote. We choose the weights so that this
145- // is an underestimate of the worst case realized price.
146- let spot_price = state. calculate_spot_price ( ) ?;
147- let min_price = state. calculate_min_spot_price ( ) ?;
148-
149- // Calculate the linear interpolation.
150- let weight = fixed ! ( 1e18 ) . pow ( fixed ! ( 1e18 ) - state. time_stretch ( ) ) ?;
151- spot_price * ( fixed ! ( 1e18 ) - weight) + min_price * weight
152- } ;
153-
140+ let conservative_price = state. calculate_conservative_short_price ( fixed ! ( 1e18 ) ) ?;
154141 // Compute the max short.
155142 let mut max_short = match panic:: catch_unwind ( || {
156143 state. calculate_max_short (
You can’t perform that action at this time.
0 commit comments