Giter VIP home page Giter VIP logo

uniswap_info's Introduction

Introduction

This is a simple webserver that exposes a RESTful interface to some of the state on Uniswap’s subgraph on thegraph.com.

Getting started

  • Install rust. See https://www.rust-lang.org/tools/install for more details.

  • Switch the rust compiler to nightly version. Nightly version of the compiler is less stable and has some experimeental features. This version of the compiler is needed for some of the packages that the project is using. rustup default nightly.

  • Run cargo run. This will compile and start the webserver.

Types of state exposed

Notes

  • The project uses https://rocket.rs/ for the webserver. This is using some experimental features of rust and therefore the project needs the nightly compiler to run.

  • The project uses https://serde.rs/ for serialising and deserialising rust objects to and fro json. This crate is able to help simplify dramatically how much marshalling and demarshalling code I had to write.

  • I experimented briefly with https://github.com/graphql-rust/graphql-client to see if I could use it to generate the graphql queries instead of writing them by hand. I could not get the crate to work with the Uniswap’s schema due to some missing type definitions and therefore I wrote the queries by hand. In a real production system, we should probably not be hand crafting the queries.

  • Rust has very powerful error handling techniques. I have just scratched the surface on proper error handling in this project. For more a production critical system, we would want to define our own nested error types.

  • Due to a lack of time, I did not put in any efforts on testing. Normally, I would at the very least add a number of unit tests (potentially also restructuring the code to make it easier to unit test). And if we were aiming to turn this into a production system, then build end-to-end integration tests as well.

uniswap_info's People

Contributors

akhi3030 avatar

Watchers

 avatar

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.