File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
client/src/pool-types/reclamm Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -338,6 +338,13 @@ export default function ReClamm() {
338338 setSimulationSecondsLastTick ( simulationSeconds ) ;
339339 setBlockNumber ( prev => prev + 1 ) ;
340340
341+ const { poolCenteredness : currentPoolCenteredness } = computeCenteredness ( {
342+ balanceA : currentBalanceA ,
343+ balanceB : currentBalanceB ,
344+ virtualBalanceA : currentVirtualBalances . virtualBalanceA ,
345+ virtualBalanceB : currentVirtualBalances . virtualBalanceB ,
346+ } ) ;
347+
341348 const { newVirtualBalances, newPriceRatio } = recalculateVirtualBalances ( {
342349 balanceA : realTimeBalanceA ,
343350 balanceB : realTimeBalanceB ,
@@ -358,6 +365,7 @@ export default function ReClamm() {
358365 simulationSecondsPerBlock : simulationSecondsPerBlock ,
359366 secondsSinceLastInteraction : simulationSecondsPerBlock ,
360367 } ,
368+ forceOutOfRange : currentPoolCenteredness <= margin / 100 ,
361369 } ) ;
362370
363371 setRealTimeVirtualBalances ( newVirtualBalances ) ;
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ export const recalculateVirtualBalances = (params: {
173173 simulationSecondsPerBlock : number ;
174174 secondsSinceLastInteraction : number ;
175175 } ;
176+ forceOutOfRange ?: boolean ;
176177} ) : {
177178 newVirtualBalances : {
178179 virtualBalanceA : number ;
@@ -217,7 +218,10 @@ export const recalculateVirtualBalances = (params: {
217218 virtualBalanceB : newVirtualBalanceB ,
218219 } ) ;
219220
220- if ( poolCenteredness <= params . poolParams . margin / 100 ) {
221+ if (
222+ poolCenteredness <= params . poolParams . margin / 100 ||
223+ params . forceOutOfRange
224+ ) {
221225 [ newVirtualBalanceA , newVirtualBalanceB ] =
222226 computeVirtualBalancesUpdatingPriceRange ( {
223227 balanceA : params . balanceA ,
You can’t perform that action at this time.
0 commit comments