Skip to content

Commit

Permalink
Revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
calintje committed Nov 15, 2024
1 parent 5c1bfc0 commit ccffacd
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/whirlpool/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ export default {
darkTheme: themes.dracula,
},
},
};
};
2 changes: 1 addition & 1 deletion docs/whirlpool/src/theme/DocCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ export default function DocCard({item}) {
default:
throw new Error(`unknown item type ${JSON.stringify(item)}`);
}
}
}
2 changes: 1 addition & 1 deletion legacy-sdk/whirlpool/src/types/public/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ export const FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD = 32768;
* The tick spacing for splash pools.
* @category Constants
*/
export const SPLASH_POOL_TICK_SPACING = 32896;
export const SPLASH_POOL_TICK_SPACING = 32896;
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ pub fn handler(
)?;

Ok(())
}
}
2 changes: 1 addition & 1 deletion programs/whirlpool/src/math/token_math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,4 @@ mod test_get_amount_delta {
assert!(get_amount_delta_a(1 << 64, 2 << 64, (u64::MAX as u128) << 1, true).is_ok());
assert!(get_amount_delta_a(1 << 64, 2 << 64, u64::MAX as u128, true).is_ok());
}
}
}
2 changes: 1 addition & 1 deletion programs/whirlpool/src/tests/swap_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,4 @@ fn derive_last_tick_in_seq(start_tick: i32, tick_spacing: u16, a_to_b: bool) ->
start_tick + (3 * num_of_ticks_in_array) - 1
};
potential_last.clamp(MIN_TICK_INDEX, MAX_TICK_INDEX)
}
}
21 changes: 6 additions & 15 deletions rust-sdk/core/src/math/tick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use ethnum::U256;
use orca_whirlpools_macros::wasm_expose;

use crate::{
ErrorCode, TickRange, FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD, MAX_TICK_INDEX, MIN_TICK_INDEX,
TICK_ARRAY_SIZE, TICK_INDEX_NOT_IN_ARRAY, U128,
ErrorCode, TickRange, FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD, MAX_TICK_INDEX, MIN_TICK_INDEX, TICK_ARRAY_SIZE, TICK_INDEX_NOT_IN_ARRAY, U128
};

const LOG_B_2_X32: i128 = 59543866431248i128;
Expand Down Expand Up @@ -314,7 +313,8 @@ pub fn get_tick_index_in_array(
if tick_index >= tick_array_start_index + (TICK_ARRAY_SIZE as i32) * (tick_spacing as i32) {
return Err(TICK_INDEX_NOT_IN_ARRAY);
}
let result = (tick_index - tick_array_start_index).unsigned_abs() / (tick_spacing as u32);
let result = (tick_index - tick_array_start_index)
.unsigned_abs() / (tick_spacing as u32);
Ok(result)
}

Expand Down Expand Up @@ -612,18 +612,9 @@ mod tests {
assert_eq!(get_tick_index_in_array(-780, -880, 10), Ok(10));

// Outside of the tick array
assert_eq!(
get_tick_index_in_array(880, 0, 10),
Err(TICK_INDEX_NOT_IN_ARRAY)
);
assert_eq!(
get_tick_index_in_array(-1, 0, 10),
Err(TICK_INDEX_NOT_IN_ARRAY)
);
assert_eq!(
get_tick_index_in_array(-881, -880, 10),
Err(TICK_INDEX_NOT_IN_ARRAY)
);
assert_eq!(get_tick_index_in_array(880, 0, 10), Err(TICK_INDEX_NOT_IN_ARRAY));
assert_eq!(get_tick_index_in_array(-1, 0, 10), Err(TICK_INDEX_NOT_IN_ARRAY));
assert_eq!(get_tick_index_in_array(-881, -880, 10), Err(TICK_INDEX_NOT_IN_ARRAY));

// Splash pool tick spacing
assert_eq!(get_tick_index_in_array(2861952, 0, 32896), Ok(87));
Expand Down
3 changes: 2 additions & 1 deletion rust-sdk/integration/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ const versionConfigs: RustConfig[] = [
];

describe("Integration", () => {

beforeEach(() => {
if (existsSync("Cargo.lock")) {
rmSync("Cargo.lock");
}
});
})

versionConfigs.forEach((config) => {
it(`Build using '${JSON.stringify(config)}'`, () => {
Expand Down

0 comments on commit ccffacd

Please sign in to comment.