adjust tick limit and fix swap loop breaking
This commit is contained in:
parent
5976a1da35
commit
76b91ade47
|
@ -9,7 +9,7 @@ use crate::{err, function, location, trace};
|
|||
pub const TICK_LIMIT: i32 = 44_364; // If you change it update length of array as well!
|
||||
pub const TICK_SEARCH_RANGE: i32 = 256;
|
||||
pub const MAX_TICK: i32 = 221_818; // log(1.0001, sqrt(2^64-1))
|
||||
pub const TICK_CROSSES_PER_IX: usize = 4;
|
||||
pub const TICK_CROSSES_PER_IX: usize = 10;
|
||||
pub const TICKS_BACK_COUNT: usize = 1;
|
||||
pub const TICKMAP_SIZE: i32 = 2 * TICK_LIMIT - 1;
|
||||
|
||||
|
|
|
@ -223,13 +223,14 @@ impl InvariantEdge {
|
|||
} else {
|
||||
virtual_cross_counter =
|
||||
virtual_cross_counter.checked_add(1).ok_or("add overflow")?;
|
||||
if InvariantSwapResult::break_swap_loop_early(
|
||||
used_ticks.len() as u16,
|
||||
virtual_cross_counter,
|
||||
)? {
|
||||
global_insufficient_liquidity = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if InvariantSwapResult::break_swap_loop_early(
|
||||
used_ticks.len() as u16,
|
||||
virtual_cross_counter,
|
||||
)? {
|
||||
global_insufficient_liquidity = true;
|
||||
break;
|
||||
}
|
||||
|
||||
pool.current_tick_index = if x_to_y && is_enough_amount_to_cross {
|
||||
|
|
Loading…
Reference in New Issue