-
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
refactor: loosen trait bound for TickDataProvider
#134
Conversation
Removed unnecessary `Clone` trait bound from multiple implementations and functions, streamlining the code where cloning wasn't needed. Updated tests and function signatures accordingly to ensure consistency. Also incremented the package version to reflect these changes.
WalkthroughThis pull request updates version numbers and refines functionality across several modules. The Cargo.toml and README.md now reflect updated package versions for uniswap-v3-sdk and uniswap-sdk-core. In src/entities/pool.rs, four new methods have been introduced to calculate and update token swap amounts with improved error handling and state mutation. In src/entities/trade.rs, two methods enable recursive evaluation of trade routes. Lastly, in src/extensions/position.rs, method signatures have been revised to accept ownership rather than mutable references, with corresponding internal logic and tests updated. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant P as Pool
C->>P: get_output_amount(input, price_limit)
P-->>C: Validate token & liquidity
P->>P: Compute swap amount
alt state change required
P->>P: Update sqrt_ratio, tick, liquidity
end
P-->>C: Return output amount or error
sequenceDiagram
participant U as User
participant T as Trade
participant P as Pool
U->>T: best_trade_exact_in(input, options)
T->>P: Query pool swap parameters
T->>T: Recursively explore trade routes
T-->>U: Return best trade candidate(s)
Possibly related PRs
Poem
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 (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
Cargo.toml
(2 hunks)README.md
(1 hunks)src/entities/pool.rs
(0 hunks)src/entities/trade.rs
(1 hunks)src/extensions/position.rs
(7 hunks)
💤 Files with no reviewable changes (1)
- src/entities/pool.rs
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Rust Tests
🔇 Additional comments (6)
src/entities/trade.rs (2)
620-620
: All clear, dear mortals.This closing brace appears merely to finalize the preceding implementation block. No concerns to raise.
622-627
: 🧹 Nitpick (assertive)Are we sure we need Clone on TP?
The PR aims to remove unneeded clone bounds. Validate if you actually require TP to be clonable. Eliminating unneeded constraints avoids extraneous copying.
src/extensions/position.rs (1)
477-480
: Ownership pass seems consistent.Passing 'position' by value aligns with the approach of returning a newly computed Position object. Ensure you truly intend to consume the old entity each time. This is acceptable if you don't reuse the original position afterwards.
Cargo.toml (2)
3-3
: Incremented version is noted.Upgrading from 3.6.0 to 3.6.1 is a trivial change. A wise move if it includes relevant bug fixes.
32-32
: 🏁 Script executed:#!/bin/bash # Attempt to check for build issues with uniswap-sdk-core v3.6.0 cargo update -p uniswap-sdk-core cargo check --all-featuresLength of output: 255
README.md (1)
53-53
: SDK Dependency Version Update: Approved, Yet Verify Consistency.
The upgrade from "3.5.0" to "3.6.0" is scientifically sound and elegantly executed, much like the precision of a theoretical physics formula. However, ensure that Cargo.toml reflects this same version update so that our dependency string does not become a source of quantum uncertainty.
Removed unnecessary
Clone
trait bound from multiple implementations and functions, streamlining the code where cloning wasn't needed. Updated tests and function signatures accordingly to ensure consistency. Also incremented the package version to reflect these changes.Summary by CodeRabbit
New Features
• Enhanced token swapping functionality with improved conversion calculations and robust validations for smoother trade experiences.
• Introduced advanced trade routing that optimizes conversion paths based on user-specified criteria.
• Streamlined position rebalancing for more intuitive management during price adjustments.
Documentation
• Updated user-facing SDK information to reflect the latest improvements.
Chores
• Upgraded dependency versions for enhanced performance and stability.