Skip to content

yield-bay/bay-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bay-watcher

The primary ETL service for Yield Bay.

Getting Started

  • Create a mongodb database
  • Copy sample env file cp .env.sample .env and set env variables.
  • cargo build
  • cargo run

How to integrate a new protocol

  1. Fetch dex related data from their subgraph/subsquid/subql

  2. Fetch farm related data from the smart contract (NOTE: for evm chef-style farms)

    • Add farm details to chef_contract_jobs function.
    • We find the number of pools in that particular farm and iterate over them.
    • Edge cases like stable swap farms are handled by checking the pids.
    • Farm chef contracts may vary for different protocols, leading to slightly different function calls.
  3. Custom integrations

    • Ones that aren't chef-style or don't use the above pattern - those protocols might offer a different API to fetch yield farming data.
    • Done inside the src/custom directory.

Safety Score

  • The Yield farm safety score system is described here.
  • Implementation present in src/scoring.rs.

Misc Details

  • The constants (which include the graphql query strings, api urls, smart contract addresses, and other utilities) are present in src/constants.rs.
  • The human-readable abis are present in src/contracts.rs.
  • We run all the tasks in an infinite loop with a delay of 3 mins in between.

Farm model (non-obvious fields)

Field Description
id Farm id, pid in case of chef-style contracts
chef Chef contract address. Some other unique identifier if not chef-style
asset.address Underlying asset address
apr.base The trading APR of the protocol (usually DEX)
apr.reward The APR from the incentive provided by the farm
allocPoint Represents the share of reward in the whole farm in chef-style farms. Its utility for us is that 0 indicates an inactive farm

The combination (id, chef, chain, protocol, asset.address) can be considered the primary key (although we are using mongodb, which uses object ids).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages