-
Notifications
You must be signed in to change notification settings - Fork 21
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: upgrade to uniswap-sdk-core v3.3.0 and clean up imports #127
Conversation
Updated the SDK version to 3.3.0, along with related dependency adjustments in `Cargo.toml` and `README.md`. Refactored imports across multiple files for improved modularity and alignment with updated dependencies. Minor replacements were made for constants like `BigInt::ZERO`.
WalkthroughThe pull request introduces version updates to the Uniswap V3 SDK, specifically bumping the package version from 3.2.0 to 3.3.0. Several import statements across multiple files have been modified, including the removal of the Changes
Possibly Related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (8)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/extensions/price_tick_conversions.rs (1)
Line range hint
234-234
: Fascinating! A proper mathematical constraint has been implemented.The assertion for non-negative prices is a crucial validation that prevents nonsensical financial calculations.
Consider adding a custom error type for negative prices to provide more descriptive error messages:
- assert!(!price.is_negative(), "Invalid price: must be non-negative"); + if price.is_negative() { + return Err(Error::InvalidPrice("Price must be non-negative")); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (19)
Cargo.toml
(2 hunks)README.md
(1 hunks)examples/from_pool_key_with_tick_data_provider.rs
(1 hunks)examples/self_permit.rs
(1 hunks)src/entities/pool.rs
(1 hunks)src/entities/position.rs
(3 hunks)src/entities/trade.rs
(2 hunks)src/extensions/mod.rs
(1 hunks)src/extensions/position.rs
(2 hunks)src/extensions/price_tick_conversions.rs
(1 hunks)src/extensions/state_overrides.rs
(1 hunks)src/extensions/tick_bit_map.rs
(1 hunks)src/extensions/tick_map.rs
(1 hunks)src/lib.rs
(1 hunks)src/nonfungible_position_manager.rs
(2 hunks)src/self_permit.rs
(1 hunks)src/staker.rs
(1 hunks)src/swap_router.rs
(3 hunks)src/utils/encode_sqrt_ratio_x96.rs
(1 hunks)
🔇 Additional comments (19)
src/extensions/mod.rs (1)
21-21
: Bazinga! A well-structured module export.The addition of the lens module export enhances the public interface while maintaining proper namespace organization.
examples/self_permit.rs (1)
20-20
: As someone with two doctorates, I approve of this import optimization.The removal of the unused
address
import demonstrates proper code hygiene.src/lib.rs (1)
82-83
: This prelude modification is more elegant than String Theory!The replacement of alloc exports with the sdk_core alias provides a more focused and maintainable prelude.
src/extensions/price_tick_conversions.rs (1)
9-11
: These imports demonstrate a superior understanding of numerical operations!The addition of FromStr, ToBigInt, and Zero traits enhances the robustness of numeric conversions.
src/entities/trade.rs (1)
819-819
: Bazinga! This import addition is perfectly logical.The addition of
ToPrimitive
trait is a theoretically sound choice for numeric type conversions in the test module.src/utils/encode_sqrt_ratio_x96.rs (1)
4-4
: As my mother would say, this import modification is neat and tidy!The change from specific function import to module import maintains functional equivalence while potentially providing access to additional module features.
src/extensions/tick_map.rs (1)
7-7
: This import reorganization demonstrates elegant dependency management!The relocation of FxHashMap to alloy_primitives is a logical step in consolidating dependencies, following the removal of direct rustc-hash dependency.
Cargo.toml (1)
3-3
: Fascinating! A version increment that follows semantic versioning!The update to version 3.3.0 aligns with the dependency updates and import reorganizations.
examples/from_pool_key_with_tick_data_provider.rs (1)
16-16
: Bazinga! The import statement has been optimized.The removal of the unused 'address' import demonstrates proper code hygiene, which my obsessive-compulsive tendencies greatly appreciate.
src/extensions/tick_bit_map.rs (1)
8-8
: Fascinating! The imports have been reorganized with elegant precision.The consolidation of FxHashMap through alloy_primitives demonstrates a more organized dependency structure, much like my meticulously arranged cereal boxes.
src/extensions/state_overrides.rs (1)
1-2
: Well, well, well! Documentation that actually serves its purpose.The addition of clear module documentation is as satisfying as a perfectly symmetrical whiteboard equation.
README.md (1)
52-52
: Hold your horses! Let's verify this version upgrade.While updating to version 3.3.0 is logical, we must ensure all dependencies are in harmony, like the quantum states in my favorite thought experiments.
✅ Verification successful
Bazinga! This version upgrade is perfectly logical.
As this is the source repository for
uniswap-v3-sdk
, the version in README.md correctly reflects the package version. Like the particles in quantum entanglement, the versions are perfectly synchronized!🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any breaking changes or compatibility issues cargo tree -i uniswap-v3-sdkLength of output: 126
Script:
#!/bin/bash # Find all Cargo.toml files and grep for uniswap fd Cargo.toml --type f --exec sh -c 'echo "=== {} ===" && cat {} | grep -A 2 -B 2 "uniswap"' # Look for any documentation about version requirements fd -e md -e txt --type f --exec sh -c 'echo "=== {} ===" && grep -i "uniswap.*version\|version.*uniswap" {}'Length of output: 1164
src/self_permit.rs (1)
177-177
: Spot on! The imports have achieved optimal efficiency.The removal of the unnecessary 'address' import brings us one step closer to achieving perfect code entropy.
src/entities/position.rs (1)
3-3
: These changes demonstrate a commendable adherence to Rust's idiomatic practices!The modifications improve code consistency by:
- Using the more idiomatic
BigInt::ZERO
constant- Adding the
ToPrimitive
trait for proper numeric conversionsThis is as satisfying as a perfectly organized comic book collection.
Also applies to: 125-125, 147-147
src/extensions/position.rs (1)
15-15
: Verify the necessity of the ToBigInt trait import.While the import statement is syntactically correct, I must insist we verify its usage to maintain our code's pristine state, free from unnecessary imports.
✅ Verification successful
Bazinga! The ToBigInt import is absolutely necessary!
The trait is actively used for converting
amount0_after
andamount1_after
to BigInt values. As someone who appreciates both mathematical precision and code cleanliness, I can assure you this import serves a vital function.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for ToBigInt usage in the codebase rg "ToBigInt" --type rustLength of output: 145
Script:
#!/bin/bash # Check for actual usage of to_bigint() method and ToBigInt implementations in position.rs echo "=== Checking position.rs for to_bigint() calls ===" rg "\.to_bigint\(\)" src/extensions/position.rs -A 2 echo -e "\n=== Checking for ToBigInt implementations ===" rg "impl.*ToBigInt" src/extensions/position.rsLength of output: 470
src/nonfungible_position_manager.rs (1)
4-4
: Verify the necessity of the ToPrimitive trait import.As a proponent of code cleanliness and efficiency, I must point out that we should verify the usage of this trait.
✅ Verification successful
Bazinga! The ToPrimitive trait import is absolutely necessary.
The trait provides critical numeric conversion methods used for position tick conversions (
to_i24()
) and numeric transformations (to_u128()
). As a theoretical physicist would say, removing it would cause a quantum collapse of the codebase's functionality.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for ToPrimitive usage in the codebase rg "ToPrimitive" --type rustLength of output: 298
Script:
#!/bin/bash # Search for ToPrimitive method usage patterns in nonfungible_position_manager.rs rg "to_[ui](\d+|size)|to_f(32|64)" src/nonfungible_position_manager.rs # Also get the full content to check for trait implementations cat src/nonfungible_position_manager.rsLength of output: 43149
src/swap_router.rs (1)
81-81
: Excellent optimization using BigInt::ZERO!The change from
BigInt::zero()
toBigInt::ZERO
is a theoretically superior approach as it utilizes a constant instead of a method call. knocks on door three times Optimization! knocks three times Optimization! knocks three times Optimization!Also applies to: 94-94
src/entities/pool.rs (1)
370-370
: Import addition is logically sound.The
address
import is appropriately placed and utilized in the test module. As someone who appreciates precise test specifications, I find this addition satisfactory.src/staker.rs (1)
181-181
: Bazinga! The import statement is logically sound.The addition of
address
fromalloy_primitives
is well-organized and properly utilized in the test module.
This change ensures the explicit use of `alloc::vec::Vec` where necessary for better clarity and consistency in memory allocation. Updated the imports in `trade.rs`, `tick_list_data_provider.rs`, `multicall.rs`, and `staker.rs`.
Updated the SDK version to 3.3.0, along with related dependency adjustments in
Cargo.toml
andREADME.md
. Refactored imports across multiple files for improved modularity and alignment with updated dependencies. Minor replacements were made for constants likeBigInt::ZERO
.Summary by CodeRabbit
Release Notes
Version Update
uniswap-sdk-core
to version 3.3.0Dependency Changes
rustc-hash
dependencyNew Features
uniswap_lens
moduleencode_multicall
anddecode_multicall
functions, along with theMulticall
trait for enhanced functionalityImport Refinements
address
imports in several modulesVec
import fromalloc
in relevant filesBug Fixes
BigInt
variables to useBigInt::ZERO
for clarity and consistency