-
Notifications
You must be signed in to change notification settings - Fork 34
Move swapper out of gemstone #726
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
Conversation
Replaces passing AlienProvider as a method argument with a dedicated rpc_provider field in all swapper provider structs. Updates constructors and trait signatures to require rpc_provider on instantiation, simplifying method calls and improving consistency. Adjusts GemSwapper and related factory methods to propagate rpc_provider to all swappers. Updates tests and integration points accordingly.
This commit refactors swapper providers and clients (Cetus, Chainflip, Jupiter, etc.) to use generic HTTP and RPC client abstractions instead of direct AlienProvider usage. Adds default constructors for each swapper, updates method signatures, and improves error handling by mapping gem_client::ClientError to SwapperError. This enables easier integration and testing, and improves code modularity and maintainability.
Summary of ChangesHello @0xh3rman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a substantial refactoring of the swapper infrastructure within the project. The primary objective is to enhance modularity, testability, and consistency by standardizing the way RPC clients are created and utilized across different blockchain integrations. This is achieved by abstracting client creation behind a new factory pattern and consolidating chain-specific RPC logic into dedicated crates, leading to a cleaner and more maintainable codebase for all supported swapper providers. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a significant and well-executed refactoring of the swapper providers. The main goal of decoupling providers from AlienProvider
and using a generic Client
or client factories has been achieved, which will improve testability and modularity. The changes are extensive and touch many parts of the gemstone
and related crates.
My review focuses on a few key areas where I've identified potential issues: an incorrect gas budget calculation in the Sui provider, a potential silent error in Tron's energy estimation, and the removal of some tests in the Chainflip provider.
Overall, this is a great improvement to the codebase architecture. Addressing the points below will help ensure the correctness and robustness of the new implementation.
Moved Sui and Tron RPC client implementations from gemstone to gem_sui and gem_tron crates, introducing network/sui.rs and network/tron.rs for unified client creation. Updated Across, Cetus, and approval logic to use new client interfaces. Added new models and methods for Sui coin assets and Tron contract calls. Removed obsolete gemstone/src/ethereum/jsonrpc.rs and gemstone/src/sui/rpc modules. Updated dependencies and feature flags for gem_tron. Refactored swapper providers to use new client patterns and improved error handling.
Removes unnecessary `#![cfg(feature = "rpc")]` attributes from model files and updates imports in Cetus provider tests to use gem_sui models. Adds a Default implementation for HyperCoreBridge to simplify instantiation.
56c916b
to
a8696ca
Compare
…o swapper-gem-client
No description provided.