/sugar

Sugar makes Velodrome devs life sweeter 🍭

Primary LanguagePython

Velodrome Sugar 🍭

Sugar comes with contracts to help working with Velodrome Finance data!

How come?!

The idea is pretty simple, instead of relying on our API for a structured data set of liquidity pairs data, these contracts can be called in an efficient way to directly fetch the same data off-chain.

What normally would require:

  1. fetching the number of liquidity pairs
  2. querying every pair address at it's index
  3. querying pair tokens data
  4. querying gauge addresses and reward rate

Takes a single call with sugar!

More importantly, the response can be paginated.

Main goals of this little project are:

  • to maximize the developers UX of working with our protocol
  • simplify complexity
  • document and test everything

But how?

On-chain data is organized for transaction cost and efficiency. We think we can hide a lot of the complexity by leveraging structs to present the data and normalize it based on it's relevancy.

Usage

The list of sugar contracts will be published on docs.velodrome.finance

Development

To setup the environment, build the Docker image first:

docker build ./ -t velodrome/sugar

Next start the container with existing environment variables:

docker run --env-file=env.example --rm -v $(pwd):/app -w /app -it velodrome/sugar sh

The environment has Brownie and Vyper already installed.

To run the tests inside the container, use:

brownie test --network=optimism-test