Skip to content

Commit 17c910c

Browse files
authored
fix: remove unused sqrtPriceLimitX96 field from swap structs (#25)
The `sqrtPriceLimitX96` field has been removed from swap-related structs and associated test cases. This cleanup eliminates redundant dependencies and simplifies the struct definitions.
1 parent f193180 commit 17c910c

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

src/abi.rs

-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ sol! {
6363
bool zeroForOne;
6464
uint128 amountIn;
6565
uint128 amountOutMinimum;
66-
uint160 sqrtPriceLimitX96;
6766
bytes hookData;
6867
}
6968

@@ -81,7 +80,6 @@ sol! {
8180
bool zeroForOne;
8281
uint128 amountOut;
8382
uint128 amountInMaximum;
84-
uint160 sqrtPriceLimitX96;
8583
bytes hookData;
8684
}
8785

src/utils/v4_base_actions_parser.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn parse_calldata(calldata: &Bytes) -> Result<V4RouterCall, Error> {
2424
mod tests {
2525
use super::*;
2626
use crate::{prelude::*, tests::*};
27-
use alloy_primitives::{address, uint, Address, U160, U256};
27+
use alloy_primitives::{address, uint, Address, U256};
2828
use once_cell::sync::Lazy;
2929
use uniswap_v3_sdk::prelude::{encode_sqrt_ratio_x96, FeeAmount};
3030

@@ -88,15 +88,13 @@ mod tests {
8888
zeroForOne: true,
8989
amountIn: AMOUNT.try_into().unwrap(),
9090
amountOutMinimum: AMOUNT.try_into().unwrap(),
91-
sqrtPriceLimitX96: U160::ZERO,
9291
hookData: Bytes::default(),
9392
}),
9493
Actions::SWAP_EXACT_OUT_SINGLE(SwapExactOutSingleParams {
9594
poolKey: USDC_WETH.pool_key.clone(),
9695
zeroForOne: true,
9796
amountOut: AMOUNT.try_into().unwrap(),
9897
amountInMaximum: AMOUNT.try_into().unwrap(),
99-
sqrtPriceLimitX96: U160::ZERO,
10098
hookData: Bytes::default(),
10199
}),
102100
Actions::SWAP_EXACT_IN(SwapExactInParams {

src/utils/v4_planner.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ mod tests {
229229
prelude::{Pool, Route},
230230
tests::*,
231231
};
232-
use alloy_primitives::{hex, U160};
232+
use alloy_primitives::hex;
233233
use once_cell::sync::Lazy;
234234

235235
static USDC_WETH: Lazy<Pool<Vec<Tick>>> = Lazy::new(|| {
@@ -334,13 +334,12 @@ mod tests {
334334
zeroForOne: true,
335335
amountIn: ONE_ETHER,
336336
amountOutMinimum: ONE_ETHER / 2,
337-
sqrtPriceLimitX96: U160::ZERO,
338337
hookData: Bytes::default(),
339338
}));
340339
assert_eq!(planner.actions, vec![0x06]);
341340
assert_eq!(
342341
planner.params[0],
343-
hex!("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000").to_vec()
342+
hex!("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000").to_vec()
344343
);
345344
}
346345

0 commit comments

Comments
 (0)