Skip to content

PeggyJV/il-loss-charts

Repository files navigation

Sommelier.finance

This repo houses the web application for Sommelier.finance, a platform for the finest liquidity management tools in DeFi.

Packages

  • client - the frontend interface for the Sommelier stack. Made with Create React App.
  • deploy - Scripts and tools for deployment on Sommelier infra (work in progress).
  • server - a Node.js Express server handling data querying and caching for the front end. No database - it's a stateless integration later.
  • sommelier-types - TypeScript types and other shared code between packages.
  • workers - Supporting workers and services to analyze and alert on changing market conditions.

Ecosystem Dependencies

  • Cosmos - The Sommelier protocol is built on the Cosmos network - meaning faster transactions, lower fees, and a universe of interoperability.
  • Uniswap - Sommelier began as a tool for LP positions on Uniswap. More AMM integrations are coming soon!
  • The Graph - Sommelier uses a custom implementation of the Uniswap V2 Subgraph for indexing and query Uniswap event data.
  • Infura - We use Infura as our Ethereum provider, with a roadmap for adding additional providers and redundancies on our backend.
  • web3js - used for connecting to client wallets (e.g. Metamask) and transaction construction and signing.

Setup

Sommelier has a standard monorepo setup using Yarn Workspaces and Lerna. This allows one to run commands at the project root and apply that command to all packages.

In order to run this locally, you will need an Infura Project ID, to get your infura project ID, please go to https://infura.io/ and create an account. It is free to create an account.

To set up the app for local development:

git clone https://github.com/PeggyJV/il-loss-charts
cd il-loss-charts

yarn config set workspaces-experimental true # Use to enable yarn workspaces
yarn # Running 'yarn' once at workspace roots installs all dependencies for each package

yarn prepare # setup commit hooks

### Local Development

# Getting environment variables set
# Run following command inside packages/server and packages/client individually
cp .env.sample .env
# After seeing your .env file, make sure to replace placeholders with your Infura Project ID


# Requires a local redis server at port 6379
yarn dev # starts both express server and CRA webpack server in same shell, with re-compile on save for both server and client

### Building and Running

yarn build # builds each package
yarn prod # runs the server only, which serves the client bundle

### Linting

yarn lint # lints each package concurrently

Lerna infers package topology to ensure that all lint/build tasks run in the proper order based on inter-package dependencies.

API Documentation

The server package uses OpenAPI for documentation. You can see compiled documentation at https://app.sommelier.finance/api/explorer/ or http://localhost:3001/api/explorer (when running locally).

The documentation source is at packages/server/src/docs/api.yml. When adding a new API route, make sure to update this file. The server uses Express OpenAPI Validator so if your route is not correctly documented, it will not be validated correctly and will not work as expected.

Connecting to the Mainnet Subgraph node locally

You'll need access to the subgraph instance and the gcloud sdk installed.

gcloud auth login # only need to login once
gcloud beta compute ssh --zone "us-west1-b" "graph-node-mainnet-1-bhtp"  --project "peggyjv-services" -- -NL 8000:localhost:8000

This will setup an ssh tunnel from your local @ port 8000 to the subgraph running on the instance @ port 8000

TODOs

You can see all TODOs for this repo in the Issues section. Feel free to submit any suggestion as an issue!

DEX and AMM Add/Remove Contracts for IL-Loss app.

Liquidity Exchange and Add to any listed Pool with XXX/ETH from any ERC20 token and develped in Vyper.

Current Contracts deployed at:

  1. Uniswapv3 Liquidity:
  1. Uniswapv2 Liquidity: