beefyfinance / beefy-api

Simple API for BeefyFinance
https://api.beefy.finance
MIT License
117 stars 201 forks source link

Create endpoint for the '/stake' section to use #64

Closed sirbeefalot closed 3 years ago

sirbeefalot commented 3 years ago

A Beefy dev has the staking section pretty much ready on the frontend side. This section will be useful for many things, one of them is to bring the BIFI rewards pool out of the https://gov.beefy.finance subdomain and into the main app. That way we can finally decommission that subdomain.

We need an endpoint that can return 5 data points for each staking pool:

  1. id: A unique ID for the pool. For example "bifi-wbnb"
  2. name: Custom name for the pool.
  3. tvl: Amount of the asset staked in the pool. For example in a pool with 4200 BIFI staked, this number would be 4200.
  4. apy: APY that the pool currently pays out. This takes into account both the value of the staked assets and of the reward token.
  5. staked: The amount of staked assets, but priced in USD. (Just need to multiply TVL * asset price)
{
  "data": [
    {
      "id": "yearn-eth",
      "name": "yearn.finance", 
      "tvl": 367025.4, 
      "apy": "20.82%", 
      "staked": 101453.46825158167
    },
    {
      "id": "bal-btcb",
      "name": "Balancer Pool",
      "tvl": 64245.17,
      "apy": "0.55%",
      "staked": 99.14566080152174
    }
  ]
}

Pretty much as soon as we can have this endpoint ready, we could have the stake section of the app live.

roman-monk commented 3 years ago

tvl: Amount of the asset staked in the pool. For example in a pool with 4200 BIFI staked, this number would be 4200. staked: The amount of staked assets, but priced in USD. (Just need to multiply TVL * asset price)

discussed with @Mo0o0d to switch this values around. @sirbeefalot you mean tvl as $ and staked as tokens amount right?