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

chore: update dependencies and refactor code #104

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uniswap-v3-sdk"
version = "2.5.0"
version = "2.6.0"
edition = "2021"
authors = ["Shuhui Luo <twitter.com/aureliano_law>"]
description = "Uniswap V3 SDK for Rust"
Expand All @@ -14,7 +14,7 @@ exclude = [".github", ".gitignore", "rustfmt.toml"]
all-features = true

[dependencies]
alloy = { version = "0.5", optional = true, features = ["contract"] }
alloy = { version = "0.6", optional = true, features = ["contract"] }
alloy-primitives = "0.8"
alloy-sol-types = "0.8"
anyhow = { version = "1.0", optional = true }
Expand All @@ -29,7 +29,7 @@ regex = { version = "1.11", optional = true }
rustc-hash = "2.0"
serde_json = { version = "1.0", optional = true }
thiserror = { version = "2", default-features = false }
uniswap-lens = { version = "0.6", optional = true }
uniswap-lens = { version = "0.7", optional = true }
uniswap-sdk-core = "3.1.0"

[features]
Expand All @@ -38,8 +38,8 @@ extensions = ["alloy", "anyhow", "base64", "regex", "serde_json", "uniswap-lens"
std = ["alloy?/std", "thiserror/std", "uniswap-sdk-core/std", "uniswap-lens?/std"]

[dev-dependencies]
alloy-signer = "0.5"
alloy-signer-local = "0.5"
alloy-signer = "0.6"
alloy-signer-local = "0.6"
criterion = "0.5.1"
dotenv = "0.15.0"
tokio = { version = "1.40", features = ["full"] }
Expand Down
24 changes: 10 additions & 14 deletions src/entities/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,12 @@ impl<TP: Clone + TickDataProvider> Pool<TP> {
};
Ok((
CurrencyAmount::from_raw_amount(output_token, -output_amount.to_big_int())?,
Self::new_with_tick_data_provider(
self.token0.clone(),
self.token1.clone(),
self.fee,
sqrt_price_x96,
Self {
sqrt_ratio_x96: sqrt_price_x96,
tick_current: TP::Index::from_i24(sqrt_price_x96.get_tick_at_sqrt_ratio()?),
liquidity,
self.tick_data_provider.clone(),
)?,
..self.clone()
},
shuhuiluo marked this conversation as resolved.
Show resolved Hide resolved
))
}

Expand Down Expand Up @@ -355,14 +353,12 @@ impl<TP: Clone + TickDataProvider> Pool<TP> {
};
Ok((
CurrencyAmount::from_raw_amount(input_token, input_amount.to_big_int())?,
Self::new_with_tick_data_provider(
self.token0.clone(),
self.token1.clone(),
self.fee,
sqrt_price_x96,
Self {
sqrt_ratio_x96: sqrt_price_x96,
tick_current: TP::Index::from_i24(sqrt_price_x96.get_tick_at_sqrt_ratio()?),
liquidity,
self.tick_data_provider.clone(),
)?,
..self.clone()
},
shuhuiluo marked this conversation as resolved.
Show resolved Hide resolved
))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/nonfungible_position_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ pub fn safe_transfer_from_parameters(options: SafeTransferOptions) -> MethodPara
/// ## Examples
///
/// ```
/// use alloy_primitives::{address, b256, uint, Signature, B256};
/// use alloy_primitives::{address, b256, uint, PrimitiveSignature, B256};
/// use alloy_signer::SignerSync;
/// use alloy_signer_local::PrivateKeySigner;
/// use alloy_sol_types::SolStruct;
Expand All @@ -458,7 +458,7 @@ pub fn safe_transfer_from_parameters(options: SafeTransferOptions) -> MethodPara
/// let hash: B256 = data.values.eip712_signing_hash(&data.domain);
///
/// let signer = PrivateKeySigner::random();
/// let signature: Signature = signer.sign_hash_sync(&hash).unwrap();
/// let signature: PrimitiveSignature = signer.sign_hash_sync(&hash).unwrap();
/// assert_eq!(
/// signature.recover_address_from_prehash(&hash).unwrap(),
/// signer.address()
Expand Down
4 changes: 2 additions & 2 deletions src/self_permit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct ERC20PermitData<P: SolStruct> {
/// ## Examples
///
/// ```
/// use alloy_primitives::{address, b256, uint, Signature, B256};
/// use alloy_primitives::{address, b256, uint, PrimitiveSignature, B256};
shuhuiluo marked this conversation as resolved.
Show resolved Hide resolved
/// use alloy_signer::SignerSync;
/// use alloy_signer_local::PrivateKeySigner;
/// use alloy_sol_types::SolStruct;
Expand Down Expand Up @@ -67,7 +67,7 @@ pub struct ERC20PermitData<P: SolStruct> {
/// // Derive the EIP-712 signing hash.
/// let hash: B256 = data.values.eip712_signing_hash(&data.domain);
///
/// let signature: Signature = signer.sign_hash_sync(&hash).unwrap();
/// let signature: PrimitiveSignature = signer.sign_hash_sync(&hash).unwrap();
/// assert_eq!(
/// signature.recover_address_from_prehash(&hash).unwrap(),
/// signer.address()
Expand Down