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!: refactor trait implementations and add traits #79

Merged
merged 6 commits into from
Sep 5, 2024
Merged

Conversation

shuhuiluo
Copy link
Collaborator

Use merge commit.

Refactored the `wrapped` method in `Currency` and its implementations to return a reference, improving efficiency. Simplified the `WETH9` token initialization and retrieval process, reducing redundancy and potential errors. Updated version to 2.1.0 in `Cargo.toml`.
Enhanced several structs across various modules by implementing the `Hash` and `Eq` traits. This ensures consistent behavior for these structs in hashed collections and comparisons.
Refactor multiple trait implementations in `FractionLike` to simplify type constraints and improve readability. Used references in arithmetic operations and metadata access for consistency. Removed redundant clone and conditional checks to streamline the code.
Converted `CurrencyLike` to accept const parameters for handling native and non-native currencies. Updated related types and traits to leverage the new const parameter approach, simplifying the logic and making type definitions more explicit. Removed redundant methods and restructured imports for clarity.
Introduced `NativeCurrency` trait representing native blockchain currencies. Implemented this trait for `Ether` and updated the `prelude` and entity modules accordingly.
@shuhuiluo shuhuiluo requested a review from malik672 September 5, 2024 02:56
Change function parameters in `quote` and `compute_price_impact` to use references instead of values for `CurrencyAmount`. This optimizes memory usage and performance by avoiding unnecessary cloning.
Copy link
Owner

@malik672 malik672 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow

@malik672 malik672 merged commit eb9285d into master Sep 5, 2024
2 checks passed
@shuhuiluo shuhuiluo deleted the eth branch September 5, 2024 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants