Skip to content

Commit

Permalink
Add Quoter (#28)
Browse files Browse the repository at this point in the history
* Add route encoding to path and update dependencies

Added a new utility function to encode routes to paths. This is useful when making swaps and trades on Uniswap's routes. Updated several dependencies to their latest versions, including the uniswap-sdk-core. Also created relevant tests for the new utility.

* Add Quoter module

A new module named Quoter has been introduced. This module provides functionality for determining on-chain method name and parameters for the appropriate function within QuoterV2. It has been integrated into the prelude for easier access throughout the codebase.

* Add unit tests for trade input in quoter.rs

Unit tests are added to verify the functionality of trade input in quoter.rs file. It covers both the single and multi-hop scenarios of exact input and output. It also tests different square root price limits and use of quoter version 2. All of these tests ensure that interaction with the Uniswap protocol works correctly.

* Refactor code to use references instead of cloning

The code has been refactored to pass routes and trade parameters by reference instead of cloning. This change helps improve efficiency by avoiding unnecessary data duplication. The changes touch on the `encode_route_to_path` function, the `quote_call_parameters` function and related tests, ensuring that each function and method now receives a reference to a route or trade, instead of a cloned object.
  • Loading branch information
shuhuiluo authored Feb 15, 2024
1 parent c544681 commit 9d1bdbb
Show file tree
Hide file tree
Showing 7 changed files with 766 additions and 73 deletions.
Loading

0 comments on commit 9d1bdbb

Please sign in to comment.