Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unused sqrtPriceLimitX96 field from swap structs #25

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ sol! {
bool zeroForOne;
uint128 amountIn;
uint128 amountOutMinimum;
uint160 sqrtPriceLimitX96;
bytes hookData;
}

Expand All @@ -81,7 +80,6 @@ sol! {
bool zeroForOne;
uint128 amountOut;
uint128 amountInMaximum;
uint160 sqrtPriceLimitX96;
bytes hookData;
}

Expand Down
4 changes: 1 addition & 3 deletions src/utils/v4_base_actions_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn parse_calldata(calldata: &Bytes) -> Result<V4RouterCall, Error> {
mod tests {
use super::*;
use crate::{prelude::*, tests::*};
use alloy_primitives::{address, uint, Address, U160, U256};
use alloy_primitives::{address, uint, Address, U256};
use once_cell::sync::Lazy;
use uniswap_v3_sdk::prelude::{encode_sqrt_ratio_x96, FeeAmount};

Expand Down Expand Up @@ -88,15 +88,13 @@ mod tests {
zeroForOne: true,
amountIn: AMOUNT.try_into().unwrap(),
amountOutMinimum: AMOUNT.try_into().unwrap(),
sqrtPriceLimitX96: U160::ZERO,
hookData: Bytes::default(),
}),
Actions::SWAP_EXACT_OUT_SINGLE(SwapExactOutSingleParams {
poolKey: USDC_WETH.pool_key.clone(),
zeroForOne: true,
amountOut: AMOUNT.try_into().unwrap(),
amountInMaximum: AMOUNT.try_into().unwrap(),
sqrtPriceLimitX96: U160::ZERO,
hookData: Bytes::default(),
}),
Actions::SWAP_EXACT_IN(SwapExactInParams {
Expand Down
5 changes: 2 additions & 3 deletions src/utils/v4_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ mod tests {
prelude::{Pool, Route},
tests::*,
};
use alloy_primitives::{hex, U160};
use alloy_primitives::hex;
use once_cell::sync::Lazy;

static USDC_WETH: Lazy<Pool<Vec<Tick>>> = Lazy::new(|| {
Expand Down Expand Up @@ -334,13 +334,12 @@ mod tests {
zeroForOne: true,
amountIn: ONE_ETHER,
amountOutMinimum: ONE_ETHER / 2,
sqrtPriceLimitX96: U160::ZERO,
hookData: Bytes::default(),
}));
assert_eq!(planner.actions, vec![0x06]);
assert_eq!(
planner.params[0],
hex!("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000").to_vec()
hex!("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000").to_vec()
);
}

Expand Down
Loading