@@ -263,10 +263,10 @@ export const getOpenAuction = (
263263 // calculate progressions
264264
265265 // {wholeBU/wholeShare} = {USD/wholeShare} / {USD/wholeBU}
266- const spotLimit = shareValue . div ( buValue ) ;
266+ const idealSpotLimit = shareValue . div ( buValue ) ;
267267
268268 // {wholeTok/wholeShare} = {wholeTok/wholeBU} * {wholeBU/wholeShare}
269- const expectedBalances = weightRanges . map ( ( weightRange ) => weightRange . spot . mul ( spotLimit ) ) ;
269+ const expectedBalances = weightRanges . map ( ( weightRange ) => weightRange . spot . mul ( idealSpotLimit ) ) ;
270270
271271 // absoluteProgression
272272 // {1} = {USD/wholeShare} / {USD/wholeShare}
@@ -361,13 +361,16 @@ export const getOpenAuction = (
361361
362362 // get new limits, constrained by extremes
363363
364+ const idealLowLimit = idealSpotLimit . mul ( ONE . sub ( delta ) ) ;
365+ const idealHighLimit = idealSpotLimit . mul ( ONE . add ( delta ) ) ;
366+
364367 // D18{BU/share} = {wholeBU/wholeShare} * D18 * {1}
365368 const newLimits = {
366- low : bn ( spotLimit . sub ( spotLimit . mul ( delta ) ) . mul ( D18d ) ) ,
367- spot : bn ( spotLimit . mul ( D18d ) ) ,
369+ low : bn ( idealLowLimit . mul ( D18d ) ) ,
370+ spot : bn ( idealSpotLimit . mul ( D18d ) ) ,
368371
369372 // hold non-eject surpluses aside if ejecting
370- high : round == AuctionRound . EJECT ? rebalance . limits . high : bn ( spotLimit . add ( spotLimit . mul ( delta ) ) . mul ( D18d ) ) ,
373+ high : round == AuctionRound . EJECT ? rebalance . limits . high : bn ( idealHighLimit . mul ( D18d ) ) ,
371374 } ;
372375
373376 // low
@@ -418,7 +421,7 @@ export const getOpenAuction = (
418421 const newWeightsD27 = {
419422 low : bn (
420423 idealWeight
421- . mul ( ONE . sub ( delta ) . div ( actualLimits . low . div ( actualLimits . spot ) ) ) // add remaining delta into weight
424+ . mul ( idealLowLimit . div ( actualLimits . low ) ) // add the portion of ` delta` we failed to propagate through to the low limit
422425 . mul ( D9d )
423426 . mul ( decimalScale [ i ] ) ,
424427 ) ,
@@ -430,7 +433,7 @@ export const getOpenAuction = (
430433 ? weightRange . high
431434 : bn (
432435 idealWeight
433- . mul ( ONE . add ( delta ) . div ( actualLimits . high . div ( actualLimits . spot ) ) ) // add remaining delta into weight
436+ . mul ( idealHighLimit . div ( actualLimits . high ) ) // add the portion of ` delta` we failed to propagate through to the high limit
434437 . mul ( D9d )
435438 . mul ( decimalScale [ i ] ) ,
436439 ) ,
0 commit comments