Giter VIP home page Giter VIP logo

tmp_sor_demo's Introduction

Smart Order Router(SOR)

Intro

  • This is the system to find the best aggregation quotes from all liquidity of dex amm, orderbook and rfq system. It also provide necessary utils to trade with the best quotes on chain.

Install

# install packages
yarn

# compile typechains and typescript
yarn build

Usage

# demo
yarn start

# test
yarn test

Docker

docker build -t sor_demo .

docker run -it --rm --name sor_demo sor_demo

Development

code structure

  • providers
    • pool provider to collect all pools
    • token provider to collect all tokens
    • quote provider to sample quote on chain
  • algorithm
    • use dfs to find all possible trading path that can route from inputToken to outputToken
    • brute force, use bfs to find the best splited route path to meet the need of trader
  • swap
    • encode optimized result from output of algorithm and execute calldata on chain to close the trade.

add new liquidity

  1. add pool provider for the new liquidity
  2. add placer for the new liquidity
  3. add quote provider for the new liquidity
  4. add encoder for the new liquidity

tmp_sor_demo's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.