Frontend

Pool

TVL/Fee Reward/24 Hours Volume

https://graph.sirius.finance/static/volume.json


Farming

calculate APR

Retrieving the farming APR could be complicated, what shows below is not complete runnable code, it's just for showing the logic behind it.

  1. We first need to retrieve how many LP tokens (eg. 4SRS) the farm is holding by calling the 'balanceOf' method.

LpAmount = LPTokenContract.balanceOf(farmAddress)

2. Then retrieve the total supply of the LP token.

LPTokenTotalSupply = LPTokenContract.totalSupply(farmAddress)

3. Call the subgraph API to get the TVL of the corresponding pool.

https://graph.sirius.finance/static/volume.json

4. Get the single LP token price using the TVL to divide the total supply of the LP token.

LPPrice = poolTVL / LPTokenTotalSupply

5. Retrieve the total staked TVL of the farm.

6. Retrieve the base rewards in SRS.

7. Get farm extra rewards. Besides SRS base reward, some farms could provide extra rewards as well such as incentive programs or partnership programs. please notice that some rewarding tokens might also use fixed price.

8. Plus the base APR and extra APR together.

Last updated