Skip to content

Library to find routes for any swap pair of tokens supported by uniswap

License

Notifications You must be signed in to change notification settings

kodemartin/uniswap-routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uniswap-routing

A small library that collects swap-pool data from uniswap into a directed graph in memory.

The library exposes the following features:

  • Fetch pool data in batches
  • Expose methods of the pool graph that
    • Provide the list of supported tokens
    • Provide all possible routes between two token pairs, along with the respective effective exchange rate
    • Provide the optimal route between two token pairs

Web interface

This functionality is used in a GraphQl server that can be run with

RUST_LOG=debug cargo run

The server constructs the pool graph at startup, and detaches a task to update it every minute in the background.

Limitations/Future work

  • Pools with liquidity equal to 0 are not processed. Nevertheless, it appears that they provide info about "dummy" pairs like "ETH" - "WETH".
  • Use aliases for common tokens that have a wrapped equivalent (e.g. "ETH" - "WETH")
  • Filter out outliers: It seems that there are pools (e.g. MASK/ETH) that present abnormal exchange rates. Obviously the have different scope, but at any case they should be filtered out as they tamper with the query results

About

Library to find routes for any swap pair of tokens supported by uniswap

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages